cosmit-suspenders 1.36.3 → 1.36.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1e7d713bc808f4f69cf91bd35385907a058f652
4
- data.tar.gz: 0d7d1d58b5824d23b934250d7d953065e26fee63
3
+ metadata.gz: fdc956dc5cd1c680d372ca6a800d6e6205d6ab97
4
+ data.tar.gz: 28141451d6927789fa8ccc585401d5d1827435c2
5
5
  SHA512:
6
- metadata.gz: 4a973ba3c5e9038aaa08491f892aa021e49a334a70f14c360e7677bb735ef741629192291f3a922a971796e5384ad0c41dd48c91443e95ab13d8a9e204bf99df
7
- data.tar.gz: e99cb007eca65640927c2bca461859e6b319e13d105f74d9b23c6b7a0f2a51c3e8f8c346ee09b3f40ed465569a11acf780f9fb544ce4423dbe1c2bc3064c523e
6
+ metadata.gz: fe7578fcf6a4a2c4dbf947cfbc8648ef9eba5e093377bfc2b8a111a2888caebf7044055a99b4547beab1ec87c571dee256a45849d043e603c03065589860e17c
7
+ data.tar.gz: 9d840f116f0fa276413ca73151da1bb3c8d6b528b65dba2ee64d967b7f8506ddd8ec96e74c0755fd692a3c36cac43236f82de95881f6c32101c13331a4c9bcce
@@ -51,7 +51,7 @@ module Suspenders
51
51
  def set_test_delivery_method
52
52
  inject_into_file(
53
53
  "config/environments/development.rb",
54
- "\n config.action_mailer.delivery_method = :test",
54
+ "\n config.action_mailer.delivery_method = :letter_opener",
55
55
  after: "config.action_mailer.raise_delivery_errors = true",
56
56
  )
57
57
  end
@@ -129,37 +129,22 @@ module Suspenders
129
129
  end
130
130
 
131
131
  def configure_smtp
132
- copy_file 'smtp.rb', 'config/smtp.rb'
133
-
134
- prepend_file 'config/environments/production.rb',
135
- %{require Rails.root.join("config/smtp")\n}
136
-
137
132
  config = <<-RUBY
138
133
 
139
- config.action_mailer.delivery_method = :smtp
140
- config.action_mailer.smtp_settings = SMTP_SETTINGS
141
- RUBY
142
-
143
- inject_into_file 'config/environments/production.rb', config,
144
- after: "config.action_mailer.raise_delivery_errors = false"
145
- end
146
-
147
- def enable_rack_canonical_host
148
- config = <<-RUBY
149
-
150
- if ENV.fetch("HEROKU_APP_NAME", "").include?("staging-pr-")
151
- ENV["APPLICATION_HOST"] = ENV["HEROKU_APP_NAME"] + ".herokuapp.com"
152
- end
134
+ ActionMailer::Base.smtp_settings = {
135
+ address: 'smtp.sendgrid.net',
136
+ port: '587',
137
+ authentication: :plain,
138
+ user_name: ENV['SENDGRID_USERNAME'],
139
+ password: ENV['SENDGRID_PASSWORD'],
140
+ domain: 'heroku.com',
141
+ enable_starttls_auto: true
142
+ }
153
143
 
154
- # Ensure requests are only served from one, canonical host name
155
- config.middleware.use Rack::CanonicalHost, ENV.fetch("APPLICATION_HOST")
156
144
  RUBY
157
145
 
158
- inject_into_file(
159
- "config/environments/production.rb",
160
- config,
161
- after: "Rails.application.configure do",
162
- )
146
+ inject_into_file 'config/environment.rb', config,
147
+ before: "Rails.application.initialize!"
163
148
  end
164
149
 
165
150
  def enable_rack_deflater
@@ -179,7 +164,7 @@ module Suspenders
179
164
  def setup_asset_host
180
165
  replace_in_file 'config/environments/production.rb',
181
166
  "# config.action_controller.asset_host = 'http://assets.example.com'",
182
- 'config.action_controller.asset_host = ENV.fetch("ASSET_HOST", ENV.fetch("APPLICATION_HOST"))'
167
+ "config.action_controller.asset_host = 'https://#{self.app_name}.herokuapp.com'"
183
168
 
184
169
  replace_in_file 'config/initializers/assets.rb',
185
170
  "config.assets.version = '1.0'",
