guard-rake 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +29 -1
- data/guard-rake.gemspec +1 -1
- data/lib/guard/rake.rb +23 -9
- data/lib/guard/rake/version.rb +2 -4
- metadata +47 -44
data/README.md
CHANGED
@@ -44,12 +44,40 @@ the watched files change.
|
|
44
44
|
|
45
45
|
### List of available options:
|
46
46
|
|
47
|
-
```
|
47
|
+
```ruby
|
48
48
|
:task => 'doit' # name of the task to be executed, required
|
49
49
|
:run_on_all => false # runs when the 'run_all' signal is received from Guard (enter is pressed), default: true
|
50
50
|
:run_on_start => true # runs when guard is started, default: true
|
51
|
+
:task_args => [] # arguments to pass to Rake::Task#invoke, default: []
|
52
|
+
```
|
53
|
+
|
54
|
+
### Rake task arguments
|
55
|
+
By default, the changed file paths will be passed into the rake task. Example:
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
task :doit, :paths do |t, args|
|
59
|
+
args.paths # Will contain an array of changed paths
|
60
|
+
end
|
51
61
|
```
|
52
62
|
|
63
|
+
You may also use this in conjunction with the :task_args options. Anything in :task_args will
|
64
|
+
be passed in first, then the array of changed paths. Example:
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
# Guardfile
|
68
|
+
guard 'rake', :task => 'doit', :task_args => ['a', 'b'] do
|
69
|
+
watch(%r{^some_files/.+$})
|
70
|
+
end
|
71
|
+
|
72
|
+
# Rakefile
|
73
|
+
task :doit, [:first, :second, :paths] do |t, args|
|
74
|
+
args.first # "a"
|
75
|
+
args.second # "b"
|
76
|
+
args.paths # ['changed1.rb', 'changed2.rb']
|
77
|
+
end
|
78
|
+
```
|
79
|
+
|
80
|
+
|
53
81
|
## Development
|
54
82
|
|
55
83
|
- Source hosted at [GitHub](https://github.com/rubyist/guard-rake)
|
data/guard-rake.gemspec
CHANGED
@@ -4,7 +4,7 @@ require 'guard/rake/version'
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = 'guard-rake'
|
7
|
-
s.version = Guard::
|
7
|
+
s.version = Guard::RakeVersion::VERSION
|
8
8
|
s.authors = ['Scott Barron']
|
9
9
|
s.email = ['scott@elitists.net']
|
10
10
|
s.homepage = 'http://github.com/rubyist/guard-rake'
|
data/lib/guard/rake.rb
CHANGED
@@ -5,20 +5,24 @@ require 'rake'
|
|
5
5
|
|
6
6
|
module Guard
|
7
7
|
class Rake < Guard
|
8
|
+
class << self
|
9
|
+
attr_accessor :rakefile_loaded
|
10
|
+
end
|
11
|
+
|
8
12
|
def initialize(watchers=[], options={})
|
9
13
|
super
|
10
14
|
@options = {
|
11
15
|
:run_on_start => true,
|
12
|
-
:run_on_all => true
|
16
|
+
:run_on_all => true,
|
17
|
+
:task_args => []
|
13
18
|
}.update(options)
|
14
19
|
@task = @options[:task]
|
15
20
|
end
|
16
21
|
|
17
22
|
def start
|
18
23
|
UI.info "Starting guard-rake #{@task}"
|
19
|
-
|
20
|
-
|
21
|
-
run_all if @options[:run_on_start]
|
24
|
+
load_rakefile unless self.class.rakefile_loaded
|
25
|
+
run_rake_task if @options[:run_on_start]
|
22
26
|
true
|
23
27
|
end
|
24
28
|
|
@@ -38,19 +42,29 @@ module Guard
|
|
38
42
|
|
39
43
|
if ::Guard::VERSION < "1.1"
|
40
44
|
def run_on_change(paths)
|
41
|
-
run_rake_task
|
45
|
+
run_rake_task(paths)
|
42
46
|
end
|
43
47
|
else
|
44
48
|
def run_on_changes(paths)
|
45
|
-
run_rake_task
|
49
|
+
run_rake_task(paths)
|
46
50
|
end
|
47
51
|
end
|
48
52
|
|
49
|
-
|
50
|
-
def run_rake_task
|
53
|
+
def run_rake_task(paths=[])
|
51
54
|
UI.info "running #{@task}"
|
52
55
|
::Rake::Task.tasks.each { |t| t.reenable }
|
53
|
-
::Rake::Task[@task].invoke
|
56
|
+
::Rake::Task[@task].invoke(*@options[:task_args], paths)
|
57
|
+
rescue Exception => e
|
58
|
+
UI.error "#{self.class.name} failed to run rake task <#{@task}>, exception was:\n\t#{e.class}: #{e.message}"
|
59
|
+
UI.debug "\n#{e.backtrace.join("\n")}"
|
60
|
+
|
61
|
+
throw :task_has_failed
|
62
|
+
end
|
63
|
+
|
64
|
+
def load_rakefile
|
65
|
+
::Rake.application.init
|
66
|
+
::Rake.application.load_rakefile
|
67
|
+
self.class.rakefile_loaded = true
|
54
68
|
end
|
55
69
|
end
|
56
70
|
end
|
data/lib/guard/rake/version.rb
CHANGED
metadata
CHANGED
@@ -1,49 +1,55 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-rake
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.8
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.7
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Scott Barron
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-03-29 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: guard
|
17
|
-
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
21
|
-
- -
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
24
22
|
type: :runtime
|
25
|
-
version_requirements: *id001
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: rake
|
28
23
|
prerelease: false
|
29
|
-
|
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: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
30
33
|
none: false
|
31
|
-
requirements:
|
32
|
-
- -
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
35
38
|
type: :runtime
|
36
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
37
46
|
description: guard-rake automatically runs Rake tasks from your Rakefile
|
38
|
-
email:
|
47
|
+
email:
|
39
48
|
- scott@elitists.net
|
40
49
|
executables: []
|
41
|
-
|
42
50
|
extensions: []
|
43
|
-
|
44
51
|
extra_rdoc_files: []
|
45
|
-
|
46
|
-
files:
|
52
|
+
files:
|
47
53
|
- .gitignore
|
48
54
|
- Gemfile
|
49
55
|
- LICENSE
|
@@ -55,30 +61,27 @@ files:
|
|
55
61
|
- lib/guard/rake/version.rb
|
56
62
|
homepage: http://github.com/rubyist/guard-rake
|
57
63
|
licenses: []
|
58
|
-
|
59
64
|
post_install_message:
|
60
65
|
rdoc_options: []
|
61
|
-
|
62
|
-
require_paths:
|
66
|
+
require_paths:
|
63
67
|
- lib
|
64
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
69
|
none: false
|
66
|
-
requirements:
|
67
|
-
- -
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version:
|
70
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ! '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
75
|
none: false
|
72
|
-
requirements:
|
73
|
-
- -
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version:
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
76
80
|
requirements: []
|
77
|
-
|
78
81
|
rubyforge_project:
|
79
|
-
rubygems_version: 1.8.
|
82
|
+
rubygems_version: 1.8.24
|
80
83
|
signing_key:
|
81
84
|
specification_version: 3
|
82
85
|
summary: Guard for running rake tasks
|
83
86
|
test_files: []
|
84
|
-
|
87
|
+
has_rdoc:
|