rolo 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rolo +7 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d33329644a696ef5200ebbeda374dde7a601890a
4
- data.tar.gz: 0620ad4c184006128e6fb19d057a1d9327053abd
3
+ metadata.gz: 24bb1f0d5d5f72338464f349ebfd0e253a2eb85f
4
+ data.tar.gz: 0f445dcd5024fd0e804a695754ada50ed73745e3
5
5
  SHA512:
6
- metadata.gz: bc23e04686d56ad9cfbe840c1496e139a3c086de83022b9b982282a87c77caa0af54db59943e19ddc24403e876da88f38f5c0609fbbcf9f24a7425207a5e7319
7
- data.tar.gz: 6671aee98bb43d124f7c9576e6bbee35e2104b012ff68f16b4037feba65e43cccc2ba8737b4d0b442acd41152c83317a004ac07b5bc6ad495160f59e1a39640f
6
+ metadata.gz: a7d175fbdeb8ef8f0e844c3c16bf5267231cfb96ec83e126d49203ff31cc45539c7c485e86fc50ea7f3ec546a02efc01347637cf61fb373a4740fa0784f00b4d
7
+ data.tar.gz: 3814215b91cf847aceee4c81bbfbf30aa3840840bea42f27e4e44c976afbda6267417764d2e9deed3163aec557584080e27cbf41f9c76f4b8baf44596233705d
data/bin/rolo CHANGED
@@ -99,7 +99,7 @@ OPTIONS = {:verbose => false,
99
99
  :port => 0,
100
100
  :timeout => 3,
101
101
  :no_bind => false,
102
- :address => "",
102
+ :address => nil,
103
103
  :message => ":: Address is in use. Is your application running?"}
104
104
 
105
105
  "Start an application and/or prevent it from running twice by simply
@@ -110,6 +110,7 @@ Syntax: rolo [options] <command> [<command arguments>]
110
110
 
111
111
  Option may be
112
112
 
113
+ -h, --help Show help message
113
114
  --verbose Show some verbose message (not very useful, though)
114
115
  -t, --test Test if application is running or if there's any error
115
116
  and return, without executing the command
@@ -134,7 +135,9 @@ closes all file descriptors at the time it runs, but it has some ways
134
135
  to listen on `%address:%port`. See EXAMPLE for details.
135
136
 
136
137
  To get support please use https://github.com/icy/rolo/issues.
137
- ".die(1, STDERR, "") if ARGV.empty?
138
+ ".die(1, STDERR, "") if ARGV.empty? \
139
+ or ARGV.include?("-h") \
140
+ or ARGV.include?("--help")
138
141
 
139
142
  while true
140
143
  f = ARGV.first
@@ -189,7 +192,7 @@ cmd = cmd.gsub("%port", OPTIONS[:port].to_s).gsub("%address", address)
189
192
 
190
193
  if OPTIONS[:no_bind]
191
194
  "The '--no-bind' option must be used with '--address' option".die \
192
- if OPTIONS[:address].empty?
195
+ if not OPTIONS[:address]
193
196
 
194
197
  begin
195
198
  OPTIONS[:message].die(0, STDOUT, "") \
@@ -205,8 +208,6 @@ else
205
208
  include Socket::Constants
206
209
  socket = Socket.new(AF_INET, SOCK_STREAM, 0)
207
210
  socket.bind(Socket.pack_sockaddr_in(OPTIONS[:port], address))
208
- # Bind on the address if specified
209
- socket.close unless OPTIONS[:address].empty?
210
211
  rescue Errno::EADDRINUSE
211
212
  OPTIONS[:message].die(0, STDOUT, "") unless OPTIONS[:message].empty?
212
213
  rescue => e
@@ -215,11 +216,11 @@ else
215
216
  end
216
217
 
217
218
  unless OPTIONS[:test]
218
- close_on_exec(false) unless OPTIONS[:no_bind]
219
219
  begin
220
220
  Dir.chdir(OPTIONS[:dir] || ".")
221
221
  rescue => e
222
222
  e.to_s.die(1)
223
223
  end
224
+ close_on_exec(false) unless OPTIONS[:no_bind]
224
225
  exec cmd
225
226
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rolo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anh K. Huynh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-22 00:00:00.000000000 Z
11
+ date: 2013-08-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Start an application and/or prevent it from running twice by simply checking
14
14
  if there is a network socket that is open by the application and/or by `rolo`