Class: Retrospec::Plugins::V1::PluginGen

Inherits:
Plugin
  • Object
show all
Defined in:
lib/retrospec/plugins/v1/plugin/plugin_gen.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(supplied_module_path = '.', config = {}) ⇒ PluginGen

Returns a new instance of PluginGen.



12
13
14
15
# File 'lib/retrospec/plugins/v1/plugin/plugin_gen.rb', line 12

def initialize(supplied_module_path='.',config={})
  super
  @context = ::PluginGen::SpecObject.new(module_path, config)
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



10
11
12
# File 'lib/retrospec/plugins/v1/plugin/plugin_gen.rb', line 10

def context
  @context
end

Class Method Details

.cli_options(global_opts) ⇒ Object



23
24
25
26
27
# File 'lib/retrospec/plugins/v1/plugin/plugin_gen.rb', line 23

def self.cli_options(global_opts)
  Trollop::options do
    opt :name, "The name of the new plugin", :require => false, :short => '-n', :type => :string, :default => File.basename(File.expand_path(global_opts[:module_path]))
  end
end

Instance Method Details

#runObject



17
18
19
20
21
# File 'lib/retrospec/plugins/v1/plugin/plugin_gen.rb', line 17

def run
  safe_create_module_files(template_dir, module_path, context)
  create_main_file
  create_plugin_file
end