@@ -199,7 +184,15 @@ module Suspenders
199
184
  config = <<-RUBY
200
185
 
201
186
  Rails.application.configure do
202
- # ...
187
+ if ENV.fetch("HEROKU_APP_NAME", "").include?("staging-pr-")
188
+ config.action_mailer.asset_host = ("https://" + ENV["HEROKU_APP_NAME"] + ".herokuapp.com")
189
+ config.action_mailer.default_url_options = { host: ENV["HEROKU_APP_NAME"] + ".herokuapp.com" }
190
+ config.action_controller.default_url_options = { host: ENV["HEROKU_APP_NAME"] + ".herokuapp.com" }
191
+ else
192
+ config.action_mailer.asset_host = ("https://" + ENV["HEROKU_APP_NAME"]+ "-staging" + ".herokuapp.com")
193
+ config.action_mailer.default_url_options = { host: ENV["HEROKU_APP_NAME"]+ "-staging" + ".herokuapp.com" }
194
+ config.action_controller.default_url_options = { host: ENV["HEROKU_APP_NAME"]+ "-staging" + ".herokuapp.com" }
195
+ end
203
196
  end
204
197
  RUBY
205
198
 
@@ -223,30 +216,27 @@ end
223
216
  end
224
217
 
225
218
  def create_shared_javascripts
226
- copy_file '_javascript.html.slim', 'app/views/partials/_javascript.html.slim'
219
+ copy_file '_javascripts.html.slim', 'app/views/partials/_javascripts.html.slim'
227
220
  end
228
221
 
229
222
  def create_application_layout
230
- template 'suspenders_layout.html.slim.erb',
231
- 'app/views/layouts/application.html.slim',
232
- force: true
223
+ template 'suspenders_layout.html.slim',
224
+ 'app/views/layouts/application.html.slim',
225
+ force: true
233
226
  end
234
227
 
235
228
  def create_application_header
236
- template '_header.html.slim.erb',
237
- 'app/views/partials/_header.html.slim',
238
- force: true
229
+ copy_file '_header.html.slim', 'app/views/partials/_header.html.slim'
239
230
  end
240
231
 
241
232
  def create_application_footer
242
- template '_footer.html.slim.erb',
243
- 'app/views/partials/_footer.html.slim',
244
- force: true
233
+ copy_file '_footer.html.slim', 'app/views/partials/_footer.html.slim'
245
234
  end
246
235
 
247
236
  def use_postgres_config_template
248
- template 'postgresql_database.yml.erb', 'config/database.yml',
249
- force: true
237
+ template 'postgresql_database.yml.erb',
238
+ 'config/database.yml',
239
+ force: true
250
240
  end
251
241
 
252
242
  def create_database
@@ -310,36 +300,38 @@ end
310
300
  template "config_locales_en.yml.erb", "config/locales/en.yml"
311
301
  end
312
302
 
313
- def configure_rack_timeout
314
- rack_timeout_config = <<-RUBY
315
- Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
316
- RUBY
317
-
318
- append_file "config/environments/production.rb", rack_timeout_config
319
- end
320
-
321
303
  def configure_simple_form
322
- bundle_command "install"
323
- bundle_command "exec rails generate simple_form:install"
304
+ bundle_command "exec rails generate simple_form:install --bootstrap"
305
+ inject_into_file "app/assets/javascripts/application.js",
306
+ "//= require bootstrap",
307
+ after: "//= require_tree ."
324
308
  end
325
309
 
326
310
  def configure_devise
327
- bundle_command "install"
328
311
  bundle_command "exec rails generate devise:install"
312
+ bundle_command "exec rake db:migrate"
329
313
  end
330
314
 
331
315
  def configure_active_admin
332
- bundle_command "install"
333
- bundle_command "exec rails generate active_admin:install"
316
+ bundle_command "exec rails generate active_admin:install --skip-users"
334
317
  bundle_command "exec rake db:migrate"
335
318
  bundle_command "exec rake db:seed"
336
319
  end
337
320
 
338
321
  def configure_initjs
339
- bundle_command "install"
340
322
  bundle_command 'exec rails generate initjs:install'
341
323
  end
342
324
 
325
+ def copy_flash_javascript_file
326
+ template "flash.js.coffee.erb", "app/assets/javascripts/#{self.app_name.underscore}/modules/flash.js.coffee"
327
+ end
328
+
329
+ def replace_flash_javascript_file
330
+ replace_in_file "app/assets/javascripts/#{self.app_name.underscore}/#{self.app_name.underscore}.js.coffee",
331
+ "modules: -> []",
332
+ "modules: -> [#{self.app_name.camelize}.Flash]"
333
+ end
334
+
343
335
  def configure_action_mailer
