welaika-suspenders 2.34 → 2.35

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
  SHA256:
3
- metadata.gz: fca0442cb0adbdb8f07149baafe1841af1d44aa4c9028260ed332ffc6dac4c70
4
- data.tar.gz: 402be3ceb068fdf2a08344050de8b5516f95cd45c63efab9bbda3c93785548d9
3
+ metadata.gz: 6dc5c70cb98579f63e22680ad0b1d522117eb65b1492d50bba5de23d7f0a662c
4
+ data.tar.gz: c97e53c5a59374b48b0331e470a1684e20dae53d3e70983a370c2a96211d3f29
5
5
  SHA512:
6
- metadata.gz: ca5b9dff76fe3ecca545cd9c7ae09984b65df11895cb31fba42d7439fed0221e509596cbabcda45ecd0d3eecc11f62b16cd9e968313dbfd5434be513b44f6218
7
- data.tar.gz: 79104448a207fd73e1a4ee60ae3261d787f9cc91dff76e847bf130a405cc0b7df2f3321b4f6d8bea1609b15c42ffd5ccebc787a9bd488a0d5abfaa8064c39837
6
+ metadata.gz: 7880528eeedca62eb57f65612351aa057e0cb0177932fc285547516c05253fe8c4c9986c0657b3cc2466863351901ca7c0234db492653fceb53ad6e9d9a4410f
7
+ data.tar.gz: 417d84ca0b5b64439a0b6fc8d089ab4a24b5f23e7bc056b645c370809929dcf10bde6cdc5225e8affef781e38793efbc609f46ce78481a238e1c75991f45d467
data/CHANGELOG_WELAIKA.md CHANGED
@@ -1,3 +1,8 @@
1
+ 2.35 (October 20th, 2019)
2
+ * Change: add more exclusion to rubocop (from the default configuration on github)
3
+ * Change: configure autoprefixer browsers list
4
+ * Feature: add sass sourcemaps (but they won't work if autoprefixer is present...)
5
+
1
6
  2.34 (October 19th, 2019)
2
7
  * Change: gitlab ci steps from prepare -> quality -> test to prepare -> test -> quality. We already run some quality checks with overcommit
3
8
  * Change: use :login instead of :plain as smtp authentication system
@@ -94,7 +94,7 @@ module Suspenders
94
94
  end
95
95
  end
96
96
 
97
- def set_buildpacks
97
+ def set_heroku_buildpacks
98
98
  %w(staging production).each do |environment|
99
99
  run_toolbelt_command(
100
100
  "buildpacks:add --index 1 heroku/nodejs",
@@ -16,7 +16,7 @@ module Suspenders
16
16
  :set_heroku_remotes,
17
17
  :set_heroku_sentry_configuration,
18
18
  :set_heroku_smtp_settings,
19
- :set_buildpacks,
19
+ :set_heroku_buildpacks,
20
20
  )
21
21
 
22
22
  def readme
@@ -300,6 +300,19 @@ config.public_file_server.headers = {
300
300
  copy_file 'rakefile_template.rb', 'Rakefile', force: true
301
301
  end
302
302
 
303
+ def configure_sourcemaps_for_sass
304
+ config = [
305
+ " config.sass.inline_source_maps = true\n",
306
+ " config.sass.line_comments = true\n"
307
+ ].join
308
+
309
+ inject_into_file(
310
+ "config/environments/development.rb",
311
+ config,
312
+ after: " config.assets.debug = true\n"
313
+ )
314
+ end
315
+
303
316
  private
304
317
 
305
318
  def raise_on_missing_translations_in(environment)
@@ -103,6 +103,7 @@ module Suspenders
103
103
  build :configure_action_mailer
104
104
  build :configure_locales_and_time_zone
105
105
  build :configure_time_formats
106
+ build :configure_sourcemaps_for_sass
106
107
  build :setup_rakefile
107
108
  build :replace_default_puma_configuration
108
109
  build :set_up_forego
@@ -119,7 +120,7 @@ module Suspenders
119
120
  build :set_heroku_backup_schedule
120
121
  build :set_heroku_sentry_configuration
121
122
  build :set_heroku_smtp_settings
122
- build :set_buildpacks
123
+ build :set_heroku_buildpacks
123
124
  build :create_heroku_pipeline
124
125
  build :configure_automatic_deployment
125
126
  end
@@ -180,6 +181,10 @@ module Suspenders
180
181
  generate("suspenders:views")
181
182
  end
182
183
 
184
+ def generate_autoprefixer
185
+ generate("suspenders:autoprefixer")
186
+ end
187
+
183
188
  def generate_outro
184
189
  build :run_rubocop_autocorrect
185
190
 
@@ -0,0 +1,31 @@
1
+ require_relative "base"
2
+
3
+ module Suspenders
4
+ class AutoprefixerGenerator < Generators::Base
5
+ def add_autoprefixer_rails
6
+ gem 'autoprefixer-rails'
7
+ Bundler.with_clean_env { run "bundle install" }
8
+ end
9
+
10
+ def copy_browserslistrc
11
+ if behavior == :invoke
12
+ list = <<~TEXT
13
+ last 1 version
14
+ > 5%
15
+ not IE 11
16
+ TEXT
17
+ in_root do
18
+ File.open('.browserslistrc', 'w') do |file|
19
+ file << list
20
+ end
21
+ end
22
+ else
23
+ in_root do
24
+ File.open('.browserslistrc', 'w') do |file|
25
+ file << 'defaults'
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -5,5 +5,5 @@ module Suspenders
5
5
  read("#{File.dirname(__FILE__)}/../../.ruby-version").
6
6
  strip.
7
7
  freeze
8
- VERSION = "2.34".freeze
8
+ VERSION = "2.35".freeze
9
9
  end
data/lib/suspenders.rb CHANGED
@@ -17,6 +17,7 @@ require "suspenders/generators/security_generator"
17
17
  require "suspenders/generators/import_dump_generator"
18
18
  require "suspenders/generators/jobs_generator"
19
19
  require "suspenders/generators/inline_svg_generator"
20
+ require "suspenders/generators/autoprefixer_generator"
20
21
  require "suspenders/generators/production/force_tls_generator"
21
22
  require "suspenders/generators/production/email_generator"
22
23
  require "suspenders/generators/production/timeout_generator"
@@ -55,6 +55,26 @@ module Suspenders
55
55
  )
56
56
  end
57
57
 
58
+ it "configures nodejs and ruby packs" do
59
+ app_builder = double(app_name: app_name)
60
+ allow(app_builder).to receive(:run)
61
+
62
+ Heroku.new(app_builder).set_heroku_buildpacks
63
+
64
+ %w(staging production).each do |remote|
65
+ expect(app_builder).to(
66
+ have_configured_buildpack(
67
+ remote_name: remote, index: 1, packname: "heroku/nodejs"
68
+ )
69
+ )
70
+ expect(app_builder).to(
71
+ have_configured_buildpack(
72
+ remote_name: remote, index: 2, packname: "heroku/ruby"
73
+ )
74
+ )
75
+ end
76
+ end
77
+
58
78
  def app_name
59
79
  SuspendersTestHelpers::APP_NAME
60
80
  end
@@ -67,6 +87,12 @@ module Suspenders
67
87
  def have_configured_var(remote_name, var)
68
88
  have_received(:run).with(/config:add #{var}=.+ --remote #{remote_name}/)
69
89
  end
90
+
91
+ def have_configured_buildpack(remote_name:, index:, packname:)
92
+ have_received(:run).with(
93
+ /buildpacks:add --index #{index} #{packname} --remote #{remote_name}/
94
+ )
95
+ end
70
96
  end
71
97
  end
72
98
  end
@@ -9,9 +9,6 @@ end
9
9
 
10
10
  ruby '<%= Suspenders::RUBY_VERSION %>'
11
11
 
12
- <% unless options[:api] %>
13
- gem 'autoprefixer-rails'
14
- <% end %>
15
12
  gem 'bootsnap', '>= 1.1.0', require: false
16
13
  gem 'coffee-rails', '~> 4.2'
17
14
  gem 'email_validator'
@@ -9,8 +9,10 @@ inherit_from: .rubocop_todo.yml
9
9
  AllCops:
10
10
  DisplayCopNames: true
11
11
  Exclude:
12
+ - '.git/**/*'
12
13
  - 'bin/*'
13
14
  - 'db/**/*'
15
+ - 'node_modules/**/*'
14
16
  - 'tmp/**/*'
15
17
  - 'vendor/**/*'
16
18
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: welaika-suspenders
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.34'
4
+ version: '2.35'
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoughtbot
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-10-19 00:00:00.000000000 Z
12
+ date: 2019-10-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -116,6 +116,7 @@ files:
116
116
  - lib/suspenders/adapters/heroku.rb
117
117
  - lib/suspenders/app_builder.rb
118
118
  - lib/suspenders/generators/app_generator.rb
119
+ - lib/suspenders/generators/autoprefixer_generator.rb
119
120
  - lib/suspenders/generators/base.rb
120
121
  - lib/suspenders/generators/ci_generator.rb
121
122
  - lib/suspenders/generators/db_optimizations_generator.rb