bulldozer 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.ruby-version +1 -0
- data/.travis.yml +12 -0
- data/CONTRIBUTING.md +59 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/NEWS.md +638 -0
- data/README.md +225 -0
- data/RELEASING.md +18 -0
- data/Rakefile +8 -0
- data/USAGE +13 -0
- data/bin/bulldozer +23 -0
- data/bin/rake +16 -0
- data/bin/rspec +16 -0
- data/bin/setup +13 -0
- data/bulldozer.gemspec +35 -0
- data/docker-compose.yml +8 -0
- data/dockerfile +11 -0
- data/lib/bulldozer.rb +24 -0
- data/lib/bulldozer/actions.rb +85 -0
- data/lib/bulldozer/adapters/heroku.rb +123 -0
- data/lib/bulldozer/app_builder.rb +321 -0
- data/lib/bulldozer/generators/analytics_generator.rb +24 -0
- data/lib/bulldozer/generators/app_generator.rb +231 -0
- data/lib/bulldozer/generators/base.rb +20 -0
- data/lib/bulldozer/generators/ci_generator.rb +22 -0
- data/lib/bulldozer/generators/db_optimizations_generator.rb +30 -0
- data/lib/bulldozer/generators/factories_generator.rb +22 -0
- data/lib/bulldozer/generators/forms_generator.rb +18 -0
- data/lib/bulldozer/generators/jobs_generator.rb +38 -0
- data/lib/bulldozer/generators/js_driver_generator.rb +15 -0
- data/lib/bulldozer/generators/json_generator.rb +10 -0
- data/lib/bulldozer/generators/lint_generator.rb +9 -0
- data/lib/bulldozer/generators/production/deployment_generator.rb +27 -0
- data/lib/bulldozer/generators/production/email_generator.rb +37 -0
- data/lib/bulldozer/generators/production/force_tls_generator.rb +11 -0
- data/lib/bulldozer/generators/production/manifest_generator.rb +24 -0
- data/lib/bulldozer/generators/production/timeout_generator.rb +21 -0
- data/lib/bulldozer/generators/staging/pull_requests_generator.rb +33 -0
- data/lib/bulldozer/generators/static_generator.rb +10 -0
- data/lib/bulldozer/generators/stylesheet_base_generator.rb +31 -0
- data/lib/bulldozer/generators/testing_generator.rb +55 -0
- data/lib/bulldozer/generators/views_generator.rb +30 -0
- data/lib/bulldozer/version.rb +8 -0
- data/spec/adapters/heroku_spec.rb +72 -0
- data/spec/fakes/bin/heroku +5 -0
- data/spec/fakes/bin/hub +5 -0
- data/spec/features/api_spec.rb +18 -0
- data/spec/features/cli_help_spec.rb +36 -0
- data/spec/features/github_spec.rb +16 -0
- data/spec/features/heroku_spec.rb +71 -0
- data/spec/features/json_spec.rb +15 -0
- data/spec/features/new_project_spec.rb +341 -0
- data/spec/features/production/deployment_spec.rb +22 -0
- data/spec/features/production/email_spec.rb +47 -0
- data/spec/features/production/manifest_spec.rb +35 -0
- data/spec/features/staging/pull_requests_spec.rb +22 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/support/be_executable_matcher.rb +7 -0
- data/spec/support/bulldozer.rb +182 -0
- data/spec/support/contain_json_matcher.rb +24 -0
- data/spec/support/exist_as_a_file_matcher.rb +7 -0
- data/spec/support/fake_github.rb +21 -0
- data/spec/support/fake_heroku.rb +53 -0
- data/spec/support/generators.rb +5 -0
- data/spec/support/match_contents_matcher.rb +6 -0
- data/spec/support/project_files.rb +13 -0
- data/templates/Gemfile.erb +51 -0
- data/templates/Procfile +2 -0
- data/templates/README.md.erb +28 -0
- data/templates/_analytics.html.erb +8 -0
- data/templates/_css_overrides.html.erb +7 -0
- data/templates/_flashes.html.erb +7 -0
- data/templates/_javascript.html.erb +3 -0
- data/templates/action_mailer.rb +5 -0
- data/templates/active_job.rb +13 -0
- data/templates/application.scss +8 -0
- data/templates/bin_deploy +12 -0
- data/templates/bin_setup +28 -0
- data/templates/bin_setup_review_app.erb +22 -0
- data/templates/browserslist +3 -0
- data/templates/bulldozer_gitignore +18 -0
- data/templates/bulldozer_layout.html.erb.erb +21 -0
- data/templates/bundler_audit.rake +4 -0
- data/templates/chromedriver.rb +17 -0
- data/templates/circle.yml.erb +6 -0
- data/templates/config_locales_en.yml.erb +19 -0
- data/templates/dev.rake +12 -0
- data/templates/dotfiles/.ctags +2 -0
- data/templates/dotfiles/.env +13 -0
- data/templates/email.rb +3 -0
- data/templates/errors.rb +34 -0
- data/templates/factories.rb +2 -0
- data/templates/factory_bot_rspec.rb +5 -0
- data/templates/flashes_helper.rb +5 -0
- data/templates/hound.yml +14 -0
- data/templates/i18n.rb +3 -0
- data/templates/json_encoding.rb +1 -0
- data/templates/postgresql_database.yml.erb +19 -0
- data/templates/puma.rb +28 -0
- data/templates/rack_mini_profiler.rb +5 -0
- data/templates/rails_helper.rb +22 -0
- data/templates/secrets.yml +8 -0
- data/templates/shoulda_matchers_config_rspec.rb +6 -0
- data/templates/smtp.rb +9 -0
- data/templates/spec_helper.rb +28 -0
- metadata +197 -0
data/README.md
ADDED
@@ -0,0 +1,225 @@
|
|
1
|
+
# Bulldozer [![Build Status](https://secure.travis-ci.org/SeasonedSoftware/bulldozer.svg?branch=master)](http://travis-ci.org/SeasonedSoftware/bulldozer) [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
|
2
|
+
|
3
|
+
Bulldozer is the base Rails application used at
|
4
|
+
[seasoned](https://seasoned.cc/).
|
5
|
+
|
6
|
+
![Bulldozer](https://banner2.kisspng.com/20180509/epe/kisspng-excavator-architectural-engineering-bulldozer-logo-5af28c67e988a6.8792375915258450959566.jpg)
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
First install the bulldozer gem:
|
11
|
+
|
12
|
+
gem install bulldozer
|
13
|
+
|
14
|
+
Then run:
|
15
|
+
|
16
|
+
bulldozer projectname
|
17
|
+
|
18
|
+
This will create a Rails app in `projectname` using the latest version of Rails.
|
19
|
+
|
20
|
+
### Associated services
|
21
|
+
|
22
|
+
* Enable [Circle CI](https://circleci.com/) Continuous Integration
|
23
|
+
* Enable [GitHub auto deploys to Heroku staging and review
|
24
|
+
apps](https://dashboard.heroku.com/apps/app-name-staging/deploy/github).
|
25
|
+
|
26
|
+
## Gemfile
|
27
|
+
|
28
|
+
To see the latest and greatest gems, look at Bulldozer'
|
29
|
+
[Gemfile](templates/Gemfile.erb), which will be appended to the default
|
30
|
+
generated projectname/Gemfile.
|
31
|
+
|
32
|
+
It includes application gems like:
|
33
|
+
|
34
|
+
* [Autoprefixer Rails](https://github.com/ai/autoprefixer-rails) for CSS vendor prefixes
|
35
|
+
* [Bourbon](https://github.com/SeasonedSoftware/bourbon) for Sass mixins
|
36
|
+
* [Bitters](https://github.com/SeasonedSoftware/bitters) for scaffold application styles
|
37
|
+
* [Delayed Job](https://github.com/collectiveidea/delayed_job) for background
|
38
|
+
processing
|
39
|
+
* [High Voltage](https://github.com/SeasonedSoftware/high_voltage) for static pages
|
40
|
+
* [Honeybadger](https://honeybadger.io) for exception notification
|
41
|
+
* [Neat](https://github.com/SeasonedSoftware/neat) for semantic grids
|
42
|
+
* [Normalize](https://necolas.github.io/normalize.css/) for resetting browser styles
|
43
|
+
* [Oj](http://www.ohler.com/oj/)
|
44
|
+
* [Postgres](https://github.com/ged/ruby-pg) for access to the Postgres database
|
45
|
+
* [Rack Canonical Host](https://github.com/tylerhunt/rack-canonical-host) to
|
46
|
+
ensure all requests are served from the same domain
|
47
|
+
* [Rack Timeout](https://github.com/heroku/rack-timeout) to abort requests that are
|
48
|
+
taking too long
|
49
|
+
* [Recipient Interceptor](https://github.com/croaky/recipient_interceptor) to
|
50
|
+
avoid accidentally sending emails to real people from staging
|
51
|
+
* [Simple Form](https://github.com/plataformatec/simple_form) for form markup
|
52
|
+
and style
|
53
|
+
* [Skylight](https://www.skylight.io/) for monitoring performance
|
54
|
+
* [Title](https://github.com/calebthompson/title) for storing titles in
|
55
|
+
translations
|
56
|
+
* [Puma](https://github.com/puma/puma) to serve HTTP requests
|
57
|
+
|
58
|
+
And development gems like:
|
59
|
+
|
60
|
+
* [Dotenv](https://github.com/bkeepers/dotenv) for loading environment variables
|
61
|
+
* [Pry Rails](https://github.com/rweng/pry-rails) for interactively exploring
|
62
|
+
objects
|
63
|
+
* [ByeBug](https://github.com/deivid-rodriguez/byebug) for interactively
|
64
|
+
debugging behavior
|
65
|
+
* [Bullet](https://github.com/flyerhzm/bullet) for help to kill N+1 queries and
|
66
|
+
unused eager loading
|
67
|
+
* [Bundler Audit](https://github.com/rubysec/bundler-audit) for scanning the
|
68
|
+
Gemfile for insecure dependencies based on published CVEs
|
69
|
+
* [Spring](https://github.com/rails/spring) for fast Rails actions via
|
70
|
+
pre-loading
|
71
|
+
* [Web Console](https://github.com/rails/web-console) for better debugging via
|
72
|
+
in-browser IRB consoles.
|
73
|
+
|
74
|
+
And testing gems like:
|
75
|
+
|
76
|
+
* [Capybara](https://github.com/jnicklas/capybara) and
|
77
|
+
[Google Chromedriver]
|
78
|
+
integration testing
|
79
|
+
* [Factory Bot](https://github.com/SeasonedSoftware/factory_bot) for test data
|
80
|
+
* [Formulaic](https://github.com/SeasonedSoftware/formulaic) for integration testing
|
81
|
+
HTML forms
|
82
|
+
* [RSpec](https://github.com/rspec/rspec) for unit testing
|
83
|
+
* [RSpec Mocks](https://github.com/rspec/rspec-mocks) for stubbing and spying
|
84
|
+
* [Shoulda Matchers](https://github.com/SeasonedSoftware/shoulda-matchers) for common
|
85
|
+
RSpec matchers
|
86
|
+
* [Timecop](https://github.com/travisjeffery/timecop) for testing time
|
87
|
+
|
88
|
+
## Other goodies
|
89
|
+
|
90
|
+
Bulldozer also comes with:
|
91
|
+
|
92
|
+
* The [`./bin/setup`][setup] convention for new developer setup
|
93
|
+
* The `./bin/deploy` convention for deploying to Heroku
|
94
|
+
* Rails' flashes set up and in application layout
|
95
|
+
* A few nice time formats set up for localization
|
96
|
+
* `Rack::Deflater` to [compress responses with Gzip][compress]
|
97
|
+
* A [low database connection pool limit][pool]
|
98
|
+
* [Safe binstubs][binstub]
|
99
|
+
* [t() and l() in specs without prefixing with I18n][i18n]
|
100
|
+
* An automatically-created `SECRET_KEY_BASE` environment variable in all
|
101
|
+
environments
|
102
|
+
* Configuration for [CircleCI][circle] Continuous Integration (tests)
|
103
|
+
* Configuration for [Hound][hound] Continuous Integration (style)
|
104
|
+
* The analytics adapter [Segment][segment] (and therefore config for Google
|
105
|
+
Analytics, Intercom, Facebook Ads, Twitter Ads, etc.)
|
106
|
+
|
107
|
+
[setup]: https://robots.seasoned.cc/bin-setup
|
108
|
+
[compress]: https://robots.seasoned.cc/content-compression-with-rack-deflater
|
109
|
+
[pool]: https://devcenter.heroku.com/articles/concurrency-and-database-connections
|
110
|
+
[binstub]: https://github.com/SeasonedSoftware/bulldozer/pull/282
|
111
|
+
[i18n]: https://github.com/SeasonedSoftware/bulldozer/pull/304
|
112
|
+
[circle]: https://circleci.com/docs
|
113
|
+
[hound]: https://houndci.com
|
114
|
+
[segment]: https://segment.com
|
115
|
+
|
116
|
+
## Heroku
|
117
|
+
|
118
|
+
You can optionally create Heroku staging and production apps:
|
119
|
+
|
120
|
+
bulldozer app --heroku true
|
121
|
+
|
122
|
+
This:
|
123
|
+
|
124
|
+
* Creates a staging and production Heroku app
|
125
|
+
* Sets them as `staging` and `production` Git remotes
|
126
|
+
* Configures staging with `HONEYBADGER_ENV` environment variable set
|
127
|
+
to `staging`
|
128
|
+
* Creates a [Heroku Pipeline] for review apps
|
129
|
+
* Schedules automated backups for 10AM UTC for both `staging` and `production`
|
130
|
+
|
131
|
+
[Heroku Pipeline]: https://devcenter.heroku.com/articles/pipelines
|
132
|
+
|
133
|
+
You can optionally specify alternate Heroku flags:
|
134
|
+
|
135
|
+
bulldozer app \
|
136
|
+
--heroku true \
|
137
|
+
--heroku-flags "--region eu --addons sendgrid,ssl"
|
138
|
+
|
139
|
+
See all possible Heroku flags:
|
140
|
+
|
141
|
+
heroku help create
|
142
|
+
|
143
|
+
## Git
|
144
|
+
|
145
|
+
This will initialize a new git repository for your Rails app. You can
|
146
|
+
bypass this with the `--skip-git` option:
|
147
|
+
|
148
|
+
bulldozer app --skip-git true
|
149
|
+
|
150
|
+
## GitHub
|
151
|
+
|
152
|
+
You can optionally create a GitHub repository for the suspended Rails app. It
|
153
|
+
requires that you have [Hub](https://github.com/github/hub) on your system:
|
154
|
+
|
155
|
+
curl https://hub.github.com/standalone -sLo ~/bin/hub && chmod +x ~/bin/hub
|
156
|
+
bulldozer app --github organization/project
|
157
|
+
|
158
|
+
This has the same effect as running:
|
159
|
+
|
160
|
+
hub create organization/project
|
161
|
+
|
162
|
+
## Spring
|
163
|
+
|
164
|
+
Bulldozer uses [spring](https://github.com/rails/spring) by default.
|
165
|
+
It makes Rails applications load faster, but it might introduce confusing issues
|
166
|
+
around stale code not being refreshed.
|
167
|
+
If you think your application is running old code, run `spring stop`.
|
168
|
+
And if you'd rather not use spring, add `DISABLE_SPRING=1` to your login file.
|
169
|
+
|
170
|
+
## Dependencies
|
171
|
+
|
172
|
+
Bulldozer requires the latest version of Ruby.
|
173
|
+
|
174
|
+
Some gems included in Bulldozer have native extensions. You should have GCC
|
175
|
+
installed on your machine before generating an app with Bulldozer.
|
176
|
+
|
177
|
+
Use [OS X GCC Installer](https://github.com/kennethreitz/osx-gcc-installer/) for
|
178
|
+
Snow Leopard (OS X 10.6).
|
179
|
+
|
180
|
+
Use [Command Line Tools for Xcode](https://developer.apple.com/downloads/index.action)
|
181
|
+
for Lion (OS X 10.7) or Mountain Lion (OS X 10.8).
|
182
|
+
|
183
|
+
We use [Google Chromedriver] for full-stack JavaScript integration testing. It
|
184
|
+
requires Google Chrome or Chromium.
|
185
|
+
|
186
|
+
[Google Chromedriver]: https://sites.google.com/a/chromium.org/chromedriver/home
|
187
|
+
|
188
|
+
PostgreSQL needs to be installed and running for the `db:create` rake task.
|
189
|
+
|
190
|
+
## Issues
|
191
|
+
|
192
|
+
If you have problems, please create a
|
193
|
+
[GitHub Issue](https://github.com/SeasonedSoftware/bulldozer/issues).
|
194
|
+
|
195
|
+
## Contributing
|
196
|
+
|
197
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
198
|
+
|
199
|
+
Thank you, [contributors]!
|
200
|
+
|
201
|
+
[contributors]: https://github.com/SeasonedSoftware/bulldozer/graphs/contributors
|
202
|
+
|
203
|
+
## License
|
204
|
+
|
205
|
+
Bulldozer is Copyright © 2008-2017 seasoned.
|
206
|
+
It is free software,
|
207
|
+
and may be redistributed under the terms specified in the [LICENSE] file.
|
208
|
+
|
209
|
+
[LICENSE]: LICENSE
|
210
|
+
|
211
|
+
## About seasoned
|
212
|
+
|
213
|
+
[![seasoned][seasoned-logo]][seasoned]
|
214
|
+
|
215
|
+
Bulldozer is maintained and funded by seasoned, inc.
|
216
|
+
The names and logos for seasoned are trademarks of seasoned, inc.
|
217
|
+
|
218
|
+
We love open source software!
|
219
|
+
See [our other projects][community].
|
220
|
+
We are [available for hire][hire].
|
221
|
+
|
222
|
+
[seasoned]: https://seasoned.cc?utm_source=github
|
223
|
+
[seasoned-logo]: http://presskit.seasoned.cc/images/seasoned-logo-for-readmes.svg
|
224
|
+
[community]: https://seasoned.cc/community?utm_source=github
|
225
|
+
[hire]: https://seasoned.cc?utm_source=github
|
data/RELEASING.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Releasing
|
2
|
+
|
3
|
+
1. Update `NEWS.md` to reflect the changes since last release.
|
4
|
+
2. Update `lib/bulldozer/version.rb` file accordingly.
|
5
|
+
3. Commit changes. There shouldn't be code changes, and thus CI doesn't need to
|
6
|
+
run; you can add `[ci skip]` to the commit message.
|
7
|
+
4. Tag the release: `git tag vVERSION -a -s`. The tag message should contain the
|
8
|
+
appropriate `NEWS.md` subsection.
|
9
|
+
5. Push changes: `git push --tags`
|
10
|
+
6. Build and publish to rubygems:
|
11
|
+
```sh
|
12
|
+
gem build bulldozer.gemspec
|
13
|
+
gem push bulldozer-*.gem
|
14
|
+
```
|
15
|
+
7. Add a new GitHub release:
|
16
|
+
https://github.com/SeasonedSoftware/bulldozer/releases/new?tag=vVERSION
|
17
|
+
8. Announce the new release, making sure to thank the contributors who helped
|
18
|
+
shape this version!
|
data/Rakefile
ADDED
data/USAGE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Description:
|
2
|
+
Bulldozer is a Rails template with seasoned standard
|
3
|
+
defaults, ready to deploy to Heroku.
|
4
|
+
|
5
|
+
For full details on the changes we've made compared to
|
6
|
+
a vanilla Rails app, check our GitHub project:
|
7
|
+
https://github.com/SeasonedSoftware/bulldozer
|
8
|
+
|
9
|
+
Example:
|
10
|
+
bulldozer ~/Code/weblog
|
11
|
+
|
12
|
+
This generates a Rails installation in ~/Code/weblog configured
|
13
|
+
with our preferred defaults.
|
data/bin/bulldozer
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
source_path = (Pathname.new(__FILE__).dirname + '../lib').expand_path
|
5
|
+
$LOAD_PATH << source_path
|
6
|
+
|
7
|
+
require 'bulldozer'
|
8
|
+
|
9
|
+
if ARGV.empty?
|
10
|
+
puts "Please provide a path for the new application"
|
11
|
+
puts
|
12
|
+
puts "See --help for more info"
|
13
|
+
exit 0
|
14
|
+
elsif ['-v', '--version'].include? ARGV[0]
|
15
|
+
puts Bulldozer::VERSION
|
16
|
+
exit 0
|
17
|
+
end
|
18
|
+
|
19
|
+
templates_root = File.expand_path(File.join("..", "templates"), File.dirname(__FILE__))
|
20
|
+
Bulldozer::AppGenerator.source_root templates_root
|
21
|
+
Bulldozer::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root << templates_root
|
22
|
+
|
23
|
+
Bulldozer::AppGenerator.start
|
data/bin/rake
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rake' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rake', 'rake')
|
data/bin/rspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rspec' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rspec-core', 'rspec')
|
data/bin/setup
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# Run this script immediately after cloning the codebase.
|
4
|
+
|
5
|
+
# Exit if any subcommand fails
|
6
|
+
set -e
|
7
|
+
|
8
|
+
# Set up Ruby dependencies via Bundler
|
9
|
+
bundle install
|
10
|
+
|
11
|
+
# Add binstubs to PATH in ~/.zshenv like this:
|
12
|
+
# export PATH=".git/safe/../../bin:$PATH"
|
13
|
+
mkdir -p .git/safe
|
data/bulldozer.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'bulldozer/version'
|
4
|
+
require 'date'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.required_ruby_version = ">= #{Bulldozer::RUBY_VERSION}"
|
8
|
+
s.required_rubygems_version = ">= 2.7.4"
|
9
|
+
s.authors = ['mpatrick']
|
10
|
+
s.date = Date.today.strftime('%Y-%m-%d')
|
11
|
+
|
12
|
+
s.description = <<-HERE
|
13
|
+
Bulldozer is a base Rails project that you can upgrade. It is used by
|
14
|
+
seasoned to get a jump start on a working app. Use Bulldozer if you're in a
|
15
|
+
rush to build something amazing; don't use it if you like missing deadlines.
|
16
|
+
HERE
|
17
|
+
|
18
|
+
s.email = 'support@seasoned.cc'
|
19
|
+
s.executables = ['bulldozer']
|
20
|
+
s.extra_rdoc_files = %w[README.md LICENSE]
|
21
|
+
s.files = `git ls-files`.split("\n")
|
22
|
+
s.homepage = 'http://github.com/SeasonedSoftware/bulldozer'
|
23
|
+
s.license = 'MIT'
|
24
|
+
s.name = 'bulldozer'
|
25
|
+
s.rdoc_options = ['--charset=UTF-8']
|
26
|
+
s.require_paths = ['lib']
|
27
|
+
s.summary = "Generate a Rails app using seasoned's best practices."
|
28
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
29
|
+
s.version = Bulldozer::VERSION
|
30
|
+
|
31
|
+
s.add_dependency 'bitters', '~> 1.7'
|
32
|
+
s.add_dependency 'rails', Bulldozer::RAILS_VERSION
|
33
|
+
|
34
|
+
s.add_development_dependency 'rspec', '~> 3.2'
|
35
|
+
end
|
data/docker-compose.yml
ADDED
data/dockerfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
FROM ruby:2.5.3
|
2
|
+
# Install VIM to edit credentials.yml.enc file
|
3
|
+
RUN apt-get update && apt-get install -y vim
|
4
|
+
ENV EDITOR="vim"
|
5
|
+
# Install container dependencies
|
6
|
+
RUN apt-get update && apt-get install -y libc-ares2 libv8-3.14.5 --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
7
|
+
# Set the work directory inside container
|
8
|
+
RUN mkdir /app
|
9
|
+
WORKDIR /app
|
10
|
+
# Copy all the rest inside work directory
|
11
|
+
COPY . /app
|
data/lib/bulldozer.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require "bulldozer/version"
|
2
|
+
require "bulldozer/generators/app_generator"
|
3
|
+
require "bulldozer/generators/static_generator"
|
4
|
+
require "bulldozer/generators/stylesheet_base_generator"
|
5
|
+
require "bulldozer/generators/forms_generator"
|
6
|
+
require "bulldozer/generators/ci_generator"
|
7
|
+
require "bulldozer/generators/db_optimizations_generator"
|
8
|
+
require "bulldozer/generators/factories_generator"
|
9
|
+
require "bulldozer/generators/lint_generator"
|
10
|
+
require "bulldozer/generators/jobs_generator"
|
11
|
+
require "bulldozer/generators/analytics_generator"
|
12
|
+
require "bulldozer/generators/views_generator"
|
13
|
+
require "bulldozer/generators/js_driver_generator"
|
14
|
+
require "bulldozer/generators/json_generator"
|
15
|
+
require "bulldozer/generators/testing_generator"
|
16
|
+
require "bulldozer/generators/production/force_tls_generator"
|
17
|
+
require "bulldozer/generators/production/email_generator"
|
18
|
+
require "bulldozer/generators/production/timeout_generator"
|
19
|
+
require "bulldozer/generators/production/deployment_generator"
|
20
|
+
require "bulldozer/generators/production/manifest_generator"
|
21
|
+
require "bulldozer/generators/staging/pull_requests_generator"
|
22
|
+
require "bulldozer/actions"
|
23
|
+
require "bulldozer/adapters/heroku"
|
24
|
+
require "bulldozer/app_builder"
|
@@ -0,0 +1,85 @@
|
|
1
|
+
module Bulldozer
|
2
|
+
module Actions
|
3
|
+
def replace_in_file(relative_path, find, replace)
|
4
|
+
path = File.join(destination_root, relative_path)
|
5
|
+
contents = IO.read(path)
|
6
|
+
unless contents.gsub!(find, replace)
|
7
|
+
raise "#{find.inspect} not found in #{relative_path}"
|
8
|
+
end
|
9
|
+
File.open(path, "w") { |file| file.write(contents) }
|
10
|
+
end
|
11
|
+
|
12
|
+
def action_mailer_host(rails_env, host)
|
13
|
+
config = "config.action_mailer.default_url_options = { host: #{host} }"
|
14
|
+
configure_environment(rails_env, config)
|
15
|
+
end
|
16
|
+
|
17
|
+
def action_mailer_asset_host(rails_env, host)
|
18
|
+
config = "config.action_mailer.asset_host = #{host}"
|
19
|
+
configure_environment(rails_env, config)
|
20
|
+
end
|
21
|
+
|
22
|
+
def configure_environment(rails_env, config)
|
23
|
+
inject_into_file(
|
24
|
+
"config/environments/#{rails_env}.rb",
|
25
|
+
"\n #{config}",
|
26
|
+
before: "\nend"
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def expand_json(file, data)
|
31
|
+
action ExpandJson.new(destination_root, file, data)
|
32
|
+
end
|
33
|
+
|
34
|
+
class ExpandJson
|
35
|
+
def initialize(destination_root, file, data)
|
36
|
+
@destination_root = destination_root
|
37
|
+
@file = file
|
38
|
+
@data = data
|
39
|
+
end
|
40
|
+
|
41
|
+
def invoke!
|
42
|
+
write_out { |existing_json| existing_json.merge(data) }
|
43
|
+
end
|
44
|
+
|
45
|
+
def revoke!
|
46
|
+
write_out { |existing_json| hash_unmerge(existing_json, data) }
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
attr_reader :destination_root, :file, :data
|
52
|
+
|
53
|
+
def write_out
|
54
|
+
new_json = yield(existing_json)
|
55
|
+
IO.write(destination_file, JSON.pretty_generate(new_json))
|
56
|
+
end
|
57
|
+
|
58
|
+
def destination_file
|
59
|
+
File.join(destination_root, file)
|
60
|
+
end
|
61
|
+
|
62
|
+
def existing_json
|
63
|
+
JSON.parse(IO.read(destination_file))
|
64
|
+
rescue Errno::ENOENT
|
65
|
+
{}
|
66
|
+
end
|
67
|
+
|
68
|
+
def hash_unmerge(hash, subhash)
|
69
|
+
subhash.reduce(hash) do |acc, (k, v)|
|
70
|
+
if hash.has_key?(k)
|
71
|
+
if v == hash[k]
|
72
|
+
acc.except(k)
|
73
|
+
elsif v.is_a?(Hash)
|
74
|
+
acc.merge(k => hash_unmerge(hash[k], v))
|
75
|
+
else
|
76
|
+
acc
|
77
|
+
end
|
78
|
+
else
|
79
|
+
acc
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|