browserify-rails 2.1.0 → 2.2.0
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 +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/browserify-rails/browserify_processor.rb +3 -5
- data/lib/browserify-rails/version.rb +1 -1
- data/test/compilation_test.rb +31 -2
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1456362e68e89aa18bc17a329fc87cd91d675e9b
|
4
|
+
data.tar.gz: 343f2a728f65649c3c0bf7c985b11b4c09d9af55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ace2902286d3ceefb7e4ab203749fd6dff9a3d78746106c0ca55b0a71c04f71955239464404354a892baa40b19b1ef7c5c9e0585823392db4f001b03a727e979
|
7
|
+
data.tar.gz: 5ca9d321b84f33e754839cd84621da22beffdf0345bd3190c5fd7ac8144d0a4565ee2d51de2c975081909f134711dbab07554dce43271f15291b2988f14adf9a
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file going forward.
|
3
3
|
|
4
|
+
## [2.2.0] - 2016-01-01
|
5
|
+
- fix another dependency issue impacting cache invalidation (see PR #131)
|
6
|
+
|
4
7
|
## [2.1.0] - 2015-12-26
|
5
8
|
- fix some dependency issues (see PR #130)
|
6
9
|
|
@@ -23,6 +23,9 @@ module BrowserifyRails
|
|
23
23
|
self.data = input[:data]
|
24
24
|
self.file = input[:filename]
|
25
25
|
|
26
|
+
# Clear the cached dependencies because the source file changes
|
27
|
+
@dependencies = nil
|
28
|
+
|
26
29
|
ensure_tmp_dir_exists!
|
27
30
|
ensure_commands_exist!
|
28
31
|
|
@@ -129,11 +132,6 @@ module BrowserifyRails
|
|
129
132
|
|
130
133
|
# @return [<String>] Paths of files, that this file depends on
|
131
134
|
def dependencies
|
132
|
-
if (@dependencies_source_file != file)
|
133
|
-
@dependencies = nil
|
134
|
-
@dependencies_source_file = file
|
135
|
-
end
|
136
|
-
|
137
135
|
@dependencies ||= begin
|
138
136
|
# We forcefully run browserify (avoiding browserifyinc) with the --list
|
139
137
|
# option to get a list of files.
|
data/test/compilation_test.rb
CHANGED
@@ -10,11 +10,12 @@ class BrowserifyTest < ActionDispatch::IntegrationTest
|
|
10
10
|
end
|
11
11
|
|
12
12
|
setup do
|
13
|
-
Rails.application.assets.cache = Sprockets::Cache::MemoryStore.new
|
14
|
-
|
15
13
|
# Reset config on each run
|
16
14
|
Dummy::Application.config.browserify_rails.force = false
|
17
15
|
|
16
|
+
# Reset the cache
|
17
|
+
Rails.application.assets.cache = Sprockets::Cache::MemoryStore.new
|
18
|
+
BrowserifyRails::BrowserifyProcessor.instance.instance_variable_set(:@dependencies, nil)
|
18
19
|
cache_file = File.join(Rails.root, "tmp/cache/browserify-rails/browserifyinc-cache.json")
|
19
20
|
File.delete(cache_file) if File.exists?(cache_file)
|
20
21
|
|
@@ -130,6 +131,34 @@ class BrowserifyTest < ActionDispatch::IntegrationTest
|
|
130
131
|
assert_equal expected_output, @response.body.strip
|
131
132
|
end
|
132
133
|
|
134
|
+
test "asset pipeline should regenerate application.js when the dependencies change and the new required file updates" do
|
135
|
+
|
136
|
+
get "/assets/application.js"
|
137
|
+
|
138
|
+
# Ensure that Sprockets can detect the change to the file modification time
|
139
|
+
sleep 1
|
140
|
+
|
141
|
+
# The dependencies of application.js change
|
142
|
+
File.open(File.join(Rails.root, "app/assets/javascripts/application.js"), "w+") do |f|
|
143
|
+
f.puts "var library = require('./a_huge_library.js');"
|
144
|
+
end
|
145
|
+
|
146
|
+
get "/assets/application.js"
|
147
|
+
|
148
|
+
assert_response :success
|
149
|
+
assert_match "\"THIS IS A HUGE LIBRARY\"", @response.body.strip
|
150
|
+
|
151
|
+
# The new required js file updates
|
152
|
+
File.open(File.join(Rails.root, "app/assets/javascripts/a_huge_library.js"), "w+") do |f|
|
153
|
+
f.puts "module.exports = \"THIS IS A HUGE LIBRARY 2\""
|
154
|
+
end
|
155
|
+
|
156
|
+
get "/assets/application.js"
|
157
|
+
|
158
|
+
assert_response :success
|
159
|
+
assert_match "\"THIS IS A HUGE LIBRARY 2\"", @response.body.strip
|
160
|
+
end
|
161
|
+
|
133
162
|
test "browserifies coffee files after they have been compiled to JS" do
|
134
163
|
expected_output = fixture("mocha.js")
|
135
164
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: browserify-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henry Hsu, Cymen Vig
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -326,4 +326,3 @@ test_files:
|
|
326
326
|
- test/fixtures/require_in_a_comment.js
|
327
327
|
- test/fixtures/secondary.out.js
|
328
328
|
- test/test_helper.rb
|
329
|
-
has_rdoc:
|