guard-shell 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 ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Joshua Hawxwell
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Guard-Shell
2
+
3
+ This little addition (1 proper line of code!) to guard allows you to run shell
4
+ commands when certain files are altered. It is very simple to setup so here is
5
+ a very quick guide.
6
+
7
+
8
+ #### Creating Backups of Files On Change
9
+
10
+ guard 'shell' do
11
+ # create a copy of the file with '.backup' at the end
12
+ watch('(.*)') {|m| `cp #{m[0]} #{m[0]}.backup` }
13
+ end
14
+
15
+
16
+ #### Rebuilding a Latex File
17
+
18
+ guard 'shell' do
19
+ # builds latex file to pdf and hides output
20
+ watch('(.*).tex') {|m| `pdflatex -shell-escape #{m[0]} 1>/dev/null` }
21
+ end
22
+
23
+
24
+ #### Saying the Name of the File You Changed
25
+
26
+ guard 'shell' do
27
+ watch('(.*)') {|m| `say #{m[0]}` }
28
+ end
29
+
30
+
31
+ And pretty much anything else you can think of!
@@ -0,0 +1,19 @@
1
+ require 'guard'
2
+ require 'guard/guard'
3
+
4
+ module Guard
5
+ class Shell < Guard
6
+
7
+ VERSION = '0.1'
8
+
9
+ # Print the result of the command, if there is a result
10
+ # to be printed. (see README.md)
11
+ #
12
+ # @param res [Array] the result of the commands that have run
13
+ #
14
+ def run_on_change(res)
15
+ puts res[0] if res[0]
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,6 @@
1
+ # Add files and commands to this file, like the example:
2
+ # watch('file/path') { `command(s)` }
3
+ #
4
+ guard 'shell' do
5
+ watch('(.*).txt') {|m| `tail #{m[0]}` }
6
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-shell
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ version: "0.1"
9
+ platform: ruby
10
+ authors:
11
+ - Joshua Hawxwell
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+
16
+ date: 2010-10-17 00:00:00 +01:00
17
+ default_executable:
18
+ dependencies:
19
+ - !ruby/object:Gem::Dependency
20
+ name: guard
21
+ requirement: &id001 !ruby/object:Gem::Requirement
22
+ none: false
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ segments:
27
+ - 0
28
+ - 1
29
+ - 0
30
+ version: 0.1.0
31
+ type: :runtime
32
+ prerelease: false
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: bundler
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 1
43
+ - 0
44
+ - 2
45
+ version: 1.0.2
46
+ type: :development
47
+ prerelease: false
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: rspec
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ segments:
57
+ - 2
58
+ - 0
59
+ - 0
60
+ - rc
61
+ version: 2.0.0.rc
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: *id003
65
+ description: Guard::Shell automatically run shell commands when watched files are modified.
66
+ email:
67
+ - m@hawx.me
68
+ executables: []
69
+
70
+ extensions: []
71
+
72
+ extra_rdoc_files: []
73
+
74
+ files:
75
+ - lib/guard/shell/templates/Guardfile
76
+ - lib/guard/shell.rb
77
+ - LICENSE
78
+ - README.md
79
+ has_rdoc: true
80
+ homepage: http://rubygems.org/gems/guard-shell
81
+ licenses: []
82
+
83
+ post_install_message:
84
+ rdoc_options: []
85
+
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ segments:
94
+ - 0
95
+ version: "0"
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ segments:
102
+ - 1
103
+ - 3
104
+ - 6
105
+ version: 1.3.6
106
+ requirements: []
107
+
108
+ rubyforge_project: guard-shell
109
+ rubygems_version: 1.3.7
110
+ signing_key:
111
+ specification_version: 3
112
+ summary: Guard gem for running shell commands
113
+ test_files: []
114
+