Class: Mechanic::EngineGenerator

Inherits:
Rails::Generators::PluginNewGenerator
  • Object
show all
Defined in:
lib/mechanic/generators/engine_generator.rb

Instance Method Summary collapse

Instance Method Details

#call_the_mechanicObject



27
28
29
30
31
32
33
34
35
# File 'lib/mechanic/generators/engine_generator.rb', line 27

def call_the_mechanic
  invoke :setup_development_environment
  invoke :customize_gemspec
  invoke :setup_test_database
  invoke :configure_engine
  invoke :setup_git
  invoke :create_github_repo
  invoke :wrap_up
end

#configure_engineObject



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/mechanic/generators/engine_generator.rb', line 62

def configure_engine
  say 'Configuring engine'
  build :configure_action_mailer
  build :generate_rspec
  build :configure_time_zone

  if options[:webkit]
    build :configure_capybara_webkit
  end

  build :add_email_validator
  build :setup_default_rake_task
end

#create_github_repoObject



82
83
84
85
86
87
# File 'lib/mechanic/generators/engine_generator.rb', line 82

def create_github_repo
  if options[:github]
    say 'Creating Github repo'
    build :create_github_repo, options[:github]
  end
end

#customize_gemspecObject



42
43
44
45
46
47
48
49
50
# File 'lib/mechanic/generators/engine_generator.rb', line 42

def customize_gemspec
  build :add_custom_gems

  if options[:webkit]
    build :add_capybara_webkit_gem
  end

  bundle_command 'install'
end

#finish_templateObject



22
23
24
25
# File 'lib/mechanic/generators/engine_generator.rb', line 22

def finish_template
  invoke :call_the_mechanic
  super
end

#init_gitObject



97
98
99
# File 'lib/mechanic/generators/engine_generator.rb', line 97

def init_git
  build :init_git
end

#run_bundleObject



101
102
103
# File 'lib/mechanic/generators/engine_generator.rb', line 101

def run_bundle
  # Let's not: We'll bundle manually at the right spot
end

#setup_development_environmentObject



37
38
39
40
# File 'lib/mechanic/generators/engine_generator.rb', line 37

def setup_development_environment
  say 'Setting up the development environment'
  build :raise_delivery_errors
end

#setup_gitObject



76
77
78
79
80
# File 'lib/mechanic/generators/engine_generator.rb', line 76

def setup_git
  say 'Initializing git'
  invoke :setup_gitignore
  invoke :init_git
end

#setup_gitignoreObject



93
94
95
# File 'lib/mechanic/generators/engine_generator.rb', line 93

def setup_gitignore
  build :gitignore_files
end

#setup_test_databaseObject



52
53
54
55
56
57
58
59
60
# File 'lib/mechanic/generators/engine_generator.rb', line 52

def setup_test_database
  say 'Setting up database in spec/dummy'

  if 'postgresql' == options[:database]
    build :use_postgres_config_template
  end

  build :create_database
end

#wrap_upObject



89
90
91
# File 'lib/mechanic/generators/engine_generator.rb', line 89

def wrap_up
  say 'Congratulations! Your trip to shop was a success.'
end