aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails_generator/spec.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-07-30 14:18:53 +0100
committerPratik Naik <pratiknaik@gmail.com>2009-07-30 14:18:53 +0100
commit915cf5747a78f28f2b25c48574031db60c3a18ae (patch)
tree048746387ddaaed418670c86451856675b8d369f /railties/lib/rails_generator/spec.rb
parent23f5e7e966defaaa1511eca57bd8de47f95cb7d9 (diff)
parentd83b1828577c268de56e1b3942e16002c9efdd57 (diff)
downloadrails-915cf5747a78f28f2b25c48574031db60c3a18ae.tar.gz
rails-915cf5747a78f28f2b25c48574031db60c3a18ae.tar.bz2
rails-915cf5747a78f28f2b25c48574031db60c3a18ae.zip
Merge commit 'mainstream/master'
Conflicts: railties/guides/source/active_support_overview.textile
Diffstat (limited to 'railties/lib/rails_generator/spec.rb')
-rw-r--r--railties/lib/rails_generator/spec.rb44
1 files changed, 0 insertions, 44 deletions
diff --git a/railties/lib/rails_generator/spec.rb b/railties/lib/rails_generator/spec.rb
deleted file mode 100644
index 9d780b7ac5..0000000000
--- a/railties/lib/rails_generator/spec.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-module Rails
- module Generator
- # A spec knows where a generator was found and how to instantiate it.
- # Metadata include the generator's name, its base path, and the source
- # which yielded it (PathSource, GemPathSource, etc.)
- class Spec
- attr_reader :name, :path, :source
-
- def initialize(name, path, source)
- @name, @path, @source = name, path, source
- end
-
- # Look up the generator class. Require its class file, find the class
- # in ObjectSpace, tag it with this spec, and return.
- def klass
- unless @klass
- require class_file
- @klass = lookup_class
- @klass.spec = self
- end
- @klass
- end
-
- def class_file
- "#{path}/#{name}_generator.rb"
- end
-
- def class_name
- "#{name.camelize}Generator"
- end
-
- private
- # Search for the first Class descending from Rails::Generator::Base
- # whose name matches the requested class name.
- def lookup_class
- ObjectSpace.each_object(Class) do |obj|
- return obj if obj.ancestors.include?(Rails::Generator::Base) and
- obj.name.split('::').last == class_name
- end
- raise NameError, "Missing #{class_name} class in #{class_file}"
- end
- end
- end
-end