suspenders-ocs 0.0.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 (75) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +11 -0
  5. data/CONTRIBUTING.md +51 -0
  6. data/Gemfile +3 -0
  7. data/LICENSE +21 -0
  8. data/NEWS.md +486 -0
  9. data/README.md +233 -0
  10. data/RELEASING.md +19 -0
  11. data/Rakefile +8 -0
  12. data/bin/rake +16 -0
  13. data/bin/rspec +16 -0
  14. data/bin/setup +13 -0
  15. data/bin/suspenders +23 -0
  16. data/lib/suspenders.rb +5 -0
  17. data/lib/suspenders/actions.rb +33 -0
  18. data/lib/suspenders/adapters/heroku.rb +125 -0
  19. data/lib/suspenders/app_builder.rb +523 -0
  20. data/lib/suspenders/generators/app_generator.rb +269 -0
  21. data/lib/suspenders/version.rb +5 -0
  22. data/spec/adapters/heroku_spec.rb +52 -0
  23. data/spec/fakes/bin/heroku +5 -0
  24. data/spec/fakes/bin/hub +5 -0
  25. data/spec/features/github_spec.rb +15 -0
  26. data/spec/features/heroku_spec.rb +93 -0
  27. data/spec/features/new_project_spec.rb +234 -0
  28. data/spec/spec_helper.rb +20 -0
  29. data/spec/support/fake_github.rb +21 -0
  30. data/spec/support/fake_heroku.rb +53 -0
  31. data/spec/support/suspenders.rb +58 -0
  32. data/suspenders.gemspec +34 -0
  33. data/templates/Gemfile.erb +63 -0
  34. data/templates/Procfile +2 -0
  35. data/templates/README.md.erb +28 -0
  36. data/templates/_analytics.html.erb +7 -0
  37. data/templates/_css_overrides.html.erb +8 -0
  38. data/templates/_flashes.html.erb +7 -0
  39. data/templates/_javascript.html.erb +12 -0
  40. data/templates/action_mailer.rb +5 -0
  41. data/templates/app.json.erb +42 -0
  42. data/templates/application.scss +9 -0
  43. data/templates/bin_deploy +12 -0
  44. data/templates/bin_setup +21 -0
  45. data/templates/bin_setup_review_app.erb +19 -0
  46. data/templates/browserslist +3 -0
  47. data/templates/bundler_audit.rake +12 -0
  48. data/templates/capybara_webkit.rb +5 -0
  49. data/templates/circle.yml.erb +6 -0
  50. data/templates/config_locales_en.yml.erb +19 -0
  51. data/templates/database_cleaner_rspec.rb +21 -0
  52. data/templates/dev.rake +12 -0
  53. data/templates/disable_xml_params.rb +1 -0
  54. data/templates/dotfiles/.ctags +2 -0
  55. data/templates/dotfiles/.env +13 -0
  56. data/templates/errors.rb +34 -0
  57. data/templates/factories.rb +2 -0
  58. data/templates/factory_girl_rspec.rb +3 -0
  59. data/templates/flashes_helper.rb +5 -0
  60. data/templates/hound.yml +14 -0
  61. data/templates/i18n.rb +3 -0
  62. data/templates/json_encoding.rb +1 -0
  63. data/templates/newrelic.yml.erb +34 -0
  64. data/templates/postgresql_database.yml.erb +21 -0
  65. data/templates/puma.rb +28 -0
  66. data/templates/rack_mini_profiler.rb +5 -0
  67. data/templates/rails_helper.rb +22 -0
  68. data/templates/secrets.yml +14 -0
  69. data/templates/shoulda_matchers_config_rspec.rb +6 -0
  70. data/templates/smtp.rb +9 -0
  71. data/templates/spec_helper.rb +29 -0
  72. data/templates/staging.rb +5 -0
  73. data/templates/suspenders_gitignore +13 -0
  74. data/templates/suspenders_layout.html.erb.erb +22 -0
  75. metadata +204 -0
