Class: RubiGen::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/sprout/generator/base_mixins.rb

Overview

Direct Known Subclasses

Sprout::Generator::NamedBase

Instance Method Summary collapse

Constructor Details

#initialize(runtime_args, runtime_options = {}) ⇒ Base

Returns a new instance of Base.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/sprout/generator/base_mixins.rb', line 65

def initialize(runtime_args, runtime_options = {})
  @args = runtime_args
  parse!(@args, runtime_options)

  # Derive source and destination paths.
  @source_root = options[:source] || File.join(spec.path, 'templates')
  
  if options[:destination]
    @destination_root = options[:destination]
  elsif defined? Sprout::Sprout.project_path
    @destination_root = Sprout::Sprout.project_path
  else
    @destination_root = Dir.pwd
  end

  # Silence the logger if requested.
  logger.quiet = options[:quiet]

  # Raise usage error if help is requested.
  usage if options[:help]
end