Class: Bretels::AppGenerator

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

Instance Method Summary collapse

Instance Method Details

#configure_appObject



98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/bretels/generators/app_generator.rb', line 98

def configure_app
  say 'Configuring app'
  build :configure_action_mailer
  build :configure_strong_parameters
  build :raise_unpermitted_params
  build :configure_time_zone
  build :configure_time_formats
  build :configure_dutch_language
  build :configure_rack_timeout
  build :disable_xml_params
  build :add_email_validator
  build :setup_default_rake_task
  build :setup_foreman
end

#copy_miscellaneous_filesObject



146
147
148
149
# File 'lib/bretels/generators/app_generator.rb', line 146

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

#create_github_repoObject



131
132
133
134
135
136
# File 'lib/bretels/generators/app_generator.rb', line 131

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

#create_heroku_appsObject



124
125
126
127
128
129
# File 'lib/bretels/generators/app_generator.rb', line 124

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

#create_suspenders_viewsObject



77
78
79
80
81
82
83
# File 'lib/bretels/generators/app_generator.rb', line 77

def create_suspenders_views
  say 'Creating suspenders views'
  build :create_partials_directory
  build :create_shared_flashes
  build :create_shared_javascripts
  build :create_application_layout
end

#customize_error_pagesObject



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

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

#customize_gemfileObject



85
86
87
88
# File 'lib/bretels/generators/app_generator.rb', line 85

def customize_gemfile
  build :replace_gemfile
  build :set_ruby_to_version_being_used
end

#finish_templateObject



18
19
20
21
# File 'lib/bretels/generators/app_generator.rb', line 18

def finish_template
  invoke :suspenders_customization
  super
end

#init_gitObject



142
143
144
# File 'lib/bretels/generators/app_generator.rb', line 142

def init_git
  build :init_git
end

#outroObject



160
161
162
163
164
165
# File 'lib/bretels/generators/app_generator.rb', line 160

def outro
  say 'Done. Congratulations!'
  say '1. Run bundle install'
  say '2. Run rake db:create'
  say "3. Run exceptional install <api-key>"
end

#remove_files_we_dont_needObject



43
44
45
46
# File 'lib/bretels/generators/app_generator.rb', line 43

def remove_files_we_dont_need
  build :remove_public_index
  build :remove_rails_logo_image
end

#remove_routes_comment_linesObject



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

def remove_routes_comment_lines
  build :remove_routes_comment_lines
end

#run_bundleObject



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

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

#setup_databaseObject



90
91
92
93
94
95
96
# File 'lib/bretels/generators/app_generator.rb', line 90

def setup_database
  say 'Setting up database'

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

#setup_development_environmentObject



48
49
50
51
52
53
# File 'lib/bretels/generators/app_generator.rb', line 48

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

#setup_gitObject



118
119
120
121
122
# File 'lib/bretels/generators/app_generator.rb', line 118

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

#setup_gitignoreObject



138
139
140
# File 'lib/bretels/generators/app_generator.rb', line 138

def setup_gitignore
  build :gitignore_files
end

#setup_production_environmentObject



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

def setup_production_environment
  say 'Setting up the production environment'
  build :configure_smtp
  build :enable_force_ssl
  build :add_cdn_settings
end

#setup_staging_environmentObject



72
73
74
75
# File 'lib/bretels/generators/app_generator.rb', line 72

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

#setup_stylesheetsObject



113
114
115
116
# File 'lib/bretels/generators/app_generator.rb', line 113

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

#setup_test_environmentObject



55
56
57
58
59
60
61
62
63
# File 'lib/bretels/generators/app_generator.rb', line 55

def setup_test_environment
  say 'Setting up the test environment'
  build :enable_factory_girl_syntax
  build :test_factories_first
  build :generate_rspec
  build :configure_rspec
  build :enable_database_cleaner
  build :generate_factories_file
end

#suspenders_customizationObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/bretels/generators/app_generator.rb', line 23

def suspenders_customization
  invoke :remove_files_we_dont_need
  invoke :customize_gemfile
  invoke :setup_development_environment
  invoke :setup_test_environment
  invoke :setup_production_environment
  invoke :setup_staging_environment
  invoke :create_suspenders_views
  invoke :setup_database
  invoke :configure_app
  invoke :setup_stylesheets
  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