Sha256: ee68af2705e7d296820275b48e0d466c3f515c50b01e08792af5ef61ade07264

Contents?: true

Size: 829 Bytes

Versions: 10

Compression:

Stored size: 829 Bytes

Contents

module Tap::Generator::Generators
  
  # :startdoc::generator a config file for a task
  # 
  # Generates a new config file for a task.  The configurations, defaults, 
  # and documentation is determined from the task source file.
  class ConfigGenerator < Tap::Generator::Base
    
    config :doc, true, &c.switch  # include documentation in the config
    
    def env
      Tap::Env.instance
    end

    def manifest(m, name, config_name=name)
      const = env.search(:tasks, name) or raise "unknown task: #{name}"
      task_class = const.constantize or raise "unknown task: #{name}"
      
      m.directory app['config']
      m.file app.filepath('config', config_name + '.yml') do |file|
        task_class.configurations.format_str((doc ? :doc : :nodoc), file)
      end
    end
    
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
bahuvrihi-tap-0.10.0 lib/tap/generator/generators/config/config_generator.rb
bahuvrihi-tap-0.10.1 lib/tap/generator/generators/config/config_generator.rb
bahuvrihi-tap-0.10.2 lib/tap/generator/generators/config/config_generator.rb
bahuvrihi-tap-0.10.3 lib/tap/generator/generators/config/config_generator.rb
bahuvrihi-tap-0.10.4 lib/tap/generator/generators/config/config_generator.rb
bahuvrihi-tap-0.10.5 lib/tap/generator/generators/config/config_generator.rb
bahuvrihi-tap-0.10.6 lib/tap/generator/generators/config/config_generator.rb
bahuvrihi-tap-0.10.7 lib/tap/generator/generators/config/config_generator.rb
tap-0.10.1 lib/tap/generator/generators/config/config_generator.rb
tap-0.10.0 lib/tap/generator/generators/config/config_generator.rb