344
336
  action_mailer_host "development", %{"localhost:3000"}
345
337
  action_mailer_host "test", %{"www.example.com"}
@@ -363,10 +355,27 @@ Rack::Timeout.timeout = (ENV["RACK_TIMEOUT"] || 10).to_i
363
355
 
364
356
  def setup_stylesheets
365
357
  remove_file "app/assets/stylesheets/application.css"
358
+
366
359
  copy_file "application.scss",
367
360
  "app/assets/stylesheets/application.scss"
368
361
  end
369
362
 
363
+ def setup_colors_stylesheet
364
+ copy_file "_colors.scss", "app/assets/stylesheets/variables/_colors.scss"
365
+
366
+ inject_into_file "app/assets/stylesheets/application.scss",
367
+ "\n// ==== Variables\n@import \"variables/colors\";",
368
+ after: '@import "font-awesome";'
369
+ end
370
+
371
+ def setup_flash_stylesheet
372
+ copy_file "_flash.scss", "app/assets/stylesheets/componentes/_flash.scss"
373
+
374
+ inject_into_file "app/assets/stylesheets/application.scss",
375
+ "\n// ==== Components\n@import \"components/flash\"; ",
376
+ after: '@import "variables/colors";'
377
+ end
378
+
370
379
  def setup_default_directories
