sprockets 3.4.0 → 3.4.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sprockets might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2fdc7a23f1f27c37cc18683119a5ba3d27dcc5e8
4
- data.tar.gz: 70560ff73b7fdd20363d768f99df198edaf314cf
3
+ metadata.gz: cb84129a09e33080f696f5eec822299e24279dba
4
+ data.tar.gz: fc5e73588c47c119874882bacdc8d8fd8da77567
5
5
  SHA512:
6
- metadata.gz: 7b8a6dd4c114dc92fdd9e57b98d8dcdb6be5d58fe450d44564d23898622a1dabb62e65338700947ee67f3c19b20c9b1936b09a12f27648a6b4bf3b22c32766cb
7
- data.tar.gz: 98e60c8ac724ef2b814b5fcf2ca8b01d91cf7542159fc66e4752b46ff8ea82964c8fc20de40731b58d2dcf40b805b5ac1fedf8aded422fcc89a3c2aff637027c
6
+ metadata.gz: e2166e7a2f5b2bea3e6eda0a29d0fd4816709bd9e93e6d99cfd00a85ff7df26747ef7d386c8a9812081726948465f887f0721a46a00c6cf06c832ed5f29b6ea0
7
+ data.tar.gz: 19c40eff6ab900018c2e7e0210e5ece20eb7780729daa0b2402cc2819012291adb145863c718340fdce43787acbc25e5407b88794df53558cea8e12c4cd5c545
@@ -1,3 +1,7 @@
1
+ **3.4.1** (November 25, 2015)
2
+
3
+ * PathUtils::Entries will no longer error on an empty directory.
4
+
1
5
  **3.4.0** (October 5, 2015)
2
6
 
3
7
  * Expose method to override the sass cache in the SassProcessor.
data/README.md CHANGED
@@ -20,6 +20,44 @@ Or include it in your project's `Gemfile` with Bundler:
20
20
  gem 'sprockets', '~> 3.0'
21
21
  ```
22
22
 
23
+ ## Behavior
24
+
25
+ ### Index files are proxies for folders
26
+
27
+ In sprockets index files such as `index.js` or `index.css` files inside of a folder will generate a file with the folder's name. So if you have a `foo/index.js` file it will compile down to `foo.js`. This is similar to NPM's behavior of using [folders as modules](https://nodejs.org/api/modules.html#modules_folders_as_modules). It is also somewhat similar to the way that a file in `public/my_folder/index.html` can be reached by a request to `/my_folder`. This means that you cannot directly use an index file. For example this would not work:
28
+
29
+ ```
30
+ <%= asset_path("foo/index.js") %>
31
+ ```
32
+
33
+ Instead you would need to use:
34
+
35
+ ```
36
+ <%= asset_path("foo.js") %>
37
+ ```
38
+
39
+ Why would you want to use this behavior? It is common behavior where you might want to include an entire directory of files in a top level javascript. You can do this in sprockets using `require_tree .`
40
+
41
+ ```
42
+ //= require_tree .
43
+ ```
44
+
45
+ This has the problem that files are required alphabetically. If your directory has `jquery-ui.js` and `jquery.min.js` then sprockets will require `jquery-ui.js` before `jquery` is required which won't work (because jquery-ui depends on jquery). Previously the only way to get the correct ordering would be to rename your files, something like `0-jquery-ui.js`. Instead of doing that you can use an index file.
46
+
47
+ For example, if you have an `application.js` and want all the files in the `foo/` folder you could do this:
48
+
49
+ ```
50
+ //= require foo.js
51
+ ```
52
+
53
+ Then create a file `foo/index.js` that requires all the files in that folder in any order you want:
54
+
55
+ ```
56
+ //= require foo.min.js
57
+ //= require foo-ui.js
58
+ ```
59
+
60
+ Now in your `application.js` will correctly load the `foo.min.js` before `foo-ui.js`. If you used `require_tree` it would not work correctly.
23
61
 
24
62
  ## Understanding the Sprockets Environment
25
63
 
@@ -55,9 +55,11 @@ module Sprockets
55
55
  # Returns an empty `Array` if the directory does not exist.
56
56
  def entries(path)
57
57
  if File.directory?(path)
58
- Dir.entries(path, :encoding => Encoding.default_internal).reject! { |entry|
58
+ entries = Dir.entries(path, :encoding => Encoding.default_internal)
59
+ entries.reject! { |entry|
59
60
  entry =~ /^\.|~$|^\#.*\#$/
60
- }.sort!
61
+ }
62
+ entries.sort!
61
63
  else
62
64
  []
63
65
  end
@@ -1,3 +1,3 @@
1
1
  module Sprockets
2
- VERSION = "3.4.0"
2
+ VERSION = "3.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Stephenson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-10-05 00:00:00.000000000 Z
12
+ date: 2015-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -317,7 +317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
317
317
  version: '0'
318
318
  requirements: []
319
319
  rubyforge_project: sprockets
320
- rubygems_version: 2.4.5.1
320
+ rubygems_version: 2.5.0
321
321
  signing_key:
322
322
  specification_version: 4
323
323
  summary: Rack-based asset packaging system