guard-steering 0.0.1
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.
- data/LICENSE +22 -0
- data/README.md +37 -0
- data/lib/guard/steering/templates/Guardfile +6 -0
- data/lib/guard/steering/version.rb +6 -0
- data/lib/guard/steering.rb +75 -0
- metadata +99 -0
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Daniel Demmel
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Guard::Steering
|
2
|
+
|
3
|
+
Lets you configure a Guard that will run Steering whenever a Handlebars.js template is added / updated.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
Edit the Gemfile so that it looks like:
|
8
|
+
|
9
|
+
source "http://rubygems.org"
|
10
|
+
gem "guard"
|
11
|
+
gem "steering",
|
12
|
+
:git => 'git://github.com/daaain/steering.git',
|
13
|
+
:branch => 'master'
|
14
|
+
gem 'guard-steering'
|
15
|
+
|
16
|
+
Note: Steering Gem needs to be able to work with files, at the moment that only work in my fork
|
17
|
+
|
18
|
+
Then on your favourite shell type:
|
19
|
+
|
20
|
+
$ bundle install
|
21
|
+
$ bundle exec guard init
|
22
|
+
$ bundle exec guard init steering
|
23
|
+
$ bundle exec guard
|
24
|
+
|
25
|
+
## Guardfile
|
26
|
+
|
27
|
+
You can adapt your 'view' files like you want. Please read Guard doc for more info about Guardfile DSL.
|
28
|
+
|
29
|
+
guard 'steering', :output_folder => "build/handlebars" do
|
30
|
+
watch(%r{^source/handlebars/.*\.handlebars$})
|
31
|
+
end
|
32
|
+
|
33
|
+
## Changelog
|
34
|
+
|
35
|
+
### 0.0.1
|
36
|
+
|
37
|
+
Initial version.
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'guard'
|
3
|
+
require 'guard/guard'
|
4
|
+
require 'guard/watcher'
|
5
|
+
require 'steering'
|
6
|
+
|
7
|
+
module Guard
|
8
|
+
class Steering < Guard
|
9
|
+
# Initialize a Guard.
|
10
|
+
# @param [Array<Guard::Watcher>] watchers the Guard file watchers
|
11
|
+
# @param [Hash] options the custom Guard options
|
12
|
+
def initialize(watchers = [], options = {})
|
13
|
+
super
|
14
|
+
@options = {
|
15
|
+
:run_at_start => true,
|
16
|
+
:output_folder => nil
|
17
|
+
}.update(options)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Call once when Guard starts. Please override initialize method to init stuff.
|
21
|
+
# @raise [:task_has_failed] when start has failed
|
22
|
+
def start
|
23
|
+
UI.info("Guard::Steering has started watching your files")
|
24
|
+
run_all if options[:run_at_start]
|
25
|
+
end
|
26
|
+
|
27
|
+
# Called when `stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).
|
28
|
+
# @raise [:task_has_failed] when stop has failed
|
29
|
+
def stop
|
30
|
+
end
|
31
|
+
|
32
|
+
# Called when `reload|r|z + enter` is pressed.
|
33
|
+
# This method should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/...
|
34
|
+
# @raise [:task_has_failed] when reload has failed
|
35
|
+
def reload
|
36
|
+
run_all
|
37
|
+
end
|
38
|
+
|
39
|
+
# Called when just `enter` is pressed
|
40
|
+
# This method should be principally used for long action like running all specs/tests/...
|
41
|
+
# @raise [:task_has_failed] when run_all has failed
|
42
|
+
def run_all
|
43
|
+
paths = Dir.glob("**/*.handlebars")
|
44
|
+
targets = Watcher.match_files(self, paths)
|
45
|
+
run_on_change targets
|
46
|
+
end
|
47
|
+
|
48
|
+
# Called on file(s) modifications that the Guard watches.
|
49
|
+
# @param [Array<String>] paths the changes files or paths
|
50
|
+
# @raise [:task_has_failed] when run_on_change has failed
|
51
|
+
def run_on_change(paths)
|
52
|
+
run_steering paths
|
53
|
+
end
|
54
|
+
|
55
|
+
# Called on file(s) deletions that the Guard watches.
|
56
|
+
# @param [Array<String>] paths the deleted files or paths
|
57
|
+
# @raise [:task_has_failed] when run_on_change has failed
|
58
|
+
def run_on_deletion(paths)
|
59
|
+
end
|
60
|
+
|
61
|
+
def run_steering(paths)
|
62
|
+
begin
|
63
|
+
paths.each do |path|
|
64
|
+
output_folder = (!@options[:output_folder].nil? && @options[:output_folder]) || File.dirname(path)
|
65
|
+
Dir.mkdir(output_folder) unless File.directory?(output_folder)
|
66
|
+
::Steering.compile_to_file(path, output_folder + "/" + File.basename(path) + ".js")
|
67
|
+
UI.info "Steering precompiled #{path} to #{output_folder}"
|
68
|
+
end
|
69
|
+
rescue Exception => e
|
70
|
+
UI.error "Steering precompilation failed: #{e}"
|
71
|
+
false
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: guard-steering
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Daniel Demmel
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-05-09 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: guard
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: steering
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: Guard::Steering automatically runs the steering gem to precompile Handlebars.js
|
63
|
+
templates
|
64
|
+
email:
|
65
|
+
- dain@danieldemmel.me
|
66
|
+
executables: []
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files: []
|
69
|
+
files:
|
70
|
+
- lib/guard/steering/templates/Guardfile
|
71
|
+
- lib/guard/steering/version.rb
|
72
|
+
- lib/guard/steering.rb
|
73
|
+
- LICENSE
|
74
|
+
- README.md
|
75
|
+
homepage: https://github.com/daaain/guard-steering
|
76
|
+
licenses: []
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 1.8.24
|
96
|
+
signing_key:
|
97
|
+
specification_version: 3
|
98
|
+
summary: Guard gem for steering
|
99
|
+
test_files: []
|