371
380
  [
372
381
  'app/views/pages',
@@ -509,6 +518,11 @@ end
509
518
  end
510
519
  end
511
520
 
521
+ def uncomment_devise_secret_token
522
+ config = "config.secret_key"
523
+ uncomment_lines("config/initializers/devise.rb", config)
524
+ end
525
+
512
526
  private
513
527
 
514
528
  def raise_on_missing_translations_in(environment)
@@ -32,8 +32,13 @@ module Suspenders
32
32
  def suspenders_customization
33
33
  invoke :customize_gemfile
34
34
  invoke :setup_simple_form
35
+ invoke :setup_database
35
36
  invoke :setup_devise
37
+ invoke :setup_stylesheets
38
+ invoke :setup_colors_stylesheet
39
+ invoke :setup_flash_stylesheet
36
40
  invoke :setup_initjs
41
+ invoke :setup_flash_messages
37
42
  invoke :setup_development_environment
38
43
  invoke :setup_test_environment
39
44
  invoke :setup_production_environment
@@ -41,23 +46,22 @@ module Suspenders
41
46
  invoke :setup_secret_token
42
47
  invoke :create_suspenders_views
43
48
  invoke :configure_app
44
- invoke :setup_stylesheets
45
49
  invoke :copy_miscellaneous_files
46
50
  invoke :customize_error_pages
47
51
  invoke :remove_config_comment_lines
48
52
  invoke :remove_routes_comment_lines
49
53
  invoke :setup_dotfiles
50
54
  invoke :setup_git
51
- invoke :setup_database
52
- invoke :create_heroku_apps
53
- invoke :create_github_repo
54
55
  invoke :setup_bundler_audit
55
- invoke :setup_spring
56
56
  invoke :setup_active_admin
57
+ invoke :uncomment_devise_secret_token
58
+ invoke :create_heroku_apps
59
+ invoke :create_github_repo
57
60
  invoke :outro
58
61
  end
59
62
 
60
63
  def customize_gemfile
64
+ say 'Setting up Gemfile'
61
65
  build :set_ruby_to_version_being_used
62
66
 
63
67
  if options[:heroku]
@@ -68,18 +72,28 @@ module Suspenders
68
72
  end
69
73
 
70
74
  def setup_simple_form
75
+ say 'Setting up Simple Form'
71
76
  build :configure_simple_form
72
77
  end
73
78
 
74
79
  def setup_devise
80
+ say 'Setting up Devise'
75
81
  build :configure_devise
76
82
  end
77
83
 
78
84
  def setup_initjs
85
+ say 'Setting up InitJS'
79
86
  build :configure_initjs
80
87
  end
81
88
 
89
+ def setup_flash_messages
90
+ say 'Setting up Flash Messages'
91
+ build :copy_flash_javascript_file
92
+ build :replace_flash_javascript_file
93
+ end
94
+
82
95
  def setup_active_admin
96
+ say 'Setting up Active Admin'
83
97
  build :configure_active_admin
84
98
  end
85
99
 
@@ -127,8 +141,6 @@ module Suspenders
127
141
  def setup_production_environment
128
142
  say 'Setting up the production environment'
129
143
  build :configure_smtp
130
- build :configure_rack_timeout
131
- build :enable_rack_canonical_host
132
144
  build :enable_rack_deflater
133
145
  build :setup_asset_host
134
146
  end
@@ -169,6 +181,16 @@ module Suspenders
169
181
  build :setup_stylesheets
170
182
  end
171
183
 
184
+ def setup_colors_stylesheet
185
+ say 'Set up colors stylesheet'
186
+ build :setup_colors_stylesheet
187
+ end
188
+
189
+ def setup_flash_stylesheet
190
+ say 'Set up flash stylesheet'
191
+ build :setup_flash_stylesheet
192
+ end
193
+
172
194
  def setup_git
173
195
  if !options[:skip_git]
174
196
  say "Initializing git"
@@ -200,10 +222,12 @@ module Suspenders
200
222
  end
201
223
 
202
224
  def setup_dotfiles
225
+ say 'Setting up Dotfiles'
203
226
  build :copy_dotfiles
204
227
  end
205
228
 
206
229
  def setup_default_directories
230
+ say 'Setting up Default Directories'
207
231
  build :setup_default_directories
208
232
  end
209
233
 
@@ -212,12 +236,8 @@ module Suspenders
212
236
  build :setup_bundler_audit
213
237
  end
214
238
 
215
- def setup_spring
216
- say "Springifying binstubs"
217
- build :setup_spring
218
- end
219
-
220
239
  def init_git
240
+ say 'Setting up GIT'
221
241
  build :init_git
222
242
  end
223
243
 
@@ -239,6 +259,10 @@ module Suspenders
239
259
  build :remove_routes_comment_lines
240
260
  end
241
261
 
262
+ def uncomment_devise_secret_token
263
+ build :uncomment_devise_secret_token
264
+ end
265
+
242
266
  def outro
243
267
  say 'Congratulations! You just pulled our suspenders.'
244
268
  end
@@ -1,5 +1,5 @@
1
1
  module Suspenders
2
2
  RAILS_VERSION = "~> 4.2"
3
3
  RUBY_VERSION = IO.read("#{File.dirname(__FILE__)}/../../.ruby-version").strip
4
- VERSION = "1.36.3"
4
+ VERSION = "1.36.11"
5
5
  end
@@ -138,7 +138,7 @@ RSpec.describe "Suspend a new project with default configuration" do
138
138
  it "configs :test email delivery method for development" do
139
139
  dev_env_file = IO.read("#{project_path}/config/environments/development.rb")
140
140
  expect(dev_env_file).
141
- to match(/^ +config.action_mailer.delivery_method = :test$/)
141
+ to match(/^ +config.action_mailer.delivery_method = :letter_opener$/)
142
142
  end
143
143
 
144
144
  it "uses APPLICATION_HOST, not HOST in the production config" do
@@ -25,6 +25,7 @@ group :development do
25
25
  gem "quiet_assets"
26
26
  gem "spring"
27
27
  gem "spring-commands-rspec"
28
+ gem "letter_opener"
28
29
  end
29
30
 
30
31
  group :development, :test do
@@ -0,0 +1,19 @@
1
+ // # =================================================================
2
+ // # Colors
3
+ // # =================================================================
4
+
5
+ // ==== Brand colors
6
+ $yellow: #ffc82a;
7
+ $black: #333;
8
+
9
+ // ==== Gray
10
+ $gray-light: #f2f2f2;
11
+ $gray: #e2e2e2;
12
+ $gray-medium: #bbb;
13
+ $gray-dark: #999;
14
+ $gray-darkest: #666;
15
+
16
+ // ==== Flash
17
+ $error: #f05f5c;
18
+ $success: #2ecc71;
19
+ $info: #5e98a3;
@@ -0,0 +1,31 @@
1
+ .flash {
2
+ font-size: 26px;
3
+ color: white;
4
+ z-index: 500;
5
+ position: fixed;
6
+ bottom: 0;
7
+ width: 100%;
8
+ text-align: center;
9
+ .wrapper {
10
+ padding: 20px;
11
+ }
12
+ .success.wrapper, .notice.wrapper {
13
+ background-color: $success;
14
+ }
15
+ .failure.wrapper, .alerts-error.wrapper, .alerts-error.wrapper {
16
+ background-color: $error;
17
+ }
18
+ .locale.wrapper {
19
+ background-color: $info;
20
+ }
21
+ .warning.wrapper {
22
+ color: $black;
23
+ background-color: $yellow;
24
+ }
25
+ }
26
+
27
+ @media (max-width: 768px) {
28
+ .flash {
29
+ font-size: 18px;
30
+ }
31
+ }
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name":"<%= app_name.dasherize %>",
3
- "scripts":{},
3
+ "scripts":{
4
+ "postdeploy": "bin/rake db:migrate"
5
+ },
4
6
  "env":{
5
7
  "APPLICATION_HOST":{
6
8
  "required":true
7
9
  },
8
- "EMAIL_RECIPIENTS":{
9
- "required":true
10
- },
11
10
  "HEROKU_APP_NAME": {
12
11
  "required":true
13
12
  },
@@ -19,22 +18,11 @@
19
18
  },
20
19
  "SECRET_KEY_BASE":{
21
20
  "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
21
  }
35
22
  },
36
23
  "addons":[
37
24
  "heroku-postgresql",
38
25
  "sendgrid"
39
- ]
26
+ ],
27
+ "buildpacks": []
40
28
  }
@@ -0,0 +1,11 @@
1
+ <%= app_name.camelize %>.Flash =
2
+ init: ->
3
+ setTimeout( ->
4
+ $('.flash').slideDown()
5
+ , 100)
6
+ if $('.flash').length > 0
7
+ setTimeout( ->
8
+ $('.flash').slideUp()
9
+ , 8000)
10
+ $(document).one 'click', ->
11
+ $('.flash').slideUp()
@@ -4,6 +4,7 @@ default: &default
4
4
 
5
5
  development:
6
6
  <<: *default
7
+ secret_key_base: '3eu3he3heu3hueh3uehu3heu3hueh3u'
7
8
 
8
9
  test:
9
10
  <<: *default
data/templates/staging.rb CHANGED
@@ -1,5 +1 @@
1
1
  require_relative "production"
2
-
3
- Mail.register_interceptor(
4
- RecipientInterceptor.new(ENV.fetch("EMAIL_RECIPIENTS"))
5
- )
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cosmit-suspenders
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.36.3
4
+ version: 1.36.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - COSMIT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-01 00:00:00.000000000 Z
11
+ date: 2016-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -140,10 +140,12 @@ files:
140
140
  - templates/Gemfile.erb
141
141
  - templates/Procfile
142
142
  - templates/README.md.erb
143
+ - templates/_colors.scss
143
144
  - templates/_flash.html.slim
145
+ - templates/_flash.scss
144
146
  - templates/_footer.html.slim
145
147
  - templates/_header.html.slim
146
- - templates/_javascript.html.slim
148
+ - templates/_javascripts.html.slim
147
149
  - templates/action_mailer.rb
148
150
  - templates/app.json.erb
149
151
  - templates/application.scss
@@ -163,6 +165,7 @@ files:
163
165
  - templates/errors.rb
164
166
  - templates/factories.rb
165
167
  - templates/factory_girl_rspec.rb
168
+ - templates/flash.js.coffee.erb
166
169
  - templates/hound.yml
167
170
  - templates/i18n.rb
168
171
  - templates/json_encoding.rb
@@ -172,7 +175,6 @@ files:
172
175
  - templates/rails_helper.rb
173
176
  - templates/secrets.yml
174
177
  - templates/shoulda_matchers_config_rspec.rb
175
- - templates/smtp.rb
176
178
  - templates/spec_helper.rb
177
179
  - templates/staging.rb
178
180
  - templates/suspenders_gitignore
data/templates/smtp.rb DELETED
@@ -1,9 +0,0 @@
1
- SMTP_SETTINGS = {
2
- address: ENV.fetch("SMTP_ADDRESS"), # example: "smtp.sendgrid.net"
3
- authentication: :plain,
4
- domain: ENV.fetch("SMTP_DOMAIN"), # example: "heroku.com"
5
- enable_starttls_auto: true,
6
- password: ENV.fetch("SMTP_PASSWORD"),
7
- port: "587",
8
- user_name: ENV.fetch("SMTP_USERNAME")
9
- }