guard-jammit 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +1 -1
- data/lib/guard/jammit.rb +26 -31
- data/lib/guard/jammit.rb.orig +103 -0
- data/lib/guard/jammit/version.rb +1 -1
- metadata +28 -120
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2755f985e8503aa08d8ddca3118928e74adf4ae0
|
4
|
+
data.tar.gz: 43c1bc032be296b04df2e4acc52a558f9ed7f98e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ccfcf8cbc766428aaa00958c1ad8355bcf013e073aae00606b9d5054b7f94276eac11efa50659272adfac5e87b7957996d1019b9460d1ff9b1df199bc97b4dc9
|
7
|
+
data.tar.gz: f2a80f7d9c29ea3de9553af04739998ed947ee6772e1b3c28bcb09faaea5bba9fa85567a70e882c19c2b881c65970b90b976b17aa05482ca9c5f684d76ff2ecc
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Guard::Jammit watches your assets to automatically package them using [Jammit](http://documentcloud.github.com/jammit/).
|
4
4
|
|
5
|
-
Tested on MRI Ruby 1.
|
5
|
+
Tested on MRI Ruby 1.9.3, 2.0.0, 2.0.1 and the latest versions of JRuby and Rubinius.
|
6
6
|
|
7
7
|
If you have any questions please join us on our [Google group](http://groups.google.com/group/guard-dev) or on `#guard`
|
8
8
|
(irc.freenode.net).
|
data/lib/guard/jammit.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
require
|
2
|
-
|
1
|
+
# Do NOT require "guard/plugin"
|
2
|
+
# It will either be required or a stub will be supplied by the test class
|
3
|
+
|
3
4
|
require 'jammit'
|
5
|
+
require 'guard/compat/plugin'
|
4
6
|
|
5
7
|
module Guard
|
6
|
-
|
7
8
|
# The Jammit Guard that gets notifications about the following
|
8
9
|
# Guard events: `start`, `stop`, `reload`, `run_all` and `run_on_change`.
|
9
10
|
#
|
10
|
-
class Jammit <
|
11
|
-
|
11
|
+
class Jammit < Plugin
|
12
12
|
DEFAULT_OPTIONS = {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
13
|
+
config_path: ::Jammit::DEFAULT_CONFIG_PATH,
|
14
|
+
output_folder: nil,
|
15
|
+
base_url: nil,
|
16
|
+
public_root: nil,
|
17
|
+
force: false,
|
18
|
+
package_names: nil,
|
19
|
+
package_on_start: true,
|
20
|
+
notification: true,
|
21
|
+
hide_success: false
|
22
22
|
}
|
23
23
|
|
24
24
|
# Initialize Guard::Jammit.
|
@@ -34,9 +34,9 @@ module Guard
|
|
34
34
|
# @option options [Boolean] :notification show notifications
|
35
35
|
# @option options [Boolean] :hide_success hide success message notification
|
36
36
|
#
|
37
|
-
def initialize(
|
37
|
+
def initialize(options = {})
|
38
38
|
options = DEFAULT_OPTIONS.merge(options)
|
39
|
-
super
|
39
|
+
super
|
40
40
|
end
|
41
41
|
|
42
42
|
# Gets called once when Guard starts.
|
@@ -46,7 +46,7 @@ module Guard
|
|
46
46
|
def start
|
47
47
|
ensure_rails_env!
|
48
48
|
|
49
|
-
::
|
49
|
+
Compat::UI.info "Using Jammit version #{::Jammit::VERSION}"
|
50
50
|
|
51
51
|
jammit if @options[:package_on_start]
|
52
52
|
end
|
@@ -64,25 +64,23 @@ module Guard
|
|
64
64
|
# @param [Array<String>] paths the changed paths and files
|
65
65
|
# @raise [:task_has_failed] when run_on_change has failed
|
66
66
|
#
|
67
|
-
def run_on_changes(
|
67
|
+
def run_on_changes(_paths)
|
68
68
|
jammit
|
69
69
|
end
|
70
70
|
|
71
71
|
# Runs Jammit to package the assets
|
72
72
|
#
|
73
73
|
def jammit
|
74
|
-
|
75
|
-
Thread.current[:jammit_packager] = nil
|
74
|
+
Thread.current[:jammit_packager] = nil
|
76
75
|
|
77
|
-
|
76
|
+
::Jammit.package! @options
|
78
77
|
|
79
|
-
|
80
|
-
|
78
|
+
Compat::UI.info 'Jammit successfully packaged the assets.'
|
79
|
+
Compat::UI.notify('Jammit successfully packaged the assets.', title: 'Jammit') if @options[:notification] && !@options[:hide_success]
|
81
80
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
end
|
81
|
+
rescue RuntimeError => e
|
82
|
+
Compat::UI.error("Jammit failed to package the assets: #{e.message}")
|
83
|
+
Compat::UI.notify('Jammit failed to package the assets.', title: 'Jammit', image: :failed) if @options[:notification]
|
86
84
|
end
|
87
85
|
|
88
86
|
private
|
@@ -90,10 +88,7 @@ module Guard
|
|
90
88
|
# Ensures that Rails env is available when Rails is only partially loaded
|
91
89
|
#
|
92
90
|
def ensure_rails_env!
|
93
|
-
if defined?(::Rails) && !::Rails.respond_to?(:env)
|
94
|
-
require 'rails'
|
95
|
-
end
|
91
|
+
require 'rails' if defined?(::Rails) && !::Rails.respond_to?(:env)
|
96
92
|
end
|
97
|
-
|
98
93
|
end
|
99
94
|
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'guard'
|
2
|
+
require 'guard/plugin'
|
3
|
+
require 'jammit'
|
4
|
+
|
5
|
+
module Guard
|
6
|
+
|
7
|
+
# The Jammit Guard that gets notifications about the following
|
8
|
+
# Guard events: `start`, `stop`, `reload`, `run_all` and `run_on_change`.
|
9
|
+
#
|
10
|
+
class Jammit < Plugin
|
11
|
+
|
12
|
+
DEFAULT_OPTIONS = {
|
13
|
+
:config_path => ::Jammit::DEFAULT_CONFIG_PATH,
|
14
|
+
:output_folder => nil,
|
15
|
+
:base_url => nil,
|
16
|
+
:public_root => nil,
|
17
|
+
:force => false,
|
18
|
+
:package_names => nil,
|
19
|
+
:package_on_start => true,
|
20
|
+
:notification => true,
|
21
|
+
:hide_success => false
|
22
|
+
}
|
23
|
+
|
24
|
+
# Initialize Guard::Jammit.
|
25
|
+
#
|
26
|
+
# @param [Array<Guard::Watcher>] watchers the watchers in the Guard block
|
27
|
+
# @param [Hash] options the options for the Guard
|
28
|
+
# @option options [String] :output_folder the output folder
|
29
|
+
# @option options [String] :base_url the base URL for the MHTML stylesheet
|
30
|
+
# @option options [String] :public_root the public root folder
|
31
|
+
# @option options [Boolean] :force force packaging
|
32
|
+
# @option options [Array<String>] package_names the package names to package
|
33
|
+
# @option options [Boolean] :package_on_start package when Guard starts
|
34
|
+
# @option options [Boolean] :notification show notifications
|
35
|
+
# @option options [Boolean] :hide_success hide success message notification
|
36
|
+
#
|
37
|
+
def initialize(options = {})
|
38
|
+
options = DEFAULT_OPTIONS.merge(options)
|
39
|
+
<<<<<<< HEAD
|
40
|
+
super(options)
|
41
|
+
=======
|
42
|
+
super
|
43
|
+
>>>>>>> dannysmith/master
|
44
|
+
end
|
45
|
+
|
46
|
+
# Gets called once when Guard starts.
|
47
|
+
#
|
48
|
+
# @raise [:task_has_failed] when run_on_change has failed
|
49
|
+
#
|
50
|
+
def start
|
51
|
+
ensure_rails_env!
|
52
|
+
|
53
|
+
::Guard::UI.info "Using Jammit version #{::Jammit::VERSION}"
|
54
|
+
|
55
|
+
jammit if @options[:package_on_start]
|
56
|
+
end
|
57
|
+
|
58
|
+
# Gets called when all files should be packaged.
|
59
|
+
#
|
60
|
+
# @raise [:task_has_failed] when run_on_change has failed
|
61
|
+
#
|
62
|
+
def run_all
|
63
|
+
jammit
|
64
|
+
end
|
65
|
+
|
66
|
+
# Gets called when watched paths and files have changes.
|
67
|
+
#
|
68
|
+
# @param [Array<String>] paths the changed paths and files
|
69
|
+
# @raise [:task_has_failed] when run_on_change has failed
|
70
|
+
#
|
71
|
+
def run_on_changes(paths)
|
72
|
+
jammit
|
73
|
+
end
|
74
|
+
|
75
|
+
# Runs Jammit to package the assets
|
76
|
+
#
|
77
|
+
def jammit
|
78
|
+
begin
|
79
|
+
Thread.current[:jammit_packager] = nil
|
80
|
+
|
81
|
+
::Jammit.package! @options
|
82
|
+
|
83
|
+
::Guard::UI.info 'Jammit successfully packaged the assets.'
|
84
|
+
::Guard::Notifier.notify('Jammit successfully packaged the assets.', :title => 'Jammit') if @options[:notification] && !@options[:hide_success]
|
85
|
+
|
86
|
+
rescue Exception => e
|
87
|
+
::Guard::UI.error("Jammit failed to package the assets: #{e.message}")
|
88
|
+
::Guard::Notifier.notify('Jammit failed to package the assets.', :title => 'Jammit', :image => :failed) if @options[:notification]
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
private
|
93
|
+
|
94
|
+
# Ensures that Rails env is available when Rails is only partially loaded
|
95
|
+
#
|
96
|
+
def ensure_rails_env!
|
97
|
+
if defined?(::Rails) && !::Rails.respond_to?(:env)
|
98
|
+
require 'rails'
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
end
|
data/lib/guard/jammit/version.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-jammit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Pelle Braendgaard
|
@@ -10,191 +9,100 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2015-07-14 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:
|
20
|
+
version: '2.12'
|
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:
|
27
|
+
version: '2.12'
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
|
-
name:
|
29
|
+
name: guard-compat
|
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: '1.2'
|
39
35
|
type: :runtime
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
|
-
requirements:
|
44
|
-
- - ! '>='
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '0'
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: bundler
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
|
-
requirements:
|
52
|
-
- - ! '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
type: :development
|
56
|
-
prerelease: false
|
57
|
-
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
38
|
requirements:
|
60
|
-
- -
|
39
|
+
- - "~>"
|
61
40
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
41
|
+
version: '1.2'
|
63
42
|
- !ruby/object:Gem::Dependency
|
64
|
-
name:
|
65
|
-
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
|
-
requirements:
|
68
|
-
- - ! '>='
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: '0'
|
71
|
-
type: :development
|
72
|
-
prerelease: false
|
73
|
-
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
|
-
requirements:
|
76
|
-
- - ! '>='
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: '0'
|
79
|
-
- !ruby/object:Gem::Dependency
|
80
|
-
name: rspec
|
81
|
-
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
|
-
requirements:
|
84
|
-
- - ! '>='
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
version: '0'
|
87
|
-
type: :development
|
88
|
-
prerelease: false
|
89
|
-
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
|
-
requirements:
|
92
|
-
- - ! '>='
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
version: '0'
|
95
|
-
- !ruby/object:Gem::Dependency
|
96
|
-
name: yard
|
97
|
-
requirement: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
|
-
requirements:
|
100
|
-
- - ! '>='
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '0'
|
103
|
-
type: :development
|
104
|
-
prerelease: false
|
105
|
-
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
|
-
requirements:
|
108
|
-
- - ! '>='
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: redcarpet
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
115
|
-
requirements:
|
116
|
-
- - ! '>='
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: '0'
|
119
|
-
type: :development
|
120
|
-
prerelease: false
|
121
|
-
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
|
-
requirements:
|
124
|
-
- - ! '>='
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
version: '0'
|
127
|
-
- !ruby/object:Gem::Dependency
|
128
|
-
name: pry
|
43
|
+
name: jammit
|
129
44
|
requirement: !ruby/object:Gem::Requirement
|
130
|
-
none: false
|
131
45
|
requirements:
|
132
|
-
- -
|
46
|
+
- - ">="
|
133
47
|
- !ruby/object:Gem::Version
|
134
48
|
version: '0'
|
135
|
-
type: :
|
49
|
+
type: :runtime
|
136
50
|
prerelease: false
|
137
51
|
version_requirements: !ruby/object:Gem::Requirement
|
138
|
-
none: false
|
139
52
|
requirements:
|
140
|
-
- -
|
53
|
+
- - ">="
|
141
54
|
- !ruby/object:Gem::Version
|
142
55
|
version: '0'
|
143
56
|
- !ruby/object:Gem::Dependency
|
144
|
-
name:
|
57
|
+
name: bundler
|
145
58
|
requirement: !ruby/object:Gem::Requirement
|
146
|
-
none: false
|
147
59
|
requirements:
|
148
|
-
- -
|
60
|
+
- - ">="
|
149
61
|
- !ruby/object:Gem::Version
|
150
62
|
version: '0'
|
151
63
|
type: :development
|
152
64
|
prerelease: false
|
153
65
|
version_requirements: !ruby/object:Gem::Requirement
|
154
|
-
none: false
|
155
66
|
requirements:
|
156
|
-
- -
|
67
|
+
- - ">="
|
157
68
|
- !ruby/object:Gem::Version
|
158
69
|
version: '0'
|
159
70
|
description: Watches your assets to automatically package them using Jammit.
|
160
71
|
email:
|
161
72
|
- pelle@stakeventures.com
|
162
|
-
- michi@
|
73
|
+
- michi@flinkfinger.com
|
163
74
|
executables: []
|
164
75
|
extensions: []
|
165
76
|
extra_rdoc_files: []
|
166
77
|
files:
|
167
|
-
- lib/guard/jammit/templates/Guardfile
|
168
|
-
- lib/guard/jammit/version.rb
|
169
|
-
- lib/guard/jammit.rb
|
170
78
|
- LICENSE
|
171
79
|
- README.md
|
80
|
+
- lib/guard/jammit.rb
|
81
|
+
- lib/guard/jammit.rb.orig
|
82
|
+
- lib/guard/jammit/templates/Guardfile
|
83
|
+
- lib/guard/jammit/version.rb
|
172
84
|
homepage: http://github.com/guard/guard-jammit
|
173
85
|
licenses: []
|
86
|
+
metadata: {}
|
174
87
|
post_install_message:
|
175
88
|
rdoc_options: []
|
176
89
|
require_paths:
|
177
90
|
- lib
|
178
91
|
required_ruby_version: !ruby/object:Gem::Requirement
|
179
|
-
none: false
|
180
92
|
requirements:
|
181
|
-
- -
|
93
|
+
- - ">="
|
182
94
|
- !ruby/object:Gem::Version
|
183
95
|
version: '0'
|
184
|
-
segments:
|
185
|
-
- 0
|
186
|
-
hash: -2599213843982422194
|
187
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
188
|
-
none: false
|
189
97
|
requirements:
|
190
|
-
- -
|
98
|
+
- - ">="
|
191
99
|
- !ruby/object:Gem::Version
|
192
100
|
version: 1.3.6
|
193
101
|
requirements: []
|
194
102
|
rubyforge_project: guard-jammit
|
195
|
-
rubygems_version:
|
103
|
+
rubygems_version: 2.4.5
|
196
104
|
signing_key:
|
197
|
-
specification_version:
|
105
|
+
specification_version: 4
|
198
106
|
summary: Guard plugin for Jammit
|
199
107
|
test_files: []
|
200
108
|
has_rdoc:
|