guard-spin 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,7 @@ module Guard
15
15
 
16
16
  def launch_spin(action)
17
17
  UI.info "#{action}ing Spin", :reset => true
18
- spawn_spin
18
+ spawn_spin spin_serve_command, spin_serve_options
19
19
  end
20
20
 
21
21
  def kill_spin
@@ -23,7 +23,7 @@ module Guard
23
23
  end
24
24
 
25
25
  def run(paths)
26
- system "spin push #{paths.join(" ")}"
26
+ run_command spin_push_command(paths), spin_push_options
27
27
  end
28
28
 
29
29
  def run_all
@@ -36,9 +36,13 @@ module Guard
36
36
 
37
37
  private
38
38
 
39
- def spawn_spin
39
+ def run_command(cmd, options = '')
40
+ system "#{cmd} #{options}"
41
+ end
42
+
43
+ def spawn_spin(cmd, options = '')
40
44
  @spin_pid = fork do
41
- exec spin_serve_command
45
+ exec "#{cmd} #{options}"
42
46
  end
43
47
  end
44
48
 
@@ -46,7 +50,6 @@ module Guard
46
50
  return unless @spin_pid
47
51
 
48
52
  Process.kill(:INT, @spin_pid)
49
- sleep 0.5
50
53
 
51
54
  begin
52
55
  unless Process.waitpid(@spin_pid, Process::WNOHANG)
@@ -57,26 +60,41 @@ module Guard
57
60
  UI.info "Spin Stopped", :reset => true
58
61
  end
59
62
 
63
+ def spin_push_command(paths)
64
+ cmd_parts = []
65
+ cmd_parts << "bundle exec" if bundler?
66
+ cmd_parts << "spin push"
67
+ cmd_parts << paths.join(' ')
68
+ cmd_parts.join(' ')
69
+ end
70
+
71
+ def spin_push_options
72
+ ''
73
+ end
74
+
60
75
  def spin_serve_command
61
76
  cmd_parts = []
62
77
  cmd_parts << "bundle exec" if bundler?
63
78
  cmd_parts << "spin serve"
64
-
65
- cmd_parts << "-Itest" if test_unit?
66
-
67
79
  cmd_parts.join(' ')
68
80
  end
69
81
 
82
+ def spin_serve_options
83
+ opt_parts = []
84
+ opt_parts << "-Itest" if test_unit?
85
+ opt_parts.join(' ')
86
+ end
87
+
70
88
  def bundler?
71
- @bundler ||= File.exist?("#{Dir.pwd}/Gemfile") && options[:bundler] != false
89
+ @bundler ||= options[:bundler] != false && File.exist?("#{Dir.pwd}/Gemfile")
72
90
  end
73
-
91
+
74
92
  def test_unit?
75
- @test_unit ||= File.exist?("#{Dir.pwd}/test/test_helper.rb") && options[:test_unit] != false
93
+ @test_unit ||= options[:test_unit] != false && File.exist?("#{Dir.pwd}/test/test_helper.rb")
76
94
  end
77
95
 
78
96
  def rspec?
79
- @rspec ||= File.exist?("#{Dir.pwd}/spec") && options[:rspec] != false
97
+ @rspec ||= options[:rspec] != false && File.exist?("#{Dir.pwd}/spec")
80
98
  end
81
99
  end
82
100
  end
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module SpinVersion
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-spin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-11-10 00:00:00.000000000 Z
13
+ date: 2011-11-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: guard
17
- requirement: &17190040760 !ruby/object:Gem::Requirement
17
+ requirement: &17194890340 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *17190040760
25
+ version_requirements: *17194890340
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: spin
28
- requirement: &17190039960 !ruby/object:Gem::Requirement
28
+ requirement: &17194889900 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,8 +33,30 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *17190039960
37
- description: Guard gem for Spin
36
+ version_requirements: *17194889900
37
+ - !ruby/object:Gem::Dependency
38
+ name: bundler
39
+ requirement: &17194889360 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '1.0'
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: *17194889360
48
+ - !ruby/object:Gem::Dependency
49
+ name: rspec
50
+ requirement: &17194887980 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '2.0'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: *17194887980
59
+ description: Guard::Spin automatically manage Spin server.
38
60
  email:
39
61
  - greenberg@entryway.net
40
62
  - assarata@gmail.com