webpacker 3.4.3 → 3.5.0

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: f57e6d29912f69dd841a014718d4ae68e94095580d0c0079b1eb5d6a09d328ec
4
- data.tar.gz: 9f87d351faf8ee3db6a8d89897a01c2e0c7805130f92bac389ccd13a97c40259
3
+ metadata.gz: 9b38dd5e5e609e48bee3589f53bb988a48d72510e5ebf3917cec8d88c1a4fa5e
4
+ data.tar.gz: 4b85f5b352d328615976f4351df62e7cd8be3c0a06a6a33d5e31b37c6ed8743d
5
5
  SHA512:
6
- metadata.gz: 68c41ff4ffce9e3ca874b642b37572be90b751acd5b216ead260e0975dfced64d0f1bdffa5931382066bf95af875fc61fdb27296f9a8761d0ea85c87d2b1d874
7
- data.tar.gz: 84344e3a2255132be3c1ddbc50ff35e07510c1269bde6ee49b097c42b521348cca44fd76e46703d07e9aa98b10dad1ec2e5617696751f7180eea932db6901ce9
6
+ metadata.gz: 81c64d85696ae88767992c32e6b841fde0c7280a9b7de057b8bab3b66d2e29e211afdf804362c8c2b93858905f0bc0d44b6d92f09bef7f21704e21d3cbe2d7b4
7
+ data.tar.gz: 6cfa6629708dc2d4c2bd080dc3d2ce5ddb99409fa448234db4da155edb38152833beb6f40389719db8f411d8dfe837a3e700a4f9736be7a35660b7b09b3ea9b6
data/.travis.yml CHANGED
@@ -3,10 +3,9 @@ language: ruby
3
3
  before_install:
4
4
  - gem update --system
5
5
  rvm:
6
- - 2.2.9
7
- - 2.3.6
8
- - 2.4.3
9
- - 2.5.0
6
+ - 2.3.7
7
+ - 2.4.4
8
+ - 2.5.1
10
9
  - ruby-head
11
10
  gemfile:
12
11
  - gemfiles/Gemfile-rails.4.2.x
