guard-simple_shell 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.
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .rvmrc
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in guard-simple-shell.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Adam Pearson
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.
@@ -0,0 +1,40 @@
1
+ # Guard::SimpleShell
2
+
3
+ A guard that runs a command once even when multiple files change.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'guard-simple-shell'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install guard-simple-shell
18
+
19
+ ## Usage
20
+
21
+ In your Guardfile:
22
+
23
+ ```ruby
24
+ # outputs 'Guard simple shell' whenever example.txt changes
25
+ guard :simple_shell, {
26
+ :name => 'Example',
27
+ :command => 'echo "Guard simple shell"',
28
+ :run_on_start => true
29
+ } do
30
+ watch(%r{example.txt})
31
+ end
32
+ ```
33
+
34
+ ## Contributing
35
+
36
+ 1. Fork it
37
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
38
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
39
+ 4. Push to the branch (`git push origin my-new-feature`)
40
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ description = "A guard that runs a shell command once, even when there are multiple file changes"
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "guard-simple_shell"
8
+ gem.version = "0.0.1"
9
+ gem.authors = ["Adam Pearson"]
10
+ gem.email = ["adam@substantial.com"]
11
+ gem.description = description
12
+ gem.summary = description
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency 'guard'
21
+ gem.add_dependency 'rainbow'
22
+
23
+ # - need to determine how to add these dev dependencies per environment (linux needs a different gem...)
24
+ # gem.add_dependency 'rb-fsevent'
25
+
26
+ end
@@ -0,0 +1,36 @@
1
+ require 'guard'
2
+ require 'guard/guard'
3
+ require 'rainbow'
4
+ module Guard
5
+ class Simpleshell < Guard
6
+ def initialize(watchers=[], options={})
7
+ @command = options[:command]
8
+ @run_on_start = options[:run_on_start]
9
+ super
10
+ end
11
+
12
+ def run_on_changes(paths)
13
+ run @command
14
+ end
15
+
16
+ def start
17
+ run @command if @run_on_start
18
+ end
19
+
20
+ def stop
21
+ end
22
+
23
+ def run(command)
24
+ log "running #{@command}"
25
+ system @command
26
+ end
27
+
28
+ def log(msg)
29
+ name = @options[:name]
30
+ output = "SHELL".color(:yellow).bright()
31
+ output << "[" + name.color(:blue) + "]"
32
+ output << " #{msg}"
33
+ puts output
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,7 @@
1
+ guard :simple_shell, {
2
+ :name => 'Example',
3
+ :command => 'echo "Example worked!"',
4
+ :run_on_start => true
5
+ } do
6
+ watch(%r{test.txt})
7
+ end
@@ -0,0 +1,3 @@
1
+ class Guard::SimpleShell
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-simple_shell
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Adam Pearson
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-10 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: guard
16
+ requirement: &70354590090720 !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: *70354590090720
25
+ - !ruby/object:Gem::Dependency
26
+ name: rainbow
27
+ requirement: &70354590090280 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70354590090280
36
+ description: A guard that runs a shell command once, even when there are multiple
37
+ file changes
38
+ email:
39
+ - adam@substantial.com
40
+ executables: []
41
+ extensions: []
42
+ extra_rdoc_files: []
43
+ files:
44
+ - .gitignore
45
+ - Gemfile
46
+ - LICENSE.txt
47
+ - README.md
48
+ - Rakefile
49
+ - guard-simple-shell.gemspec
50
+ - lib/guard/simple_shell.rb
51
+ - lib/guard/simple_shell/templates/Guardfile
52
+ - lib/guard/simple_shell/version.rb
53
+ homepage: ''
54
+ licenses: []
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubyforge_project:
73
+ rubygems_version: 1.8.10
74
+ signing_key:
75
+ specification_version: 3
76
+ summary: A guard that runs a shell command once, even when there are multiple file
77
+ changes
78
+ test_files: []