underlay 1.50.1

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.
Files changed (86) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/.rubocop.yml +87 -0
  4. data/.ruby-version +1 -0
  5. data/CONTRIBUTING.md +46 -0
  6. data/Gemfile +5 -0
  7. data/LICENSE +21 -0
  8. data/README.md +218 -0
  9. data/RELEASING.md +16 -0
  10. data/Rakefile +10 -0
  11. data/USAGE +13 -0
  12. data/bin/rake +18 -0
  13. data/bin/rspec +18 -0
  14. data/bin/setup +13 -0
  15. data/bin/underlay +29 -0
  16. data/circle.yml +3 -0
  17. data/lib/underlay/actions.rb +41 -0
  18. data/lib/underlay/adapters/heroku.rb +133 -0
  19. data/lib/underlay/app_builder.rb +556 -0
  20. data/lib/underlay/generators/app_generator.rb +280 -0
  21. data/lib/underlay/generators/enforce_ssl_generator.rb +14 -0
  22. data/lib/underlay/generators/initialize_active_job_generator.rb +21 -0
  23. data/lib/underlay/generators/static_generator.rb +12 -0
  24. data/lib/underlay/generators/stylesheet_base_generator.rb +36 -0
  25. data/lib/underlay/version.rb +10 -0
  26. data/lib/underlay.rb +11 -0
  27. data/spec/adapters/heroku_spec.rb +78 -0
  28. data/spec/fakes/bin/heroku +9 -0
  29. data/spec/fakes/bin/hub +9 -0
  30. data/spec/features/cli_help_spec.rb +38 -0
  31. data/spec/features/github_spec.rb +18 -0
  32. data/spec/features/heroku_spec.rb +72 -0
  33. data/spec/features/new_project_spec.rb +308 -0
  34. data/spec/spec_helper.rb +22 -0
  35. data/spec/support/fake_github.rb +26 -0
  36. data/spec/support/fake_heroku.rb +58 -0
  37. data/spec/support/underlay.rb +100 -0
  38. data/templates/Gemfile.erb +81 -0
  39. data/templates/Procfile +2 -0
  40. data/templates/README.md.erb +21 -0
  41. data/templates/_analytics.html.slim +10 -0
  42. data/templates/_css_overrides.html.slim +5 -0
  43. data/templates/_flashes.html.slim +8 -0
  44. data/templates/_flashes.scss +21 -0
  45. data/templates/_javascript.html.slim +10 -0
  46. data/templates/action_mailer.rb +7 -0
  47. data/templates/active_job.rb +15 -0
  48. data/templates/app.json.erb +45 -0
  49. data/templates/application.example.yml +19 -0
  50. data/templates/application.scss +5 -0
  51. data/templates/bin_deploy +12 -0
  52. data/templates/bin_rake +12 -0
  53. data/templates/bin_setup +31 -0
  54. data/templates/bin_setup_review_app.erb +22 -0
  55. data/templates/bin_update +26 -0
  56. data/templates/browserslist +3 -0
  57. data/templates/bundler_audit.rake +6 -0
  58. data/templates/capybara.rb +22 -0
  59. data/templates/circle.yml.erb +38 -0
  60. data/templates/config_locales_en.yml.erb +19 -0
  61. data/templates/database_cleaner_rspec.rb +23 -0
  62. data/templates/dev.rake +14 -0
  63. data/templates/dvelp_gitignore +18 -0
  64. data/templates/dvelp_layout.html.slim +17 -0
  65. data/templates/errors.rb +36 -0
  66. data/templates/factories.rb +4 -0
  67. data/templates/factory_bot_rspec.rb +5 -0
  68. data/templates/flashes_helper.rb +7 -0
  69. data/templates/i18n.rb +5 -0
  70. data/templates/json_encoding.rb +3 -0
  71. data/templates/lograge.rb +11 -0
  72. data/templates/postgresql_database.yml.erb +19 -0
  73. data/templates/puma.rb +14 -0
  74. data/templates/rack_mini_profiler.rb +7 -0
  75. data/templates/rails_helper.rb +27 -0
  76. data/templates/rubocop.yml.erb +85 -0
  77. data/templates/scss-lint.yml.erb +167 -0
  78. data/templates/secrets.yml +8 -0
  79. data/templates/sentry.rb +6 -0
  80. data/templates/shoulda_matchers_config_rspec.rb +8 -0
  81. data/templates/sidekiq.yml +3 -0
  82. data/templates/slim-lint.yml.erb +28 -0
  83. data/templates/smtp.rb +15 -0
  84. data/templates/spec_helper.rb +35 -0
  85. data/underlay.gemspec +33 -0
  86. metadata +187 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2fe8523d018762fed74e94b455407b356d91c32e26558db70044b366e4971ae3
