tirantes 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +8 -0
- data/CONTRIBUTING.md +38 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +140 -0
- data/LICENSE +21 -0
- data/NEWS.md +125 -0
- data/README.md +160 -0
- data/Rakefile +8 -0
- data/bin/tirantes +16 -0
- data/features/github_repo.feature +8 -0
- data/features/heroku_true.feature +9 -0
- data/features/rake_clean.feature +15 -0
- data/features/step_definitions/tirantes_steps.rb +68 -0
- data/features/support/bin/heroku +5 -0
- data/features/support/bin/hub +5 -0
- data/features/support/env.rb +10 -0
- data/features/support/fake_github.rb +21 -0
- data/features/support/fake_heroku.rb +21 -0
- data/lib/tirantes/actions.rb +40 -0
- data/lib/tirantes/app_builder.rb +322 -0
- data/lib/tirantes/generators/app_generator.rb +203 -0
- data/lib/tirantes/version.rb +3 -0
- data/templates/Gemfile_clean +50 -0
- data/templates/Procfile +2 -0
- data/templates/README.md.erb +11 -0
- data/templates/_flashes.html.erb +5 -0
- data/templates/_javascript.html.erb +10 -0
- data/templates/application.css.scss +14 -0
- data/templates/background_jobs_minitest.rb +19 -0
- data/templates/bin_setup +18 -0
- data/templates/config_locales_en.yml +11 -0
- data/templates/database_cleaner_minitest.rb +15 -0
- data/templates/disable_xml_params.rb +3 -0
- data/templates/errors.rb +28 -0
- data/templates/exception_notification.rb +8 -0
- data/templates/javascripts/prefilled_input.js +59 -0
- data/templates/postgresql_database.yml.erb +12 -0
- data/templates/puma.rb +13 -0
- data/templates/rack_timeout.rb +1 -0
- data/templates/sample.env +14 -0
- data/templates/secret_token.rb.erb +5 -0
- data/templates/simple_form_purecss.rb +13 -0
- data/templates/smtp.rb +10 -0
- data/templates/test_helper.rb +39 -0
- data/templates/tirantes_gitignore +17 -0
- data/templates/tirantes_layout.html.erb.erb +15 -0
- data/tirantes.gemspec +33 -0
- metadata +163 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
class FakeGithub
|
2
|
+
RECORDER = File.expand_path(File.join('..', '..', 'tmp', 'hub_commands'), File.dirname(__FILE__))
|
3
|
+
|
4
|
+
def initialize(args)
|
5
|
+
@args = args
|
6
|
+
end
|
7
|
+
|
8
|
+
def run!
|
9
|
+
File.open(RECORDER, 'a') do |file|
|
10
|
+
file.write @args.join(' ')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.clear!
|
15
|
+
FileUtils.rm_rf RECORDER
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.has_created_repo?(repo_name)
|
19
|
+
File.open(RECORDER, 'r').read.include?("create #{repo_name}")
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class FakeHeroku
|
2
|
+
RECORDER = File.expand_path(File.join('..', '..', 'tmp', 'heroku_commands'), File.dirname(__FILE__))
|
3
|
+
|
4
|
+
def initialize(args)
|
5
|
+
@args = args
|
6
|
+
end
|
7
|
+
|
8
|
+
def run!
|
9
|
+
File.open(RECORDER, 'a') do |file|
|
10
|
+
file.write @args.join(' ')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.clear!
|
15
|
+
FileUtils.rm_rf RECORDER
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.has_created_app?(app_name)
|
19
|
+
File.open(RECORDER, 'r').read.include?("create #{app_name}")
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Tirantes
|
2
|
+
module Actions
|
3
|
+
def concat_file(source, destination)
|
4
|
+
contents = IO.read(find_in_source_paths(source))
|
5
|
+
append_file destination, contents
|
6
|
+
end
|
7
|
+
|
8
|
+
def replace_in_file(relative_path, find, replace)
|
9
|
+
path = File.join(destination_root, relative_path)
|
10
|
+
contents = IO.read(path)
|
11
|
+
unless contents.gsub!(find, replace)
|
12
|
+
raise "#{find.inspect} not found in #{relative_path}"
|
13
|
+
end
|
14
|
+
File.open(path, "w") { |file| file.write(contents) }
|
15
|
+
end
|
16
|
+
|
17
|
+
def action_mailer_host(rails_env, host)
|
18
|
+
host_config = "config.action_mailer.default_url_options = { host: '#{host}' }"
|
19
|
+
configure_environment(rails_env, host_config)
|
20
|
+
end
|
21
|
+
|
22
|
+
def configure_environment(rails_env, config)
|
23
|
+
inject_into_file(
|
24
|
+
"config/environments/#{rails_env}.rb",
|
25
|
+
"\n\n #{config}",
|
26
|
+
before: "\nend"
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def download_file(uri_string, destination)
|
31
|
+
uri = URI.parse(uri_string)
|
32
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
33
|
+
http.use_ssl = true if uri_string =~ /^https/
|
34
|
+
request = Net::HTTP::Get.new(uri.path)
|
35
|
+
contents = http.request(request).body
|
36
|
+
path = File.join(destination_root, destination)
|
37
|
+
File.open(path, "w") { |file| file.write(contents) }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,322 @@
|
|
1
|
+
module Tirantes
|
2
|
+
class AppBuilder < Rails::AppBuilder
|
3
|
+
include Tirantes::Actions
|
4
|
+
|
5
|
+
def readme
|
6
|
+
template 'README.md.erb', 'README.md'
|
7
|
+
end
|
8
|
+
|
9
|
+
def remove_public_index
|
10
|
+
remove_file 'public/index.html'
|
11
|
+
end
|
12
|
+
|
13
|
+
def remove_rails_logo_image
|
14
|
+
remove_file 'app/assets/images/rails.png'
|
15
|
+
end
|
16
|
+
|
17
|
+
def raise_on_delivery_errors
|
18
|
+
replace_in_file 'config/environments/development.rb',
|
19
|
+
'raise_delivery_errors = false', 'raise_delivery_errors = true'
|
20
|
+
end
|
21
|
+
|
22
|
+
def raise_on_unpermitted_parameters
|
23
|
+
action_on_unpermitted_parameters = <<-RUBY
|
24
|
+
|
25
|
+
# Raise an ActionController::UnpermittedParameters exception when
|
26
|
+
# a parameter is not explcitly permitted but is passed anyway.
|
27
|
+
config.action_controller.action_on_unpermitted_parameters = :raise
|
28
|
+
RUBY
|
29
|
+
inject_into_file(
|
30
|
+
"config/environments/development.rb",
|
31
|
+
action_on_unpermitted_parameters,
|
32
|
+
before: "\nend"
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
def provide_setup_script
|
37
|
+
foreman = <<-RUBY
|
38
|
+
# Set up Rails app. Run this script immediately after cloning the codebase.
|
39
|
+
# https://github.com/thoughtbot/guides/tree/master/protocol
|
40
|
+
|
41
|
+
# Set up configurable environment variables
|
42
|
+
if [ ! -f .env ]; then
|
43
|
+
cp .sample.env .env
|
44
|
+
fi
|
45
|
+
|
46
|
+
# Pick a port for Foreman
|
47
|
+
echo "port: 7000" > .foreman
|
48
|
+
|
49
|
+
# Set up DNS via Pow
|
50
|
+
if [ -d ~/.pow ]
|
51
|
+
then
|
52
|
+
echo 7000 > ~/.pow/`basename $PWD`
|
53
|
+
else
|
54
|
+
echo "Pow not set up but the team uses it for this project. Setup: http://goo.gl/RaDPO"
|
55
|
+
fi
|
56
|
+
RUBY
|
57
|
+
|
58
|
+
append_file 'bin/setup', foreman
|
59
|
+
run 'chmod a+x bin/setup'
|
60
|
+
end
|
61
|
+
|
62
|
+
def configure_generators
|
63
|
+
config = <<-RUBY
|
64
|
+
config.generators do |generate|
|
65
|
+
generate.helper false
|
66
|
+
generate.javascript_engine false
|
67
|
+
generate.request_specs false
|
68
|
+
generate.routing_specs false
|
69
|
+
generate.stylesheets false
|
70
|
+
generate.test_framework :mini_test, :spec => true, :fixture => true
|
71
|
+
generate.view_specs false
|
72
|
+
end
|
73
|
+
|
74
|
+
RUBY
|
75
|
+
|
76
|
+
inject_into_class 'config/application.rb', 'Application', config
|
77
|
+
end
|
78
|
+
|
79
|
+
def configure_exception_notifier
|
80
|
+
copy_file 'exception_notification.rb', 'config/initializers/exception_notification.rb'
|
81
|
+
end
|
82
|
+
|
83
|
+
def configure_smtp
|
84
|
+
copy_file 'smtp.rb', 'config/initializers/smtp.rb'
|
85
|
+
|
86
|
+
prepend_file 'config/environments/production.rb',
|
87
|
+
"require Rails.root.join('config/initializers/smtp')\n"
|
88
|
+
|
89
|
+
config = <<-RUBY
|
90
|
+
|
91
|
+
config.action_mailer.delivery_method = :smtp
|
92
|
+
config.action_mailer.smtp_settings = SMTP_SETTINGS
|
93
|
+
RUBY
|
94
|
+
|
95
|
+
inject_into_file 'config/environments/production.rb', config,
|
96
|
+
:after => 'config.action_mailer.raise_delivery_errors = false'
|
97
|
+
end
|
98
|
+
|
99
|
+
def setup_staging_environment
|
100
|
+
run 'cp config/environments/production.rb config/environments/staging.rb'
|
101
|
+
|
102
|
+
prepend_file 'config/environments/staging.rb',
|
103
|
+
"Mail.register_interceptor RecipientInterceptor.new(ENV['EMAIL_RECIPIENTS'])\n"
|
104
|
+
end
|
105
|
+
|
106
|
+
def setup_secret_token
|
107
|
+
template 'secret_token.rb.erb', 'config/initializers/secret_token.rb', :force => true
|
108
|
+
end
|
109
|
+
|
110
|
+
def create_partials_directory
|
111
|
+
empty_directory 'app/views/application'
|
112
|
+
end
|
113
|
+
|
114
|
+
def create_shared_flashes
|
115
|
+
copy_file '_flashes.html.erb', 'app/views/application/_flashes.html.erb'
|
116
|
+
end
|
117
|
+
|
118
|
+
def create_shared_javascripts
|
119
|
+
copy_file '_javascript.html.erb', 'app/views/application/_javascript.html.erb'
|
120
|
+
end
|
121
|
+
|
122
|
+
def create_application_layout
|
123
|
+
template 'tirantes_layout.html.erb.erb',
|
124
|
+
'app/views/layouts/application.html.erb',
|
125
|
+
:force => true
|
126
|
+
end
|
127
|
+
|
128
|
+
def remove_turbolinks
|
129
|
+
replace_in_file 'app/assets/javascripts/application.js',
|
130
|
+
/\/\/= require turbolinks\n/,
|
131
|
+
''
|
132
|
+
end
|
133
|
+
|
134
|
+
def create_common_javascripts
|
135
|
+
directory 'javascripts', 'app/assets/javascripts'
|
136
|
+
end
|
137
|
+
|
138
|
+
def use_postgres_config_template
|
139
|
+
template 'postgresql_database.yml.erb', 'config/database.yml',
|
140
|
+
:force => true
|
141
|
+
end
|
142
|
+
|
143
|
+
def create_database
|
144
|
+
bundle_command 'exec rake db:create'
|
145
|
+
end
|
146
|
+
|
147
|
+
def replace_gemfile
|
148
|
+
remove_file 'Gemfile'
|
149
|
+
copy_file 'Gemfile_clean', 'Gemfile'
|
150
|
+
end
|
151
|
+
|
152
|
+
def set_ruby_to_version_being_used
|
153
|
+
inject_into_file 'Gemfile', "\n\nruby '#{RUBY_VERSION}'",
|
154
|
+
after: /source 'https:\/\/rubygems.org'/
|
155
|
+
end
|
156
|
+
|
157
|
+
def enable_database_cleaner
|
158
|
+
copy_file 'database_cleaner_minitest.rb', 'test/support/database_cleaner.rb'
|
159
|
+
end
|
160
|
+
|
161
|
+
def configure_minitest
|
162
|
+
remove_file 'test/test_helper.rb'
|
163
|
+
copy_file 'test_helper.rb', 'test/test_helper.rb'
|
164
|
+
end
|
165
|
+
|
166
|
+
def configure_background_jobs_for_minitest
|
167
|
+
copy_file 'background_jobs_minitest.rb', 'test/support/background_jobs.rb'
|
168
|
+
run 'rails g delayed_job:active_record'
|
169
|
+
end
|
170
|
+
|
171
|
+
def configure_time_zone
|
172
|
+
config = <<-RUBY
|
173
|
+
config.active_record.default_timezone = :utc
|
174
|
+
|
175
|
+
RUBY
|
176
|
+
inject_into_class 'config/application.rb', 'Application', config
|
177
|
+
end
|
178
|
+
|
179
|
+
def configure_pretty_formatter
|
180
|
+
config = <<-RUBY
|
181
|
+
config.log_formatter = PrettyFormatter.formatter
|
182
|
+
|
183
|
+
RUBY
|
184
|
+
inject_into_class 'config/application.rb', 'Application', config
|
185
|
+
end
|
186
|
+
|
187
|
+
def configure_simple_form
|
188
|
+
run 'rails g simple_form:install'
|
189
|
+
copy_file 'simple_form_purecss.rb', 'config/simple_form_purecss.rb'
|
190
|
+
end
|
191
|
+
|
192
|
+
def configure_time_formats
|
193
|
+
remove_file 'config/locales/en.yml'
|
194
|
+
copy_file 'config_locales_en.yml', 'config/locales/en.yml'
|
195
|
+
end
|
196
|
+
|
197
|
+
def configure_rack_timeout
|
198
|
+
copy_file 'rack_timeout.rb', 'config/initializers/rack_timeout.rb'
|
199
|
+
end
|
200
|
+
|
201
|
+
def configure_action_mailer
|
202
|
+
action_mailer_host 'development', "#{app_name}.local"
|
203
|
+
action_mailer_host 'test', 'www.example.com'
|
204
|
+
action_mailer_host 'staging', "staging.#{app_name}.com"
|
205
|
+
action_mailer_host 'production', "#{app_name}.com"
|
206
|
+
end
|
207
|
+
|
208
|
+
def generate_minitest
|
209
|
+
generate 'rails g mini_test: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.css.scss',
|
224
|
+
'app/assets/stylesheets/application.css.scss'
|
225
|
+
[
|
226
|
+
'app/assets/stylesheets/base',
|
227
|
+
'app/assets/stylesheets/layout',
|
228
|
+
'app/assets/stylesheets/modules'
|
229
|
+
].each do |dir|
|
230
|
+
run "mkdir #{dir}"
|
231
|
+
run "touch #{dir}/.keep"
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
def gitignore_files
|
236
|
+
remove_file '.gitignore'
|
237
|
+
copy_file 'tirantes_gitignore', '.gitignore'
|
238
|
+
[
|
239
|
+
'app/views/pages',
|
240
|
+
'test/lib',
|
241
|
+
'test/controllers',
|
242
|
+
'test/models',
|
243
|
+
'test/integration',
|
244
|
+
'test/helpers',
|
245
|
+
'test/support/matchers',
|
246
|
+
'test/support/mixins',
|
247
|
+
'test/support/shared_examples'
|
248
|
+
].each do |dir|
|
249
|
+
run "mkdir #{dir}"
|
250
|
+
run "touch #{dir}/.keep"
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
def init_git
|
255
|
+
run 'git init'
|
256
|
+
end
|
257
|
+
|
258
|
+
def create_heroku_apps
|
259
|
+
path_addition = override_path_for_tests
|
260
|
+
run "#{path_addition} heroku create #{app_name}-production --remote=production"
|
261
|
+
run "#{path_addition} heroku create #{app_name}-staging --remote=staging"
|
262
|
+
run "#{path_addition} heroku config:add RACK_ENV=staging RAILS_ENV=staging --remote=staging"
|
263
|
+
end
|
264
|
+
|
265
|
+
def set_heroku_remotes
|
266
|
+
remotes = <<-RUBY
|
267
|
+
|
268
|
+
# Set up staging and production git remotes
|
269
|
+
git remote add staging git@heroku.com:#{app_name}-staging.git
|
270
|
+
git remote add production git@heroku.com:#{app_name}-production.git
|
271
|
+
RUBY
|
272
|
+
|
273
|
+
append_file 'bin/setup', remotes
|
274
|
+
end
|
275
|
+
|
276
|
+
def create_github_repo(repo_name)
|
277
|
+
path_addition = override_path_for_tests
|
278
|
+
run "#{path_addition} hub create #{repo_name}"
|
279
|
+
end
|
280
|
+
|
281
|
+
def copy_miscellaneous_files
|
282
|
+
copy_file 'errors.rb', 'config/initializers/errors.rb'
|
283
|
+
end
|
284
|
+
|
285
|
+
def customize_error_pages
|
286
|
+
meta_tags =<<-EOS
|
287
|
+
<meta charset='utf-8' />
|
288
|
+
<meta name='ROBOTS' content='NOODP' />
|
289
|
+
EOS
|
290
|
+
|
291
|
+
%w(500 404 422).each do |page|
|
292
|
+
inject_into_file "public/#{page}.html", meta_tags, :after => "<head>\n"
|
293
|
+
replace_in_file "public/#{page}.html", /<!--.+-->\n/, ''
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
def remove_routes_comment_lines
|
298
|
+
replace_in_file 'config/routes.rb',
|
299
|
+
/Rails\.application\.routes\.draw do.*end/m,
|
300
|
+
"Rails\.application.routes.draw do\nend"
|
301
|
+
end
|
302
|
+
|
303
|
+
def disable_xml_params
|
304
|
+
copy_file 'disable_xml_params.rb', 'config/initializers/disable_xml_params.rb'
|
305
|
+
end
|
306
|
+
|
307
|
+
def setup_default_rake_task
|
308
|
+
append_file 'Rakefile' do
|
309
|
+
"task(:default).clear\ntask :default => ['test:all']\n"
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
private
|
314
|
+
|
315
|
+
def override_path_for_tests
|
316
|
+
if ENV['TESTING']
|
317
|
+
support_bin = File.expand_path(File.join('..', '..', '..', 'features', 'support', 'bin'))
|
318
|
+
"PATH=#{support_bin}:$PATH"
|
319
|
+
end
|
320
|
+
end
|
321
|
+
end
|
322
|
+
end
|
@@ -0,0 +1,203 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/rails/app/app_generator'
|
3
|
+
|
4
|
+
module Tirantes
|
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 :heroku, :type => :boolean, :aliases => '-H', :default => false,
|
10
|
+
:desc => 'Create staging and production Heroku apps'
|
11
|
+
|
12
|
+
class_option :github, :type => :string, :aliases => '-G', :default => nil,
|
13
|
+
:desc => 'Create Github repository and add remote origin pointed to repo'
|
14
|
+
|
15
|
+
class_option :skip_test_unit, :type => :boolean, :aliases => '-T', :default => true,
|
16
|
+
:desc => 'Skip Test::Unit files'
|
17
|
+
|
18
|
+
def finish_template
|
19
|
+
invoke :tirantes_customization
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def tirantes_customization
|
24
|
+
invoke :remove_files_we_dont_need
|
25
|
+
invoke :customize_gemfile
|
26
|
+
invoke :setup_database
|
27
|
+
invoke :setup_development_environment
|
28
|
+
invoke :setup_test_environment
|
29
|
+
invoke :setup_production_environment
|
30
|
+
invoke :setup_staging_environment
|
31
|
+
invoke :create_tirantes_views
|
32
|
+
invoke :setup_coffeescript
|
33
|
+
invoke :configure_app
|
34
|
+
invoke :setup_stylesheets
|
35
|
+
invoke :copy_miscellaneous_files
|
36
|
+
invoke :customize_error_pages
|
37
|
+
invoke :remove_routes_comment_lines
|
38
|
+
invoke :setup_git
|
39
|
+
invoke :create_heroku_apps
|
40
|
+
invoke :create_github_repo
|
41
|
+
invoke :outro
|
42
|
+
end
|
43
|
+
|
44
|
+
def remove_files_we_dont_need
|
45
|
+
build :remove_public_index
|
46
|
+
build :remove_rails_logo_image
|
47
|
+
end
|
48
|
+
|
49
|
+
def customize_gemfile
|
50
|
+
build :replace_gemfile
|
51
|
+
build :set_ruby_to_version_being_used
|
52
|
+
bundle_command 'install'
|
53
|
+
end
|
54
|
+
|
55
|
+
def setup_database
|
56
|
+
say 'Setting up database'
|
57
|
+
|
58
|
+
if 'postgresql' == options[:database]
|
59
|
+
build :use_postgres_config_template
|
60
|
+
end
|
61
|
+
|
62
|
+
build :create_database
|
63
|
+
|
64
|
+
say 'If you want to use pg text search, remember to'
|
65
|
+
say 'to generate and migrate pg_search_documents table'
|
66
|
+
say 'rails g pg_search:migration:multisearch'
|
67
|
+
say 'rake db:migrate'
|
68
|
+
end
|
69
|
+
|
70
|
+
def setup_development_environment
|
71
|
+
say 'Setting up the development environment'
|
72
|
+
build :raise_on_delivery_errors
|
73
|
+
build :raise_on_unpermitted_parameters
|
74
|
+
build :provide_setup_script
|
75
|
+
build :configure_generators
|
76
|
+
end
|
77
|
+
|
78
|
+
def setup_test_environment
|
79
|
+
say 'Setting up the test environment'
|
80
|
+
build :generate_minitest
|
81
|
+
build :configure_minitest
|
82
|
+
build :configure_background_jobs_for_minitest
|
83
|
+
build :enable_database_cleaner
|
84
|
+
build :configure_capybara_webkit
|
85
|
+
end
|
86
|
+
|
87
|
+
def setup_production_environment
|
88
|
+
say 'Setting up the production environment'
|
89
|
+
build :configure_smtp
|
90
|
+
build :configure_exception_notifier
|
91
|
+
end
|
92
|
+
|
93
|
+
def setup_staging_environment
|
94
|
+
say 'Setting up the staging environment'
|
95
|
+
build :setup_staging_environment
|
96
|
+
end
|
97
|
+
|
98
|
+
def create_tirantes_views
|
99
|
+
say 'Creating tirantes views'
|
100
|
+
build :create_partials_directory
|
101
|
+
build :create_shared_flashes
|
102
|
+
build :create_shared_javascripts
|
103
|
+
build :create_application_layout
|
104
|
+
end
|
105
|
+
|
106
|
+
def setup_coffeescript
|
107
|
+
say 'Setting up CoffeeScript defaults'
|
108
|
+
build :remove_turbolinks
|
109
|
+
build :create_common_javascripts
|
110
|
+
end
|
111
|
+
|
112
|
+
def configure_app
|
113
|
+
say 'Configuring app'
|
114
|
+
build :configure_action_mailer
|
115
|
+
build :blacklist_active_record_attributes
|
116
|
+
build :configure_strong_parameters
|
117
|
+
build :configure_time_zone
|
118
|
+
build :configure_time_formats
|
119
|
+
build :configure_pretty_formatter
|
120
|
+
build :configure_simple_form
|
121
|
+
build :configure_rack_timeout
|
122
|
+
build :disable_xml_params
|
123
|
+
build :setup_secret_token
|
124
|
+
build :setup_default_rake_task
|
125
|
+
build :configure_puma
|
126
|
+
build :setup_foreman
|
127
|
+
end
|
128
|
+
|
129
|
+
def setup_stylesheets
|
130
|
+
say 'Set up stylesheets'
|
131
|
+
build :setup_stylesheets
|
132
|
+
end
|
133
|
+
|
134
|
+
def setup_git
|
135
|
+
if !options[:skip_git]
|
136
|
+
say 'Initializing git'
|
137
|
+
invoke :setup_gitignore
|
138
|
+
invoke :init_git
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def create_heroku_apps
|
143
|
+
if options[:heroku]
|
144
|
+
say 'Creating Heroku apps'
|
145
|
+
build :create_heroku_apps
|
146
|
+
build :set_heroku_remotes
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def create_github_repo
|
151
|
+
if !options[:skip_git] && options[:github]
|
152
|
+
say 'Creating Github repo'
|
153
|
+
build :create_github_repo, options[:github]
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
def setup_gitignore
|
158
|
+
build :gitignore_files
|
159
|
+
end
|
160
|
+
|
161
|
+
def init_git
|
162
|
+
build :init_git
|
163
|
+
end
|
164
|
+
|
165
|
+
def copy_libraries
|
166
|
+
say 'Copying libraries'
|
167
|
+
build :copy_libraries
|
168
|
+
end
|
169
|
+
|
170
|
+
def copy_miscellaneous_files
|
171
|
+
say 'Copying miscellaneous support files'
|
172
|
+
build :copy_miscellaneous_files
|
173
|
+
end
|
174
|
+
|
175
|
+
def customize_error_pages
|
176
|
+
say 'Customizing the 500/404/422 pages'
|
177
|
+
build :customize_error_pages
|
178
|
+
end
|
179
|
+
|
180
|
+
def remove_routes_comment_lines
|
181
|
+
build :remove_routes_comment_lines
|
182
|
+
end
|
183
|
+
|
184
|
+
def outro
|
185
|
+
say 'Congratulations! You just pulled our tirantes.'
|
186
|
+
say 'Please execute bin/setup to complete this application setup'
|
187
|
+
end
|
188
|
+
|
189
|
+
def run_bundle
|
190
|
+
# Let's not: We'll bundle manually at the right spot
|
191
|
+
end
|
192
|
+
|
193
|
+
protected
|
194
|
+
|
195
|
+
def get_builder_class
|
196
|
+
Tirantes::AppBuilder
|
197
|
+
end
|
198
|
+
|
199
|
+
def using_active_record?
|
200
|
+
!options[:skip_active_record]
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'coffee-rails'
|
4
|
+
gem 'delayed_job_active_record', '>= 4.0.0'
|
5
|
+
gem 'email_validator'
|
6
|
+
gem 'exception_notification'
|
7
|
+
gem 'high_voltage'
|
8
|
+
gem 'jquery-rails'
|
9
|
+
gem 'pg'
|
10
|
+
gem 'pg_search'
|
11
|
+
gem 'pretty_formatter'
|
12
|
+
gem 'puma'
|
13
|
+
gem 'purecss-rails'
|
14
|
+
gem 'rack-timeout'
|
15
|
+
gem 'rails', '>= 4.2.0'
|
16
|
+
gem 'recipient_interceptor'
|
17
|
+
gem 'restful_controller', require: 'restful'
|
18
|
+
gem 'sass-rails'
|
19
|
+
gem 'simple_form'
|
20
|
+
gem 'slim'
|
21
|
+
gem 'uglifier'
|
22
|
+
|
23
|
+
group :development do
|
24
|
+
gem 'byebug'
|
25
|
+
gem 'web-console', '~> 2.0'
|
26
|
+
gem 'better_errors'
|
27
|
+
gem 'binding_of_caller'
|
28
|
+
gem 'foreman'
|
29
|
+
end
|
30
|
+
|
31
|
+
group :development, :test do
|
32
|
+
gem 'spring'
|
33
|
+
gem 'minitest-rails', '~> 2.0.0'
|
34
|
+
end
|
35
|
+
|
36
|
+
group :test do
|
37
|
+
gem 'database_cleaner'
|
38
|
+
gem 'launchy'
|
39
|
+
#gem 'minitest-colorize'
|
40
|
+
#gem 'minitest-focus'
|
41
|
+
gem 'minitest-rails-capybara'
|
42
|
+
gem 'poltergeist'
|
43
|
+
gem 'simplecov'
|
44
|
+
gem 'webmock'
|
45
|
+
end
|
46
|
+
|
47
|
+
group :staging, :production do
|
48
|
+
gem 'newrelic_rpm', '>= 3.6.7'
|
49
|
+
gem 'rails_12factor'
|
50
|
+
end
|
data/templates/Procfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# <%= app_name %>
|
2
|
+
|
3
|
+
|
4
|
+
### Guides and style
|
5
|
+
|
6
|
+
Use the following guides for getting things done, programming well, and
|
7
|
+
programming in style.
|
8
|
+
|
9
|
+
* [Protocol](http://github.com/thoughtbot/guides/blob/master/protocol)
|
10
|
+
* [Best Practices](http://github.com/thoughtbot/guides/blob/master/best-practices)
|
11
|
+
* [Style](http://github.com/thoughtbot/guides/blob/master/style)
|