guard-ruby 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md ADDED
@@ -0,0 +1,37 @@
1
+ # Guard-Ruby
2
+
3
+ This is a trivial [guard](http://github.com/guard/guard) extension that runs ruby files. You might use it to develop benchmarks or other small one-off scripts that don't require much ceremony.
4
+
5
+ ## Install
6
+
7
+ Install the gem:
8
+
9
+ $ gem install guard-ruby
10
+
11
+ Or add it to your Gemfile:
12
+
13
+ gem 'guard-ruby'
14
+
15
+ Add an example to your Guardfile:
16
+
17
+ $ guard init ruby
18
+
19
+ ## Usage
20
+
21
+ Please read the [Guard usage doc](https://github.com/guard/guard#readme)
22
+
23
+ ## Guardfile
24
+
25
+ The original motivation was for developing benchmarks - single file ruby projects that should be re-run each time they change.
26
+
27
+ guard 'ruby' do
28
+ # run any benchmarking files
29
+ watch(/bench.*\.rb/)
30
+ end
31
+
32
+ If you provide a block, the return value will be used as the script to run.
33
+
34
+ guard 'ruby' do
35
+ # run a program when it's data is changed
36
+ watch(/.*\.csv/) { 'convert.rb' }
37
+ end
@@ -0,0 +1,7 @@
1
+ guard 'ruby' do
2
+ # run any benchmarking files
3
+ watch(/bench.*\.rb/)
4
+
5
+ # run a program when it's data is changed
6
+ watch(/.*\.csv/) { 'convert.rb' }
7
+ end
data/lib/guard/ruby.rb ADDED
@@ -0,0 +1,20 @@
1
+ require 'guard'
2
+ require 'guard/guard'
3
+
4
+ module Guard
5
+ class Ruby < Guard
6
+ VERSION = "0.0.1"
7
+
8
+ def start
9
+ run_all if options[:all_on_start]
10
+ end
11
+
12
+ def run_all
13
+ run_on_change(Watcher.match_files(self, Dir.glob('*.rb')))
14
+ end
15
+
16
+ def run_on_change(paths)
17
+ paths.each {|path| system("ruby #{path}")}
18
+ end
19
+ end
20
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Justin Love
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-09 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: guard
16
+ requirement: &2160805220 !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: *2160805220
25
+ - !ruby/object:Gem::Dependency
26
+ name: mast
27
+ requirement: &2160804580 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2160804580
36
+ description: ! " Guard::Ruby is for running simple ruby files that don't necessarily
37
+ have a\n separate test file or predictable pass/fail output, such as benchmarks.\n"
38
+ email:
39
+ - git@JustinLove.name
40
+ executables: []
41
+ extensions: []
42
+ extra_rdoc_files: []
43
+ files:
44
+ - lib/guard/ruby/templates/Guardfile
45
+ - lib/guard/ruby.rb
46
+ - Readme.md
47
+ homepage: ''
48
+ licenses: []
49
+ post_install_message:
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubyforge_project: guard-ruby
67
+ rubygems_version: 1.8.6
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: Guard gem for running simple Ruby files
71
+ test_files: []