Class: Bakeware::AppGenerator

Inherits:
Rails::Generators::AppGenerator
  • Object
show all
Defined in:
lib/bakeware/generators/app_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_jquery_uiObject



84
85
86
87
# File 'lib/bakeware/generators/app_generator.rb', line 84

def add_jquery_ui
  say 'Add jQuery ui to the standard application.js'
  build :add_jquery_ui
end

#bakeware_customizationObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/bakeware/generators/app_generator.rb', line 26

def bakeware_customization
  invoke :remove_files_we_dont_need
  invoke :customize_gemfile
  invoke :setup_development_environment
  invoke :setup_test_environment
  invoke :setup_staging_environment
  invoke :create_bakeware_views
  invoke :create_common_javascripts
  invoke :add_jquery_ui
  invoke :setup_database
  invoke :configure_app
  invoke :setup_stylesheets
  invoke :copy_libraries
  invoke :copy_miscellaneous_files
  invoke :customize_error_pages
  invoke :remove_routes_comment_lines
  invoke :setup_git
  invoke :create_heroku_apps
  invoke :create_github_repo
  invoke :outro
end

#configure_appObject



112
113
114
115
116
117
118
119
120
121
# File 'lib/bakeware/generators/app_generator.rb', line 112

def configure_app
  say 'Configuring app'
  build :configure_action_mailer
  build :configure_time_zone
  build :configure_time_formats

  build :add_email_validator
  build :setup_default_rake_task
  build :setup_foreman
end

#copy_librariesObject



156
157
158
159
# File 'lib/bakeware/generators/app_generator.rb', line 156

def copy_libraries
  say 'Copying libraries'
  build :copy_libraries
end

#copy_miscellaneous_filesObject



161
162
163
164
# File 'lib/bakeware/generators/app_generator.rb', line 161

def copy_miscellaneous_files
  say 'Copying miscellaneous support files'
  build :copy_miscellaneous_files
end

#create_bakeware_viewsObject



71
72
73
74
75
76
77
# File 'lib/bakeware/generators/app_generator.rb', line 71

def create_bakeware_views
  say 'Creating bakeware views'
  build :create_partials_directory
  build :create_shared_flashes
  build :create_shared_javascripts
  build :create_application_layout
end

#create_common_javascriptsObject



79
80
81
82
# File 'lib/bakeware/generators/app_generator.rb', line 79

def create_common_javascripts
  say 'Pulling in some common javascripts'
  build :create_common_javascripts
end

#create_github_repoObject



141
142
143
144
145
146
# File 'lib/bakeware/generators/app_generator.rb', line 141

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

#create_heroku_appsObject



134
135
136
137
138
139
# File 'lib/bakeware/generators/app_generator.rb', line 134

def create_heroku_apps
  if options[:heroku]
    say 'Creating Heroku apps'
    build :create_heroku_apps
  end
end

#customize_error_pagesObject



166
167
168
169
# File 'lib/bakeware/generators/app_generator.rb', line 166

def customize_error_pages
  say 'Customizing the 500/404/422 pages'
  build :customize_error_pages
end

#customize_gemfileObject



89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/bakeware/generators/app_generator.rb', line 89

def customize_gemfile
  build :set_ruby_to_version_being_used
  build :add_custom_gems

  if options[:meaty]
    build :add_meaty_gems
    build :add_extra_config
  end
  say 'preheating the oven - BE PATIENT'
  
  bundle_command 'install --binstubs=bin/stubs'
end

#finish_templateObject



21
22
23
24
# File 'lib/bakeware/generators/app_generator.rb', line 21

def finish_template
  invoke :bakeware_customization
  super
end

#init_gitObject



152
153
154
# File 'lib/bakeware/generators/app_generator.rb', line 152

def init_git
  build :init_git
end

#outroObject



175
176
177
178
179
180
181
182
183
184
185
# File 'lib/bakeware/generators/app_generator.rb', line 175

def outro
  say 'Congratulations! You just baked up a project with bakeware.'
  say "Remember to run 'rails generate airbrake' with your airbrake API key. Also, a newrelic standard config file was automatically setup for you."
  if options[:meaty]
    say "Since you went meaty, a standard unicorn config file was setup for you as well."
    say "And you baked some challah (nice!), so don't forget to finish setting that up."
  end
  if options[:heroku]
    say "Lastly, don't forget to add your heroku config vars for staging and production (for s3, etc)"
  end
end

#remove_files_we_dont_needObject



48
49
50
51
# File 'lib/bakeware/generators/app_generator.rb', line 48

def remove_files_we_dont_need
  build :remove_public_index
  build :remove_rails_logo_image
end

#remove_routes_comment_linesObject



171
172
173
# File 'lib/bakeware/generators/app_generator.rb', line 171

def remove_routes_comment_lines
  build :remove_routes_comment_lines
end

#run_bundleObject



187
188
189
# File 'lib/bakeware/generators/app_generator.rb', line 187

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

#setup_databaseObject



102
103
104
105
106
107
108
109
110
# File 'lib/bakeware/generators/app_generator.rb', line 102

def setup_database
  say 'Setting up database'

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

  build :create_database
end

#setup_development_environmentObject



53
54
55
56
57
# File 'lib/bakeware/generators/app_generator.rb', line 53

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

#setup_gitObject



128
129
130
131
132
# File 'lib/bakeware/generators/app_generator.rb', line 128

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

#setup_gitignoreObject



148
149
150
# File 'lib/bakeware/generators/app_generator.rb', line 148

def setup_gitignore
  build :gitignore_files
end

#setup_staging_environmentObject



65
66
67
68
69
# File 'lib/bakeware/generators/app_generator.rb', line 65

def setup_staging_environment
  say 'Setting up the staging environment'
  build :setup_staging_environment
  build :initialize_on_precompile
end

#setup_stylesheetsObject



123
124
125
126
# File 'lib/bakeware/generators/app_generator.rb', line 123

def setup_stylesheets
  say 'Set up stylesheets'
  build :setup_stylesheets
end

#setup_test_environmentObject



59
60
61
62
63
# File 'lib/bakeware/generators/app_generator.rb', line 59

def setup_test_environment
  say 'Setting up the test environment'
  #still need some database cleaners in here
  build :setup_guard_spork
end