Class: TazaGenerator

Inherits:
RubiGen::Base
  • Object
show all
Defined in:
lib/app_generators/taza/taza_generator.rb

Constant Summary collapse

DEFAULT_SHEBANG =
File.join(Config::CONFIG['bindir'],
Config::CONFIG['ruby_install_name'])

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of TazaGenerator.



11
12
13
14
15
16
17
# File 'lib/app_generators/taza/taza_generator.rb', line 11

def initialize(runtime_args, runtime_options = {})
  super
  usage if args.empty?
  @destination_root = File.expand_path(args.shift)
  @name = base_name
  extract_options
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/app_generators/taza/taza_generator.rb', line 9

def name
  @name
end

Instance Method Details

#create_directories(m) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/app_generators/taza/taza_generator.rb', line 32

def create_directories(m)
  BASEDIRS.each { |path| m.directory path }
  m.directory File.join('lib','sites')
  m.directory File.join('spec','isolation')
  m.directory File.join('spec','integration')
  m.directory File.join('spec','story')
  m.directory 'script'
end

#manifestObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/app_generators/taza/taza_generator.rb', line 19

def manifest
  record do |m|    
    create_directories(m)
    m.template "rakefile.rb.erb", "rakefile"
    m.template "config.yml.erb", File.join("config","config.yml")
    m.template "spec_helper.rb.erb", File.join("spec","spec_helper.rb")
    m.dependency "install_rubigen_scripts", [destination_root, 'taza'],
      :shebang => options[:shebang], :collision => :force
    m.template "console.erb", File.join("script","console")
    m.template "console.cmd.erb", File.join("script","console.cmd")
  end
end