Class: TazaGenerator

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

Constant Summary

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

Installation skeleton. Intermediate directories are automatically created so don't sweat their absence here.

lib
  config
  script
  spec
)

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (TazaGenerator) initialize(runtime_args, runtime_options = {})

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

- (Object) name (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

- (Object) create_directories(m)



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

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

- (Object) manifest



19
20
21
22
23
24
25
26
27
28
29
30
31
# 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 "Gemfile.erb", "Gemfile"
    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"), {:chmod => 0755}
    m.template "console.cmd.erb", File.join("script","console.cmd")
  end
end