webpacker_lite 2.0.2 → 2.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e2db317915bebedc04ee628df5ebb0d007cafd5
4
- data.tar.gz: '047779354717394e059550b300f6b86f7e0653b4'
3
+ metadata.gz: 8ea5e5942f1f281d39534cc47a456e51e2257108
4
+ data.tar.gz: 89a00ce6bf138f78f8e381687c69d3932480f08c
5
5
  SHA512:
6
- metadata.gz: 8a1f1f0931790a5004fbde87baa04ded96dcf69270f19c17a6e7459c0343b91439efa2ec7afccbb7c8a0d39b92e2814c4454dff8d8d728d40feb0652c124d3db
7
- data.tar.gz: 24e05588ada561572186806b1e18e4fdd889072b525b485b8f2a8d2d9013837224834b5b193ed69ad85c9528737f42d64c0ac0cb0e92e8b49407cdf608d9ea3f
6
+ metadata.gz: d6124cf538517d2af41017c756fdfe95bb362eda73923314a44be3fa92db5016d6a3c212874d486226087fb9d86293fad1c0cab30106192e5872311208d26982
7
+ data.tar.gz: 3314e35bd8dc6118b891f4e51e6467c4d17e3a12f059925f8ce736e0dd81136c5c161aa9f82fb8fbd3c19df9e76494066b3d93c28f5201a16475e0dc46a87db6
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ Contributors: please follow the recommendations outlined at [keepachangelog.com]
6
6
  ## [Unreleased]
7
7
  *Please add entries here for your pull requests.*
8
8
 