@@ -0,0 +1,2 @@
1
+ web: bundle exec puma -p $PORT -C ./config/puma.rb
2
+ worker: bundle exec rake jobs:work
@@ -0,0 +1,28 @@
1
+ # <%= app_name.humanize %>
2
+
3
+ ## Getting Started
4
+
5
+ After you have cloned this repo, run this setup script to set up your machine
6
+ with the necessary dependencies to run and test this app:
7
+
8
+ % ./bin/setup
9
+
10
+ It assumes you have a machine equipped with Ruby, Postgres, etc. If not, set up
11
+ your machine with [this script].
12
+
13
+ [this script]: https://github.com/thoughtbot/laptop
14
+
15
+ After setting up, you can run the application using [Heroku Local]:
16
+
17
+ % heroku local
18
+
19
+ [Heroku Local]: https://devcenter.heroku.com/articles/heroku-local
20
+
21
+ ## Guidelines
22
+
23
+ Use the following guides for getting things done, programming well, and
24
+ programming in style.
25
+
26
+ * [Protocol](http://github.com/thoughtbot/guides/blob/master/protocol)
27
+ * [Best Practices](http://github.com/thoughtbot/guides/blob/master/best-practices)
28
+ * [Style](http://github.com/thoughtbot/guides/blob/master/style)
@@ -0,0 +1,7 @@
1
+ <% if ENV["SEGMENT_KEY"] %>
2
+ <script type="text/javascript">
3
+ window.analytics=window.analytics||[],window.analytics.methods=["identify","group","track","page","pageview","alias","ready","on","once","off","trackLink","trackForm","trackClick","trackSubmit"],window.analytics.factory=function(t){return function(){var a=Array.prototype.slice.call(arguments);return a.unshift(t),window.analytics.push(a),window.analytics}};for(var i=0;i<window.analytics.methods.length;i++){var key=window.analytics.methods[i];window.analytics[key]=window.analytics.factory(key)}window.analytics.load=function(t){if(!document.getElementById("analytics-js")){var a=document.createElement("script");a.type="text/javascript",a.id="analytics-js",a.async=!0,a.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n)}},window.analytics.SNIPPET_VERSION="2.0.9",
4
+ window.analytics.load("<%= ENV["SEGMENT_KEY"] %>");
5
+ window.analytics.page();
6
+ </script>
7
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <% if Rails.env.test? %>
2
+ <style type="text/css">
3
+ * {
4
+ transition-property: none !important;
5
+ -webkit-transition-property: none !important;
6
+ }
7
+ </style>
8
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <% if flash.any? %>
2
+ <div class="flashes">
3
+ <% user_facing_flashes.each do |key, value| -%>
4
+ <div class="flash-<%= key %>"><%= value %></div>
5
+ <% end -%>
6
+ </div>
7
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <%= javascript_include_tag :application %>
2
+
3
+ <%= yield :javascript %>
4
+
5
+ <%= render "analytics" %>
6
+
7
+ <% if Rails.env.test? %>
8
+ <%= javascript_tag do %>
9
+ $.fx.off = true;
10
+ $.ajaxSetup({ async: false });
11
+ <% end %>
12
+ <% end %>
@@ -0,0 +1,5 @@
1
+ RSpec.configure do |config|
2
+ config.before(:each) do
3
+ ActionMailer::Base.deliveries.clear
4
+ end
5
+ end
@@ -0,0 +1,42 @@
1
+ {
2
+ "name":"<%= app_name.dasherize %>",
3
+ "scripts":{},
4
+ "env":{
5
+ "APPLICATION_HOST":{
6
+ "required":true
7
+ },
8
+ "EMAIL_RECIPIENTS":{
9
+ "required":true
10
+ },
11
+ "HEROKU_APP_NAME": {
12
+ "required":true
13
+ },
14
+ "HEROKU_PARENT_APP_NAME": {
15
+ "required":true
16
+ },
17
+ "RACK_ENV":{
18
+ "required":true
19
+ },
20
+ "SECRET_KEY_BASE":{
21
+ "generator":"secret"
22
+ },
23
+ "SMTP_ADDRESS":{
24
+ "required":true
25
+ },
26
+ "SMTP_DOMAIN":{
27
+ "required":true
28
+ },
29
+ "SMTP_PASSWORD":{
30
+ "required":true
31
+ },
32
+ "SMTP_USERNAME":{
33
+ "required":true
34
+ },
35
+ "WEB_CONCURRENCY":{
36
+ "required":true
37
+ }
38
+ },
39
+ "addons":[
40
+ "heroku-postgresql"
41
+ ]
42
+ }
@@ -0,0 +1,9 @@
1
+ @charset "utf-8";
2
+
3
+ @import "normalize-rails";
4
+
5
+ @import "bourbon";
6
+ @import "neat";
7
+
8
+ @import "base/base";
9
+ @import "refills/flashes";
@@ -0,0 +1,12 @@
1
+ #!/bin/sh
2
+
3
+ # Run this script to deploy the app to Heroku.
4
+
5
+ set -e
6
+
7
+ branch="$(git symbolic-ref HEAD --short)"
8
+ target="${1:-staging}"
9
+
10
+ git push "$target" "$branch:master"
11
+ heroku run rake db:migrate --remote "$target"
12
+ heroku restart --remote "$target"
@@ -0,0 +1,21 @@
1
+ #!/bin/sh
2
+
3
+ # Set up Rails app. Run this script immediately after cloning the codebase.
4
+ # https://github.com/thoughtbot/guides/tree/master/protocol
5
+
6
+ # Exit if any subcommand fails
7
+ set -e
8
+
9
+ # Set up Ruby dependencies via Bundler
10
+ gem install bundler --conservative
11
+ bundle check || bundle install
12
+
13
+ # Set up database and add any development seed data
14
+ bin/rake dev:prime
15
+
16
+ # Add binstubs to PATH via export PATH=".git/safe/../../bin:$PATH" in ~/.zshenv
17
+ mkdir -p .git/safe
18
+
19
+ # Only if this isn't CI
20
+ # if [ -z "$CI" ]; then
21
+ # fi
@@ -0,0 +1,19 @@
1
+ #!/bin/sh
2
+
3
+ # Run this script to set up a review app's database and worker dyno
4
+
5
+ set -e
6
+
7
+ if [ -z "$1" ]; then
8
+ printf "You must provide a review app (same as the pull request) id.\n"
9
+ exit 64
10
+ fi
11
+
12
+ heroku pg:backups restore \
13
+ `heroku pg:backups public-url -a <%= app_name.dasherize %>-staging` \
14
+ DATABASE_URL \
15
+ --confirm <%= app_name.dasherize %>-staging-pr-$1 \
16
+ --app <%= app_name.dasherize %>-staging-pr-$1
17
+ heroku run rake db:migrate --app <%= app_name.dasherize %>-staging-pr-$1
18
+ heroku ps:scale worker=1 --app <%= app_name.dasherize %>-staging-pr-$1
19
+ heroku restart --app <%= app_name.dasherize %>-staging-pr-$1
@@ -0,0 +1,3 @@
1
+ Last 2 versions
2
+ Explorer >= 11
3
+ Android >= 4.4
@@ -0,0 +1,12 @@
1
+ if Rails.env.development? || Rails.env.test?
2
+ require "bundler/audit/cli"
3
+
4
+ namespace :bundler do
5
+ desc "Updates the ruby-advisory-db and runs audit"
6
+ task :audit do
7
+ %w(update check).each do |command|
8
+ Bundler::Audit::CLI.start [command]
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ Capybara.javascript_driver = :webkit
2
+
3
+ Capybara::Webkit.configure do |config|
4
+ config.block_unknown_urls
5
+ end
@@ -0,0 +1,6 @@
1
+ database:
2
+ override:
3
+ - bin/setup
4
+ test:
5
+ override:
6
+ - COVERAGE=true bin/rake
@@ -0,0 +1,19 @@
1
+ en:
2
+ date:
3
+ formats:
4
+ default:
5
+ "%m/%d/%Y"
6
+ with_weekday:
7
+ "%a %m/%d/%y"
8
+
9
+ time:
10
+ formats:
11
+ default:
12
+ "%a, %b %-d, %Y at %r"
13
+ date:
14
+ "%b %-d, %Y"
15
+ short:
16
+ "%B %d"
17
+
18
+ titles:
19
+ application: <%= app_name.humanize %>
@@ -0,0 +1,21 @@
1
+ RSpec.configure do |config|
2
+ config.before(:suite) do
3
+ DatabaseCleaner.clean_with(:deletion)
4
+ end
5
+
6
+ config.before(:each) do
7
+ DatabaseCleaner.strategy = :transaction
8
+ end
9
+
10
+ config.before(:each, js: true) do
11
+ DatabaseCleaner.strategy = :deletion
12
+ end
13
+
14
+ config.before(:each) do
15
+ DatabaseCleaner.start
16
+ end
17
+
18
+ config.after(:each) do
19
+ DatabaseCleaner.clean
20
+ end
21
+ end
@@ -0,0 +1,12 @@
1
+ if Rails.env.development? || Rails.env.test?
2
+ require "factory_girl"
3
+
4
+ namespace :dev do
5
+ desc "Sample data for local development environment"
6
+ task prime: "db:setup" do
7
+ include FactoryGirl::Syntax::Methods
8
+
9
+ # create(:user, email: "user@example.com", password: "password")
10
+ end
11
+ end
12
+ end
@@ -0,0 +1 @@
1
+ ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML)
@@ -0,0 +1,2 @@
1
+ --recurse=yes
2
+ --exclude=vendor
@@ -0,0 +1,13 @@
1
+ # https://github.com/ddollar/forego
2
+ ASSET_HOST=localhost:3000
3
+ APPLICATION_HOST=localhost:3000
4
+ PORT=3000
5
+ RACK_ENV=development
6
+ RACK_MINI_PROFILER=0
7
+ SECRET_KEY_BASE=development_secret
8
+ EXECJS_RUNTIME=Node
9
+ SMTP_ADDRESS=smtp.example.com
10
+ SMTP_DOMAIN=example.com
11
+ SMTP_PASSWORD=password
12
+ SMTP_USERNAME=username
13
+ WEB_CONCURRENCY=1
@@ -0,0 +1,34 @@
1
+ require "net/http"
2
+ require "net/smtp"
3
+
4
+ # Example:
5
+ # begin
6
+ # some http call
7
+ # rescue *HTTP_ERRORS => error
8
+ # notify_hoptoad error
9
+ # end
10
+
11
+ HTTP_ERRORS = [
12
+ EOFError,
13
+ Errno::ECONNRESET,
14
+ Errno::EINVAL,
15
+ Net::HTTPBadResponse,
16
+ Net::HTTPHeaderSyntaxError,
17
+ Net::ProtocolError,
18
+ Timeout::Error,
19
+ ]
20
+
21
+ SMTP_SERVER_ERRORS = [
22
+ IOError,
23
+ Net::SMTPAuthenticationError,
24
+ Net::SMTPServerBusy,
25
+ Net::SMTPUnknownError,
26
+ Timeout::Error,
27
+ ]
28
+
29
+ SMTP_CLIENT_ERRORS = [
30
+ Net::SMTPFatalError,
31
+ Net::SMTPSyntaxError,
32
+ ]
33
+
34
+ SMTP_ERRORS = SMTP_SERVER_ERRORS + SMTP_CLIENT_ERRORS
@@ -0,0 +1,2 @@
1
+ FactoryGirl.define do
2
+ end
@@ -0,0 +1,3 @@
1
+ RSpec.configure do |config|
2
+ config.include FactoryGirl::Syntax::Methods
3
+ end
@@ -0,0 +1,5 @@
1
+ module FlashesHelper
2
+ def user_facing_flashes
3
+ flash.to_hash.slice("alert", "error", "notice", "success")
4
+ end
5
+ end
@@ -0,0 +1,14 @@
1
+ # See https://houndci.com/configuration for help.
2
+ haml:
3
+ # config_file: .haml-style.yml
4
+ enabled: true
5
+ javascript:
6
+ # config_file: .javascript-style.json
7
+ enabled: true
8
+ # ignore_file: .javascript_ignore
9
+ ruby:
10
+ # config_file: .ruby-style.yml
11
+ enabled: true
12
+ scss:
13
+ # config_file: .scss-style.yml
14
+ enabled: true
data/templates/i18n.rb ADDED
@@ -0,0 +1,3 @@
1
+ RSpec.configure do |config|
2
+ config.include ActionView::Helpers::TranslationHelper
3
+ end
@@ -0,0 +1 @@
1
+ ActiveSupport::JSON::Encoding.time_precision = 0
@@ -0,0 +1,34 @@
1
+ common: &default_settings
2
+ app_name: "<%= app_name %>"
3
+ audit_log:
4
+ enabled: false
5
+ browser_monitoring:
6
+ auto_instrument: true
7
+ capture_params: false
8
+ developer_mode: false
9
+ error_collector:
10
+ capture_source: true
11
+ enabled: true
12
+ ignore_errors: "ActionController::RoutingError,Sinatra::NotFound"
13
+ license_key: "<%%= ENV["NEW_RELIC_LICENSE_KEY"] %>"
14
+ log_level: info
15
+ monitor_mode: true
16
+ transaction_tracer:
17
+ enabled: true
18
+ record_sql: obfuscated
19
+ stack_trace_threshold: 0.500
20
+ transaction_threshold: apdex_f
21
+ development:
22
+ <<: *default_settings
23
+ monitor_mode: false
24
+ developer_mode: true
25
+ test:
26
+ <<: *default_settings
27
+ monitor_mode: false
28
+ production:
29
+ <<: *default_settings
30
+ monitor_mode: true
31
+ staging:
32
+ <<: *default_settings
33
+ app_name: "<%= app_name %> (Staging)"
34
+ monitor_mode: true
@@ -0,0 +1,21 @@
1
+ development: &default
2
+ adapter: postgresql
3
+ database: <%= app_name %>_development
4
+ encoding: utf8
5
+ min_messages: warning
6
+ pool: <%%= Integer(ENV.fetch("DB_POOL", 5)) %>
7
+ reaping_frequency: <%%= Integer(ENV.fetch("DB_REAPING_FREQUENCY", 10)) %>
8
+ timeout: 5000
9
+
10
+ test:
11
+ <<: *default
12
+ database: <%= app_name %>_test
13
+
14
+ production: &deploy
15
+ encoding: utf8
16
+ min_messages: warning
17
+ pool: <%%= [Integer(ENV.fetch("MAX_THREADS", 5)), Integer(ENV.fetch("DB_POOL", 5))].max %>
18
+ timeout: 5000
19
+ url: <%%= ENV.fetch("DATABASE_URL", "") %>
20
+
21
+ staging: *deploy