lib/tap/generator/generators/config.rb in tap-gen-0.1.1 vs lib/tap/generator/generators/config.rb in tap-gen-0.1.2
- old
+ new
@@ -5,14 +5,14 @@
# Generates a new config file for a task. The configurations, defaults,
# and documentation is determined from the source file.
#
# Configurations for other types of configurable resources may also be
# generated. Specify the constant attribute identifying the resource
- # using the 'resource' flag. This generates a config file for the Root
+ # using the 'type' flag. This generates a config file for the Root
# generator:
#
- # % tap generate config root --resource generator
+ # % tap generate config root --type generator
#
class Config < Tap::Generator::Base
dump_delegates = lambda do |leader, delegate, block|
nested_delegates = delegate.default(false).delegates
@@ -65,23 +65,23 @@
# Dumps configurations as YAML without documentation,
# used when the doc config is false.
NODOC_FORMAT = nodoc_format
- config :doc, true, &c.switch # include documentation in the config
- config :nest, false, &c.switch # generate nested config files
- config :blanks, true, &c.switch # allow generation of empty config files
- config :resource, 'task' # specify the resource type
+ config :doc, true, &c.switch # Include documentation in the config
+ config :nest, false, &c.switch # Generate nested config files
+ config :blanks, true, &c.switch # Allow generation of empty config files
+ config :type, 'task' # Specify the resource type
- # Lookup the named resource class. Lookup happens through the active Env
+ # Lookup the named resource. Lookup happens through the active Env
# instance, specifically using:
#
- # Env.instance.constant_manifest(resource)[name]
+ # Env.instance[type][name]
#
# Raises an error if the name cannot be resolved to a resource.
def lookup(name)
env = Tap::Env.instance
- env.constant_manifest(resource)[name] or raise "unknown #{resource}: #{name}"
+ env[type][name] or raise "unknown #{type}: #{name}"
end
def manifest(m, name, config_name=nil)
# setup
tasc = lookup(name)
\ No newline at end of file