garlando 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7caf226a549137d06499593a0fc968acca5aaa68
4
- data.tar.gz: 3be821e59ccd449cd81c43aed644bd920522ce28
3
+ metadata.gz: a26124f779ff719156ef89436396438690a13575
4
+ data.tar.gz: 2180fac73c8d8d20af242246f303c04706c94fc0
5
5
  SHA512:
6
- metadata.gz: 49a6825840e4cfd913829325a518f6451c64c91de9d09fb58fc23fed89755dbdfcfa353e6f7223b29f6c944df8e6ad08312f36107eeafda03fbd2d77b82c37ea
7
- data.tar.gz: 1c07f8f67e3f5503719a87b4fa5a662f1bb142bc3cf4adba047c43e05d62ed42fff98cd48134f2b687ef612ee42316fdac1a56c17952599c1ef091502fa76529
6
+ metadata.gz: 423a4f94d150de10a56e150aa85961e25ff63bee01be2fd5b8dca4fd09ffa67c81d4b9d52ff2b1e196eff540cfefa5fb7e9dc86ce134e80e4f03d56757328656
7
+ data.tar.gz: cfaad47b919be25962360e2d060ab031e79e6fb95d5520d0c1cdef09fcb1f11df9a2940f753fb42b0d3caf769e8a8c3e2be1fa07f8a2e2ccf86458b204ee5d9f
data/lib/garlando.rb CHANGED
@@ -47,10 +47,7 @@ module Garlando
47
47
  pid = File.read(pid_path).to_i
48
48
  Timeout.timeout(10) do
49
49
  begin
50
- while running?
51
- Process.kill :INT, pid
52
- sleep 0.5
53
- end
50
+ kill pid while running?
54
51
  rescue Errno::ESRCH
55
52
  end
56
53
  end
@@ -71,6 +68,11 @@ module Garlando
71
68
 
72
69
  private
73
70
 
71
+ def kill(pid, sig=:INT)
72
+ Process.kill sig, pid
73
+ sleep 0.5
74
+ end
75
+
74
76
  def running?
75
77
  File.exists? pid_path
76
78
  end
@@ -83,8 +85,12 @@ module Garlando
83
85
  File.join @options[:pwd], 'config/environment.rb'
84
86
  end
85
87
 
88
+ def log_path
89
+ File.join @options[:pwd], @options[:log]
90
+ end
91
+
86
92
  def reopen
87
- file = File.open File.join(@options[:pwd], @options[:log]), 'w+'
93
+ file = File.open log_path, 'w+'
88
94
  [STDOUT, STDERR].each { |e| e.reopen file }
89
95
  end
90
96
 
@@ -1,3 +1,3 @@
1
1
  module Garlando
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -0,0 +1,17 @@
1
+ module Guard
2
+ class Garlando < Plugin
3
+ def initialize(options={})
4
+ super
5
+ tuples = %w(-s -o -p -P -E).zip(options.values_at *%i(server host port pid env))
6
+ @option = tuples.reject { |_, e| e.nil? }.map { |e| e * ' ' } * ' '
7
+ end
8
+
9
+ def start
10
+ system 'garlando #{@option}'
11
+ end
12
+
13
+ def stop
14
+ system 'garlando stop'
15
+ end
16
+ end
17
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: garlando
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - miyucy
@@ -41,6 +41,7 @@ files:
41
41
  - garlando.gemspec
42
42
  - lib/garlando.rb
43
43
  - lib/garlando/version.rb
44
+ - lib/guard/garlando.rb
44
45
  - spec/garlando_spec.rb
45
46
  - spec/spec_helper.rb
46
47
  homepage: https://github.com/miyucy/garlando