4
+ data.tar.gz: a3e90a69b043ba06d48e694b34d16da30f7fb7f8f41b391bc2d96df66e599f27
5
+ SHA512:
6
+ metadata.gz: cc80e1ba6629d92fb1977b5159e850ff4f3d9dd5579025e28e245f9cbacd7bfd321e9f2d8b221dfc8ccf268dd096088cebaeaad848e2f7da6e0208a9af276665
7
+ data.tar.gz: 7c6d8069f5b175fd5495181a714fa87b5bf4ab6a753a838aa43df888a354656a62592d435cf46c0cdc2f62004d891a186e586be04c46ab6dc2057b8c6ec9f35f
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ *.swp
3
+ Gemfile.lock
4
+ /.bundle
5
+ /tmp
data/.rubocop.yml ADDED
@@ -0,0 +1,87 @@
1
+ Layout/AlignParameters:
2
+ EnforcedStyle: with_fixed_indentation
3
+
4
+ Layout/EmptyLinesAroundBlockBody:
5
+ Exclude:
6
+ - 'db/schema.rb'
7
+
8
+ Layout/ExtraSpacing:
9
+ Exclude:
10
+ - 'bin/*'
11
+ - 'db/schema.rb'
12
+
13
+ Layout/FirstParameterIndentation:
14
+ EnforcedStyle: consistent
15
+
16
+ Layout/IndentArray:
17
+ EnforcedStyle: consistent
18
+
19
+ Layout/MultilineMethodCallIndentation:
20
+ EnforcedStyle: indented
21
+
22
+ Metrics/AbcSize:
23
+ Enabled: true
24
+ Exclude:
25
+ - 'lib/underlay/generators/app_generator.rb'
26
+
27
+ Metrics/BlockLength:
28
+ Enabled: true
29
+ Exclude:
30
+ - 'spec/adapters/heroku_spec.rb'
31
+ - 'spec/features/cli_help_spec.rb'
32
+ - 'spec/features/heroku_spec.rb'
33
+ - 'spec/features/new_project_spec.rb'
34
+
35
+ Metrics/ClassLength:
36
+ Enabled: true
37
+ Exclude:
38
+ - 'lib/underlay/app_builder.rb'
39
+ - 'lib/underlay/generators/app_generator.rb'
40
+
41
+ Metrics/LineLength:
42
+ Max: 80
43
+ Exclude:
44
+ - 'db/schema.rb'
45
+ - 'spec/support/fake_heroku.rb'
46
+
47
+ Metrics/MethodLength:
48
+ Enabled: false
49
+
50
+ Style/BlockComments:
51
+ Exclude:
52
+ - 'spec/spec_helper.rb'
53
+
54
+ Style/Documentation:
55
+ Enabled: false
56
+
57
+ Style/GuardClause:
58
+ Enabled: false
59
+
60
+ Style/HashSyntax:
61
+ Exclude:
62
+ - 'Rakefile'
63
+ - 'lib/tasks/*.rake'
64
+
65
+ Style/IfUnlessModifier:
66
+ Enabled: false
67
+
68
+ Style/NumericLiterals:
69
+ Exclude:
70
+ - 'db/schema.rb'
71
+
72
+ Style/PercentLiteralDelimiters:
73
+ PreferredDelimiters:
74
+ '%': ()
75
+ '%i': '[]'
76
+ '%q': ()
77
+ '%Q': ()
78
+ '%r': '{}'
79
+ '%s': ()
80
+ '%w': '[]'
81
+ '%W': '[]'
82
+ '%x': ()
83
+
84
+ Style/StringLiterals:
85
+ Exclude:
86
+ - 'bin/*'
87
+ - 'db/schema.rb'
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.5.1
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,46 @@
1
+ # Contributing
2
+
3
+ We love pull requests from everyone. By participating in this project, you agree
4
+ to abide by the thoughtbot [code of conduct].
5
+
6
+ [code of conduct]: https://thoughtbot.com/open-source-code-of-conduct
7
+
8
+ Fork the repo:
9
+
10
+ git clone git@github.com:thoughtbot/underlay.git
11
+
12
+ Set up your machine:
13
+
14
+ ./bin/setup
15
+
16
+ Make sure the tests pass:
17
+
18
+ rake
19
+
20
+ Make your change.
21
+ Write tests.
22
+ Follow our [style guide][style].
23
+ Make the tests pass:
24
+
25
+ [style]: https://github.com/DVELP/cookbook/blob/master/guides/code-style
26
+
27
+ rake
28
+
29
+ Mention how your changes affect the project to other developers and users in the
30
+ `NEWS.md` file.
31
+
32
+ Write a [good commit message][commit].
33
+ Push to your fork.
34
+ [Submit a pull request][pr].
35
+
36
+ [commit]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
37
+ [pr]: https://github.com/DVELP/underlay/compare/
38
+
39
+ Wait for us.
40
+ We try to at least comment on pull requests within one business day.
41
+ We may suggest changes.
42
+
43
+ ## Versions
44
+
45
+ To update the Ruby version,
46
+ change `.ruby-version` and `.travis.yml`.
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 20018 DVELP Ltd.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,218 @@
1
+ # Underlay
2
+
3
+ Underlay is used by [DVELP](https://dvelp.co.uk/) to fire up new rails applications.
4
+
5
+ ## Installation
6
+
7
+ First install the underlay gem:
8
+
9
+ gem install underlay
10
+
11
+ Then run:
12
+
13
+ underlay projectname
14
+
15
+ This will create a Rails app in `projectname` using the latest version of Rails.
16
+
17
+ ### Associated services
18
+
19
+ * Enable [Circle CI](https://circleci.com/) Continuous Integration
20
+ * Enable [GitHub auto deploys to Heroku staging and reviewapps](https://dashboard.heroku.com/apps/app-name-staging/deploy/github)
21
+ * Enable [Sentry](https://sentry.io/) Error Tracking
22
+
23
+ ## Packaged Gems
24
+
25
+ To see the latest and greatest gems, look at Underlay'
26
+ [Gemfile](templates/Gemfile.erb), which will be appended to the default
27
+ generated projectname/Gemfile.
28
+
29
+ It includes application gems like:
30
+
31
+ * [Autoprefixer Rails](https://github.com/ai/autoprefixer-rails) for CSS vendor prefixes
32
+ * [Flutie](https://github.com/thoughtbot/flutie) for `page_title` and `body_class` view
33
+ helpers
34
+ * [High Voltage](https://github.com/thoughtbot/high_voltage) for static pages
35
+ * [jQuery Rails](https://github.com/rails/jquery-rails) for jQuery
36
+ * [Normalize](https://necolas.github.io/normalize.css/) for resetting browser styles
37
+ * [Postgres](https://github.com/ged/ruby-pg) for access to the Postgres database
38
+ * [Sentry](https://github.com/getsentry/raven-ruby) for exception notification
39
+ * [Sidekiq](https://github.com/mperham/sidekiq) for background processing
40
+ * [Rack Canonical Host](https://github.com/tylerhunt/rack-canonical-host) to
41
+ ensure all requests are served from the same domain
42
+ * [Rack Timeout](https://github.com/heroku/rack-timeout) to abort requests that are
43
+ taking too long
44
+ * [Recipient Interceptor](https://github.com/croaky/recipient_interceptor) to
45
+ avoid accidentally sending emails to real people from staging
46
+ * [Simple Form](https://github.com/plataformatec/simple_form) for form markup
47
+ and style
48
+ * [Skylight](https://www.skylight.io/) for monitoring performance
49
+ * [Title](https://github.com/calebthompson/title) for storing titles in
50
+ translations
51
+ * [Puma](https://github.com/puma/puma) to serve HTTP requests
52
+
53
+ And development gems like:
54
+
55
+ * [Figaro](https://github.com/laserlemon/figaro) for loading environment variables
56
+ * [Pry Rails](https://github.com/rweng/pry-rails) for interactively exploring
57
+ objects
58
+ * [ByeBug](https://github.com/deivid-rodriguez/byebug) for interactively
59
+ debugging behavior
60
+ * [Bullet](https://github.com/flyerhzm/bullet) for help to kill N+1 queries and
61
+ unused eager loading
62
+ * [Bundler Audit](https://github.com/rubysec/bundler-audit) for scanning the
63
+ Gemfile for insecure dependencies based on published CVEs
64
+ * [Spring](https://github.com/rails/spring) for fast Rails actions via
65
+ pre-loading
66
+ * [Web Console](https://github.com/rails/web-console) for better debugging via
67
+ in-browser IRB consoles.
68
+
69
+ And testing gems like:
70
+
71
+ * [Capybara](https://github.com/jnicklas/capybara) and
72
+ * [Factory Bot](https://github.com/thoughtbot/factory_bot) for test data
73
+ * [Formulaic](https://github.com/thoughtbot/formulaic) for integration testing
74
+ HTML forms
75
+ * [Poltergeist](https://github.com/teampoltergeist/poltergeist) for
76
+ integration testing
77
+ * [RSpec](https://github.com/rspec/rspec) for unit testing
78
+ * [RSpec Mocks](https://github.com/rspec/rspec-mocks) for stubbing and spying
79
+ * [Shoulda Matchers](https://github.com/thoughtbot/shoulda-matchers) for common
80
+ RSpec matchers
81
+ * [Timecop](https://github.com/travisjeffery/timecop) for testing time
82
+
83
+ ## More Awesomeness
84
+
85
+ Underlay also comes with:
86
+
87
+ * The `./bin/setup` convention for new developer setup
88
+ * The `./bin/deploy` convention for deploying to Heroku
89
+ * Rails' flashes set up and in application layout
90
+ * A few nice time formats set up for localization
91
+ * `Rack::Deflater` to compress responses with Gzip
92
+ * A [low database connection pool limit][pool]
93
+ * Safe binstubs
94
+ * `t()` and `l()` in specs without prefixing with `I18n`
95
+ * An automatically-created `SECRET_KEY_BASE` environment variable in all
96
+ environments
97
+ * Configuration for [CircleCI][circle] Continuous Integration (tests)
98
+ * Configuration for [Sentry][sentry] error tracking
99
+ * The analytics adapter [Google Tag Manager][gtm]
100
+
101
+ [pool]: https://devcenter.heroku.com/articles/concurrency-and-database-connections
102
+ [circle]: https://circleci.com/docs
103
+ [gtm]: https://www.google.com/analytics/tag-manager/
104
+ [sentry]: https://sentry.io
105
+
106
+ ## Heroku
107
+
108
+ You can optionally create Heroku staging and production apps:
109
+
110
+ underlay app --heroku true
111
+
112
+ This:
113
+
114
+ * Creates a staging and production Heroku app
115
+ * Sets them as `staging` and `production` Git remotes
116
+ * Creates a [Heroku Pipeline] for review apps
117
+ * Schedules automated backups for 10AM UTC for both `staging` and `production`
118
+
119
+ [Heroku Pipeline]: https://devcenter.heroku.com/articles/pipelines
120
+
121
+ You can optionally specify alternate Heroku flags:
122
+
123
+ underlay app \
124
+ --heroku true \
125
+ --heroku-flags "--region eu --addons sendgrid,ssl"
126
+
127
+ See all possible Heroku flags:
128
+
129
+ heroku help create
130
+
131
+ ## Git
132
+
133
+ This will initialize a new git repository for your Rails app. You can
134
+ bypass this with the `--skip-git` option:
135
+
136
+ underlay app --skip-git true
137
+
138
+ ## GitHub
139
+
140
+ You can optionally create a GitHub repository for Rails app. It
141
+ requires that you have [Hub](https://github.com/github/hub) on your system:
142
+
143
+ curl http://hub.github.com/standalone -sLo ~/bin/hub && chmod +x ~/bin/hub
144
+ underlay app --github organization/project
145
+
146
+ This has the same effect as running:
147
+
148
+ hub create organization/project -p
149
+
150
+ ## Spring
151
+
152
+ Underlay uses [spring](https://github.com/rails/spring) by default.
153
+ It makes Rails applications load faster, but it might introduce confusing issues
154
+ around stale code not being refreshed.
155
+ If you think your application is running old code, run `spring stop`.
156
+ And if you'd rather not use spring, add `DISABLE_SPRING=1` to your login file.
157
+
158
+ ## Api
159
+
160
+ You can set app to API mode:
161
+
162
+ `underlay app --api true`
163
+
164
+ This creates API application without assets and action cable.
165
+
166
+ ## Dependencies
167
+
168
+ Underlay requires the latest version of Ruby.
169
+
170
+ PostgreSQL needs to be installed and running for the `db:create` rake task.
171
+
172
+ ## TODO
173
+
174
+ - [X] Install TwilioBase gem (if the option is set)
175
+ - [x] Remove duplicate application.html.erb layout
176
+ - [ ] Fix issue with flashes.scss partial not being added to assets
177
+ - [ ] Configure s3 buckets and ENV vars
178
+ - [ ] Manually check all files are created and in place
179
+ - [ ] Configure Redis on heroku (with config vars + initializer)
180
+ - [X] Update rake (in generated project) to run lints
181
+ - [X] Prevent views and static sites from generating in API mode
182
+ - [ ] Setup default front-end libraries and depencies
183
+ - [X] Setup .gitignore
184
+ - [X] Fix lograge Installation
185
+ - [X] Setup circle ci
186
+ - [X] Configure rspec to require spec_helper
187
+ - [X] Use factory_bot_rails instead of factory_bot
188
+ - [X] Create github repo
189
+ - [X] Fix rubocop and other linters offenses
190
+ - [ ] Publish gem
191
+
192
+ ## Kudos
193
+
194
+ This app was built on the foundations set out in
195
+ [Suspenders](https://github.com/thoughtbot/suspenders) by
196
+ [Thoughtbot](https://thoughtbot.com/).
197
+
198
+ ## Development
199
+
200
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/rake` to run the automated test suite.
201
+
202
+ To install this gem onto your local machine, run `bundle exec rake install`.
203
+
204
+ ## Contributing
205
+
206
+ Bug reports and pull requests are welcome on GitHub at https://github.com/DVELP/front_man. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
207
+
208
+
209
+ ## License
210
+
211
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
212
+
213
+ <br></br>
214
+ [![DVELP logo](https://raw.githubusercontent.com/DVELP/cookbook/master/assets/dvelp-logo.png 'DVELP logo')](http://dvelp.co.uk)
215
+
216
+ Seoable was created and is maintained by DVELP Ltd.
217
+
218
+ If you like what you see and would like to hire us or join us, [get in touch](http://dvelp.co.uk)!
data/RELEASING.md ADDED
@@ -0,0 +1,16 @@
1
+ # Releasing
2
+
3
+ 1. Update `lib/underlay/version.rb` file accordingly.
4
+ 2. Commit changes. There shouldn't be code changes, and thus CI doesn't need to
5
+ run, you can then add `[ci skip]` to the commit message.
6
+ 3. Tag the release: `git tag vVERSION -a -s`.
7
+ 4. Push changes: `git push --tags`
8
+ 5. Build and publish to rubygems:
9
+ ```bash
10
+ gem build underlay.gemspec
11
+ gem push underlay-*.gem
12
+ ```
13
+ 6. Add a new GitHub release:
14
+ https://github.com/DVELP/underlay/releases/new?tag=vVERSION
15
+ 9. Announce the new release, making sure to say "thank you" to the contributors
16
+ who helped shape this version!
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/setup'
4
+ require 'bundler/gem_tasks'
5
+ require 'rspec/core/rake_task'
6
+
7
+ RSpec::Core::RakeTask.new(:rspec)
8
+
9
+ desc 'Run the test suite'
10
+ task :default => :rspec
data/USAGE ADDED
@@ -0,0 +1,13 @@
1
+ Description:
2
+ Underlay is a Rails template with DVELP 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/DVELP/underlay
8
+
9
+ Example:
10
+ underlay ~/Code/weblog
11
+
12
+ This generates a Rails installation in ~/Code/weblog configured
13
+ with our preferred defaults.
data/bin/rake ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rake' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ load Gem.bin_path('rake', 'rake')
data/bin/rspec ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ 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/bin/underlay ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'pathname'
5
+
6
+ source_path = (Pathname.new(__FILE__).dirname + '../lib').expand_path
7
+ $LOAD_PATH << source_path
8
+
9
+ require 'underlay'
10
+
11
+ if ARGV.empty?
12
+ puts "Please provide a path for the new application"
13
+ puts
14
+ puts "See --help for more info"
15
+ exit 0
16
+ elsif ['-v', '--version'].include? ARGV[0]
17
+ puts Underlay::VERSION
18
+ exit 0
19
+ end
20
+
21
+ templates_root = File.expand_path(
22
+ File.join("..", "templates"),
23
+ File.dirname(__FILE__)
24
+ )
25
+ Underlay::AppGenerator.source_root templates_root
26
+ Underlay::AppGenerator.source_paths << Rails::Generators::AppGenerator
27
+ .source_root << templates_root
28
+
29
+ Underlay::AppGenerator.start
data/circle.yml ADDED
@@ -0,0 +1,3 @@
1
+ test:
2
+ override:
3
+ - bin/rake
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Underlay
4
+ module Actions
5
+ def replace_in_file(relative_path, find, replace)
6
+ path = File.join(destination_root, relative_path)
7
+ contents = IO.read(path)
8
+ unless contents.gsub!(find, replace)
9
+ raise "#{find.inspect} not found in #{relative_path}"
10
+ end
11
+
12
+ File.open(path, 'w') { |file| file.write(contents) }
13
+ end
14
+
15
+ def action_mailer_host(rails_env, host)
16
+ config = "config.action_mailer.default_url_options = { host: #{host} }"
17
+ configure_environment(rails_env, config)
18
+ end
19
+
20
+ def action_mailer_asset_host(rails_env, host)
21
+ config = "config.action_mailer.asset_host = #{host}"
22
+ configure_environment(rails_env, config)
23
+ end
24
+
25
+ def configure_application_file(config)
26
+ inject_into_file(
27
+ 'config/application.rb',
28
+ "\n\n #{config}",
29
+ before: "\n end"
30
+ )
31
+ end
32
+
33
+ def configure_environment(rails_env, config)
34
+ inject_into_file(
35
+ "config/environments/#{rails_env}.rb",
36
+ "\n #{config}",
37
+ before: "\nend"
38
+ )
39
+ end
40
+ end
41
+ end