jetfuel 1.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +11 -0
  5. data/CONTRIBUTING.md +36 -0
  6. data/Gemfile +3 -0
  7. data/Gemfile.lock +131 -0
  8. data/LICENSE +21 -0
  9. data/NEWS.md +246 -0
  10. data/README.md +191 -0
  11. data/Rakefile +8 -0
  12. data/bin/jetfuel +18 -0
  13. data/bin/rake +16 -0
  14. data/bin/rspec +16 -0
  15. data/bin/setup +13 -0
  16. data/jetfuel.gemspec +37 -0
  17. data/lib/jetfuel/actions.rb +25 -0
  18. data/lib/jetfuel/app_builder.rb +400 -0
  19. data/lib/jetfuel/generators/app_generator.rb +227 -0
  20. data/lib/jetfuel/version.rb +5 -0
  21. data/lib/jetfuel.rb +4 -0
  22. data/spec/fakes/bin/heroku +5 -0
  23. data/spec/fakes/bin/hub +5 -0
  24. data/spec/features/github_spec.rb +10 -0
  25. data/spec/features/heroku_spec.rb +19 -0
  26. data/spec/features/new_project_spec.rb +68 -0
  27. data/spec/spec_helper.rb +24 -0
  28. data/spec/support/fake_github.rb +21 -0
  29. data/spec/support/fake_heroku.rb +38 -0
  30. data/spec/support/jetfuel.rb +49 -0
  31. data/templates/Brewfile +2 -0
  32. data/templates/Gemfile.erb +51 -0
  33. data/templates/Procfile +2 -0
  34. data/templates/README.md.erb +25 -0
  35. data/templates/_analytics.html.erb +7 -0
  36. data/templates/_flashes.html.erb +8 -0
  37. data/templates/_javascript.html.erb +12 -0
  38. data/templates/action_mailer.rb +5 -0
  39. data/templates/application.css.scss +7 -0
  40. data/templates/application_helper.rb +9 -0
  41. data/templates/background_jobs_rspec.rb +19 -0
  42. data/templates/bin_setup +32 -0
  43. data/templates/config_locales_en.yml +11 -0
  44. data/templates/database_cleaner_rspec.rb +21 -0
  45. data/templates/development_seeds.rb +13 -0
  46. data/templates/devise.rb +257 -0
  47. data/templates/disable_xml_params.rb +3 -0
  48. data/templates/errors.rb +28 -0
  49. data/templates/factory_girl_rspec.rb +3 -0
  50. data/templates/flashes.css.scss +4 -0
  51. data/templates/i18n.rb +3 -0
  52. data/templates/newrelic.yml.erb +34 -0
  53. data/templates/postgresql_database.yml.erb +12 -0
  54. data/templates/rack_timeout.rb +1 -0
  55. data/templates/sample.env +3 -0
  56. data/templates/secrets.yml +14 -0
  57. data/templates/smtp.rb +9 -0
  58. data/templates/spec_helper.rb +32 -0
  59. data/templates/staging.rb +5 -0
  60. data/templates/suspenders_gitignore +13 -0
  61. data/templates/suspenders_layout.html.erb.erb +16 -0
  62. data/templates/travis.yml.erb +31 -0
  63. data/templates/unicorn.rb +30 -0
  64. metadata +211 -0
