slining 1.1.0 → 1.2.0
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 +4 -4
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/CONTRIBUTING.md +1 -1
- data/LICENSE +2 -2
- data/NEWS.md +67 -0
- data/README.md +32 -19
- data/RELEASING.md +19 -0
- data/bin/slining +3 -3
- data/lib/slining.rb +5 -4
- data/lib/slining/adapters/heroku.rb +67 -0
- data/lib/slining/app_builder.rb +109 -67
- data/lib/slining/generators/app_generator.rb +22 -5
- data/lib/slining/version.rb +1 -1
- data/slining.gemspec +1 -0
- data/spec/adapters/heroku_spec.rb +52 -0
- data/spec/features/heroku_spec.rb +56 -30
- data/spec/features/new_project_spec.rb +66 -4
- data/spec/spec_helper.rb +4 -1
- data/spec/support/fake_heroku.rb +5 -3
- data/spec/support/slining.rb +20 -12
- data/templates/Gemfile.erb +6 -4
- data/templates/Procfile +1 -1
- data/templates/README.md.erb +3 -7
- data/templates/bin_setup.erb +1 -11
- data/templates/capybara_webkit.rb +5 -0
- data/templates/circle.yml.erb +9 -0
- data/templates/{development_seeds.rb → dev.rake} +1 -1
- data/templates/disable_xml_params.rb +0 -2
- data/templates/dotfiles/.ctags +2 -0
- data/templates/factories.rb +2 -0
- data/templates/postgresql_database.yml.erb +11 -1
- data/templates/puma.rb +19 -0
- data/templates/rails_helper.rb +1 -2
- data/templates/sample.env +7 -3
- data/templates/shoulda_matchers_config_rspec.rb +6 -0
- data/templates/slining_gitignore +0 -1
- data/templates/spec_helper.rb +1 -0
- metadata +27 -8
- data/.travis.yml +0 -11
- data/Gemfile.lock +0 -123
- data/templates/travis.yml.erb +0 -21
- data/templates/unicorn.rb +0 -30
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 42d9762ac323a494ce17c4118dcd30f012013c88
|
|
4
|
+
data.tar.gz: 8a2760aab2790ac14eb37db94da78df715067948
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d91d7677e8df1366d44e6d712346ca2cb08ab44ec27da873af7ec61d6b67736cf755afeb320b9da42f543eb934a146d1dc5ff7d9fcb43371bd72737359f4821d
|
|
7
|
+
data.tar.gz: 99707fa9618fae7608c7cf7d93055c7783d19264f50a5bd1f25065b4884b2dfaf362f1b82c6bc1e3d36b900536181c0ed244bf4ef4af4f8818b9afceb366fec9
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.2.
|
|
1
|
+
2.2.3
|
data/CONTRIBUTING.md
CHANGED
data/LICENSE
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
The MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2015+
|
|
4
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2015+ vaporware, inc.
|
|
4
|
+
Copyright (c) 2008-2015 thoughtbot, inc.
|
|
5
5
|
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
of this software and associated documentation files (the "Software"), to deal
|
data/NEWS.md
CHANGED
|
@@ -1,3 +1,70 @@
|
|
|
1
|
+
1.2.0 (November 17, 2015)
|
|
2
|
+
* Changed addon references for Heroku [upstream-1]
|
|
3
|
+
* Upgraded to Ruby 2.2.3
|
|
4
|
+
* Upgraded to RSpec 3.3 [upstream-2]
|
|
5
|
+
* Replaced TravisCI with CircleCI [upstream-3], [upstream-11], [upstream-29]
|
|
6
|
+
* Rename Dev Seeds [upstream-4]
|
|
7
|
+
* Remove Unicorn in favor of Puma, as [recommended by Heroku] [upstream-5], [upstream-18]
|
|
8
|
+
* Remove Gemfile.lock [upstream-6]
|
|
9
|
+
* Add ctags configuration dotfile [upstream-7]
|
|
10
|
+
* Rename `$HOST` to `$APPLICATION_HOST` for zsh compatibility [upstream-8],[upstream-9]
|
|
11
|
+
* Remove comments and newlines in config files [upstream-10]
|
|
12
|
+
* Abort tests run if `DATABASE_URL` env variable is setup [upstream-12]
|
|
13
|
+
* Fix on port 3000 [upstream-13]
|
|
14
|
+
* Add mandatory environment variables to .sample.env [upstream-14]
|
|
15
|
+
* Provide Shoulda Matchers config [upstream-15], [upstream-16]
|
|
16
|
+
* Move i18n tasks out of production for performance [upstream-17]
|
|
17
|
+
* Add quiet_assets as development dependency [upstream-19]
|
|
18
|
+
* Generate empty spec/factories.rb file [upstream-20]
|
|
19
|
+
* Fix deprecation warning from capybara-webkit [upstream-21]
|
|
20
|
+
* Slining command line responds to `-v` and `--version` options [upstream-22]
|
|
21
|
+
* Configure simple_form earlier [upstream-23], [upstream-28]
|
|
22
|
+
* Remove old deprecation [upstream-24]
|
|
23
|
+
* Removed `action_mailer_host` in staging [upstream-25]
|
|
24
|
+
* Cleanup generated `bin/setup` file and rake binstub [upstream-26], [upstream-27]
|
|
25
|
+
* Add `bullet` as development dependency [upstream-30]
|
|
26
|
+
* Add adapter for heroku actions [upstream-31]
|
|
27
|
+
* Replace foreman with heroku local ([Forego]) [upstream-32]
|
|
28
|
+
* Add RELEASING document [upstream-33]
|
|
29
|
+
* Raise on missing Sprockets assets in test [upstream-34]
|
|
30
|
+
|
|
31
|
+
[recommended by Heroku]: https://devcenter.heroku.com/changelog-items/594
|
|
32
|
+
[upstream-1]: https://github.com/thoughtbot/suspenders/commit/f34ab5189300a57e14c28aaeca17bd5573080f1d
|
|
33
|
+
[upstream-2]: https://github.com/thoughtbot/suspenders/commit/35979868ba9f8a8d0e89f58722ecf7687ae7bf14
|
|
34
|
+
[upstream-3]: https://github.com/thoughtbot/suspenders/commit/ac3924da64bb2c71f8611919e5f43b85261da600
|
|
35
|
+
[upstream-4]: https://github.com/thoughtbot/suspenders/commit/2cd79f5f6b0919340fe0ed4c69d83ff4f449dadb
|
|
36
|
+
[upstream-5]: https://github.com/thoughtbot/suspenders/commit/c681ed379f4117dd62e64ff4e910a38e1a4cbf47
|
|
37
|
+
[upstream-6]: https://github.com/thoughtbot/suspenders/commit/539b5c6e7fe68ee6ccad168ea6e267c7f12ae9bd
|
|
38
|
+
[upstream-7]: https://github.com/thoughtbot/suspenders/commit/390c0c4f8164729927890a66d5ad62b26b10f9f4
|
|
39
|
+
[upstream-8]: https://github.com/thoughtbot/suspenders/commit/9d27905884540e44109cc66630062101307f150a
|
|
40
|
+
[upstream-9]: https://github.com/thoughtbot/suspenders/commit/f6f4869f9dbad9104597bc4380330e8311f75d08
|
|
41
|
+
[upstream-10]: https://github.com/thoughtbot/suspenders/commit/f65e94d919796c353c399e7d1a814cd5bbf6c50d
|
|
42
|
+
[upstream-11]: https://github.com/thoughtbot/suspenders/commit/741677f47ad614bdbd023e38788a2d0dcc06e1ad
|
|
43
|
+
[upstream-12]: https://github.com/thoughtbot/suspenders/commit/2c069e1e387e3a538aa44a2d235f05e22b0cb03a
|
|
44
|
+
[upstream-13]: https://github.com/thoughtbot/suspenders/commit/4292fea5b17a3ee9a4c1ed11aef4430f0fb71921
|
|
45
|
+
[upstream-14]: https://github.com/thoughtbot/suspenders/commit/efff20491c492715ed6fd8fb2700bbcd8b99709f
|
|
46
|
+
[upstream-15]: https://github.com/thoughtbot/suspenders/commit/af523754f3a27b14ac76e0b9a43391a87541e34c
|
|
47
|
+
[upstream-16]: https://github.com/thoughtbot/suspenders/commit/6f4bc189a91b68dfbb7d37bb669e799602d8d4fd
|
|
48
|
+
[upstream-17]: https://github.com/thoughtbot/suspenders/commit/66d048be81cf5608ea5ee42075bdccf29122256f
|
|
49
|
+
[upstream-18]: https://github.com/thoughtbot/suspenders/commit/bfd75f9f16f8557ddf91a069525d13f7bdc7ce8f
|
|
50
|
+
[upstream-19]: https://github.com/thoughtbot/suspenders/commit/3a06edfd2a66047912cc08a85af32a7dfac16324
|
|
51
|
+
[upstream-20]: https://github.com/thoughtbot/suspenders/commit/0243f89579363fc6a487e46b2ba14b50a9fc23d4
|
|
52
|
+
[upstream-21]: https://github.com/thoughtbot/suspenders/commit/791d938f91bf5fb5ae5ec987d6ceaffbec8f923e
|
|
53
|
+
[upstream-22]: https://github.com/thoughtbot/suspenders/commit/e1a5b2f1101a94a55753020266288b354160cf4f
|
|
54
|
+
[upstream-23]: https://github.com/thoughtbot/suspenders/commit/4b517a11547f880df4b9237c1dd6e96a2cba9cc7
|
|
55
|
+
[upstream-24]: https://github.com/thoughtbot/suspenders/commit/cde3eb1748172c56b6d857a140bc1ed6314c5b34
|
|
56
|
+
[upstream-25]: https://github.com/thoughtbot/suspenders/commit/0a4dfa2c293993272938cf1de80c7934337b52fc
|
|
57
|
+
[upstream-26]: https://github.com/thoughtbot/suspenders/commit/53b2fea247740eef92d8e63a144ab66c1109add7
|
|
58
|
+
[upstream-27]: https://github.com/thoughtbot/suspenders/commit/8e75eef9fae0b44e3300704ea91c454318808925
|
|
59
|
+
[upstream-28]: https://github.com/thoughtbot/suspenders/commit/8974398f31e6cb276798da36366ab76510706025
|
|
60
|
+
[upstream-29]: https://github.com/thoughtbot/suspenders/commit/6ac8874496e15da3f0e5906cbb2b5e7261be00ca
|
|
61
|
+
[upstream-30]: https://github.com/thoughtbot/suspenders/commit/e077da95487698467080f94aa397147a6617a9f8
|
|
62
|
+
[upstream-31]: https://github.com/thoughtbot/suspenders/commit/f733bb413ad92edcf81d3ce3273ccb3382878be9
|
|
63
|
+
[upstream-32]: https://github.com/thoughtbot/suspenders/commit/6b7614a8dc7ff2a7dd32d087039e49fd5984a35d
|
|
64
|
+
[Forego]: https://github.com/ddollar/forego
|
|
65
|
+
[upstream-33]: https://github.com/thoughtbot/suspenders/commit/e96f8450ebfebacd13973d091fcbc9115ace00bc
|
|
66
|
+
[upstream-34]: https://github.com/thoughtbot/suspenders/commit/dd6b2037e5a7f5cd99b96187be143129af9ab2cb
|
|
67
|
+
|
|
1
68
|
1.1.0 (June 23, 2015)
|
|
2
69
|
* Added HAML and HAML Rails
|
|
3
70
|
* Added Twitter Bootstrap
|
data/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# Slining
|
|
1
|
+
# Slining
|
|
2
2
|
|
|
3
3
|
Slining is the Silver Lining to Vaporware's Rails development, i.e. the base Rails application used at
|
|
4
|
-
[vaporware](http://vaporwa.re). It's a forked project from [thoughtbot's suspenders](
|
|
4
|
+
[vaporware](http://vaporwa.re). It's a forked project from [thoughtbot's suspenders](https://github.com/thoughtbot/suspenders).
|
|
5
5
|
|
|
6
6
|
## Installation
|
|
7
7
|
|
|
@@ -40,7 +40,7 @@ It includes application gems like:
|
|
|
40
40
|
* [Postgres](https://github.com/ged/ruby-pg) for access to the Postgres database
|
|
41
41
|
* [Rack Canonical Host](https://github.com/tylerhunt/rack-canonical-host) to
|
|
42
42
|
ensure all requests are served from the same domain
|
|
43
|
-
* [Rack Timeout](https://github.com/
|
|
43
|
+
* [Rack Timeout](https://github.com/heroku/rack-timeout) to abort requests that are
|
|
44
44
|
taking too long
|
|
45
45
|
* [Recipient Interceptor](https://github.com/croaky/recipient_interceptor) to
|
|
46
46
|
avoid accidentally sending emails to real people from staging
|
|
@@ -48,7 +48,7 @@ It includes application gems like:
|
|
|
48
48
|
and style
|
|
49
49
|
* [Title](https://github.com/calebthompson/title) for storing titles in
|
|
50
50
|
translations
|
|
51
|
-
* [
|
|
51
|
+
* [Puma](https://github.com/puma/puma) to serve HTTP requests.
|
|
52
52
|
|
|
53
53
|
And development gems like:
|
|
54
54
|
|
|
@@ -57,12 +57,16 @@ And development gems like:
|
|
|
57
57
|
objects
|
|
58
58
|
* [ByeBug](https://github.com/deivid-rodriguez/byebug) for interactively
|
|
59
59
|
debugging behavior
|
|
60
|
+
* [Bullet](https://github.com/flyerhzm/bullet) for help to kill N+1 queries and
|
|
61
|
+
unused eager loading
|
|
60
62
|
* [Bundler Audit](https://github.com/rubysec/bundler-audit) for scanning the
|
|
61
63
|
Gemfile for insecure dependencies based on published CVEs
|
|
62
64
|
* [Spring](https://github.com/rails/spring) for fast Rails actions via
|
|
63
65
|
pre-loading
|
|
64
66
|
* [Web Console](https://github.com/rails/web-console) for better debugging via
|
|
65
67
|
in-browser IRB consoles.
|
|
68
|
+
* [Quiet Assets](https://github.com/evrone/quiet_assets) for muting assets
|
|
69
|
+
pipeline log messages
|
|
66
70
|
|
|
67
71
|
And testing gems like:
|
|
68
72
|
|
|
@@ -76,7 +80,7 @@ And testing gems like:
|
|
|
76
80
|
* [RSpec Mocks](https://github.com/rspec/rspec-mocks) for stubbing and spying
|
|
77
81
|
* [Shoulda Matchers](https://github.com/thoughtbot/shoulda-matchers) for common
|
|
78
82
|
RSpec matchers
|
|
79
|
-
* [Timecop](https://github.com/
|
|
83
|
+
* [Timecop](https://github.com/ferndopolis/timecop-console) for testing time
|
|
80
84
|
|
|
81
85
|
## Other goodies
|
|
82
86
|
|
|
@@ -92,17 +96,17 @@ Slining also comes with:
|
|
|
92
96
|
* [t() and l() in specs without prefixing with I18n][i18n]
|
|
93
97
|
* An automatically-created `SECRET_KEY_BASE` environment variable in all
|
|
94
98
|
environments
|
|
95
|
-
* Configuration for [
|
|
99
|
+
* Configuration for [CircleCI][circle] Continuous Integration (tests)
|
|
96
100
|
* Configuration for [Hound][hound] Continuous Integration (style)
|
|
97
101
|
* The analytics adapter [Segment][segment] (and therefore config for Google
|
|
98
102
|
Analytics, Intercom, Facebook Ads, Twitter Ads, etc.)
|
|
99
103
|
|
|
100
|
-
[setup]:
|
|
101
|
-
[compress]:
|
|
104
|
+
[setup]: https://robots.thoughtbot.com/bin-setup
|
|
105
|
+
[compress]: https://robots.thoughtbot.com/content-compression-with-rack-deflater
|
|
102
106
|
[pool]: https://devcenter.heroku.com/articles/concurrency-and-database-connections
|
|
103
107
|
[binstub]: https://github.com/thoughtbot/suspenders/pull/282
|
|
104
108
|
[i18n]: https://github.com/thoughtbot/suspenders/pull/304
|
|
105
|
-
[
|
|
109
|
+
[circle]: https://circleci.com/docs
|
|
106
110
|
[hound]: https://houndci.com
|
|
107
111
|
[segment]: https://segment.com
|
|
108
112
|
|
|
@@ -129,7 +133,7 @@ You can optionally specify alternate Heroku flags:
|
|
|
129
133
|
|
|
130
134
|
slining app \
|
|
131
135
|
--heroku true \
|
|
132
|
-
--heroku-flags "--region eu --addons
|
|
136
|
+
--heroku-flags "--region eu --addons deployhooks,scheduler,ssl"
|
|
133
137
|
|
|
134
138
|
See all possible Heroku flags:
|
|
135
139
|
|
|
@@ -156,7 +160,7 @@ This has the same effect as running:
|
|
|
156
160
|
|
|
157
161
|
## Spring
|
|
158
162
|
|
|
159
|
-
|
|
163
|
+
Slining uses [spring](https://github.com/rails/spring) by default.
|
|
160
164
|
It makes Rails applications load faster, but it might introduce confusing issues
|
|
161
165
|
around stale code not being refreshed.
|
|
162
166
|
If you think your application is running old code, run `spring stop`.
|
|
@@ -164,6 +168,13 @@ And if you'd rather not use spring, add `DISABLE_SPRING=1` to your login file.
|
|
|
164
168
|
|
|
165
169
|
## Dependencies
|
|
166
170
|
|
|
171
|
+
[][gem]
|
|
172
|
+
[][license]
|
|
173
|
+
[][gemnasium]
|
|
174
|
+
[][circleci]
|
|
175
|
+
[][codeclimate]
|
|
176
|
+
[][codeclimate]
|
|
177
|
+
|
|
167
178
|
Slining requires the latest version of Ruby.
|
|
168
179
|
|
|
169
180
|
Some gems included in Slining have native extensions. You should have GCC
|
|
@@ -193,12 +204,14 @@ See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
|
193
204
|
|
|
194
205
|
Thank you, [contributors]!
|
|
195
206
|
|
|
196
|
-
[contributors]: https://github.com/vaporware/slining/graphs/contributors
|
|
197
|
-
|
|
198
207
|
## License
|
|
199
|
-
Slining is Copyright © 2015+ vaporware.
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
[
|
|
208
|
+
Slining is Copyright © 2015+ vaporware. MIT Licensed, see [LICENSE] for details.
|
|
209
|
+
|
|
210
|
+
[gem]: https://rubygems.org/gems/slining
|
|
211
|
+
[circleci]: https://circleci.com/gh/vaporware/slining
|
|
212
|
+
[gemnasium]: https://gemnasium.com/vaporware/slining
|
|
213
|
+
[codeclimate]: https://codeclimate.com/github/vaporware/slining
|
|
214
|
+
[rubyinstaller]: http://rubyinstaller.org/
|
|
215
|
+
[rubydoc]: http://rubydoc.info/github/vaporware/slining
|
|
216
|
+
[LICENSE]: https://github.com/vaporware/slining/blob/master/LICENSE.md
|
|
217
|
+
[contributors]: https://github.com/vaporware/slining/graphs/contributors
|
data/RELEASING.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Releasing
|
|
2
|
+
|
|
3
|
+
1. Update `lib/slining/version.rb` file accordingly.
|
|
4
|
+
2. Update `NEWS.md` to reflect the changes since last release.
|
|
5
|
+
3. Commit changes. There shouldn't be code changes, and thus CI doesn't need to
|
|
6
|
+
run, you can then add `[ci skip]` to the commit message.
|
|
7
|
+
4. Tag the release: `git tag vVERSION -a`. 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
|
+
```bash
|
|
12
|
+
gem build slining.gemspec
|
|
13
|
+
gem push slining-*.gem
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
7. Add a new GitHub release:
|
|
17
|
+
https://github.com/vaporware/slining/releases/new?tag=vVERSION
|
|
18
|
+
8. Announce the new release, making sure to say "thank you" to the contributors
|
|
19
|
+
who helped shape this version!
|
data/bin/slining
CHANGED
|
@@ -6,9 +6,9 @@ $LOAD_PATH << source_path
|
|
|
6
6
|
|
|
7
7
|
require 'slining'
|
|
8
8
|
|
|
9
|
-
if ['
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
if ['-v', '--version'].include? ARGV[0]
|
|
10
|
+
puts Slining::VERSION
|
|
11
|
+
exit 0
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
templates_root = File.expand_path(File.join("..", "templates"), File.dirname(__FILE__))
|
data/lib/slining.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
3
|
-
require
|
|
4
|
-
require
|
|
1
|
+
require "slining/version"
|
|
2
|
+
require "slining/generators/app_generator"
|
|
3
|
+
require "slining/actions"
|
|
4
|
+
require "slining/adapters/heroku"
|
|
5
|
+
require "slining/app_builder"
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
module Slining
|
|
2
|
+
module Adapters
|
|
3
|
+
class Heroku
|
|
4
|
+
def initialize(app_builder)
|
|
5
|
+
@app_builder = app_builder
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def set_heroku_remotes
|
|
9
|
+
remotes = <<-SHELL.strip_heredoc
|
|
10
|
+
|
|
11
|
+
# Set up the staging and production apps.
|
|
12
|
+
#{command_to_join_heroku_app('staging')}
|
|
13
|
+
#{command_to_join_heroku_app('production')}
|
|
14
|
+
SHELL
|
|
15
|
+
|
|
16
|
+
app_builder.append_file "bin/setup", remotes
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def set_up_heroku_specific_gems
|
|
20
|
+
app_builder.inject_into_file(
|
|
21
|
+
"Gemfile",
|
|
22
|
+
%{\n\s\sgem "rails_stdout_logging"},
|
|
23
|
+
after: /group :staging, :production do/,
|
|
24
|
+
)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def set_heroku_rails_secrets
|
|
28
|
+
%w(staging production).each do |environment|
|
|
29
|
+
run_toolbelt_command(
|
|
30
|
+
"config:add SECRET_KEY_BASE=#{generate_secret}",
|
|
31
|
+
environment,
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
attr_reader :app_builder
|
|
39
|
+
|
|
40
|
+
def command_to_join_heroku_app(environment)
|
|
41
|
+
heroku_app_name = heroku_app_name_for(environment)
|
|
42
|
+
<<-SHELL
|
|
43
|
+
if heroku join --app #{heroku_app_name} &> /dev/null; then
|
|
44
|
+
git remote add #{environment} git@heroku.com:#{heroku_app_name}.git || true
|
|
45
|
+
printf 'You are a collaborator on the "#{heroku_app_name}" Heroku app\n'
|
|
46
|
+
else
|
|
47
|
+
printf 'Ask for access to the "#{heroku_app_name}" Heroku app\n'
|
|
48
|
+
fi
|
|
49
|
+
SHELL
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def heroku_app_name_for(environment)
|
|
53
|
+
"#{app_builder.app_name.dasherize}-#{environment}"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def generate_secret
|
|
57
|
+
SecureRandom.hex(64)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def run_toolbelt_command(command, environment)
|
|
61
|
+
app_builder.run(
|
|
62
|
+
"heroku #{command} --remote #{environment}",
|
|
63
|
+
)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
data/lib/slining/app_builder.rb
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
|
+
require "forwardable"
|
|
2
|
+
|
|
1
3
|
module Slining
|
|
2
4
|
class AppBuilder < Rails::AppBuilder
|
|
3
5
|
include Slining::Actions
|
|
6
|
+
extend Forwardable
|
|
7
|
+
|
|
8
|
+
def_delegators :heroku_adapter,
|
|
9
|
+
:set_heroku_remotes,
|
|
10
|
+
:set_up_heroku_specific_gems,
|
|
11
|
+
:set_heroku_rails_secrets
|
|
4
12
|
|
|
5
13
|
def readme
|
|
6
14
|
template 'README.md.erb', 'README.md'
|
|
7
15
|
end
|
|
8
16
|
|
|
17
|
+
def raise_on_missing_assets_in_test
|
|
18
|
+
inject_into_file(
|
|
19
|
+
"config/environments/test.rb",
|
|
20
|
+
"\n config.assets.raise_runtime_errors = true",
|
|
21
|
+
after: "Rails.application.configure do"
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
9
25
|
def raise_on_delivery_errors
|
|
10
26
|
replace_in_file 'config/environments/development.rb',
|
|
11
27
|
'raise_delivery_errors = false', 'raise_delivery_errors = true'
|
|
@@ -19,6 +35,23 @@ module Slining
|
|
|
19
35
|
)
|
|
20
36
|
end
|
|
21
37
|
|
|
38
|
+
def add_bullet_gem_configuration
|
|
39
|
+
config = <<-RUBY
|
|
40
|
+
config.after_initialize do
|
|
41
|
+
Bullet.enable = true
|
|
42
|
+
Bullet.bullet_logger = true
|
|
43
|
+
Bullet.rails_logger = true
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
RUBY
|
|
47
|
+
|
|
48
|
+
inject_into_file(
|
|
49
|
+
"config/environments/development.rb",
|
|
50
|
+
config,
|
|
51
|
+
after: "config.action_mailer.raise_delivery_errors = true\n",
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
|
|
22
55
|
def raise_on_unpermitted_parameters
|
|
23
56
|
config = <<-RUBY
|
|
24
57
|
config.action_controller.action_on_unpermitted_parameters = :raise
|
|
@@ -27,13 +60,21 @@ module Slining
|
|
|
27
60
|
inject_into_class "config/application.rb", "Application", config
|
|
28
61
|
end
|
|
29
62
|
|
|
63
|
+
def configure_quiet_assets
|
|
64
|
+
config = <<-RUBY
|
|
65
|
+
config.quiet_assets = true
|
|
66
|
+
RUBY
|
|
67
|
+
|
|
68
|
+
inject_into_class "config/application.rb", "Application", config
|
|
69
|
+
end
|
|
70
|
+
|
|
30
71
|
def provide_setup_script
|
|
31
|
-
template "bin_setup.erb", "bin/setup",
|
|
72
|
+
template "bin_setup.erb", "bin/setup", force: true
|
|
32
73
|
run "chmod a+x bin/setup"
|
|
33
74
|
end
|
|
34
75
|
|
|
35
76
|
def provide_dev_prime_task
|
|
36
|
-
copy_file '
|
|
77
|
+
copy_file 'dev.rake', 'lib/tasks/dev.rake'
|
|
37
78
|
end
|
|
38
79
|
|
|
39
80
|
def configure_generators
|
|
@@ -58,6 +99,10 @@ module Slining
|
|
|
58
99
|
copy_file 'factory_girl_rspec.rb', 'spec/support/factory_girl.rb'
|
|
59
100
|
end
|
|
60
101
|
|
|
102
|
+
def generate_factories_file
|
|
103
|
+
copy_file "factories.rb", "spec/factories.rb"
|
|
104
|
+
end
|
|
105
|
+
|
|
61
106
|
def set_up_hound
|
|
62
107
|
copy_file "hound.yml", ".hound.yml"
|
|
63
108
|
end
|
|
@@ -79,14 +124,14 @@ module Slining
|
|
|
79
124
|
RUBY
|
|
80
125
|
|
|
81
126
|
inject_into_file 'config/environments/production.rb', config,
|
|
82
|
-
:
|
|
127
|
+
after: 'config.action_mailer.raise_delivery_errors = false'
|
|
83
128
|
end
|
|
84
129
|
|
|
85
130
|
def enable_rack_canonical_host
|
|
86
131
|
config = <<-RUBY
|
|
87
132
|
|
|
88
133
|
# Ensure requests are only served from one, canonical host name
|
|
89
|
-
config.middleware.use Rack::CanonicalHost, ENV.fetch("
|
|
134
|
+
config.middleware.use Rack::CanonicalHost, ENV.fetch("APPLICATION_HOST")
|
|
90
135
|
RUBY
|
|
91
136
|
|
|
92
137
|
inject_into_file(
|
|
@@ -113,7 +158,7 @@ module Slining
|
|
|
113
158
|
def setup_asset_host
|
|
114
159
|
replace_in_file 'config/environments/production.rb',
|
|
115
160
|
"# config.action_controller.asset_host = 'http://assets.example.com'",
|
|
116
|
-
'config.action_controller.asset_host = ENV.fetch("ASSET_HOST", ENV.fetch("
|
|
161
|
+
'config.action_controller.asset_host = ENV.fetch("ASSET_HOST", ENV.fetch("APPLICATION_HOST"))'
|
|
117
162
|
|
|
118
163
|
replace_in_file 'config/initializers/assets.rb',
|
|
119
164
|
"config.assets.version = '1.0'",
|
|
@@ -185,18 +230,14 @@ end
|
|
|
185
230
|
create_file '.ruby-version', "#{Slining::RUBY_VERSION}\n"
|
|
186
231
|
end
|
|
187
232
|
|
|
188
|
-
def setup_heroku_specific_gems
|
|
189
|
-
inject_into_file(
|
|
190
|
-
"Gemfile",
|
|
191
|
-
%{\n\s\sgem "rails_stdout_logging"},
|
|
192
|
-
after: /group :staging, :production do/
|
|
193
|
-
)
|
|
194
|
-
end
|
|
195
|
-
|
|
196
233
|
def enable_database_cleaner
|
|
197
234
|
copy_file 'database_cleaner_rspec.rb', 'spec/support/database_cleaner.rb'
|
|
198
235
|
end
|
|
199
236
|
|
|
237
|
+
def provide_shoulda_matchers_config
|
|
238
|
+
copy_file "shoulda_matchers_config_rspec.rb", "spec/support/shoulda_matchers.rb"
|
|
239
|
+
end
|
|
240
|
+
|
|
200
241
|
def configure_spec_support_features
|
|
201
242
|
empty_directory_with_keep_file 'spec/features'
|
|
202
243
|
empty_directory_with_keep_file 'spec/support/features'
|
|
@@ -209,8 +250,8 @@ end
|
|
|
209
250
|
copy_file "spec_helper.rb", "spec/spec_helper.rb"
|
|
210
251
|
end
|
|
211
252
|
|
|
212
|
-
def
|
|
213
|
-
template '
|
|
253
|
+
def configure_ci
|
|
254
|
+
template 'circle.yml.erb', 'circle.yml'
|
|
214
255
|
end
|
|
215
256
|
|
|
216
257
|
def configure_i18n_for_test_environment
|
|
@@ -235,6 +276,10 @@ end
|
|
|
235
276
|
copy_file 'action_mailer.rb', 'spec/support/action_mailer.rb'
|
|
236
277
|
end
|
|
237
278
|
|
|
279
|
+
def configure_capybara_webkit
|
|
280
|
+
copy_file "capybara_webkit.rb", "spec/support/capybara_webkit.rb"
|
|
281
|
+
end
|
|
282
|
+
|
|
238
283
|
def configure_time_formats
|
|
239
284
|
remove_file "config/locales/en.yml"
|
|
240
285
|
template "config_locales_en.yml.erb", "config/locales/en.yml"
|
|
@@ -253,10 +298,9 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
|
|
|
253
298
|
end
|
|
254
299
|
|
|
255
300
|
def configure_action_mailer
|
|
256
|
-
action_mailer_host "development", %{"localhost
|
|
301
|
+
action_mailer_host "development", %{"localhost:3000"}
|
|
257
302
|
action_mailer_host "test", %{"www.example.com"}
|
|
258
|
-
action_mailer_host "
|
|
259
|
-
action_mailer_host "production", %{ENV.fetch("HOST")}
|
|
303
|
+
action_mailer_host "production", %{ENV.fetch("APPLICATION_HOST")}
|
|
260
304
|
end
|
|
261
305
|
|
|
262
306
|
def configure_active_job
|
|
@@ -278,11 +322,11 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
|
|
|
278
322
|
generate 'rspec:install'
|
|
279
323
|
end
|
|
280
324
|
|
|
281
|
-
def
|
|
282
|
-
copy_file
|
|
325
|
+
def configure_puma
|
|
326
|
+
copy_file "puma.rb", "config/puma.rb"
|
|
283
327
|
end
|
|
284
328
|
|
|
285
|
-
def
|
|
329
|
+
def set_up_forego
|
|
286
330
|
copy_file 'sample.env', '.sample.env'
|
|
287
331
|
copy_file 'Procfile', 'Procfile'
|
|
288
332
|
end
|
|
@@ -310,6 +354,10 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
|
|
|
310
354
|
end
|
|
311
355
|
end
|
|
312
356
|
|
|
357
|
+
def copy_dotfiles
|
|
358
|
+
directory("dotfiles",".")
|
|
359
|
+
end
|
|
360
|
+
|
|
313
361
|
def init_git
|
|
314
362
|
run 'git init'
|
|
315
363
|
end
|
|
@@ -333,34 +381,6 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
|
|
|
333
381
|
create_production_heroku_app(flags)
|
|
334
382
|
end
|
|
335
383
|
|
|
336
|
-
def set_heroku_remotes
|
|
337
|
-
remotes = <<-SHELL
|
|
338
|
-
|
|
339
|
-
# Set up the staging and production apps.
|
|
340
|
-
#{join_heroku_app('staging')}
|
|
341
|
-
#{join_heroku_app('production')}
|
|
342
|
-
SHELL
|
|
343
|
-
|
|
344
|
-
append_file 'bin/setup', remotes
|
|
345
|
-
end
|
|
346
|
-
|
|
347
|
-
def join_heroku_app(environment)
|
|
348
|
-
heroku_app_name = heroku_app_name_for(environment)
|
|
349
|
-
<<-SHELL
|
|
350
|
-
if heroku join --app #{heroku_app_name} &> /dev/null; then
|
|
351
|
-
git remote add #{environment} git@heroku.com:#{heroku_app_name}.git || true
|
|
352
|
-
printf 'You are a collaborator on the "#{heroku_app_name}" Heroku app\n'
|
|
353
|
-
else
|
|
354
|
-
printf 'Ask for access to the "#{heroku_app_name}" Heroku app\n'
|
|
355
|
-
fi
|
|
356
|
-
SHELL
|
|
357
|
-
end
|
|
358
|
-
|
|
359
|
-
def set_heroku_rails_secrets
|
|
360
|
-
%w(staging production).each do |environment|
|
|
361
|
-
run_heroku "config:add SECRET_KEY_BASE=#{generate_secret}", environment
|
|
362
|
-
end
|
|
363
|
-
end
|
|
364
384
|
|
|
365
385
|
def set_heroku_serve_static_files
|
|
366
386
|
%w(staging production).each do |environment|
|
|
@@ -386,9 +406,21 @@ you can deploy to staging and production with:
|
|
|
386
406
|
run "chmod a+x bin/deploy"
|
|
387
407
|
end
|
|
388
408
|
|
|
409
|
+
def configure_automatic_deployment
|
|
410
|
+
staging_remote_name = heroku_app_name_for("staging")
|
|
411
|
+
deploy_command = <<-YML.strip_heredoc
|
|
412
|
+
deployment:
|
|
413
|
+
staging:
|
|
414
|
+
branch: master
|
|
415
|
+
commands:
|
|
416
|
+
- bin/deploy staging
|
|
417
|
+
YML
|
|
418
|
+
|
|
419
|
+
append_file "circle.yml", deploy_command
|
|
420
|
+
end
|
|
421
|
+
|
|
389
422
|
def create_github_repo(repo_name)
|
|
390
|
-
|
|
391
|
-
run "#{path_addition} hub create #{repo_name}"
|
|
423
|
+
run "hub create #{repo_name}"
|
|
392
424
|
end
|
|
393
425
|
|
|
394
426
|
def setup_segment
|
|
@@ -419,11 +451,33 @@ you can deploy to staging and production with:
|
|
|
419
451
|
EOS
|
|
420
452
|
|
|
421
453
|
%w(500 404 422).each do |page|
|
|
422
|
-
inject_into_file "public/#{page}.html", meta_tags, :
|
|
454
|
+
inject_into_file "public/#{page}.html", meta_tags, after: "<head>\n"
|
|
423
455
|
replace_in_file "public/#{page}.html", /<!--.+-->\n/, ''
|
|
424
456
|
end
|
|
425
457
|
end
|
|
426
458
|
|
|
459
|
+
def remove_config_comment_lines
|
|
460
|
+
config_files = [
|
|
461
|
+
"application.rb",
|
|
462
|
+
"environment.rb",
|
|
463
|
+
"environments/development.rb",
|
|
464
|
+
"environments/production.rb",
|
|
465
|
+
"environments/test.rb",
|
|
466
|
+
]
|
|
467
|
+
|
|
468
|
+
config_files.each do |config_file|
|
|
469
|
+
path = File.join(destination_root, "config/#{config_file}")
|
|
470
|
+
|
|
471
|
+
accepted_content = File.readlines(path).reject do |line|
|
|
472
|
+
line =~ /^.*#.*$/ || line =~ /^$\n/
|
|
473
|
+
end
|
|
474
|
+
|
|
475
|
+
File.open(path, "w") do |file|
|
|
476
|
+
accepted_content.each { |line| file.puts line }
|
|
477
|
+
end
|
|
478
|
+
end
|
|
479
|
+
end
|
|
480
|
+
|
|
427
481
|
def remove_routes_comment_lines
|
|
428
482
|
replace_in_file 'config/routes.rb',
|
|
429
483
|
/Rails\.application\.routes\.draw do.*end/m,
|
|
@@ -458,24 +512,12 @@ end
|
|
|
458
512
|
uncomment_lines("config/environments/#{environment}.rb", config)
|
|
459
513
|
end
|
|
460
514
|
|
|
461
|
-
def override_path_for_tests
|
|
462
|
-
if ENV['TESTING']
|
|
463
|
-
support_bin = File.expand_path(File.join('..', '..', 'spec', 'fakes', 'bin'))
|
|
464
|
-
"PATH=#{support_bin}:$PATH"
|
|
465
|
-
end
|
|
466
|
-
end
|
|
467
|
-
|
|
468
515
|
def run_heroku(command, environment)
|
|
469
|
-
|
|
470
|
-
run "#{path_addition} heroku #{command} --remote #{environment}"
|
|
471
|
-
end
|
|
472
|
-
|
|
473
|
-
def generate_secret
|
|
474
|
-
SecureRandom.hex(64)
|
|
516
|
+
run "heroku #{command} --remote #{environment}"
|
|
475
517
|
end
|
|
476
518
|
|
|
477
|
-
def
|
|
478
|
-
@
|
|
519
|
+
def heroku_adapter
|
|
520
|
+
@heroku_adapter ||= Adapters::Heroku.new(self)
|
|
479
521
|
end
|
|
480
522
|
|
|
481
523
|
def serve_static_files_line
|