browserify-rails 0.7.1 → 0.7.2

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: 1ec87a4fff319b405562ec1fa058d017b69f6d11
4
- data.tar.gz: 237322a74b3801ccb8124b948fd89700a742c831
3
+ metadata.gz: 30aa6ecc21b58fae95e203d97f744d5164b4f98f
4
+ data.tar.gz: 9e8b2a62aa6df28a79107c52d9f7bd59b5a73537
5
5
  SHA512:
6
- metadata.gz: 0b7cf388a9aedb93b97d24d0169f02a8c98ebb10b1aa053f224fb03d954982602edb57f379072da200f29ffafa477157bcff897d0fbcc8ad583359b9582fe85f
7
- data.tar.gz: 7f0a8eb6d944b42b032f3b04b3d6700a1ba69562364f7a732df7e0c631ff625d5be17c71cbd8eb443bbd986285ebd488f33a0d2a05a228e0ccd5b99c60feec7b
6
+ metadata.gz: 074706b730a8d8c0d9867af220b44043563e0c2e9fc9ce5342b37e24ed7f455c28da83a3bf92e798f6651dea6b13207cd45ef9793bc9b832652222a95018e6f7
7
+ data.tar.gz: 12474ed07ad4db35699e4477142d91f55a2fe809bf2f9dd6d0b005ba3fe2e4e69b587af1d82dd610375e834545673ef7b1fbfdaaee01f9f4d865e50a4ba44f41
data/README.md CHANGED
@@ -76,6 +76,7 @@ config.browserify_rails.commandline_options = "-t coffeeify --extension=\".js.co
76
76
  ## Requirements
77
77
 
78
78
  * node-browserify 4.x
79
+ * browserify-incremental
79
80
 
80
81
  ## Configuration
81
82
 
@@ -106,6 +107,11 @@ class My::Application < Rails::Application
106
107
  # The default is `false`
107
108
  config.browserify_rails.evaluate_node_modules = true
108
109
 
110
+ # Force browserify on every found JavaScript asset
111
+ #
112
+ # The default is `false`
113
+ config.browserify_rails.force = true
114
+
109
115
  # Command line options used when running browserify
110
116
  #
111
117
  # can be provided as an array:
@@ -53,7 +53,7 @@ module BrowserifyRails
53
53
  end
54
54
 
55
55
  def should_browserify?
56
- in_path? && !browserified? && commonjs_module?
56
+ config.force || (in_path? && !browserified? && commonjs_module?)
57
57
  end
58
58
 
59
59
  # Is this file in any of the configured paths?
@@ -2,6 +2,9 @@ module BrowserifyRails
2
2
  class Railtie < Rails::Engine
3
3
  config.browserify_rails = ActiveSupport::OrderedOptions.new
4
4
 
5
+ # Always browserify every file
6
+ config.browserify_rails.force = false
7
+
5
8
  # Which paths should be browserified?
6
9
  config.browserify_rails.paths = [lambda { |p| p.start_with?(Rails.root.join("app").to_s) },
7
10
  lambda { |p| p.start_with?(Rails.root.join("node_modules").to_s) }]
@@ -1,3 +1,3 @@
1
1
  module BrowserifyRails
2
- VERSION = "0.7.1"
2
+ VERSION = "0.7.2"
3
3
  end
@@ -12,6 +12,9 @@ class BrowserifyTest < ActionController::IntegrationTest
12
12
  setup do
13
13
  Rails.application.assets.cache = nil
14
14
 
15
+ # Reset config on each run
16
+ Dummy::Application.config.browserify_rails.force = false
17
+
15
18
  cache_file = File.join(Rails.root, "tmp/browserify-rails/browserifyinc-cache.json")
16
19
  File.delete(cache_file) if File.exists?(cache_file)
17
20
 
@@ -150,6 +153,19 @@ class BrowserifyTest < ActionController::IntegrationTest
150
153
  assert_equal fixture("browserified.out.js"), @response.body.strip
151
154
  end
152
155
 
156
+ test "skip files that should not be browserified" do
157
+ get "/assets/plain.js"
158
+
159
+ assert_equal fixture("plain.js"), @response.body.strip
160
+ end
161
+
162
+ test "browserify even plain files if force == true" do
163
+ Dummy::Application.config.browserify_rails.force = true
164
+ get "/assets/plain.js"
165
+
166
+ assert_equal fixture("plain.out.js"), @response.body.strip
167
+ end
168
+
153
169
  test "uses config/browserify.yml to mark a module as globally available via --require" do
154
170
  expected_output = fixture("main.out.js")
155
171
 
@@ -0,0 +1 @@
1
+ var string = "good old, simple plain javascript. No fancy modules here";
@@ -0,0 +1,4 @@
1
+ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"__RAILS_ROOT__/app/assets/javascripts/_stream_0.js":[function(require,module,exports){
2
+ var string = "good old, simple plain javascript. No fancy modules here";
3
+
4
+ },{}]},{},["__RAILS_ROOT__/app/assets/javascripts/_stream_0.js"]);
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: 0.7.1
4
+ version: 0.7.2
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: 2015-02-07 00:00:00.000000000 Z
11
+ date: 2015-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sprockets
@@ -145,6 +145,7 @@ files:
145
145
  - test/dummy/app/assets/javascripts/nested/index.js.example
146
146
  - test/dummy/app/assets/javascripts/node.js.example
147
147
  - test/dummy/app/assets/javascripts/node_path_based_require.js.example
148
+ - test/dummy/app/assets/javascripts/plain.js
148
149
  - test/dummy/app/assets/javascripts/secondary.js.example
149
150
  - test/dummy/app/assets/javascripts/some_folder/answer.js.example
150
151
  - test/dummy/app/assets/stylesheets/application.css
@@ -190,6 +191,8 @@ files:
190
191
  - test/fixtures/mocha.js
191
192
  - test/fixtures/node_path_based_require.out.js
192
193
  - test/fixtures/node_test_package.out.js
194
+ - test/fixtures/plain.js
195
+ - test/fixtures/plain.out.js
193
196
  - test/fixtures/secondary.out.js
194
197
  - test/test_helper.rb
195
198
  homepage: https://github.com/browserify-rails/browserify-rails
@@ -233,6 +236,7 @@ test_files:
233
236
  - test/dummy/app/assets/javascripts/nested/index.js.example
234
237
  - test/dummy/app/assets/javascripts/node.js.example
235
238
  - test/dummy/app/assets/javascripts/node_path_based_require.js.example
239
+ - test/dummy/app/assets/javascripts/plain.js
236
240
  - test/dummy/app/assets/javascripts/secondary.js.example
237
241
  - test/dummy/app/assets/javascripts/some_folder/answer.js.example
238
242
  - test/dummy/app/assets/stylesheets/application.css
@@ -278,5 +282,7 @@ test_files:
278
282
  - test/fixtures/mocha.js
279
283
  - test/fixtures/node_path_based_require.out.js
280
284
  - test/fixtures/node_test_package.out.js
285
+ - test/fixtures/plain.js
286
+ - test/fixtures/plain.out.js
281
287
  - test/fixtures/secondary.out.js
282
288
  - test/test_helper.rb