Class: Suspenders::AppGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details


183
184
185
# File 'lib/suspenders/generators/app_generator.rb', line 183

def self.banner
  "suspenders #{arguments.map(&:usage).join(" ")} [options]"
end

Instance Method Details

#configure_appObject


98
99
100
101
102
103
# File 'lib/suspenders/generators/app_generator.rb', line 98

def configure_app
  say "Configuring app"
  build :configure_action_mailer
  build :configure_time_formats
  build :setup_default_rake_task
end

#copy_miscellaneous_filesObject


127
128
129
130
# File 'lib/suspenders/generators/app_generator.rb', line 127

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

#create_github_repoObject


120
121
122
123
124
125
# File 'lib/suspenders/generators/app_generator.rb', line 120

def create_github_repo
  if !options[:skip_git] && options[:github]
    say "Creating Github repo"
    build :create_github_repo, options[:github]
  end
end

#create_heroku_appsObject


105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/suspenders/generators/app_generator.rb', line 105

def create_heroku_apps
  if options[:heroku]
    say "Creating Heroku apps"
    build :create_heroku_apps, options[:heroku_flags]
    build :set_heroku_remotes
    build :set_heroku_rails_secrets
    build :set_heroku_application_host
    build :set_heroku_honeybadger_env
    build :set_heroku_backup_schedule
    build :set_heroku_buildpacks
    build :create_heroku_pipeline
    build :configure_automatic_deployment
  end
end

#customize_gemfileObject


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

def customize_gemfile
  build :replace_gemfile, options[:path]
  bundle_command "install"
end

#finish_templateObject


38
39
40
41
# File 'lib/suspenders/generators/app_generator.rb', line 38

def finish_template
  invoke :suspenders_customization
  super
end

#generate_defaultObject


140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/suspenders/generators/app_generator.rb', line 140

def generate_default
  run("spring stop")
  generate("suspenders:runner")
  generate("suspenders:profiler")
  generate("suspenders:json")
  generate("suspenders:static")
  generate("suspenders:stylesheet_base")
  generate("suspenders:testing")
  generate("suspenders:ci")
  generate("suspenders:js_driver")
  unless options[:api]
    generate("suspenders:forms")
  end
  generate("suspenders:db_optimizations")
  generate("suspenders:factories")
  generate("suspenders:lint")
  generate("suspenders:jobs")
  generate("suspenders:analytics")
  generate("suspenders:inline_svg")
  generate("suspenders:advisories")
  generate("suspenders:preloader")
end

#generate_deployment_defaultObject


163
164
165
166
167
168
169
170
171
172
# File 'lib/suspenders/generators/app_generator.rb', line 163

def generate_deployment_default
  generate("suspenders:staging:pull_requests")
  generate("suspenders:production:single_redirect")
  generate("suspenders:production:compression")
  generate("suspenders:production:force_tls")
  generate("suspenders:production:email")
  generate("suspenders:production:timeout")
  generate("suspenders:production:deployment")
  generate("suspenders:production:manifest")
end

#generate_viewsObject


174
175
176
# File 'lib/suspenders/generators/app_generator.rb', line 174

def generate_views
  generate("suspenders:views")
end

#outroObject


178
179
180
181
# File 'lib/suspenders/generators/app_generator.rb', line 178

def outro
  say "Congratulations! You just pulled our suspenders."
  say honeybadger_outro
end

#remove_config_comment_linesObject


132
133
134
# File 'lib/suspenders/generators/app_generator.rb', line 132

def remove_config_comment_lines
  build :remove_config_comment_lines
end

#remove_routes_comment_linesObject


136
137
138
# File 'lib/suspenders/generators/app_generator.rb', line 136

def remove_routes_comment_lines
  build :remove_routes_comment_lines
end

#setup_databaseObject


65
66
67
68
69
70
71
72
73
# File 'lib/suspenders/generators/app_generator.rb', line 65

def setup_database
  say "Setting up database"

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

  build :create_database
end

#setup_development_environmentObject


75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/suspenders/generators/app_generator.rb', line 75

def setup_development_environment
  say "Setting up the development environment"
  build :configure_local_mail
  build :raise_on_missing_assets_in_test
  build :raise_on_delivery_errors
  build :set_test_delivery_method
  build :raise_on_unpermitted_parameters
  build :provide_setup_script
  build :configure_generators
  build :configure_i18n_for_missing_translations
  build :configure_quiet_assets
end

#setup_production_environmentObject


88
89
90
91
# File 'lib/suspenders/generators/app_generator.rb', line 88

def setup_production_environment
  say "Setting up the production environment"
  build :setup_asset_host
end

#setup_secret_tokenObject


93
94
95
96
# File 'lib/suspenders/generators/app_generator.rb', line 93

def setup_secret_token
  say "Moving secret token out of version control"
  build :setup_secret_token
end

#suspenders_customizationObject


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/suspenders/generators/app_generator.rb', line 43

def suspenders_customization
  invoke :customize_gemfile
  invoke :setup_development_environment
  invoke :setup_production_environment
  invoke :setup_secret_token
  invoke :configure_app
  invoke :copy_miscellaneous_files
  invoke :setup_database
  invoke :create_github_repo
  invoke :generate_default
  invoke :create_heroku_apps
  invoke :generate_deployment_default
  invoke :remove_config_comment_lines
  invoke :remove_routes_comment_lines
  invoke :outro
end