guard-sprockets 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,47 @@
1
+ require 'guard'
2
+ require 'guard/guard'
3
+
4
+ require 'sprockets'
5
+
6
+ module Guard
7
+ class Sprockets < Guard
8
+ def initialize(watchers=[], options={})
9
+ super
10
+ @destination = options[:destination]
11
+ end
12
+
13
+ def start
14
+ UI.info "Sprockets waiting for js file changes..."
15
+ end
16
+
17
+ def run_all
18
+ true
19
+ end
20
+
21
+ def run_on_change(paths)
22
+ sprocketize paths.first
23
+ end
24
+
25
+ private
26
+
27
+ def sprocketize(path)
28
+ parts = path.split('/')
29
+ file = parts.pop
30
+ parts.pop
31
+ @destination ||= parts.join('/')
32
+ secretary = ::Sprockets::Secretary.new(
33
+ :asset_root => "#{parts.first}",
34
+ :load_path => ["#{parts.join('/')}/src/*"],
35
+ :source_files => ["#{path}"],
36
+ :interpolate_constants => false
37
+ )
38
+ # Generate a Sprockets::Concatenation object from the source files
39
+ concatenation = secretary.concatenation
40
+ # Write the concatenation to disk
41
+ concatenation.save_to("#{@destination}/#{file}")
42
+ # Install provided assets into the asset root
43
+ secretary.install_assets
44
+ UI.info "Sprockets creating file #{@destination}/#{file}"
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,3 @@
1
+ guard 'sprockets', :destination => "public/javascripts" do
2
+ watch (%r{app/assets/javascripts/application.js})
3
+ end
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+ module Guard
3
+ module Sprockets
4
+ VERSION = '0.1.3'
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-sprockets
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.3
6
+ platform: ruby
7
+ authors:
8
+ - Aaron Cruz
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-05-11 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: guard
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.2.2
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: sprockets
28
+ prerelease: false
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: "0"
35
+ type: :runtime
36
+ version_requirements: *id002
37
+ description: guard file for sprockets
38
+ email:
39
+ - aaron@aaroncruz.com
40
+ executables: []
41
+
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - lib/guard/sprockets/templates/Guardfile
48
+ - lib/guard/sprockets/version.rb
49
+ - lib/guard/sprockets.rb
50
+ homepage: http://aaroncruz.com
51
+ licenses: []
52
+
53
+ post_install_message:
54
+ rdoc_options: []
55
+
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: "0"
70
+ requirements: []
71
+
72
+ rubyforge_project: guard-sprockets
73
+ rubygems_version: 1.7.2
74
+ signing_key:
75
+ specification_version: 3
76
+ summary: guard file for sprockets
77
+ test_files: []
78
+
79
+ has_rdoc: