Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > 8fab9522b53a55b84fe50fc4b6de11c7 > files > 1

ruby-rubigen-1.5.8-6.mga3.src.rpm

diff --git a/lib/rubigen/lookup.rb b/lib/rubigen/lookup.rb
index bbb5c44..987cdb9 100644
--- a/lib/rubigen/lookup.rb
+++ b/lib/rubigen/lookup.rb
@@ -50,6 +50,10 @@ module Lookup
     def self.included(base)
       base.extend(ClassMethods)
       # base.use_component_sources!  # TODO is this required since it has no scope/source context
+
+      class << base
+        class_attribute :_sources
+      end
     end
 
     # Convenience method to instantiate another generator.
@@ -60,7 +64,7 @@ def instance(generator_name, args, runtime_options = {})
     module ClassMethods
       # The list of sources where we look, in order, for generators.
       def sources
-        if read_inheritable_attribute(:sources).blank?
+        if self._sources.blank?
           if superclass == RubiGen::Base
             superclass_sources = superclass.sources
             diff = superclass_sources.inject([]) do |mem, source|
@@ -69,11 +73,11 @@ def sources
               mem << source unless found
               mem
             end
-            write_inheritable_attribute(:sources, diff)
+            self._sources = diff
           end
-          active.use_component_sources! if read_inheritable_attribute(:sources).blank?
+          active.use_component_sources! if self._sources.blank?
         end
-        read_inheritable_attribute(:sources)
+        self._sources
       end
 
       # Add a source to the end of the list.
@@ -84,22 +88,20 @@ def append_sources(*args)
 
       # Add a source to the beginning of the list.
       def prepend_sources(*args)
-        sources = self.sources
-        reset_sources
-        write_inheritable_array(:sources, args.flatten + sources)
+        self._sources = args.flatten + self._sources
         invalidate_cache!
       end
 
       # Reset the source list.
       def reset_sources
-        write_inheritable_attribute(:sources, [])
+        self._sources = []
         invalidate_cache!
       end
       
       # Use application generators (app, ?).
       def use_application_sources!(*filters)
-        reset_sources
-        write_inheritable_attribute(:sources, application_sources(filters))
+        self._sources = application_sources(filters)
+        invalidate_cache!
       end
       
       def application_sources(filters = [])
@@ -124,7 +126,6 @@ def application_sources(filters = [])
       # 5.  User home directory.  Search ~/.rubigen/rubygems_generators.
       # 6.  RubyGems.   Search for gems containing /rubygems_generators folder.
       def use_component_sources!(*filters)
-        reset_sources
         new_sources = []
         if defined? ::APP_ROOT
           new_sources << PathSource.new(:root, "#{::APP_ROOT}/generators")
@@ -132,7 +133,8 @@ def use_component_sources!(*filters)
           new_sources << PathSource.new(:plugins, "#{::APP_ROOT}/vendor/plugins/*/**/generators")
         end
         new_sources << filtered_sources(filters)
-        write_inheritable_attribute(:sources, new_sources.flatten)
+        self._sources = new_sources.flatten
+        invalidate_cache!
       end
       
       def filtered_sources(filters)
diff --git a/lib/rubigen/options.rb b/lib/rubigen/options.rb
index abdfec2..4eded53 100644
--- a/lib/rubigen/options.rb
+++ b/lib/rubigen/options.rb
@@ -10,6 +10,9 @@ class << base
         end
         alias_method :inherited, :inherited_with_options
       end
+      base.module_eval do
+        class_attribute :_mandatory_options, :_default_options
+      end
     end
 
     module ClassMethods
@@ -20,17 +23,17 @@ def inherited_with_options(sub)
 
       def mandatory_options(options = nil)
         if options
-          write_inheritable_attribute(:mandatory_options, options)
+          self._mandatory_options = options
         else
-          read_inheritable_attribute(:mandatory_options) or write_inheritable_attribute(:mandatory_options, {})
+          self._mandatory_options or (self._mandatory_options = {})
         end
       end
 
       def default_options(options = nil)
         if options
-          write_inheritable_attribute(:default_options, options)
+          self._default_options = options
         else
-          read_inheritable_attribute(:default_options) or write_inheritable_attribute(:default_options, {})
+          self._default_options or (self._default_options = {})
         end
       end
 
diff --git a/rubigen.gemspec b/rubigen.gemspec
index b82ec15..3a57e55 100644
--- a/rubigen.gemspec
+++ b/rubigen.gemspec
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
   gem.require_paths = ["lib"]
   gem.version       = Rubigen::VERSION
   
-  gem.add_dependency 'activesupport', '>= 2.3.5', "< 3.2.0"
+  gem.add_dependency 'activesupport', '>= 3.0.0'
   gem.add_development_dependency 'rake'
   gem.add_development_dependency 'i18n'
   gem.add_development_dependency 'rspec','~>1.3'
-- 
1.7.10

--- a/metadata~	2013-02-18 14:59:29.840203462 +0800
+++ b/metadata	2013-02-18 15:00:04.381211306 +0800
@@ -20,10 +20,7 @@
     requirements:
     - - ! '>='
       - !ruby/object:Gem::Version
-        version: 2.3.5
-    - - <
-      - !ruby/object:Gem::Version
-        version: 3.2.0
+        version: 3.0.0
   type: :runtime
   prerelease: false
   version_requirements: *70192466936140