data/CHANGELOG.md CHANGED
@@ -1,4 +1,21 @@
1
- **Please note that Webpacker 3.1.0 and 3.1.1 has some serious bugs so please consider using either 3.0.2 or 3.2.0**
1
+ **Please note that Webpacker 3.1.0 and 3.1.1 have some serious bugs so please consider using either 3.0.2 or 3.2.0**
2
+
3
+ ## [3.5.0] - 2018-04-29
4
+
5
+ ### Fixed
6
+ - Remove compilation digest file if webpack command fails [#1399](https://github.com/rails/webpacker/pull/1399)
7
+ - Handle http dev_server setting properly in the proxy [#1420]
8
+ - Use correct protocol [#1425](https://github.com/rails/webpacker/pull/1425)
9
+
10
+ ### Added
11
+ - `image_pack_tag` helper [#1400](https://github.com/rails/webpacker/pull/1400)
12
+ - devserver proxy for custom environments [#1415](https://github.com/rails/webpacker/pull/1415)
13
+ - Rails webpacker:info task [#1416](https://github.com/rails/webpacker/pull/1416)
14
+ (https://github.com/rails/webpacker/pull/1420)
15
+ - Include `RAILS_RELATIVE_URL_ROOT` environment variable in publicPath [#1428](https://github.com/rails/webpacker/pull/1428)
16
+
17
+ Complete list of changes: [#1464](https://github.com/rails/webpacker/pull/1464)
18
+
2
19
 
3
20
  ## [3.4.3] - 2018-04-3
4
21
 
@@ -37,7 +54,7 @@
37
54
 
38
55
  ### Breaking changes
39
56
 
40
- - Fixes #1281 by installing binstubs only as local executables. To upgrade:
57
+ - Fixes [#1281](https://github.com/rails/webpacker/issues/1281) by installing binstubs only as local executables. To upgrade:
41
58
 
42
59
  ```
43
60
  bundle exec rails webpacker:binstubs
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- webpacker (3.4.3)
4
+ webpacker (3.5.0)
5
5
  activesupport (>= 4.2)
6
6
  rack-proxy (>= 0.6.1)
7
7
  railties (>= 4.2)
@@ -57,7 +57,7 @@ GEM
57
57
  activesupport (>= 4.2.0)
58
58
  i18n (0.9.5)
59
59
  concurrent-ruby (~> 1.0)
60
- loofah (2.2.0)
60
+ loofah (2.2.2)
61
61
  crass (~> 1.0.2)
62
62
  nokogiri (>= 1.5.9)
63
63
  mail (2.7.0)
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2016-2017 David Heinemeier Hansson, Basecamp
1
+ Copyright (c) 2016-2018 David Heinemeier Hansson, Basecamp
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -81,7 +81,7 @@ Or add it to your `Gemfile`:
81
81
 
82
82
  ```ruby
83
83
  # Gemfile
84
- gem 'webpacker', '~> 3.3'
84
+ gem 'webpacker', '~> 3.5'
85
85
 
86
86
  # OR if you prefer to use master
87
87
  gem 'webpacker', git: 'https://github.com/rails/webpacker.git'
@@ -154,7 +154,7 @@ in the `app/javascript/packs/*.js` files and automatically reload the browser to
154
154
  ./bin/webpack-dev-server
155
155
 
156
156
  # watcher
157
- ./bin/webpack --colors --progress
157
+ ./bin/webpack --watch --colors --progress
158
158
 
159
159
  # standalone build
160
160
  ./bin/webpack
@@ -186,7 +186,7 @@ WEBPACKER_DEV_SERVER_HOST=0.0.0.0 ./bin/webpack-dev-server
186
186
  **Note:** You need to allow webpack-dev-server host as an allowed origin for `connect-src` if you are running your application in a restrict CSP environment (like Rails 5.2+). This can be done in Rails 5.2+ in the CSP initializer `config/initializers/content_security_policy.rb` with a snippet like this:
187
187
 
188
188
  ```ruby
189
- p.connect_src :self, :https, 'http://localhost:3035', 'ws://localhost:3035' if Rails.env.development?
189
+ policy.connect_src :self, :https, 'http://localhost:3035', 'ws://localhost:3035' if Rails.env.development?
190
190
  ```
191
191
 
192
192
  **Note:** Don't forget to prefix `ruby` when running these binstubs on Windows
@@ -248,7 +248,7 @@ bundle exec rails webpacker:compile
248
248
 
249
249
  ### Upgrading
250
250
 
251
- You can run following commands to upgrade Webpacker to the latest stable version. This process involves upgrading the gem and related npm modules:
251
+ You can run following commands to upgrade Webpacker to the latest stable version. This process involves upgrading the gem and related JavaScript packages:
252
252
 
253
253
  ```bash
254
254
  bundle update webpacker
@@ -258,7 +258,7 @@ yarn add webpack-dev-server@^2.11.1
258
258
 
259
259
  ### Yarn Integrity
260
260
 
261
- By default, in development, webpacker runs a yarn integrity check to ensure that all local npm packages are up-to-date. This is similar to what bundler does currently in Rails, but for JavaScript packages. If your system is out of date, then Rails will not initialize. You will be asked to upgrade your local npm packages by running `yarn install`.
261
+ By default, in development, webpacker runs a yarn integrity check to ensure that all local JavaScript packages are up-to-date. This is similar to what bundler does currently in Rails, but for JavaScript packages. If your system is out of date, then Rails will not initialize. You will be asked to upgrade your local JavaScript packages by running `yarn install`.
262
262
 
263
263
  To turn off this option, you will need to override the default by adding a new config option to your Rails development environment configuration file (`config/environment/development.rb`):
264
264
 
@@ -324,9 +324,9 @@ with the following code:
324
324
 
325
325
  ```ruby
326
326
  if Rails.env.development?
327
- p.script_src :self, :https, :unsafe_eval
327
+ policy.script_src :self, :https, :unsafe_eval
328
328
  else
329
- p.script_src :self, :https
329
+ policy.script_src :self, :https
330
330
  end
331
331
  ```
332
332
 
@@ -352,9 +352,9 @@ configuration:
352
352
 
353
353
  ```ruby
354
354
  if Rails.env.development?
355
- p.script_src :self, :https, :unsafe_eval
355
+ policy.script_src :self, :https, :unsafe_eval
356
356
  else
357
- p.script_src :self, :https
357
+ policy.script_src :self, :https
358
358
  end
359
359
  ```
360
360
  You can read more about this in the [Vue docs](https://vuejs.org/v2/guide/installation.html#CSP-environments).
@@ -486,7 +486,7 @@ Webpacker::Compiler.watched_paths << 'bower_components'
486
486
 
487
487
  ## Deployment
488
488
 
489
- Webpacker hooks up a new `webpacker:compile` task to `assets:precompile`, which gets run whenever you run `assets:precompile`. If you are not using Sprockets, `webpacker:compile` is automatically aliased to `assets:precompile`. Remember to set NODE_ENV environment variable to production during deployment or when running this rake task.
489
+ Webpacker hooks up a new `webpacker:compile` task to `assets:precompile`, which gets run whenever you run `assets:precompile`. If you are not using Sprockets, `webpacker:compile` is automatically aliased to `assets:precompile`. Similar to sprockets both rake tasks will compile packs in production mode but will use `RAILS_ENV` to load configuration from `config/webpacker.yml` (if available).
490
490
 
491
491
  ## Docs
492
492
 
data/docs/cloud9.md CHANGED
@@ -83,7 +83,7 @@ dev_server:
83
83
  use_local_ip: false
84
84
  ```
85
85
 
86
- into the these custom configuration:
86
+ into these custom configuration:
87
87
 
88
88
  ```yaml
89
89
  dev_server:
data/docs/webpack.md CHANGED
@@ -29,7 +29,7 @@ module.exports = {
29
29
  }
30
30
 
31
31
  // config/webpack/environment.js
32
- const environment = require('./environment')
32
+ const { environment } = require('@rails/webpacker')
33
33
  const customConfig = require('./custom')
34
34
 
35
35
  // Set nested object prop using path notation
@@ -14,9 +14,9 @@ if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR > 1
14
14
  say "This can be done in Rails 5.2+ for development environment in the CSP initializer", :yellow
15
15
  say "config/initializers/content_security_policy.rb with a snippet like this:", :yellow
16
16
  say "if Rails.env.development?", :yellow
17
- say " p.script_src :self, :https, :unsafe_eval", :yellow
17
+ say " policy.script_src :self, :https, :unsafe_eval", :yellow
18
18
  say "else", :yellow
19
- say " p.script_src :self, :https", :yellow
19
+ say " policy.script_src :self, :https", :yellow
20
20
  say "end", :yellow
21
21
  end
22
22
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
4
- ENV["NODE_ENV"] ||= ENV["NODE_ENV"] || "development"
4
+ ENV["NODE_ENV"] ||= "development"
5
5
 
6
6
  require "pathname"
7
7
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
4
- ENV["NODE_ENV"] ||= ENV["NODE_ENV"] || "development"
4
+ ENV["NODE_ENV"] ||= "development"
5
5
 
6
6
  require "pathname"
7
7
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
@@ -22,4 +22,4 @@ copy_file "#{__dir__}/examples/coffee/hello_coffee.coffee",
22
22
  say "Installing all Coffeescript dependencies"
23
23
  run "yarn add coffeescript@1.12.7 coffee-loader"
24
24
 
25
- say "Webpacker now supports Coffeeescript 🎉", :green
25
+ say "Webpacker now supports Coffeescript 🎉", :green
@@ -1,5 +1,5 @@
1
- // Run this example by adding <%= javascript_pack_tag 'hello_erb' %> to the head of your layout file,
2
- // like app/views/layouts/application.html.erb.
1
+ // Run this example by adding <%%= javascript_pack_tag 'hello_erb' %> to the head of your layout file,
2
+ // like app/views/layouts/application.html.erb. Don't forget to uncomment erb tag after adding it to your layout file.
3
3
 
4
4
  <% name = 'Erb' %>
5
5
 
@@ -19,7 +19,7 @@ say "Adding configurations"
19
19
 
20
20
  check_yarn_integrity_config = ->(value) { <<CONFIG }
21
21
  # Verifies that versions and hashed value of the package contents in the project's package.json
22
- config.webpacker.check_yarn_integrity = #{value}
22
+ config.webpacker.check_yarn_integrity = #{value}
23
23
  CONFIG
24
24
 
25
25
  if Rails::VERSION::MAJOR >= 5
@@ -50,7 +50,7 @@ if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR > 1
50
50
  say "You need to allow webpack-dev-server host as allowed origin for connect-src.", :yellow
51
51
  say "This can be done in Rails 5.2+ for development environment in the CSP initializer", :yellow
52
52
  say "config/initializers/content_security_policy.rb with a snippet like this:", :yellow
53
- say "p.connect_src :self, :https, \"http://localhost:3035\", \"ws://localhost:3035\" if Rails.env.development?", :yellow
53
+ say "policy.connect_src :self, :https, \"http://localhost:3035\", \"ws://localhost:3035\" if Rails.env.development?", :yellow
54
54
  end
55
55
 
56
56
  say "Webpacker successfully installed 🎉 🍰", :green
data/lib/install/vue.rb CHANGED
@@ -24,16 +24,16 @@ copy_file "#{__dir__}/examples/vue/app.vue",
24
24
  "#{Webpacker.config.source_path}/app.vue"
25
25
 
26
26
  say "Installing all Vue dependencies"
27
- run "yarn add vue vue-loader vue-template-compiler"
27
+ run "yarn add vue vue-loader@14.2.2 vue-template-compiler"
28
28
 
29
29
  if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR > 1
30
30
  say "You need to enable unsafe-eval rule.", :yellow
31
31
  say "This can be done in Rails 5.2+ for development environment in the CSP initializer", :yellow
32
32
  say "config/initializers/content_security_policy.rb with a snippet like this:", :yellow
33
33
  say "if Rails.env.development?", :yellow
34
- say " p.script_src :self, :https, :unsafe_eval", :yellow
34
+ say " policy.script_src :self, :https, :unsafe_eval", :yellow
35
35
  say "else", :yellow
36
- say " p.script_src :self, :https", :yellow
36
+ say " policy.script_src :self, :https", :yellow
37
37
  say "end", :yellow
38
38
  end
39
39
 
@@ -1,4 +1,5 @@
1
1
  tasks = {
2
+ "webpacker:info" => "Provides information on Webpacker's environment",
2
3
  "webpacker:install" => "Installs and setup webpack with Yarn",
3
4
  "webpacker:compile" => "Compiles webpack bundles based on environment",
4
5
  "webpacker:clobber" => "Removes the webpack compiled output directory",
@@ -0,0 +1,19 @@
1
+ require "webpacker/version"
2
+
3
+ namespace :webpacker do
4
+ desc "Provide information on Webpacker's environment"
5
+ task :info do
6
+ $stdout.puts "Ruby: #{`ruby --version`}"
7
+ $stdout.puts "Rails: #{Rails.version}"
8
+ $stdout.puts "Webpacker: #{Webpacker::VERSION}"
9
+ $stdout.puts "Node: #{`node --version`}"
10
+ $stdout.puts "Yarn: #{`yarn --version`}"
11
+
12
+ $stdout.puts "\n"
13
+ $stdout.puts "@rails/webpacker: \n#{`npm list @rails/webpacker version`}"
14
+
15
+ $stdout.puts "Is bin/webpack present?: #{File.exist? 'bin/webpack'}"
16
+ $stdout.puts "Is bin/webpack-dev-server present?: #{File.exist? 'bin/webpack-dev-server'}"
17
+ $stdout.puts "Is bin/yarn present?: #{File.exist? 'bin/yarn'}"
18
+ end
19
+ end
data/lib/webpacker.rb CHANGED
@@ -15,7 +15,7 @@ module Webpacker
15
15
 
16
16
  def with_node_env(env)
17
17
  original = ENV["NODE_ENV"]
18
- ENV["NODE_ENV"] = "production"
18
+ ENV["NODE_ENV"] = env
19
19
  yield
20
20
  ensure
21
21
  ENV["NODE_ENV"] = original
@@ -19,7 +19,9 @@ class Webpacker::Compiler
19
19
  def compile
20
20
  if stale?
21
21
  record_compilation_digest
22
- run_webpack
22
+ run_webpack.tap do |success|
23
+ remove_compilation_digest if !success
24
+ end
23
25
  else
24
26
  true
25
27
  end
@@ -50,10 +52,14 @@ class Webpacker::Compiler
50
52
  compilation_digest_path.write(watched_files_digest)
51
53
  end
52
54
 
55
+ def remove_compilation_digest
56
+ compilation_digest_path.delete if compilation_digest_path.exist?
57
+ end
58
+
53
59
  def run_webpack
54
60
  logger.info "Compiling…"
55
61
 
56
- sterr, stdout, status = Open3.capture3(webpack_env, "#{RbConfig.ruby} ./bin/webpack")
62
+ stdout, sterr , status = Open3.capture3(webpack_env, "#{RbConfig.ruby} ./bin/webpack")
57
63
 
58
64
  if status.success?
59
65
  logger.info "Compiled all packs in #{config.public_output_path}"
@@ -60,6 +60,6 @@ class Webpacker::DevServer
60
60
  end
61
61
 
62
62
  def defaults
63
- config.send(:defaults)[:dev_server]
63
+ config.send(:defaults)[:dev_server] || {}
64
64
  end
65
65
  end
@@ -11,6 +11,10 @@ class Webpacker::DevServerProxy < Rack::Proxy
11
11
  def perform_request(env)
12
12
  if env["PATH_INFO"].start_with?("/#{public_output_uri_path}") && Webpacker.dev_server.running?
13
13
  env["HTTP_HOST"] = env["HTTP_X_FORWARDED_HOST"] = env["HTTP_X_FORWARDED_SERVER"] = Webpacker.dev_server.host_with_port
14
+ env["HTTP_X_FORWARDED_PROTO"] = env["HTTP_X_FORWARDED_SCHEME"] = Webpacker.dev_server.protocol
15
+ unless Webpacker.dev_server.https?
16
+ env["HTTPS"] = env["HTTP_X_FORWARDED_SSL"] = "off"
17
+ end
14
18
  env["SCRIPT_NAME"] = ""
15
19
 
16
20
  super(env)
@@ -33,6 +33,16 @@ module Webpacker::Helper
33
33
  end
34
34
  end
35
35
 
36
+ # Creates a image tag that references the named pack file.
37
+ #
38
+ # Example:
39
+ #
40
+ # <%= image_pack_tag 'application.png', size: '16x10', alt: 'Edit Entry' %>
41
+ # <img alt='Edit Entry' src='/packs/application-k344a6d59eef8632c9d1.png' width='16' height='10' />
42
+ def image_pack_tag(name, **options)
43
+ image_tag(asset_path(Webpacker.manifest.lookup!(name)), **options)
44
+ end
45
+
36
46
  # Creates a script tag that references the named pack file, as compiled by webpack per the entries list
37
47
  # in config/webpack/shared.js. By default, this list is auto-generated to match everything in
38
48
  # app/javascript/packs/*.js. In production mode, the digested reference is automatically looked up.
@@ -46,7 +46,8 @@ class Webpacker::Engine < ::Rails::Engine
46
46
  end
47
47
 
48
48
  initializer "webpacker.proxy" do |app|
49
- if Rails.env.development?
49
+ insert_middleware = Webpacker.config.dev_server.present? rescue nil
50
+ if insert_middleware
50
51
  app.middleware.insert_before 0,
51
52
  Rails::VERSION::MAJOR >= 5 ?
52
53
  Webpacker::DevServerProxy : "Webpacker::DevServerProxy", ssl_verify_none: true
@@ -1,4 +1,4 @@
1
1
  module Webpacker
2
2
  # Change the version in package.json too, please!
3
- VERSION = "3.4.3".freeze
3
+ VERSION = "3.5.0".freeze
4
4
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rails/webpacker",
3
- "version": "3.4.3",
3
+ "version": "3.5.0",
4
4
  "description": "Use webpack to manage app-like JavaScript modules in Rails",
5
5
  "main": "package/index.js",
6
6
  "files": [
@@ -1,14 +1,30 @@
1
1
  /* global test expect, describe */
2
2
 
3
- const { chdirTestApp, chdirCwd } = require('../utils/helpers')
3
+ const { chdirCwd, chdirTestApp } = require('../utils/helpers')
4
4
 
5
5
  chdirTestApp()
6
6
 
7
7
  const config = require('../config')
8
8
 
9
9
  describe('Config', () => {
10
+ beforeEach(() => jest.resetModules())
10
11
  afterAll(chdirCwd)
11
12
 
13
+ test('public path', () => {
14
+ process.env.RAILS_ENV = 'development'
15
+ delete process.env.RAILS_RELATIVE_URL_ROOT
16
+ const config = require('../config')
17
+ expect(config.publicPath).toEqual('/packs/')
18
+ })
19
+
20
+ // also tests removal of extra slashes
21
+ test('public path with relative root', () => {
22
+ process.env.RAILS_ENV = 'development'
23
+ process.env.RAILS_RELATIVE_URL_ROOT = '/foo'
24
+ const config = require('../config')
25
+ expect(config.publicPath).toEqual('/foo/packs/')
26
+ })
27
+
12
28
  test('should return extensions as listed in app config', () => {
13
29
  expect(config.extensions).toEqual([
14
30
  '.js',
data/package/config.js CHANGED
@@ -20,6 +20,14 @@ if (isArray(app.extensions) && app.extensions.length) delete defaults.extensions
20
20
 
21
21
  const config = deepMerge(defaults, app)
22
22
  config.outputPath = resolve('public', config.public_output_path)
23
- config.publicPath = `/${config.public_output_path}/`.replace(/([^:]\/)\/+/g, '$1')
23
+
24
+ let publicPath = `/${config.public_output_path}/`
25
+ // Add prefix to publicPath.
26
+ if (process.env.RAILS_RELATIVE_URL_ROOT) {
27
+ publicPath = `/${process.env.RAILS_RELATIVE_URL_ROOT}${publicPath}`
28
+ }
29
+
30
+ // Remove extra slashes.
31
+ config.publicPath = publicPath.replace(/(^\/|[^:]\/)\/+/g, '$1')
24
32
 
25
33
  module.exports = config
@@ -1,12 +1,20 @@
1
1
  require "test_helper"
2
2
 
3
3
  class CompilerTest < Minitest::Test
4
- def setup
4
+ def remove_compilation_digest_path
5
5
  Webpacker.compiler.send(:compilation_digest_path).tap do |path|
6
6
  path.delete if path.exist?
7
7
  end
8
8
  end
9
9
 
10
+ def setup
11
+ remove_compilation_digest_path
12
+ end
13
+
14
+ def teardown
15
+ remove_compilation_digest_path
16
+ end
17
+
10
18
  def test_custom_environment_variables
11
19
  assert Webpacker.compiler.send(:webpack_env)["FOO"] == nil
12
20
  Webpacker.compiler.env["FOO"] = "BAR"
@@ -29,6 +37,27 @@ class CompilerTest < Minitest::Test
29
37
  assert !Webpacker.compiler.fresh?
30
38
  end
31
39
 
40
+ def test_freshness_on_compile_success
41
+ status = OpenStruct.new(success?: true)
42
+
43
+ assert Webpacker.compiler.stale?
44
+ Open3.stub :capture3, [:sterr, :stdout, status] do
45
+ Webpacker.compiler.compile
46
+ assert Webpacker.compiler.fresh?
47
+ end
48
+ end
49
+
50
+ def test_staleness_on_compile_fail
51
+ status = OpenStruct.new(success?: false)
52
+
53
+ assert Webpacker.compiler.stale?
54
+ Open3.stub :capture3, [:sterr, :stdout, status] do
55
+
56
+ Webpacker.compiler.compile
57
+ assert Webpacker.compiler.stale?
58
+ end
59
+ end
60
+
32
61
  def test_compilation_digest_path
33
62
  assert Webpacker.compiler.send(:compilation_digest_path).to_s.ends_with?(Webpacker.env)
34
63
  end
data/test/helper_test.rb CHANGED
@@ -31,6 +31,12 @@ class HelperTest < ActionView::TestCase
31
31
  assert_equal "https://example.com/packs/bootstrap-c38deda30895059837cf.css", asset_pack_url("bootstrap.css")
32
32
  end
33
33
 
34
+ def test_image_pack_tag
35
+ assert_equal \
36
+ "<img alt=\"Edit Entry\" src=\"/packs/application-k344a6d59eef8632c9d1.png\" width=\"16\" height=\"10\" />",
37
+ image_pack_tag("application.png", size: "16x10", alt: "Edit Entry")
38
+ end
39
+
34
40
  def test_javascript_pack_tag
35
41
  assert_equal \
36
42
  %(<script src="/packs/bootstrap-300631c4f0e0f9c865bc.js"></script>),
data/webpacker.gemspec CHANGED
@@ -10,6 +10,11 @@ Gem::Specification.new do |s|
10
10
  s.homepage = "https://github.com/rails/webpacker"
11
11
  s.license = "MIT"
12
12
 
13
+ s.metadata = {
14
+ "source_code_uri" => "https://github.com/rails/webpacker/tree/v#{Webpacker::VERSION}",
15
+ "changelog_uri" => "https://github.com/rails/webpacker/blob/v#{Webpacker::VERSION}/CHANGELOG.md"
16
+ }
17
+
13
18
  s.required_ruby_version = ">= 2.2.0"
14
19
 
15
20
  s.add_dependency "activesupport", ">= 4.2"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webpacker
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.3
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-04-03 00:00:00.000000000 Z
12
+ date: 2018-04-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -157,6 +157,7 @@ files:
157
157
  - lib/tasks/webpacker/check_yarn.rake
158
158
  - lib/tasks/webpacker/clobber.rake
159
159
  - lib/tasks/webpacker/compile.rake
160
+ - lib/tasks/webpacker/info.rake
160
161
  - lib/tasks/webpacker/install.rake
161
162
  - lib/tasks/webpacker/verify_install.rake
162
163
  - lib/tasks/webpacker/yarn_install.rake
@@ -235,7 +236,9 @@ files:
235
236
  homepage: https://github.com/rails/webpacker
236
237
  licenses:
237
238
  - MIT
238
- metadata: {}
239
+ metadata:
240
+ source_code_uri: https://github.com/rails/webpacker/tree/v3.5.0
241
+ changelog_uri: https://github.com/rails/webpacker/blob/v3.5.0/CHANGELOG.md
239
242
  post_install_message:
240
243
  rdoc_options: []
241
244
  require_paths: