Class: Adva::Generators::Engine

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/adva/generators/engine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options = {}) ⇒ Engine

Returns a new instance of Engine.



10
11
12
13
# File 'lib/adva/generators/engine.rb', line 10

def initialize(name, options = {})
  @name = name
  super()
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/adva/generators/engine.rb', line 8

def name
  @name
end

Instance Method Details

#buildObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/adva/generators/engine.rb', line 15

def build
  empty_directory "adva-#{name}"
  template        "gemspec.erb", "adva-#{name}/adva-#{name}.gemspec"
  template        'Gemfile.erb', "adva-#{name}/Gemfile"

  empty_directory "adva-#{name}/app"
  empty_directory "adva-#{name}/app/controllers"
  empty_directory "adva-#{name}/app/models"
  empty_directory "adva-#{name}/app/views"

  empty_directory "adva-#{name}/config"
  empty_directory "adva-#{name}/config/locales"
  template        'en.yml.erb',  "adva-#{name}/config/locales/en.yml"
  template        'redirects.rb.erb', "adva-#{name}/config/redirects.rb"
  template        'routes.rb.erb', "adva-#{name}/config/routes.rb"

  empty_directory "adva-#{name}/db/migrate"
  template        'migration.rb.erb', "adva-#{name}/db/migrate/#{migration_timestamp}_adva_#{name}_create_tables.rb"

  empty_directory "adva-#{name}/features"
  template        'env.rb', "adva-#{name}/features/env.rb"
  template        'feature.erb', "adva-#{name}/features/#{name}.feature"

  empty_directory "adva-#{name}/lib/adva"
  create_file     "adva-#{name}/lib/adva-#{name}.rb", "require 'adva/#{name}'"
  template        'engine.rb.erb', "adva-#{name}/lib/adva/#{name}.rb"

  empty_directory "adva-#{name}/lib/testing"
  create_file     "adva-#{name}/lib/paths.rb", "adva-#{name}/lib/step_definitions.rb"
  template        'paths.rb.erb', "adva-#{name}/lib/testing/paths.rb"

  empty_directory "adva-#{name}/test"
  template        'all.rb', "adva-#{name}/test/all.rb"
  template        'test_helper.rb.erb', "adva-#{name}/test/test_helper.rb"
end