gb-firestarter 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +5 -0
- data/.ruby-version +1 -0
- data/.travis.yml +19 -0
- data/CONTRIBUTING.md +38 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +133 -0
- data/README.md +7 -36
- data/Rakefile +8 -0
- data/bin/rspec +16 -0
- data/firestarter.gemspec +34 -0
- data/lib/firestarter/actions.rb +35 -0
- data/lib/firestarter/app_builder.rb +297 -0
- data/lib/firestarter/generators/app_generator.rb +186 -0
- data/lib/firestarter/version.rb +4 -0
- data/lib/firestarter.rb +4 -0
- data/spec/features/new_project_spec.rb +38 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/support/firestarter.rb +49 -0
- data/templates/Gemfile.erb +55 -0
- data/templates/Procfile +1 -0
- data/templates/README.md.erb +25 -0
- data/templates/Rakefile.erb +10 -0
- data/templates/_flashes.slim +3 -0
- data/templates/_javascript.slim +9 -0
- data/templates/application.sass +3 -0
- data/templates/bin_setup +17 -0
- data/templates/config_locales_en.yml +11 -0
- data/templates/database_cleaner_rspec.rb +21 -0
- data/templates/development_seeds.rb +13 -0
- data/templates/disable_xml_params.rb +3 -0
- data/templates/errors.rb +28 -0
- data/templates/factories_spec.rb +13 -0
- data/templates/factories_spec_rake_task.rb +15 -0
- data/templates/factory_girl_syntax_rspec.rb +3 -0
- data/templates/firestarter_gitignore +18 -0
- data/templates/firestarter_layout.slim.erb +12 -0
- data/templates/i18n.rb +3 -0
- data/templates/postgresql_database.yml.erb +12 -0
- data/templates/puma.rb +18 -0
- data/templates/rack_timeout.rb +1 -0
- data/templates/ruby-version.erb +1 -0
- data/templates/sample.env +3 -0
- data/templates/secret_token.rb +10 -0
- data/templates/smtp.rb +10 -0
- data/templates/spec_helper.rb +42 -0
- data/templates/staging.rb +3 -0
- metadata +78 -38
@@ -0,0 +1,297 @@
|
|
1
|
+
module Firestarter
|
2
|
+
class AppBuilder < Rails::AppBuilder
|
3
|
+
include Firestarter::Actions
|
4
|
+
|
5
|
+
def readme
|
6
|
+
template 'README.md.erb', 'README.md'
|
7
|
+
end
|
8
|
+
|
9
|
+
def rakefile
|
10
|
+
template 'Rakefile.erb', 'Rakefile'
|
11
|
+
end
|
12
|
+
|
13
|
+
def raise_on_delivery_errors
|
14
|
+
replace_in_file 'config/environments/development.rb',
|
15
|
+
'raise_delivery_errors = false', 'raise_delivery_errors = true'
|
16
|
+
end
|
17
|
+
|
18
|
+
def raise_on_unpermitted_parameters
|
19
|
+
action_on_unpermitted_parameters = <<-RUBY
|
20
|
+
|
21
|
+
# Raise an ActionController::UnpermittedParameters exception when
|
22
|
+
# a parameter is not explcitly permitted but is passed anyway.
|
23
|
+
config.action_controller.action_on_unpermitted_parameters = :raise
|
24
|
+
RUBY
|
25
|
+
inject_into_file(
|
26
|
+
"config/environments/development.rb",
|
27
|
+
action_on_unpermitted_parameters,
|
28
|
+
before: "\nend"
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
def provide_setup_script
|
33
|
+
remove_file 'bin/setup'
|
34
|
+
copy_file 'bin_setup', 'bin/setup'
|
35
|
+
run 'chmod a+x bin/setup'
|
36
|
+
end
|
37
|
+
|
38
|
+
def provide_dev_prime_task
|
39
|
+
copy_file 'development_seeds.rb', 'lib/tasks/development_seeds.rake'
|
40
|
+
end
|
41
|
+
|
42
|
+
def configure_generators
|
43
|
+
config = <<-RUBY
|
44
|
+
config.generators do |generate|
|
45
|
+
generate.helper false
|
46
|
+
generate.javascript_engine false
|
47
|
+
generate.request_specs false
|
48
|
+
generate.routing_specs false
|
49
|
+
generate.stylesheets false
|
50
|
+
generate.test_framework :rspec
|
51
|
+
generate.view_specs false
|
52
|
+
end
|
53
|
+
|
54
|
+
RUBY
|
55
|
+
|
56
|
+
inject_into_class 'config/application.rb', 'Application', config
|
57
|
+
end
|
58
|
+
|
59
|
+
def enable_factory_girl_syntax
|
60
|
+
copy_file 'factory_girl_syntax_rspec.rb', 'spec/support/factory_girl.rb'
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_factories_first
|
64
|
+
copy_file 'factories_spec.rb', 'spec/models/factories_spec.rb'
|
65
|
+
append_file 'Rakefile', factories_spec_rake_task
|
66
|
+
end
|
67
|
+
|
68
|
+
def configure_smtp
|
69
|
+
copy_file 'smtp.rb', 'config/initializers/smtp.rb'
|
70
|
+
|
71
|
+
prepend_file 'config/environments/production.rb',
|
72
|
+
"require Rails.root.join('config/initializers/smtp')\n"
|
73
|
+
|
74
|
+
config = <<-RUBY
|
75
|
+
|
76
|
+
config.action_mailer.delivery_method = :smtp
|
77
|
+
config.action_mailer.smtp_settings = SMTP_SETTINGS
|
78
|
+
RUBY
|
79
|
+
|
80
|
+
inject_into_file 'config/environments/production.rb', config,
|
81
|
+
:after => 'config.action_mailer.raise_delivery_errors = false'
|
82
|
+
end
|
83
|
+
|
84
|
+
def enable_rack_deflater
|
85
|
+
config = <<-RUBY
|
86
|
+
|
87
|
+
# Enable deflate / gzip compression of controller-generated responses
|
88
|
+
config.middleware.use Rack::Deflater
|
89
|
+
RUBY
|
90
|
+
|
91
|
+
inject_into_file 'config/environments/production.rb', config,
|
92
|
+
:after => "config.serve_static_assets = false\n"
|
93
|
+
end
|
94
|
+
|
95
|
+
def setup_staging_environment
|
96
|
+
staging_file = 'config/environments/staging.rb'
|
97
|
+
copy_file 'staging.rb', staging_file
|
98
|
+
|
99
|
+
config = <<-RUBY
|
100
|
+
|
101
|
+
#{app_name.classify}::Application.configure do
|
102
|
+
# ...
|
103
|
+
end
|
104
|
+
RUBY
|
105
|
+
|
106
|
+
append_file staging_file, config
|
107
|
+
end
|
108
|
+
|
109
|
+
def setup_secret_token
|
110
|
+
template 'secret_token.rb',
|
111
|
+
'config/initializers/secret_token.rb',
|
112
|
+
:force => true
|
113
|
+
end
|
114
|
+
|
115
|
+
def create_partials_directory
|
116
|
+
empty_directory 'app/views/application'
|
117
|
+
end
|
118
|
+
|
119
|
+
def create_shared_flashes
|
120
|
+
copy_file '_flashes.slim', 'app/views/application/_flashes.slim'
|
121
|
+
end
|
122
|
+
|
123
|
+
def create_shared_javascripts
|
124
|
+
copy_file '_javascript.slim', 'app/views/application/_javascript.slim'
|
125
|
+
end
|
126
|
+
|
127
|
+
def create_application_layout
|
128
|
+
remove_file 'app/views/layouts/application.html.erb'
|
129
|
+
template 'firestarter_layout.slim.erb',
|
130
|
+
'app/views/layouts/application.slim',
|
131
|
+
force: true
|
132
|
+
end
|
133
|
+
|
134
|
+
def remove_turbolinks
|
135
|
+
replace_in_file 'app/assets/javascripts/application.js',
|
136
|
+
/\/\/= require turbolinks\n/,
|
137
|
+
''
|
138
|
+
end
|
139
|
+
|
140
|
+
def use_postgres_config_template
|
141
|
+
template 'postgresql_database.yml.erb', 'config/database.yml',
|
142
|
+
force: true
|
143
|
+
end
|
144
|
+
|
145
|
+
def create_database
|
146
|
+
bundle_command 'exec rake db:create db:migrate'
|
147
|
+
end
|
148
|
+
|
149
|
+
def replace_gemfile
|
150
|
+
remove_file 'Gemfile'
|
151
|
+
template 'Gemfile.erb', 'Gemfile'
|
152
|
+
end
|
153
|
+
|
154
|
+
def set_ruby_to_version_being_used
|
155
|
+
template 'ruby-version.erb', '.ruby-version'
|
156
|
+
end
|
157
|
+
|
158
|
+
def enable_database_cleaner
|
159
|
+
copy_file 'database_cleaner_rspec.rb', 'spec/support/database_cleaner.rb'
|
160
|
+
end
|
161
|
+
|
162
|
+
def configure_spec_support_features
|
163
|
+
empty_directory_with_keep_file 'spec/features'
|
164
|
+
empty_directory_with_keep_file 'spec/support/features'
|
165
|
+
end
|
166
|
+
|
167
|
+
def configure_rspec
|
168
|
+
remove_file 'spec/spec_helper.rb'
|
169
|
+
copy_file 'spec_helper.rb', 'spec/spec_helper.rb'
|
170
|
+
end
|
171
|
+
|
172
|
+
def configure_i18n_in_specs
|
173
|
+
copy_file 'i18n.rb', 'spec/support/i18n.rb'
|
174
|
+
end
|
175
|
+
|
176
|
+
def configure_time_zone
|
177
|
+
config = <<-RUBY
|
178
|
+
config.active_record.default_timezone = :utc
|
179
|
+
|
180
|
+
RUBY
|
181
|
+
inject_into_class 'config/application.rb', 'Application', config
|
182
|
+
end
|
183
|
+
|
184
|
+
def configure_time_formats
|
185
|
+
remove_file 'config/locales/en.yml'
|
186
|
+
copy_file 'config_locales_en.yml', 'config/locales/en.yml'
|
187
|
+
end
|
188
|
+
|
189
|
+
def configure_rack_timeout
|
190
|
+
copy_file 'rack_timeout.rb', 'config/initializers/rack_timeout.rb'
|
191
|
+
end
|
192
|
+
|
193
|
+
def configure_action_mailer
|
194
|
+
action_mailer_host 'development', "#{app_name}.local"
|
195
|
+
action_mailer_host 'test', 'www.example.com'
|
196
|
+
action_mailer_host 'staging', "staging.#{app_name}.com"
|
197
|
+
action_mailer_host 'production', "#{app_name}.com"
|
198
|
+
end
|
199
|
+
|
200
|
+
def fix_i18n_deprecation_warning
|
201
|
+
config = <<-RUBY
|
202
|
+
config.i18n.enforce_available_locales = true
|
203
|
+
|
204
|
+
RUBY
|
205
|
+
inject_into_class 'config/application.rb', 'Application', config
|
206
|
+
end
|
207
|
+
|
208
|
+
def generate_rspec
|
209
|
+
generate 'rspec:install'
|
210
|
+
end
|
211
|
+
|
212
|
+
def configure_puma
|
213
|
+
copy_file 'puma.rb', 'config/puma.rb'
|
214
|
+
end
|
215
|
+
|
216
|
+
def setup_foreman
|
217
|
+
copy_file 'sample.env', '.sample.env'
|
218
|
+
copy_file 'Procfile', 'Procfile'
|
219
|
+
end
|
220
|
+
|
221
|
+
def setup_stylesheets
|
222
|
+
remove_file 'app/assets/stylesheets/application.css'
|
223
|
+
copy_file 'application.sass',
|
224
|
+
'app/assets/stylesheets/application.sass'
|
225
|
+
end
|
226
|
+
|
227
|
+
def gitignore_files
|
228
|
+
remove_file '.gitignore'
|
229
|
+
copy_file 'firestarter_gitignore', '.gitignore'
|
230
|
+
[
|
231
|
+
'app/views/pages',
|
232
|
+
'spec/lib',
|
233
|
+
'spec/controllers',
|
234
|
+
'spec/helpers',
|
235
|
+
'spec/support/matchers',
|
236
|
+
'spec/support/mixins',
|
237
|
+
'spec/support/shared_examples'
|
238
|
+
].each do |dir|
|
239
|
+
run "mkdir #{dir}"
|
240
|
+
run "touch #{dir}/.keep"
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
def init_git
|
245
|
+
run 'git init'
|
246
|
+
end
|
247
|
+
|
248
|
+
def copy_miscellaneous_files
|
249
|
+
copy_file 'errors.rb', 'config/initializers/errors.rb'
|
250
|
+
end
|
251
|
+
|
252
|
+
def customize_error_pages
|
253
|
+
meta_tags =<<-EOS
|
254
|
+
<meta charset='utf-8' />
|
255
|
+
<meta name='ROBOTS' content='NOODP' />
|
256
|
+
EOS
|
257
|
+
|
258
|
+
%w(500 404 422).each do |page|
|
259
|
+
inject_into_file "public/#{page}.html", meta_tags, :after => "<head>\n"
|
260
|
+
replace_in_file "public/#{page}.html", /<!--.+-->\n/, ''
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
def remove_routes_comment_lines
|
265
|
+
replace_in_file 'config/routes.rb',
|
266
|
+
/Rails.application\.routes\.draw do.*end/m,
|
267
|
+
"Rails.application.routes.draw do\nend"
|
268
|
+
end
|
269
|
+
|
270
|
+
def disable_xml_params
|
271
|
+
copy_file 'disable_xml_params.rb', 'config/initializers/disable_xml_params.rb'
|
272
|
+
end
|
273
|
+
|
274
|
+
def setup_default_rake_task
|
275
|
+
append_file 'Rakefile' do
|
276
|
+
"task(:default).clear\ntask :default => [:spec]\n"
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
private
|
281
|
+
|
282
|
+
def override_path_for_tests
|
283
|
+
if ENV['TESTING']
|
284
|
+
support_bin = File.expand_path(File.join('..', '..', 'spec', 'fakes', 'bin'))
|
285
|
+
"PATH=#{support_bin}:$PATH"
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
def factories_spec_rake_task
|
290
|
+
IO.read find_in_source_paths('factories_spec_rake_task.rb')
|
291
|
+
end
|
292
|
+
|
293
|
+
def generate_secret
|
294
|
+
SecureRandom.hex(64)
|
295
|
+
end
|
296
|
+
end
|
297
|
+
end
|
@@ -0,0 +1,186 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/rails/app/app_generator'
|
3
|
+
|
4
|
+
module Firestarter
|
5
|
+
class AppGenerator < Rails::Generators::AppGenerator
|
6
|
+
class_option :database, :type => :string, :aliases => '-d', :default => 'postgresql',
|
7
|
+
:desc => "Preconfigure for selected database (options: #{DATABASES.join('/')})"
|
8
|
+
|
9
|
+
class_option :github, :type => :string, :aliases => '-G', :default => nil,
|
10
|
+
:desc => 'Create Github repository and add remote origin pointed to repo'
|
11
|
+
|
12
|
+
class_option :skip_test_unit, :type => :boolean, :aliases => '-T', :default => true,
|
13
|
+
:desc => 'Skip Test::Unit files'
|
14
|
+
|
15
|
+
def finish_template
|
16
|
+
invoke :firestarter_customization
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
def firestarter_customization
|
21
|
+
invoke :customize_gemfile
|
22
|
+
invoke :setup_development_environment
|
23
|
+
invoke :setup_test_environment
|
24
|
+
invoke :setup_production_environment
|
25
|
+
invoke :setup_staging_environment
|
26
|
+
invoke :setup_secret_token
|
27
|
+
invoke :create_firestarter_views
|
28
|
+
invoke :setup_coffeescript
|
29
|
+
invoke :configure_app
|
30
|
+
invoke :setup_stylesheets
|
31
|
+
invoke :copy_miscellaneous_files
|
32
|
+
invoke :customize_error_pages
|
33
|
+
invoke :remove_routes_comment_lines
|
34
|
+
invoke :setup_git
|
35
|
+
invoke :setup_database
|
36
|
+
invoke :outro
|
37
|
+
end
|
38
|
+
|
39
|
+
def customize_gemfile
|
40
|
+
build :replace_gemfile
|
41
|
+
build :set_ruby_to_version_being_used
|
42
|
+
bundle_command 'install'
|
43
|
+
end
|
44
|
+
|
45
|
+
def setup_database
|
46
|
+
say 'Setting up database'
|
47
|
+
|
48
|
+
if 'postgresql' == options[:database]
|
49
|
+
build :use_postgres_config_template
|
50
|
+
end
|
51
|
+
|
52
|
+
build :create_database
|
53
|
+
end
|
54
|
+
|
55
|
+
def setup_development_environment
|
56
|
+
say 'Setting up the development environment'
|
57
|
+
build :raise_on_delivery_errors
|
58
|
+
build :raise_on_unpermitted_parameters
|
59
|
+
build :provide_setup_script
|
60
|
+
build :provide_dev_prime_task
|
61
|
+
build :configure_generators
|
62
|
+
end
|
63
|
+
|
64
|
+
def setup_test_environment
|
65
|
+
say 'Setting up the test environment'
|
66
|
+
build :enable_factory_girl_syntax
|
67
|
+
build :test_factories_first
|
68
|
+
build :generate_rspec
|
69
|
+
build :configure_rspec
|
70
|
+
build :enable_database_cleaner
|
71
|
+
build :configure_spec_support_features
|
72
|
+
build :configure_i18n_in_specs
|
73
|
+
end
|
74
|
+
|
75
|
+
def setup_production_environment
|
76
|
+
say 'Setting up the production environment'
|
77
|
+
build :configure_smtp
|
78
|
+
build :enable_rack_deflater
|
79
|
+
end
|
80
|
+
|
81
|
+
def setup_staging_environment
|
82
|
+
say 'Setting up the staging environment'
|
83
|
+
build :setup_staging_environment
|
84
|
+
end
|
85
|
+
|
86
|
+
def setup_secret_token
|
87
|
+
say 'Moving secret token out of version control'
|
88
|
+
build :setup_secret_token
|
89
|
+
end
|
90
|
+
|
91
|
+
def create_firestarter_views
|
92
|
+
say 'Creating firestarter views'
|
93
|
+
build :create_partials_directory
|
94
|
+
build :create_shared_flashes
|
95
|
+
build :create_shared_javascripts
|
96
|
+
build :create_application_layout
|
97
|
+
end
|
98
|
+
|
99
|
+
def setup_coffeescript
|
100
|
+
say 'Setting up CoffeeScript defaults'
|
101
|
+
build :remove_turbolinks
|
102
|
+
end
|
103
|
+
|
104
|
+
def configure_app
|
105
|
+
say 'Configuring app'
|
106
|
+
build :configure_action_mailer
|
107
|
+
build :configure_time_zone
|
108
|
+
build :configure_time_formats
|
109
|
+
build :configure_rack_timeout
|
110
|
+
build :disable_xml_params
|
111
|
+
build :fix_i18n_deprecation_warning
|
112
|
+
build :setup_default_rake_task
|
113
|
+
build :configure_puma
|
114
|
+
build :setup_foreman
|
115
|
+
end
|
116
|
+
|
117
|
+
def setup_stylesheets
|
118
|
+
say 'Set up stylesheets'
|
119
|
+
build :setup_stylesheets
|
120
|
+
end
|
121
|
+
|
122
|
+
def setup_git
|
123
|
+
if !options[:skip_git]
|
124
|
+
say 'Initializing git'
|
125
|
+
invoke :setup_gitignore
|
126
|
+
invoke :init_git
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def setup_gitignore
|
131
|
+
build :gitignore_files
|
132
|
+
end
|
133
|
+
|
134
|
+
def init_git
|
135
|
+
build :init_git
|
136
|
+
end
|
137
|
+
|
138
|
+
def copy_miscellaneous_files
|
139
|
+
say 'Copying miscellaneous support files'
|
140
|
+
build :copy_miscellaneous_files
|
141
|
+
end
|
142
|
+
|
143
|
+
def customize_error_pages
|
144
|
+
say 'Customizing the 500/404/422 pages'
|
145
|
+
build :customize_error_pages
|
146
|
+
end
|
147
|
+
|
148
|
+
def remove_routes_comment_lines
|
149
|
+
build :remove_routes_comment_lines
|
150
|
+
end
|
151
|
+
|
152
|
+
def outro
|
153
|
+
say 'Congratulations! You just started a fire.'
|
154
|
+
end
|
155
|
+
|
156
|
+
def run_bundle
|
157
|
+
# Let's not: We'll bundle manually at the right spot
|
158
|
+
end
|
159
|
+
|
160
|
+
def ruby_version_with_patch_level
|
161
|
+
"#{RUBY_VERSION}#{patch_level}"
|
162
|
+
end
|
163
|
+
|
164
|
+
protected
|
165
|
+
|
166
|
+
def get_builder_class
|
167
|
+
Firestarter::AppBuilder
|
168
|
+
end
|
169
|
+
|
170
|
+
def using_active_record?
|
171
|
+
!options[:skip_active_record]
|
172
|
+
end
|
173
|
+
|
174
|
+
def patch_level
|
175
|
+
if RUBY_PATCHLEVEL == 0 && RUBY_VERSION >= '2.1.0'
|
176
|
+
''
|
177
|
+
else
|
178
|
+
"-p#{RUBY_PATCHLEVEL}"
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
def spring_install?
|
183
|
+
false
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
data/lib/firestarter.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
feature 'Suspend a new project with default configuration' do
|
4
|
+
scenario 'specs pass' do
|
5
|
+
run_firestarter
|
6
|
+
|
7
|
+
Dir.chdir(project_path) do
|
8
|
+
Bundler.with_clean_env do
|
9
|
+
expect(`rake`).to include('0 failures')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
scenario 'staging config is inherited from production' do
|
15
|
+
run_firestarter
|
16
|
+
|
17
|
+
staging_file = IO.read("#{project_path}/config/environments/staging.rb")
|
18
|
+
config_stub = "Dummy::Application.configure do"
|
19
|
+
expect(staging_file).to match(/^require_relative 'production'/)
|
20
|
+
expect(staging_file).to match(/#{config_stub}/), staging_file
|
21
|
+
end
|
22
|
+
|
23
|
+
if RUBY_PATCHLEVEL == 0 && RUBY_VERSION >= '2.1.0'
|
24
|
+
scenario '.ruby-version does not include patchlevel for Ruby 2.1.0+' do
|
25
|
+
run_firestarter
|
26
|
+
|
27
|
+
ruby_version_file = IO.read("#{project_path}/.ruby-version")
|
28
|
+
expect(ruby_version_file).to eq "#{RUBY_VERSION}\n"
|
29
|
+
end
|
30
|
+
else
|
31
|
+
scenario '.ruby-version includes patchlevel for all pre-Ruby 2.1.0 versions' do
|
32
|
+
run_firestarter
|
33
|
+
|
34
|
+
ruby_version_file = IO.read("#{project_path}/.ruby-version")
|
35
|
+
expect(ruby_version_file).to eq "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}\n"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'capybara/rspec'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
Bundler.require(:default, :test)
|
5
|
+
|
6
|
+
require (Pathname.new(__FILE__).dirname + '../lib/firestarter').expand_path
|
7
|
+
|
8
|
+
Dir['./spec/support/**/*.rb'].each { |file| require file }
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.include FirestarterTestHelpers
|
12
|
+
|
13
|
+
config.before(:all) do
|
14
|
+
create_tmp_directory
|
15
|
+
end
|
16
|
+
|
17
|
+
config.before(:each) do
|
18
|
+
drop_dummy_database
|
19
|
+
remove_project_directory
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module FirestarterTestHelpers
|
2
|
+
APP_NAME = 'dummy'
|
3
|
+
|
4
|
+
def remove_project_directory
|
5
|
+
FileUtils.rm_rf(project_path)
|
6
|
+
end
|
7
|
+
|
8
|
+
def create_tmp_directory
|
9
|
+
FileUtils.mkdir_p(tmp_path)
|
10
|
+
end
|
11
|
+
|
12
|
+
def run_firestarter(arguments = nil)
|
13
|
+
Dir.chdir(tmp_path) do
|
14
|
+
Bundler.with_clean_env do
|
15
|
+
ENV['TESTING'] = '1'
|
16
|
+
|
17
|
+
%x(#{firestarter_bin} #{APP_NAME} #{arguments})
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def drop_dummy_database
|
23
|
+
if File.exists?(project_path)
|
24
|
+
Dir.chdir(project_path) do
|
25
|
+
Bundler.with_clean_env do
|
26
|
+
`rake db:drop`
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def project_path
|
33
|
+
@project_path ||= Pathname.new("#{tmp_path}/#{APP_NAME}")
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def tmp_path
|
39
|
+
@tmp_path ||= Pathname.new("#{root_path}/tmp")
|
40
|
+
end
|
41
|
+
|
42
|
+
def firestarter_bin
|
43
|
+
File.join(root_path, 'bin', 'firestarter')
|
44
|
+
end
|
45
|
+
|
46
|
+
def root_path
|
47
|
+
File.expand_path('../../../', __FILE__)
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
ruby '<%= RUBY_VERSION %>'
|
4
|
+
|
5
|
+
gem 'bourbon'
|
6
|
+
gem 'coffee-rails'
|
7
|
+
gem 'dotenv-rails'
|
8
|
+
gem 'email_validator'
|
9
|
+
gem 'foreman'
|
10
|
+
gem 'jquery-rails'
|
11
|
+
gem 'pg'
|
12
|
+
gem 'pry-rails'
|
13
|
+
gem 'puma'
|
14
|
+
gem 'rack-timeout'
|
15
|
+
gem 'rails', '~> <%= Firestarter::RAILS_VERSION %>'
|
16
|
+
gem 'recipient_interceptor'
|
17
|
+
gem 'sass-rails'
|
18
|
+
gem 'slim-rails'
|
19
|
+
gem 'title'
|
20
|
+
gem 'uglifier'
|
21
|
+
|
22
|
+
group :development do
|
23
|
+
gem 'better_errors'
|
24
|
+
gem 'binding_of_caller'
|
25
|
+
gem 'letter_opener'
|
26
|
+
end
|
27
|
+
|
28
|
+
group :development, :test do
|
29
|
+
gem 'awesome_print'
|
30
|
+
gem 'factory_girl_rails'
|
31
|
+
gem 'rspec-rails', '~> 3.0'
|
32
|
+
end
|
33
|
+
|
34
|
+
group :test do
|
35
|
+
gem 'capybara-webkit', '>= 1.0.0'
|
36
|
+
gem 'database_cleaner'
|
37
|
+
gem 'launchy'
|
38
|
+
gem 'simplecov', require: false
|
39
|
+
gem 'timecop'
|
40
|
+
gem 'webmock'
|
41
|
+
gem 'rubocop', require: false
|
42
|
+
end
|
43
|
+
|
44
|
+
group :production, :staging do
|
45
|
+
gem 'rails_12factor'
|
46
|
+
end
|
47
|
+
|
48
|
+
group :deploy do
|
49
|
+
gem 'capistrano', '~> 3.2.1', require: false
|
50
|
+
gem 'capistrano-rails', require: false
|
51
|
+
gem 'capistrano-rvm', require: false
|
52
|
+
gem 'capistrano-bundler', require: false
|
53
|
+
gem 'capistrano3-env', require: false
|
54
|
+
gem 'capistrano-foreman', github: 'groupbuddies/capistrano-foreman', branch: :master
|
55
|
+
end
|
data/templates/Procfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
web: bundle exec puma -C config/puma.rb
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%= app_name.humanize %>
|
2
|
+
<%= '=' * app_name.humanize.length %>
|
3
|
+
|
4
|
+
Getting Started
|
5
|
+
---------------
|
6
|
+
|
7
|
+
This repository comes equipped with a self-setup script:
|
8
|
+
|
9
|
+
% ./bin/setup
|
10
|
+
|
11
|
+
After setting up, you can run the application using [foreman]:
|
12
|
+
|
13
|
+
% foreman start
|
14
|
+
|
15
|
+
[foreman]: http://ddollar.github.io/foreman/
|
16
|
+
|
17
|
+
Guidelines
|
18
|
+
----------
|
19
|
+
|
20
|
+
Use the following guides for getting things done, programming well, and
|
21
|
+
programming in style.
|
22
|
+
|
23
|
+
* [Protocol](http://github.com/groupbuddies/guides/blob/master/protocol)
|
24
|
+
* [Best Practices](http://github.com/groupbuddies/guides/blob/master/best-practices)
|
25
|
+
* [Style](http://github.com/groupbuddies/guides/blob/master/style)
|