@@ -0,0 +1,11 @@
1
+ en:
2
+ date:
3
+ formats:
4
+ default: '%m/%d/%Y'
5
+ with_weekday: '%a %m/%d/%y'
6
+
7
+ time:
8
+ formats:
9
+ default: '%a, %b %-d, %Y at %r'
10
+ date: '%b %-d, %Y'
11
+ short: '%B %d'
@@ -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,13 @@
1
+ if Rails.env.development?
2
+ require 'factory_girl'
3
+
4
+ namespace :dev do
5
+ desc 'Seed data for development environment'
6
+ task prime: 'db:setup' do
7
+ FactoryGirl.find_definitions
8
+ include FactoryGirl::Syntax::Methods
9
+
10
+ # create(:user, email: 'user@example.com', password: 'password')
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,257 @@
1
+ # Use this hook to configure devise mailer, warden hooks and so forth.
2
+ # Many of these configuration options can be set straight in your model.
3
+ Devise.setup do |config|
4
+ # The secret key used by Devise. Devise uses this key to generate
5
+ # random tokens. Changing this key will render invalid all existing
6
+ # confirmation, reset password and unlock tokens in the database.
7
+ # config.secret_key = 'afa7efc91e2f4ef9c31474e2a523805c32280219154ec2d1a27697031ed52f36a32f064fd0ead0602173cb41de11efdec66a5d0e903caed6cfb979137a5654d2'
8
+ config.secret_key = ENV['SECRET_KEY_BASE']
9
+
10
+ # ==> Mailer Configuration
11
+ # Configure the e-mail address which will be shown in Devise::Mailer,
12
+ # note that it will be overwritten if you use your own mailer class
13
+ # with default "from" parameter.
14
+ config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
15
+
16
+ # Configure the class responsible to send e-mails.
17
+ # config.mailer = 'Devise::Mailer'
18
+
19
+ # ==> ORM configuration
20
+ # Load and configure the ORM. Supports :active_record (default) and
21
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
22
+ # available as additional gems.
23
+ require 'devise/orm/active_record'
24
+
25
+ # ==> Configuration for any authentication mechanism
26
+ # Configure which keys are used when authenticating a user. The default is
27
+ # just :email. You can configure it to use [:username, :subdomain], so for
28
+ # authenticating a user, both parameters are required. Remember that those
29
+ # parameters are used only when authenticating and not when retrieving from
30
+ # session. If you need permissions, you should implement that in a before filter.
31
+ # You can also supply a hash where the value is a boolean determining whether
32
+ # or not authentication should be aborted when the value is not present.
33
+ # config.authentication_keys = [ :email ]
34
+
35
+ # Configure parameters from the request object used for authentication. Each entry
36
+ # given should be a request method and it will automatically be passed to the
37
+ # find_for_authentication method and considered in your model lookup. For instance,
38
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
39
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
40
+ # config.request_keys = []
41
+
42
+ # Configure which authentication keys should be case-insensitive.
43
+ # These keys will be downcased upon creating or modifying a user and when used
44
+ # to authenticate or find a user. Default is :email.
45
+ config.case_insensitive_keys = [ :email ]
46
+
47
+ # Configure which authentication keys should have whitespace stripped.
48
+ # These keys will have whitespace before and after removed upon creating or
49
+ # modifying a user and when used to authenticate or find a user. Default is :email.
50
+ config.strip_whitespace_keys = [ :email ]
51
+
52
+ # Tell if authentication through request.params is enabled. True by default.
53
+ # It can be set to an array that will enable params authentication only for the
54
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
55
+ # enable it only for database (email + password) authentication.
56
+ # config.params_authenticatable = true
57
+
58
+ # Tell if authentication through HTTP Auth is enabled. False by default.
59
+ # It can be set to an array that will enable http authentication only for the
60
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
61
+ # enable it only for database authentication. The supported strategies are:
62
+ # :database = Support basic authentication with authentication key + password
63
+ # config.http_authenticatable = false
64
+
65
+ # If http headers should be returned for AJAX requests. True by default.
66
+ # config.http_authenticatable_on_xhr = true
67
+
68
+ # The realm used in Http Basic Authentication. 'Application' by default.
69
+ # config.http_authentication_realm = 'Application'
70
+
71
+ # It will change confirmation, password recovery and other workflows
72
+ # to behave the same regardless if the e-mail provided was right or wrong.
73
+ # Does not affect registerable.
74
+ # config.paranoid = true
75
+
76
+ # By default Devise will store the user in session. You can skip storage for
77
+ # particular strategies by setting this option.
78
+ # Notice that if you are skipping storage for all authentication paths, you
79
+ # may want to disable generating routes to Devise's sessions controller by
80
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
81
+ config.skip_session_storage = [:http_auth]
82
+
83
+ # By default, Devise cleans up the CSRF token on authentication to
84
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
85
+ # requests for sign in and sign up, you need to get a new CSRF token
86
+ # from the server. You can disable this option at your own risk.
87
+ # config.clean_up_csrf_token_on_authentication = true
88
+
89
+ # ==> Configuration for :database_authenticatable
90
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
91
+ # using other encryptors, it sets how many times you want the password re-encrypted.
92
+ #
93
+ # Limiting the stretches to just one in testing will increase the performance of
94
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
95
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
96
+ # encryptor), the cost increases exponentially with the number of stretches (e.g.
97
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
98
+ config.stretches = Rails.env.test? ? 1 : 10
99
+
100
+ # Setup a pepper to generate the encrypted password.
101
+ # config.pepper = '91830fa2ce641b68b64584807d96d1845f083ee1b107041e93b9be91bf5996e64d385e0dbf138aa7d16b7961e753470fdf755c702e3e9c28ddee98f221564cf0'
102
+
103
+ # ==> Configuration for :confirmable
104
+ # A period that the user is allowed to access the website even without
105
+ # confirming their account. For instance, if set to 2.days, the user will be
106
+ # able to access the website for two days without confirming their account,
107
+ # access will be blocked just in the third day. Default is 0.days, meaning
108
+ # the user cannot access the website without confirming their account.
109
+ # config.allow_unconfirmed_access_for = 2.days
110
+
111
+ # A period that the user is allowed to confirm their account before their
112
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
113
+ # their account within 3 days after the mail was sent, but on the fourth day
114
+ # their account can't be confirmed with the token any more.
115
+ # Default is nil, meaning there is no restriction on how long a user can take
116
+ # before confirming their account.
117
+ # config.confirm_within = 3.days
118
+
119
+ # If true, requires any email changes to be confirmed (exactly the same way as
120
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
121
+ # db field (see migrations). Until confirmed, new email is stored in
122
+ # unconfirmed_email column, and copied to email column on successful confirmation.
123
+ config.reconfirmable = true
124
+
125
+ # Defines which key will be used when confirming an account
126
+ # config.confirmation_keys = [ :email ]
127
+
128
+ # ==> Configuration for :rememberable
129
+ # The time the user will be remembered without asking for credentials again.
130
+ # config.remember_for = 2.weeks
131
+
132
+ # If true, extends the user's remember period when remembered via cookie.
133
+ # config.extend_remember_period = false
134
+
135
+ # Options to be passed to the created cookie. For instance, you can set
136
+ # secure: true in order to force SSL only cookies.
137
+ # config.rememberable_options = {}
138
+
139
+ # ==> Configuration for :validatable
140
+ # Range for password length.
141
+ config.password_length = 8..128
142
+
143
+ # Email regex used to validate email formats. It simply asserts that
144
+ # one (and only one) @ exists in the given string. This is mainly
145
+ # to give user feedback and not to assert the e-mail validity.
146
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
147
+
148
+ # ==> Configuration for :timeoutable
149
+ # The time you want to timeout the user session without activity. After this
150
+ # time the user will be asked for credentials again. Default is 30 minutes.
151
+ # config.timeout_in = 30.minutes
152
+
153
+ # If true, expires auth token on session timeout.
154
+ # config.expire_auth_token_on_timeout = false
155
+
156
+ # ==> Configuration for :lockable
157
+ # Defines which strategy will be used to lock an account.
158
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
159
+ # :none = No lock strategy. You should handle locking by yourself.
160
+ # config.lock_strategy = :failed_attempts
161
+
162
+ # Defines which key will be used when locking and unlocking an account
163
+ # config.unlock_keys = [ :email ]
164
+
165
+ # Defines which strategy will be used to unlock an account.
166
+ # :email = Sends an unlock link to the user email
167
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
168
+ # :both = Enables both strategies
169
+ # :none = No unlock strategy. You should handle unlocking by yourself.
170
+ # config.unlock_strategy = :both
171
+
172
+ # Number of authentication tries before locking an account if lock_strategy
173
+ # is failed attempts.
174
+ # config.maximum_attempts = 20
175
+
176
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
177
+ # config.unlock_in = 1.hour
178
+
179
+ # Warn on the last attempt before the account is locked.
180
+ # config.last_attempt_warning = false
181
+
182
+ # ==> Configuration for :recoverable
183
+ #
184
+ # Defines which key will be used when recovering the password for an account
185
+ # config.reset_password_keys = [ :email ]
186
+
187
+ # Time interval you can reset your password with a reset password key.
188
+ # Don't put a too small interval or your users won't have the time to
189
+ # change their passwords.
190
+ config.reset_password_within = 6.hours
191
+
192
+ # ==> Configuration for :encryptable
193
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
194
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
195
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
196
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
197
+ # REST_AUTH_SITE_KEY to pepper).
198
+ #
199
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
200
+ # config.encryptor = :sha512
201
+
202
+ # ==> Scopes configuration
203
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
204
+ # "users/sessions/new". It's turned off by default because it's slower if you
205
+ # are using only default views.
206
+ # config.scoped_views = false
207
+
208
+ # Configure the default scope given to Warden. By default it's the first
209
+ # devise role declared in your routes (usually :user).
210
+ # config.default_scope = :user
211
+
212
+ # Set this configuration to false if you want /users/sign_out to sign out
213
+ # only the current scope. By default, Devise signs out all scopes.
214
+ # config.sign_out_all_scopes = true
215
+
216
+ # ==> Navigation configuration
217
+ # Lists the formats that should be treated as navigational. Formats like
218
+ # :html, should redirect to the sign in page when the user does not have
219
+ # access, but formats like :xml or :json, should return 401.
220
+ #
221
+ # If you have any extra navigational formats, like :iphone or :mobile, you
222
+ # should add them to the navigational formats lists.
223
+ #
224
+ # The "*/*" below is required to match Internet Explorer requests.
225
+ # config.navigational_formats = ['*/*', :html]
226
+
227
+ # The default HTTP method used to sign out a resource. Default is :delete.
228
+ config.sign_out_via = :delete
229
+
230
+ # ==> OmniAuth
231
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
232
+ # up on your models and hooks.
233
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
234
+
235
+ # ==> Warden configuration
236
+ # If you want to use other strategies, that are not supported by Devise, or
237
+ # change the failure app, you can configure them inside the config.warden block.
238
+ #
239
+ # config.warden do |manager|
240
+ # manager.intercept_401 = false
241
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
242
+ # end
243
+
244
+ # ==> Mountable engine configurations
245
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
246
+ # is mountable, there are some extra configurations to be taken into account.
247
+ # The following options are available, assuming the engine is mounted as:
248
+ #
249
+ # mount MyEngine, at: '/my_engine'
250
+ #
251
+ # The router that invoked `devise_for`, in the example above, would be:
252
+ # config.router_name = :my_engine
253
+ #
254
+ # When using omniauth, Devise cannot automatically set Omniauth path,
255
+ # so you need to do it manually. For the users scope, it would be:
256
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
257
+ end
@@ -0,0 +1,3 @@
1
+ # Protect against injection attacks
2
+ # http://www.kb.cert.org/vuls/id/380039
3
+ ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML)
@@ -0,0 +1,28 @@
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 = [Timeout::Error,
12
+ Errno::EINVAL,
13
+ Errno::ECONNRESET,
14
+ EOFError,
15
+ Net::HTTPBadResponse,
16
+ Net::HTTPHeaderSyntaxError,
17
+ Net::ProtocolError]
18
+
19
+ SMTP_SERVER_ERRORS = [TimeoutError,
20
+ IOError,
21
+ Net::SMTPUnknownError,
22
+ Net::SMTPServerBusy,
23
+ Net::SMTPAuthenticationError]
24
+
25
+ SMTP_CLIENT_ERRORS = [Net::SMTPFatalError,
26
+ Net::SMTPSyntaxError]
27
+
28
+ SMTP_ERRORS = SMTP_SERVER_ERRORS + SMTP_CLIENT_ERRORS
@@ -0,0 +1,3 @@
1
+ RSpec.configure do |config|
2
+ config.include FactoryGirl::Syntax::Methods
3
+ end
@@ -0,0 +1,4 @@
1
+ .flash {
2
+ @include border-top-radius(0px);
3
+ @include border-bottom-radius(0px);
4
+ }
data/templates/i18n.rb ADDED
@@ -0,0 +1,3 @@
1
+ RSpec.configure do |config|
2
+ config.include AbstractController::Translation
3
+ end
@@ -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,12 @@
1
+ development: &default
2
+ adapter: postgresql
3
+ database: <%= app_name %>_development
4
+ encoding: utf8
5
+ host: localhost
6
+ min_messages: warning
7
+ pool: 2
8
+ timeout: 5000
9
+
10
+ test:
11
+ <<: *default
12
+ database: <%= app_name %>_test
@@ -0,0 +1 @@
1
+ Rack::Timeout.timeout = (ENV['TIMEOUT_IN_SECONDS'] || 5).to_i
@@ -0,0 +1,3 @@
1
+ # http://ddollar.github.com/foreman/
2
+ RACK_ENV=development
3
+ SECRET_KEY_BASE=development_secret
@@ -0,0 +1,14 @@
1
+ default: &default
2
+ secret_key_base: <%%= ENV['SECRET_KEY_BASE'] %>
3
+
4
+ development:
5
+ <<: *default
6
+
7
+ test:
8
+ <<: *default
9
+
10
+ staging:
11
+ <<: *default
12
+
13
+ production:
14
+ <<: *default
data/templates/smtp.rb ADDED
@@ -0,0 +1,9 @@
1
+ SMTP_SETTINGS = {
2
+ address: ENV.fetch('SMTP_ADDRESS'), # example: 'smtp.sendgrid.net'
3
+ authentication: :plain,
4
+ domain: ENV.fetch('SMTP_DOMAIN'), # example: 'this-app.com'
5
+ enable_starttls_auto: true,
6
+ password: ENV.fetch('SMTP_PASSWORD'),
7
+ port: '587',
8
+ user_name: ENV.fetch('SMTP_USERNAME')
9
+ }
@@ -0,0 +1,32 @@
1
+ ENV['RAILS_ENV'] = 'test'
2
+
3
+ require File.expand_path('../../config/environment', __FILE__)
4
+
5
+ require 'rspec/rails'
6
+ require 'shoulda/matchers'
7
+ require 'webmock/rspec'
8
+
9
+ Dir[Rails.root.join('spec/support/**/*.rb')].each { |file| require file }
10
+
11
+ module Features
12
+ # Extend this module in spec/support/features/*.rb
13
+ end
14
+
15
+ RSpec.configure do |config|
16
+ config.expect_with :rspec do |c|
17
+ c.syntax = :expect
18
+ end
19
+
20
+ config.include Features, type: :feature
21
+ config.include Formulaic::Dsl, type: :feature
22
+ config.include Devise::TestHelpers, type: :controller
23
+
24
+ config.infer_base_class_for_anonymous_controllers = false
25
+ config.order = 'random'
26
+ config.treat_symbols_as_metadata_keys_with_true_values = true
27
+ config.use_transactional_fixtures = false
28
+ end
29
+
30
+ ActiveRecord::Migration.maintain_test_schema!
31
+ Capybara.javascript_driver = :webkit
32
+ WebMock.disable_net_connect!(allow_localhost: true)
@@ -0,0 +1,5 @@
1
+ require_relative 'production'
2
+
3
+ Mail.register_interceptor(
4
+ RecipientInterceptor.new(ENV.fetch('EMAIL_RECIPIENTS'))
5
+ )
@@ -0,0 +1,13 @@
1
+ !.keep
2
+ *.DS_Store
3
+ *.swo
4
+ *.swp
5
+ /.bundle
6
+ /.env
7
+ /.foreman
8
+ /coverage/*
9
+ /db/*.sqlite3
10
+ /log/*
11
+ /public/system
12
+ /tags
13
+ /tmp/*
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="ROBOTS" content="NOODP" />
6
+ <meta name="viewport" content="initial-scale=1" />
7
+ <title><%%= title %></title>
8
+ <%%= stylesheet_link_tag :application, :media => 'all' %>
9
+ <%%= csrf_meta_tags %>
10
+ </head>
11
+ <body class="<%%= body_class %>">
12
+ <%%= render 'flashes' -%>
13
+ <%%= yield %>
14
+ <%%= render 'javascript' %>
15
+ </body>
16
+ </html>
@@ -0,0 +1,31 @@
1
+ before_install:
2
+ - "echo '--colour' > ~/.rspec"
3
+ - "echo 'gem: --no-document' > ~/.gemrc"
4
+ - export DISPLAY=:99.0
5
+ - sh -e /etc/init.d/xvfb start
6
+ before_script:
7
+ - cp .sample.env .env
8
+ <% if options[:database] == 'postgresql' %>
9
+ - psql -c 'create database "<%= app_name %>_test";' -U postgres
10
+ <% end %>
11
+ branches:
12
+ only:
13
+ - master
14
+ cache:
15
+ - bundler
16
+ language:
17
+ - ruby
18
+ notifications:
19
+ campfire:
20
+ on_failure:
21
+ - always
22
+ on_success:
23
+ - change
24
+ template:
25
+ - '(%{branch} - %{author}): %{message} - %{build_url}'
26
+ email:
27
+ - false
28
+ rvm:
29
+ - <%= Suspenders::RUBY_VERSION %>
30
+ addons:
31
+ postgresql: "9.3"
@@ -0,0 +1,30 @@
1
+ # https://devcenter.heroku.com/articles/rails-unicorn
2
+
3
+ worker_processes (ENV['WEB_CONCURRENCY'] || 3).to_i
4
+ timeout (ENV['WEB_TIMEOUT'] || 5).to_i
5
+ preload_app true
6
+
7
+ before_fork do |server, worker|
8
+ Signal.trap 'TERM' do
9
+ puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
10
+ Process.kill 'QUIT', Process.pid
11
+ end
12
+
13
+ if defined? ActiveRecord::Base
14
+ ActiveRecord::Base.connection.disconnect!
15
+ end
16
+ end
17
+
18
+ after_fork do |server, worker|
19
+ Signal.trap 'TERM' do
20
+ puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
21
+ end
22
+
23
+ if defined? ActiveRecord::Base
24
+ config = ActiveRecord::Base.configurations[Rails.env] ||
25
+ Rails.application.config.database_configuration[Rails.env]
26
+ config['reaping_frequency'] = (ENV['DB_REAPING_FREQUENCY'] || 10).to_i
27
+ config['pool'] = (ENV['DB_POOL'] || 2).to_i
28
+ ActiveRecord::Base.establish_connection(config)
29
+ end
30
+ end