guard-process 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ .vagrant
data/.travis.yml CHANGED
@@ -5,7 +5,5 @@ notifications:
5
5
  rvm:
6
6
  - 1.9.2
7
7
  - 1.9.3
8
- - ruby-head
9
8
  - jruby-19mode
10
- - jruby-head
11
9
  script: "bundle exec rake test"
data/README.md CHANGED
@@ -1,19 +1,16 @@
1
- Guard::Process [![Build Status](https://secure.travis-ci.org/socialreferral/guard-process.png)](http://travis-ci.org/socialreferral/guard-process)
2
- ==============
1
+ # Guard::Process [![Build Status](https://secure.travis-ci.org/socialreferral/guard-process.png)](http://travis-ci.org/socialreferral/guard-process)
3
2
  Guard to run continues processes.
4
3
 
5
4
  This gem requires Ruby 1.9.2, 1.9.3 or JRuby in 1.9 mode.
6
5
 
7
- Usage
8
- -----
6
+ # Usage
9
7
  Please read the [Guard documentation](https://github.com/guard/guard#readme) to learn how to use Guard.
10
8
 
11
9
  There is also an exellent screencast available on [Railscasts](http://railscasts.com/episodes/264-guard)
12
10
 
13
11
  Additionally there is a great introductory article on [Intridea Blog](http://intridea.com/2011/8/25/hire-a-guard-for-your-project) mentioning Guard::Process.
14
12
 
15
- Guardfile
16
- ---------
13
+ # Guardfile
17
14
  You can add as many process Guards as you want, an example Guardfile:
18
15
 
19
16
  ``` ruby
@@ -26,14 +23,15 @@ You can add as many process Guards as you want, an example Guardfile:
26
23
  end
27
24
  ```
28
25
 
29
- Options
30
- -------
26
+ # Options
31
27
  The following options are available:
32
28
 
33
29
  - name
34
30
  The display name of your process in Guard, this is shown when Guard::Process is starting and stopping your process
35
31
  - command
36
32
  The command to run as you would run it from the command line
33
+ - dir
34
+ The directory in which you want to run the command, if none is given then Ruby's current working directory is used
37
35
  - stop_signal
38
36
  The signal that Guard::Process sends to terminate the process when it needs to stop/restart it. This defaults to 'TERM' (in some cases you may need KILL).
39
37
  - env
@@ -42,8 +40,13 @@ The following options are available:
42
40
  {"SSL_CERTS_DIR" => "/etc/ssl/certs", "JAVA_HOME" => "/usr/local/java"}
43
41
  ```
44
42
 
45
- Development
46
- -----------
43
+ # Changes
44
+
45
+ ## 1.0.4
46
+
47
+ - Adds the dir option
48
+
49
+ # Development
47
50
  - Source hosted on [GitHub](https://github.com)
48
51
  - Please report issues and feature requests using [GitHub issues](https://github.com/socialreferral/guard-process/issues)
49
52
 
@@ -52,10 +55,8 @@ Pull requests are welcome, please make sure your patches are well tested before
52
55
  - Add tests for your changes using MiniTest::Unit
53
56
  - Do not change the version number in the gemspec
54
57
 
55
- License
56
- -------
58
+ # License
57
59
  Guard::Process is released under the MIT license.
58
60
 
59
- Author
60
- ------
61
+ # Author
61
62
  [Mark Kremer](https://github.com/mkremer)
data/Vagrantfile ADDED
@@ -0,0 +1,10 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ Vagrant::Config.run do |config|
5
+ config.vm.box = "guard"
6
+ config.vm.box_url = "http://files.vagrantup.com/precise64.box"
7
+ config.vm.network :hostonly, "192.168.33.21"
8
+ config.vm.share_folder "v-root", "/vagrant", ".", :nfs => !(ENV["OS"] =~ /windows/i)
9
+ config.vm.provision :shell, :path => "vagrant-provision"
10
+ end
@@ -4,7 +4,7 @@ require 'rbconfig' unless defined?(RbConfig)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "guard-process"
7
- s.version = "1.0.3"
7
+ s.version = "1.0.4"
8
8
  s.authors = ["Mark Kremer"]
9
9
  s.email = ["mark@socialreferral.com"]
10
10
  s.homepage = ""
data/lib/guard/process.rb CHANGED
@@ -9,6 +9,7 @@ module Guard
9
9
  @command = options.fetch(:command).split(" ")
10
10
  @env = options[:env] || {}
11
11
  @name = options[:name]
12
+ @dir = options[:dir] || Dir.getwd
12
13
  @stop_signal = options[:stop_signal] || "TERM"
13
14
  super
14
15
  end
@@ -28,7 +29,9 @@ module Guard
28
29
  original_env[key] = ENV[key]
29
30
  ENV[key] = value
30
31
  end
31
- @pid = Spoon.spawnp(*@command)
32
+ Dir.chdir(@dir) do
33
+ @pid = Spoon.spawnp(*@command)
34
+ end
32
35
  original_env.each_pair do |key, value|
33
36
  ENV[key] = value
34
37
  end
@@ -74,6 +74,13 @@ class GuardProcessTest < MiniTest::Unit::TestCase
74
74
  assert_equal 'VALUE 2', written_env['VAR3']
75
75
  end
76
76
 
77
+ def test_changed_working_directory_if_option_dir_is_set
78
+ @options = {:command => 'ls', :name => 'LsProcess', :dir => TEST_ROOT}
79
+ Dir.expects(:chdir).with(TEST_ROOT)
80
+ @guard = Guard::Process.new([], @options)
81
+ @guard.start and @guard.stop
82
+ end
83
+
77
84
  def test_commands_are_formatted_properly_for_spoon
78
85
  @options = {:command => 'echo test test', :name => 'EchoProcess', :env => {"VAR1" => "VALUE 1"}}
79
86
  ::Process.stubs(:kill).returns(true)
data/vagrant-provision ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env bash
2
+
3
+ export DEBIAN_FRONTEND=noninteractive
4
+
5
+ apt-get update > /dev/null
6
+ apt-get -y install build-essential git-core ruby1.9.1-full ruby1.9.1-dev libyaml-dev libssl-dev zlib1g-dev libreadline-dev openssl libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev ncurses-dev automake libtool bison libffi-dev
7
+
8
+ gem install bundler pry
9
+
10
+ su -c 'cd /vagrant && bundle' vagrant
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-process
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-26 00:00:00.000000000Z
12
+ date: 2012-11-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
16
- requirement: &8458120 !ruby/object:Gem::Requirement
16
+ requirement: &84583090 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.4.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *8458120
24
+ version_requirements: *84583090
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: spoon
27
- requirement: &8456680 !ruby/object:Gem::Requirement
27
+ requirement: &84582790 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.0.1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *8456680
35
+ version_requirements: *84582790
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: ffi
38
- requirement: &8455800 !ruby/object:Gem::Requirement
38
+ requirement: &84582530 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.9
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *8455800
46
+ version_requirements: *84582530
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: minitest
49
- requirement: &8454880 !ruby/object:Gem::Requirement
49
+ requirement: &84582280 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *8454880
57
+ version_requirements: *84582280
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: mocha
60
- requirement: &8454000 !ruby/object:Gem::Requirement
60
+ requirement: &84581940 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *8454000
68
+ version_requirements: *84581940
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: guard-minitest
71
- requirement: &8453260 !ruby/object:Gem::Requirement
71
+ requirement: &84581720 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *8453260
79
+ version_requirements: *84581720
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: guard-bundler
82
- requirement: &8452460 !ruby/object:Gem::Requirement
82
+ requirement: &84581500 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *8452460
90
+ version_requirements: *84581500
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rake
93
- requirement: &8442840 !ruby/object:Gem::Requirement
93
+ requirement: &84581230 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *8442840
101
+ version_requirements: *84581230
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rb-inotify
104
- requirement: &8441380 !ruby/object:Gem::Requirement
104
+ requirement: &84580980 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *8441380
112
+ version_requirements: *84580980
113
113
  description: Guard extension to run cli processes
114
114
  email:
115
115
  - mark@socialreferral.com
@@ -124,12 +124,14 @@ files:
124
124
  - LICENSE
125
125
  - README.md
126
126
  - Rakefile
127
+ - Vagrantfile
127
128
  - guard-process.gemspec
128
129
  - lib/guard/process.rb
129
130
  - lib/guard/process/templates/Guardfile
130
131
  - test/guard/process_test.rb
131
132
  - test/run_me.rb
132
133
  - test/test_helper.rb
134
+ - vagrant-provision
133
135
  homepage: ''
134
136
  licenses: []
135
137
  post_install_message:
@@ -150,10 +152,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
152
  version: '0'
151
153
  segments:
152
154
  - 0
153
- hash: 3136733467448734788
155
+ hash: 1062270739
154
156
  requirements: []
155
157
  rubyforge_project:
156
- rubygems_version: 1.8.10
158
+ rubygems_version: 1.8.11
157
159
  signing_key:
158
160
  specification_version: 3
159
161
  summary: Guard extension to run cli processes