oye 0.1.2 → 0.1.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
  SHA256:
3
- metadata.gz: bd9695ade1c74d7e4a4c0593cd39f0e559f94a3242586e905d33eb66dbc30f49
4
- data.tar.gz: ca15ae1503c2fe6777c0a3f9dfc1a7be7a8975407931c8d192930a0524812ef3
3
+ metadata.gz: 5bf2b6f8b1f021e9b5945051d4a10a1e7d17b0972b17c9298d566ebe37405314
4
+ data.tar.gz: e8de50c9741f0bdad0c9263a2723871fce17f99328bc9e7eed2a71ef9d2f837a
5
5
  SHA512:
6
- metadata.gz: e59fb07e4d00d6551cbec9edd4524da762bedb0641cc27e546d11f809d7424b6b995180d66ee0f4b425a646806e381a8699a112c8136977bf23c9967c03d39a5
7
- data.tar.gz: '009310c48f9299dc31750fcb4fbc5316a1b2f52e3a1ae48973e2eab950ce563ddf6cc065c7896a4dc355ec6a2bdcd65bef73d4e52d74eabf4bf17a03a8d9c810'
6
+ metadata.gz: c1b3657913076644a229c546479eb9d8ca50a4622320a39e754dc4d5cfe209d891f77ad2a7d5afb53c7f1f34dd2f6fbb1d6e83c67a19861082afc5b89894b8c7
7
+ data.tar.gz: d5d20c18f23b559edeec125bafd29ede069e22fea9f0e117ac40452f79164d8a7a77113c7636e77f287bb9430b9ba598b2b5fd7c4dad86a9632c3559c0a189be
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- oye (0.1.2)
4
+ oye (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -9,3 +9,5 @@ A continuous monitoring tool that does a few things:
9
9
  [ ] use multithreaading. each thread should watch a unique repo.
10
10
  [ ] run rails tests inside Oye.monitor
11
11
  [ ] check for irregularities in @repos, e.g two repeated cloned repos
12
+ [ ] give warning if port is not open use port_open? method
13
+ - also you should remove the '--port' option. instead specify the port in unicorn.rb
data/lib/oye/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Oye
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/oye.rb CHANGED
@@ -3,6 +3,8 @@ $LOAD_PATH.unshift __dir__
3
3
  require "oye/version"
4
4
  require 'fileutils'
5
5
  require 'yaml'
6
+ require 'socket'
7
+ require 'timeout'
6
8
 
7
9
  module Oye
8
10
  class Error < StandardError; end
@@ -93,8 +95,13 @@ module Oye
93
95
  end
94
96
 
95
97
  def monitor
96
- trap('TERM') { exit }
97
- trap('INT') { exit }
98
+ %w(TERM INT).each do |signal|
99
+ trap(signal) do
100
+ stop
101
+ ProFileUtils.rm_f(oye_pidfile)
102
+ exit
103
+ end
104
+ end
98
105
 
99
106
  @repos.keys.filter_map do |origin|
100
107
  next unless File.exists?(origin)
@@ -263,6 +270,22 @@ module Oye
263
270
 
264
271
  private
265
272
 
273
+ def port_open?(port)
274
+ begin
275
+ Timeout::timeout(1) do
276
+ begin
277
+ s = TCPServer.new(port)
278
+ s.close
279
+ return true
280
+ rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::EADDRINUSE
281
+ return false
282
+ end
283
+ end
284
+ rescue Timeout::Error
285
+ end
286
+ return false
287
+ end
288
+
266
289
  def oyedir
267
290
  "#{ENV['HOME']}/.oye"
268
291
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oye
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - sergioro