9
+ ## [2.0.3] - 2017-05-29
10
+ ### Fixed
11
+ * Fixed caching of manifest.json for tests. [#14](https://github.com/shakacode/webpacker_lite/pull/14) by [justin808](https://github.com/justin808).
12
+
9
13
  ## [2.0.2] - 2017-05-26
10
14
  ### Fixed
11
15
  * Fixed rake assets:clobber. [#11](https://github.com/shakacode/webpacker_lite/pull/11) by [dpuscher](https://github.com/dpuscher).
@@ -30,7 +34,8 @@ All in [#9](https://github.com/shakacode/webpacker_lite/pull/9) by [justin808](h
30
34
  ## [1.0.0] - 2017-05-03
31
35
  Initial release
32
36
 
33
- [Unreleased]: https://github.com/shakacode/webpacker_lite/compare/2.0.2...master
37
+ [Unreleased]: https://github.com/shakacode/webpacker_lite/compare/2.0.3...master
38
+ [2.0.3]: https://github.com/shakacode/react_on_rails/compare/2.0.2...2.0.3
34
39
  [2.0.2]: https://github.com/shakacode/react_on_rails/compare/2.0.1...2.0.2
35
40
  [2.0.1]: https://github.com/shakacode/react_on_rails/compare/2.0.0...2.0.1
36
41
  [2.0.0]: https://github.com/shakacode/react_on_rails/compare/1.0.0...2.0.0
data/CONTRIBUTING.md CHANGED
@@ -45,6 +45,10 @@ or to autofix:
45
45
  bundle exec rubocop -a
46
46
  ```
47
47
 
48
+ ### Debugging
49
+
50
+ Enable pry by setting an ENV value for `USE_PRY`. When you use pry, you may get a useless warning about circular references.
51
+
48
52
  ### All ci
49
53
 
50
54
  ```sh
@@ -67,10 +71,15 @@ What do project maintainers do? What sort of work is involved? [sstephenson](htt
67
71
 
68
72
  # Releasing
69
73
 
70
- If the version to bump is `2.0.1`
74
+ Using [gem-release](https://github.com/svenfuchs/gem-release).
75
+
76
+ If the version to bump is `2.0.3`
71
77
 
72
78
  ```
73
- gem bump --tag --push --version 2.0.1
79
+ git checkout master
80
+ git pull --rebase
81
+ gem bump --version 2.0.3
82
+ bundle
83
+ git commit -m "Update Gemfile.lock"
84
+ gem release --tag --push
74
85
  ```
75
-
76
-
data/Gemfile CHANGED
@@ -8,4 +8,13 @@ gem "rubocop", ">= 0.47", require: false
8
8
 
9
9
  group :test do
10
10
  gem "minitest", "~> 5.10", "!= 5.10.2"
11
+
12
+ if ENV["USE_PRY"]
13
+ gem "pry"
14
+ gem "pry-byebug"
15
+ gem "pry-doc"
16
+ gem "pry-rails"
17
+ gem "pry-rescue"
18
+ gem "pry-stack_explorer"
19
+ end
11
20
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- webpacker_lite (2.0.1)
4
+ webpacker_lite (2.0.3)
5
5
  activesupport (>= 4.2)
6
6
  multi_json (~> 1.2)
7
7
  railties (>= 4.2)
@@ -9,39 +9,39 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actioncable (5.1.0)
13
- actionpack (= 5.1.0)
12
+ actioncable (5.1.1)
13
+ actionpack (= 5.1.1)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (~> 0.6.1)
16
- actionmailer (5.1.0)
17
- actionpack (= 5.1.0)
18
- actionview (= 5.1.0)
19
- activejob (= 5.1.0)
16
+ actionmailer (5.1.1)
17
+ actionpack (= 5.1.1)
18
+ actionview (= 5.1.1)
19
+ activejob (= 5.1.1)
20
20
  mail (~> 2.5, >= 2.5.4)
21
21
  rails-dom-testing (~> 2.0)
22
- actionpack (5.1.0)
23
- actionview (= 5.1.0)
24
- activesupport (= 5.1.0)
22
+ actionpack (5.1.1)
23
+ actionview (= 5.1.1)
24
+ activesupport (= 5.1.1)
25
25
  rack (~> 2.0)
26
26
  rack-test (~> 0.6.3)
27
27
  rails-dom-testing (~> 2.0)
28
28
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
- actionview (5.1.0)
30
- activesupport (= 5.1.0)
29
+ actionview (5.1.1)
30
+ activesupport (= 5.1.1)
31
31
  builder (~> 3.1)
32
32
  erubi (~> 1.4)
33
33
  rails-dom-testing (~> 2.0)
34
34
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
35
- activejob (5.1.0)
36
- activesupport (= 5.1.0)
35
+ activejob (5.1.1)
36
+ activesupport (= 5.1.1)
37
37
  globalid (>= 0.3.6)
38
- activemodel (5.1.0)
39
- activesupport (= 5.1.0)
40
- activerecord (5.1.0)
41
- activemodel (= 5.1.0)
42
- activesupport (= 5.1.0)
38
+ activemodel (5.1.1)
39
+ activesupport (= 5.1.1)
40
+ activerecord (5.1.1)
41
+ activemodel (= 5.1.1)
42
+ activesupport (= 5.1.1)
43
43
  arel (~> 8.0)
44
- activesupport (5.1.0)
44
+ activesupport (5.1.1)
45
45
  concurrent-ruby (~> 1.0, >= 1.0.2)
46
46
  i18n (~> 0.7)
47
47
  minitest (~> 5.1)
@@ -65,42 +65,44 @@ GEM
65
65
  mini_portile2 (2.1.0)
66
66
  minitest (5.10.1)
67
67
  multi_json (1.12.1)
68
- nio4r (2.0.0)
68
+ nio4r (2.1.0)
69
69
  nokogiri (1.7.2)
70
70
  mini_portile2 (~> 2.1.0)
71
+ parallel (1.11.2)
71
72
  parser (2.4.0.0)
72
73
  ast (~> 2.2)
73
74
  powerpack (0.1.1)
74
- rack (2.0.2)
75
+ rack (2.0.3)
75
76
  rack-test (0.6.3)
76
77
  rack (>= 1.0)
77
- rails (5.1.0)
78
- actioncable (= 5.1.0)
79
- actionmailer (= 5.1.0)
80
- actionpack (= 5.1.0)
81
- actionview (= 5.1.0)
82
- activejob (= 5.1.0)
83
- activemodel (= 5.1.0)
84
- activerecord (= 5.1.0)
85
- activesupport (= 5.1.0)
78
+ rails (5.1.1)
79
+ actioncable (= 5.1.1)
80
+ actionmailer (= 5.1.1)
81
+ actionpack (= 5.1.1)
82
+ actionview (= 5.1.1)
83
+ activejob (= 5.1.1)
84
+ activemodel (= 5.1.1)
85
+ activerecord (= 5.1.1)
86
+ activesupport (= 5.1.1)
86
87
  bundler (>= 1.3.0, < 2.0)
87
- railties (= 5.1.0)
88
+ railties (= 5.1.1)
88
89
  sprockets-rails (>= 2.0.0)
89
90
  rails-dom-testing (2.0.3)
90
91
  activesupport (>= 4.2.0)
91
92
  nokogiri (>= 1.6)
92
93
  rails-html-sanitizer (1.0.3)
93
94
  loofah (~> 2.0)
94
- railties (5.1.0)
95
- actionpack (= 5.1.0)
96
- activesupport (= 5.1.0)
95
+ railties (5.1.1)
96
+ actionpack (= 5.1.1)
97
+ activesupport (= 5.1.1)
97
98
  method_source
98
99
  rake (>= 0.8.7)
99
100
  thor (>= 0.18.1, < 2.0)
100
101
  rainbow (2.2.2)
101
102
  rake
102
103
  rake (12.0.0)
103
- rubocop (0.48.1)
104
+ rubocop (0.49.1)
105
+ parallel (~> 1.10)
104
106
  parser (>= 2.3.3.1, < 3.0)
105
107
  powerpack (~> 0.1)
106
108
  rainbow (>= 1.99.1, < 3.0)
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Webpacker Lite
2
2
  ![Gem Version](https://badge.fury.io/rb/webpacker_lite.svg)
3
3
 
4
+ **VERSION 8 of [React on Rails](https://github.com/shakacode/react_on_rails) is super close!!!** [VERSION 8.0.0-beta.3](https://rubygems.org/gems/react_on_rails/versions/8.0.0.beta.3) has shipped with [webpacker_lite](https://github.com/shakacode/webpacker_lite) support! Please try [the 8.0.0-beta.3 beta](https://rubygems.org/gems/react_on_rails/versions/8.0.0.beta.3) and please report issues! We're **SUPER** close as we've also upgraded the [shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial) with [PR #395](https://github.com/shakacode/react-webpack-rails-tutorial/pull/395). That PR shows the changes needed to go to Webpacker Lite.
5
+
6
+
4
7
  *A slimmer version of Webpacker*
5
8
 
6
9
  Webpacker Lite provides similar webpack enabled view helpers from [Webpacker](https://github.com/rails/webpacker).
@@ -38,7 +38,7 @@ class WebpackerLite::Configuration < WebpackerLite::FileLoader
38
38
  end
39
39
 
40
40
  def configuration
41
- load_instance if WebpackerLite::Env.development?
41
+ load_instance
42
42
  raise WebpackerLite::FileLoader::FileLoaderError.new("WebpackerLite::Configuration.load_instance must be called first") unless instance
43
43
  instance.data
44
44
  end
@@ -8,10 +8,6 @@ class WebpackerLite::Env < WebpackerLite::FileLoader
8
8
  instance.data
9
9
  end
10
10
 
11
- def development?
12
- current == "development"
13
- end
14
-
15
11
  def hot_loading?
16
12
  (ENV["HOT_RELOADING"].present? && (
17
13
  ENV["HOT_RELOADING"].upcase == "YES" ||
@@ -4,21 +4,34 @@ class WebpackerLite::FileLoader
4
4
  class FileLoaderError < StandardError; end
5
5
 
6
6
  class_attribute :instance
7
- attr_accessor :data
7
+ attr_accessor :data, :mtime
8
8
 
9
9
  class << self
10
10
  def load_instance(path = file_path)
11
+ # Assume production is 100% cached
12
+ return if self.instance && # if we have a singleton
13
+ (env == "production" || # skip if production bc always cached
14
+ self.instance.mtime == File.mtime(path)) # skip if mtime not changed
15
+
11
16
  self.instance = new(path)
12
17
  end
13
18
 
14
19
  def file_path
15
20
  raise FileLoaderError.new("Subclass of WebpackerLite::FileLoader should override this method")
16
21
  end
22
+
23
+ private
24
+
25
+ # Prefer the NODE_ENV to the rails env.
26
+ def env
27
+ ENV["NODE_ENV"].presence || Rails.env
28
+ end
17
29
  end
18
30
 
19
31
  private
20
32
  def initialize(path)
21
33
  @path = path
34
+ @mtime = File.mtime(path)
22
35
  @data = load_data
23
36
  end
24
37
 
@@ -41,7 +41,7 @@ class WebpackerLite::Manifest < WebpackerLite::FileLoader
41
41
  def lookup(name)
42
42
  instance.confirm_manifest_exists
43
43
 
44
- load_instance if WebpackerLite::Env.development? || instance.data.empty?
44
+ load_instance
45
45
  raise WebpackerLite::FileLoader::FileLoaderError.new("WebpackerLite::Manifest.load must be called first") unless instance
46
46
  instance.data[name.to_s]
47
47
  end
@@ -1,3 +1,3 @@
1
1
  module WebpackerLite
2
- VERSION = "2.0.2".freeze
2
+ VERSION = "2.0.3".freeze
3
3
  end
@@ -2,12 +2,12 @@ require "webpacker_test"
2
2
 
3
3
  class ConfigurationTest < Minitest::Test
4
4
  def test_manifest_path
5
- manifest_path = File.join(File.dirname(__FILE__), "test_app/public/webpack", "manifest.json").to_s
6
- assert_equal WebpackerLite::Configuration.manifest_path.to_s, manifest_path
5
+ manifest_path = File.join(File.dirname(__FILE__), "test_app/public/webpack/test", "manifest.json").to_s
6
+ assert_equal manifest_path, WebpackerLite::Configuration.manifest_path.to_s
7
7
  end
8
8
 
9
9
  def test_output_path
10
- output_path = File.join(File.dirname(__FILE__), "test_app/public/webpack").to_s
11
- assert_equal WebpackerLite::Configuration.webpack_public_output_dir.to_s, output_path
10
+ output_path = File.join(File.dirname(__FILE__), "test_app/public/webpack/test").to_s
11
+ assert_equal output_path, WebpackerLite::Configuration.webpack_public_output_dir.to_s
12
12
  end
13
13
  end
data/test/env_test.rb CHANGED
@@ -2,11 +2,11 @@ require "webpacker_test"
2
2
 
3
3
  class EnvTest < Minitest::Test
4
4
  def test_current_env
5
- assert_equal WebpackerLite::Env.current, "production"
5
+ assert_equal Rails.env, WebpackerLite::Env.current
6
6
  end
7
7
 
8
8
  def test_file_path
9
- correct_path = File.join(File.dirname(__FILE__), "test_app/config", "webpacker_lite.yml").to_s
10
- assert_equal WebpackerLite::Env.file_path.to_s, correct_path
9
+ correct_path = File.join(File.dirname(__FILE__), "test_app", "config", "webpacker_lite.yml").to_s
10
+ assert_equal correct_path, WebpackerLite::Env.file_path.to_s
11
11
  end
12
12
  end
data/test/helper_test.rb CHANGED
@@ -7,17 +7,17 @@ class HelperTest < ActionView::TestCase
7
7
  end
8
8
 
9
9
  def test_asset_pack_path
10
- assert_equal @view.asset_pack_path("bootstrap.js"), "/webpack/bootstrap-300631c4f0e0f9c865bc.js"
11
- assert_equal @view.asset_pack_path("bootstrap.css"), "/webpack/bootstrap-c38deda30895059837cf.css"
10
+ assert_equal @view.asset_pack_path("bootstrap.js"), "/webpack/test/bootstrap-300631c4f0e0f9c865bc.js"
11
+ assert_equal @view.asset_pack_path("bootstrap.css"), "/webpack/test/bootstrap-c38deda30895059837cf.css"
12
12
  end
13
13
 
14
14
  def test_javascript_pack_tag
15
- script = %(<script src="/webpack/bootstrap-300631c4f0e0f9c865bc.js"></script>)
15
+ script = %(<script src="/webpack/test/bootstrap-300631c4f0e0f9c865bc.js"></script>)
16
16
  assert_equal @view.javascript_pack_tag("bootstrap.js"), script
17
17
  end
18
18
 
19
19
  def test_stylesheet_pack_tag
20
- expected_style = %(<link rel="stylesheet" media="screen" href="/webpack/bootstrap-c38deda30895059837cf.css" />)
20
+ expected_style = %(<link rel="stylesheet" media="screen" href="/webpack/test/bootstrap-c38deda30895059837cf.css" />)
21
21
  assert_equal @view.stylesheet_pack_tag("bootstrap.css"), expected_style
22
22
  end
23
23
  end
@@ -2,12 +2,12 @@ require "webpacker_test"
2
2
 
3
3
  class ManifestTest < Minitest::Test
4
4
  def test_file_path
5
- file_path = File.join(File.dirname(__FILE__), "test_app/public/webpack", "manifest.json").to_s
5
+ file_path = File.join(File.dirname(__FILE__), "test_app/public/webpack/test", "manifest.json").to_s
6
6
  assert_equal WebpackerLite::Manifest.file_path.to_s, file_path
7
7
  end
8
8
 
9
9
  def test_lookup_exception
10
- manifest_path = File.join(File.dirname(__FILE__), "test_app/public/webpack", "manifest.json").to_s
10
+ manifest_path = File.join(File.dirname(__FILE__), "test_app/public/webpack/test", "manifest.json").to_s
11
11
  asset_file = "calendar.js"
12
12
  msg = <<-MSG
13
13
  WebpackerLite can't find #{asset_file} in your manifest #{manifest_path}. Possible causes:
@@ -0,0 +1,27 @@
1
+ # Note: Base output directory of /public is assumed for static files
2
+ default: &default
3
+ manifest: manifest.json
4
+ # Used in your webpack configuration. Must be created in the
5
+ # webpack_public_output_dir folder
6
+
7
+ development:
8
+ <<: *default
9
+ # generated files for development, in /public/webpack/development
10
+ webpack_public_output_dir: webpack/development
11
+
12
+ # Default is localhost:3500
13
+ hot_reloading_host: localhost:3500
14
+
15
+ # Developer note: considering removing this option so it can ONLY be turned by using an ENV value.
16
+ # Default is false, ENV 'HOT_RELOAD' will always override
17
+ hot_reloading_enabled_by_default: false
18
+
19
+ test:
20
+ <<: *default
21
+ # generated files for tests, in /public/webpack/test
22
+ webpack_public_output_dir: webpack/test
23
+
24
+ production:
25
+ <<: *default
26
+ # generated files for tests, in /public/webpack/production
27
+ webpack_public_output_dir: webpack/production
@@ -1,10 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ if ENV["USE_PRY"]
4
+ require "pry"
5
+ end
6
+
3
7
  require "minitest/autorun"
4
8
  require "rails"
5
9
  require "rails/test_help"
6
10
  require "webpacker_lite"
7
11
 
12
+ Rails.env = "test"
13
+
8
14
  module TestApp
9
15
  class Application < ::Rails::Application
10
16
  config.root = File.join(File.dirname(__FILE__), "test_app")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webpacker_lite
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson, Justin Gordon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-27 00:00:00.000000000 Z
11
+ date: 2017-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -100,7 +100,8 @@ files:
100
100
  - test/helper_test.rb
101
101
  - test/manifest_test.rb
102
102
  - test/test_app/config/secrets.yml
103
- - test/test_app/public/webpack/manifest.json
103
+ - test/test_app/config/webpacker_lite.yml
104
+ - test/test_app/public/webpack/test/manifest.json
104
105
  - test/webpacker_test.rb
105
106
  - webpacker.gemspec
106
107
  - yarn.lock
@@ -124,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
125
  version: '0'
125
126
  requirements: []
126
127
  rubyforge_project:
127
- rubygems_version: 2.6.8
128
+ rubygems_version: 2.6.11
128
129
  signing_key:
129
130
  specification_version: 4
130
131
  summary: Asset Helpers for Webpack
@@ -134,5 +135,6 @@ test_files:
134
135
  - test/helper_test.rb
135
136
  - test/manifest_test.rb
136
137
  - test/test_app/config/secrets.yml
137
- - test/test_app/public/webpack/manifest.json
138
+ - test/test_app/config/webpacker_lite.yml
139
+ - test/test_app/public/webpack/test/manifest.json
138
140
  - test/webpacker_test.rb