guard-restarter 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +8 -0
- data/lib/guard/restarter.rb +17 -4
- metadata +11 -17
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3df7bc64c6bbe1732b2beea1e580c03e8dff59ae
|
4
|
+
data.tar.gz: 28edc51c15b5dd287eeda4b48e17053952753281
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 907834848570c03cc6ea6d35264ba9c4ac10b823ebfa0581d4df930ced392dc37623685485f71bb277ab590e09398e8dc2243b39dde7a60eda150135d07987bb
|
7
|
+
data.tar.gz: eb3ceca12810b56bd2f74bcce11b4b826e873261b370d261a0b148eb52baaf4dc3334ddb3303f1983749861ff2765d90cd051a6da4074b065e3daca341383768
|
data/README.md
CHANGED
@@ -23,3 +23,11 @@ guard :restarter, :command => "./run_server" do
|
|
23
23
|
watch(/\.*\.[ch]$/)
|
24
24
|
end
|
25
25
|
```
|
26
|
+
|
27
|
+
You can also pass in the full set of arguments to `Process.spawn` for more control:
|
28
|
+
|
29
|
+
``` ruby
|
30
|
+
guard :restarter, :spawn => [{ "CC" => "gcc" }, "make", :err => "/dev/null"] do
|
31
|
+
watch(/\.*\.[ch]$/)
|
32
|
+
end
|
33
|
+
```
|
data/lib/guard/restarter.rb
CHANGED
@@ -4,13 +4,14 @@ require "guard/watcher"
|
|
4
4
|
|
5
5
|
module Guard
|
6
6
|
class Restarter < ::Guard::Guard
|
7
|
-
VERSION = "0.0.
|
7
|
+
VERSION = "0.0.2"
|
8
8
|
|
9
9
|
def initialize(watchers = [], options = {})
|
10
10
|
super
|
11
11
|
@pid = nil
|
12
12
|
@command = options[:command]
|
13
|
-
|
13
|
+
@spawn = options[:spawn]
|
14
|
+
raise "Must provide option :command or :spawn" unless @command || @spawn
|
14
15
|
end
|
15
16
|
|
16
17
|
def start()
|
@@ -29,7 +30,15 @@ module Guard
|
|
29
30
|
private
|
30
31
|
|
31
32
|
def start_server
|
32
|
-
|
33
|
+
custom_spawn_args = { chdir: Dir.pwd, pgroup: true }
|
34
|
+
if @command
|
35
|
+
args = [@command, custom_spawn_args]
|
36
|
+
elsif @spawn.last.is_a? Hash
|
37
|
+
args = @spawn[0..-2] << @spawn.last.merge(custom_spawn_args)
|
38
|
+
else
|
39
|
+
args = @spawn << custom_spawn_args
|
40
|
+
end
|
41
|
+
@pid = spawn(*args)
|
33
42
|
Process.detach(@pid)
|
34
43
|
end
|
35
44
|
|
@@ -53,7 +62,11 @@ module Guard
|
|
53
62
|
end
|
54
63
|
|
55
64
|
def start_info
|
56
|
-
|
65
|
+
if @command
|
66
|
+
UI.info "Running command '#{@command}'..."
|
67
|
+
else
|
68
|
+
UI.info "Running spawn: #{@spawn.inspect}..."
|
69
|
+
end
|
57
70
|
end
|
58
71
|
|
59
72
|
def run_info
|
metadata
CHANGED
@@ -1,36 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-restarter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Caleb Spare
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-03-22 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: guard
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
|
-
description:
|
31
|
-
and restart it when files change.
|
32
|
-
|
33
|
-
'
|
27
|
+
description: |
|
28
|
+
guard-restarter is a guard plugin to run a command (often a server) and restart it when files change.
|
34
29
|
email:
|
35
30
|
- cespare@gmail.com
|
36
31
|
executables: []
|
@@ -45,27 +40,26 @@ files:
|
|
45
40
|
- lib/guard/restarter.rb
|
46
41
|
homepage: https://github.com/cespare/guard-restarter
|
47
42
|
licenses: []
|
43
|
+
metadata: {}
|
48
44
|
post_install_message:
|
49
45
|
rdoc_options: []
|
50
46
|
require_paths:
|
51
47
|
- lib
|
52
48
|
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
49
|
requirements:
|
55
|
-
- -
|
50
|
+
- - '>='
|
56
51
|
- !ruby/object:Gem::Version
|
57
52
|
version: '0'
|
58
53
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
-
none: false
|
60
54
|
requirements:
|
61
|
-
- -
|
55
|
+
- - '>='
|
62
56
|
- !ruby/object:Gem::Version
|
63
57
|
version: '0'
|
64
58
|
requirements: []
|
65
59
|
rubyforge_project:
|
66
|
-
rubygems_version:
|
60
|
+
rubygems_version: 2.0.0
|
67
61
|
signing_key:
|
68
|
-
specification_version:
|
62
|
+
specification_version: 4
|
69
63
|
summary: A guard-plugin to restart a server.
|
70
64
|
test_files: []
|
71
65
|
has_rdoc:
|