guard-sprockets 0.4.3 → 0.5.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 +7 -0
- data/LICENSE +20 -0
- data/README.md +35 -12
- data/lib/guard/sprockets.rb +12 -1
- data/lib/guard/sprockets/version.rb +1 -1
- metadata +26 -38
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4e895f229d870ee389fbe71295c0af73d352e2dc
|
4
|
+
data.tar.gz: 2342a8b0a3c58fa343aec83a8e6026ad112d7807
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6cdd3b32a121eb97822e9379907dacf8c9d7a13c06d052c3a0242935758046725a87c59662babc705f1925808f80853a26e7d20ef8cad4d7f12a37aef94ddd0a
|
7
|
+
data.tar.gz: cc03116aab742fe15e4ac8305e3f28fb4b906e4f72b330d144ebea49d793d5d43969a5cc0ec10d0e25bb07ae6aa1545754b3949e574b830f942990c9beef90bc
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010-2013 Aaron Cruz
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
# Guard::Sprockets
|
1
|
+
# Guard::Sprockets
|
2
|
+
|
3
|
+
[](http://badge.fury.io/rb/guard-sprockets) [](https://travis-ci.org/guard/guard-sprockets) [](https://gemnasium.com/guard/guard-sprockets) [](https://codeclimate.com/github/guard/guard-sprockets) [](https://coveralls.io/r/guard/guard-sprockets)
|
2
4
|
|
3
5
|
Sprockets guard automatically packages your JavaScript files together when your source files are saved.
|
4
6
|
|
@@ -11,21 +13,21 @@ Please be sure to have [Guard](https://github.com/guard/guard) installed before
|
|
11
13
|
|
12
14
|
Install the gem:
|
13
15
|
|
14
|
-
```
|
16
|
+
```bash
|
15
17
|
$ gem install guard-sprockets
|
16
18
|
```
|
17
19
|
|
18
20
|
Add it to your Gemfile (inside the `:tools` group for instance):
|
19
21
|
|
20
22
|
```ruby
|
21
|
-
group :
|
23
|
+
group :development do
|
22
24
|
gem 'guard-sprockets'
|
23
25
|
end
|
24
26
|
```
|
25
27
|
|
26
28
|
Add guard definition to your Guardfile by running this command:
|
27
29
|
|
28
|
-
```
|
30
|
+
```bash
|
29
31
|
$ guard init sprockets
|
30
32
|
```
|
31
33
|
|
@@ -39,7 +41,7 @@ Guard::Sprockets can be adapted to all kind of projects.
|
|
39
41
|
|
40
42
|
### Typical Rails 3 app (default generated Guardfile)
|
41
43
|
|
42
|
-
```
|
44
|
+
```ruby
|
43
45
|
guard 'sprockets', :destination => 'public/javascripts', :asset_paths => ['/app/assets/javascripts'] do
|
44
46
|
watch 'app/assets/javascripts/application.js'
|
45
47
|
end
|
@@ -49,23 +51,44 @@ Please read [Guard doc](https://github.com/guard/guard#readme) for more informat
|
|
49
51
|
|
50
52
|
## Options
|
51
53
|
|
52
|
-
```
|
54
|
+
```ruby
|
53
55
|
:destination => 'public/js' # change the destination folder in which the compiled assets are saved, default: 'public/javascripts'
|
54
56
|
:asset_paths => 'app/js' # add a directory (or on array of directories) to Sprockets' environment's load path, default: ['app/assets/javascripts']
|
55
57
|
:asset_paths => ['app/js', 'lib/js'] # asset_paths can be a String or an Array
|
56
58
|
:minify => true # minify the JavaScript files content using Uglifier, default: false
|
57
59
|
# be sure to add: "gem 'uglifier'" in your Gemfile
|
60
|
+
:keep_paths => true # retain the directory structure of an asset's path relative to the asset_path, default: false
|
61
|
+
# this prevents assets with the same basename, but placed different folders, from overwriting each other in the destination folder
|
62
|
+
# e.x. with this option set to true: app/js/vendor/rails/turbolinks.js.coffee -> public/js/vendor/rails/turbolinks.js
|
63
|
+
# and with this option set to false: app/js/vendor/rails/turbolinks.js.coffee -> public/js/turbolinks.js
|
58
64
|
:root_file => 'app/js/app.js' # if set, only this file will be compiled, default: nil
|
59
65
|
:root_file => ['one.js', 'two.js'] # root_file can be a String or an Array
|
60
66
|
```
|
61
67
|
|
62
|
-
##
|
63
|
-
|
68
|
+
## Development
|
69
|
+
|
70
|
+
* Documentation hosted at [RubyDoc](http://rubydoc.info/gems/guard-sprockets/frames).
|
71
|
+
* Source hosted at [GitHub](https://github.com/guard/guard-sprockets).
|
72
|
+
|
73
|
+
Pull requests are very welcome! Please try to follow these simple rules if applicable:
|
74
|
+
|
75
|
+
* Please create a topic branch for every separate change you make.
|
76
|
+
* Make sure your patches are well tested. All specs must pass on [Travis CI](https://travis-ci.org/guard/guard-sprockets).
|
77
|
+
* Update the [Yard](http://yardoc.org/) documentation.
|
78
|
+
* Update the [README](https://github.com/guard/guard-sprockets/blob/master/README.md).
|
79
|
+
* Please **do not change** the version number.
|
80
|
+
|
81
|
+
For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
|
82
|
+
`#guard` (irc.freenode.net).
|
83
|
+
|
84
|
+
## Author
|
85
|
+
|
86
|
+
[Aaron Cruz](https://github.com/pferdefleisch) ([@mraaroncruz](http://twitter.com/mraaroncruz), [aaroncruz.com](http://aaroncruz.com))
|
64
87
|
|
65
|
-
|
88
|
+
## Maintainer
|
66
89
|
|
67
|
-
|
90
|
+
[Rémy Coutable](https://github.com/rymai) ([@rymai](http://twitter.com/rymai), [rym.ai](http://rym.ai))
|
68
91
|
|
69
|
-
|
92
|
+
## Contributors
|
70
93
|
|
71
|
-
|
94
|
+
https://github.com/guard/guard-sprockets/contributors
|
data/lib/guard/sprockets.rb
CHANGED
@@ -16,6 +16,7 @@ module Guard
|
|
16
16
|
@asset_paths = Array(@options[:asset_paths] || 'app/assets/javascripts')
|
17
17
|
@destination = @options[:destination] || 'public/javascripts'
|
18
18
|
@root_file = Array(@options[:root_file])
|
19
|
+
@keep_paths = @options[:keep_paths] || false
|
19
20
|
|
20
21
|
@sprockets = ::Sprockets::Environment.new
|
21
22
|
@asset_paths.each { |p| @sprockets.append_path(p) }
|
@@ -60,7 +61,17 @@ module Guard
|
|
60
61
|
def sprocketize(path)
|
61
62
|
path = Pathname.new(path)
|
62
63
|
|
63
|
-
output_filename =
|
64
|
+
output_filename = if @keep_paths
|
65
|
+
# retain the relative directories of assets to the asset directory
|
66
|
+
parent_paths = @asset_paths.find_all { |p| path.to_s.start_with?(p) }.collect { |p| Pathname.new(p) }
|
67
|
+
relative_paths = parent_paths.collect { |p| path.relative_path_from(p) }
|
68
|
+
relative_path = relative_paths.min_by { |p| p.to_s.size }
|
69
|
+
|
70
|
+
without_preprocessor_extension(relative_path.to_s)
|
71
|
+
else
|
72
|
+
without_preprocessor_extension(path.basename.to_s)
|
73
|
+
end
|
74
|
+
|
64
75
|
output_path = Pathname.new(File.join(@destination, output_filename))
|
65
76
|
|
66
77
|
UI.info "Sprockets will compile #{output_filename}"
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-sprockets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Aaron Cruz
|
@@ -10,44 +9,39 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2013-
|
12
|
+
date: 2013-09-25 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: guard
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - ~>
|
21
19
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.
|
20
|
+
version: '1.8'
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - ~>
|
29
26
|
- !ruby/object:Gem::Version
|
30
|
-
version: 1.
|
27
|
+
version: '1.8'
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: execjs
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
32
|
- - ~>
|
37
33
|
- !ruby/object:Gem::Version
|
38
|
-
version: '
|
34
|
+
version: '2.0'
|
39
35
|
type: :runtime
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
39
|
- - ~>
|
45
40
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
41
|
+
version: '2.0'
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
43
|
name: sprockets
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
46
|
- - ~>
|
53
47
|
- !ruby/object:Gem::Version
|
@@ -55,7 +49,6 @@ dependencies:
|
|
55
49
|
type: :runtime
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
52
|
requirements:
|
60
53
|
- - ~>
|
61
54
|
- !ruby/object:Gem::Version
|
@@ -63,36 +56,32 @@ dependencies:
|
|
63
56
|
- !ruby/object:Gem::Dependency
|
64
57
|
name: bundler
|
65
58
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
59
|
requirements:
|
68
|
-
- -
|
60
|
+
- - '>='
|
69
61
|
- !ruby/object:Gem::Version
|
70
|
-
version: '
|
62
|
+
version: '0'
|
71
63
|
type: :development
|
72
64
|
prerelease: false
|
73
65
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
66
|
requirements:
|
76
|
-
- -
|
67
|
+
- - '>='
|
77
68
|
- !ruby/object:Gem::Version
|
78
|
-
version: '
|
69
|
+
version: '0'
|
79
70
|
- !ruby/object:Gem::Dependency
|
80
71
|
name: rspec
|
81
72
|
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
73
|
requirements:
|
84
|
-
- -
|
74
|
+
- - '>='
|
85
75
|
- !ruby/object:Gem::Version
|
86
|
-
version: '
|
76
|
+
version: '0'
|
87
77
|
type: :development
|
88
78
|
prerelease: false
|
89
79
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
80
|
requirements:
|
92
|
-
- -
|
81
|
+
- - '>='
|
93
82
|
- !ruby/object:Gem::Version
|
94
|
-
version: '
|
95
|
-
description: Guard::Sprockets automatically packages your
|
83
|
+
version: '0'
|
84
|
+
description: Guard::Sprockets automatically packages your JavaScript files together.
|
96
85
|
email:
|
97
86
|
- aaron@aaroncruz.com
|
98
87
|
- kematzy at gmail
|
@@ -103,30 +92,29 @@ files:
|
|
103
92
|
- lib/guard/sprockets/templates/Guardfile
|
104
93
|
- lib/guard/sprockets/version.rb
|
105
94
|
- lib/guard/sprockets.rb
|
95
|
+
- LICENSE
|
106
96
|
- README.md
|
107
97
|
homepage: https://rubygems.org/gems/guard-sprockets
|
108
98
|
licenses: []
|
99
|
+
metadata: {}
|
109
100
|
post_install_message:
|
110
101
|
rdoc_options: []
|
111
102
|
require_paths:
|
112
103
|
- lib
|
113
104
|
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
115
105
|
requirements:
|
116
|
-
- -
|
106
|
+
- - '>='
|
117
107
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
108
|
+
version: 1.8.7
|
119
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
-
none: false
|
121
110
|
requirements:
|
122
|
-
- -
|
111
|
+
- - '>='
|
123
112
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
113
|
+
version: '0'
|
125
114
|
requirements: []
|
126
|
-
rubyforge_project:
|
127
|
-
rubygems_version:
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 2.0.7
|
128
117
|
signing_key:
|
129
|
-
specification_version:
|
118
|
+
specification_version: 4
|
130
119
|
summary: Guard gem for Sprockets
|
131
120
|
test_files: []
|
132
|
-
has_rdoc:
|