microget 1.1.0 → 1.1.1
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.
- checksums.yaml +4 -4
- data/lib/microget.rb +1 -1
- data/lib/microget/server_runner.rb +16 -3
- data/microget.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87f3ed02ccdc53cbaeb27da5c3e75ac5fd59c183
|
4
|
+
data.tar.gz: 7a7f074fc1e08bfdd4671c3d219517c6a245f820
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c09a374a6665ee27dfee54f969cb92297480d37b1bfb4444d0a9d3a96b2c2c4d3875e47762accf5bdde27bfa26b1dc3b709bf29d16e31c1d7e1ab0f9550ac75f
|
7
|
+
data.tar.gz: 02285a2a3f7b05bdf42e12a289a145d8d7f1d238cf3862fcc26dcfd9ca4c5dff982b6a2d9cd711212f36fb17f680c655d4132237d659baaa198aaad4ae41cadb
|
data/lib/microget.rb
CHANGED
@@ -7,8 +7,12 @@ class Microget::ServerRunner < Struct.new(:name, :command, :port, :rackup_file_p
|
|
7
7
|
def command
|
8
8
|
super % [port, rackup_file_path]
|
9
9
|
end
|
10
|
-
|
11
|
-
|
10
|
+
|
11
|
+
# Start the server as a subprocess and store its PID.
|
12
|
+
#
|
13
|
+
# @param timeout[Fixnum] the number of seconds to wait for the server to boot up
|
14
|
+
# @return [TrueClass] true
|
15
|
+
def start!(timeout: SHOULD_CONNECT_WITHIN)
|
12
16
|
# Boot Puma in a forked process
|
13
17
|
@pid = fork do
|
14
18
|
$stderr.puts "Spinning up with #{command.inspect}"
|
@@ -36,19 +40,27 @@ class Microget::ServerRunner < Struct.new(:name, :command, :port, :rackup_file_p
|
|
36
40
|
@running = true
|
37
41
|
break
|
38
42
|
rescue Errno::ECONNREFUSED
|
39
|
-
if (Time.now - t) >
|
43
|
+
if (Time.now - t) > timeout # The server is still not on, bail out
|
40
44
|
raise "Could not get the server started in 2 seconds, something might be misconfigured"
|
41
45
|
end
|
42
46
|
end
|
43
47
|
end
|
44
48
|
|
45
49
|
trap("TERM") { stop! }
|
50
|
+
true
|
46
51
|
end
|
47
52
|
|
53
|
+
# Tells whether the server is currently running
|
54
|
+
#
|
55
|
+
# @return [TrueClass, FalseClass]
|
48
56
|
def running?
|
49
57
|
!!@running
|
50
58
|
end
|
51
59
|
|
60
|
+
# Stops the server by issuing progressively harsher signals to it's process
|
61
|
+
# (in the order of TERM, TERM, KILL).
|
62
|
+
#
|
63
|
+
# @return [TrueClass]
|
52
64
|
def stop!
|
53
65
|
return unless @pid
|
54
66
|
|
@@ -56,5 +68,6 @@ class Microget::ServerRunner < Struct.new(:name, :command, :port, :rackup_file_p
|
|
56
68
|
%W( TERM TERM KILL ).each {|sig| Process.kill(sig, @pid); sleep 0.5 }
|
57
69
|
@pid = nil
|
58
70
|
@running = false
|
71
|
+
true
|
59
72
|
end
|
60
73
|
end
|
data/microget.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: microget 1.1.
|
5
|
+
# stub: microget 1.1.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "microget"
|
9
|
-
s.version = "1.1.
|
9
|
+
s.version = "1.1.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Julik Tarkhanov"]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2016-01-03"
|
15
15
|
s.description = "Pedal-to-the-metal HTTP client for GET requests"
|
16
16
|
s.email = "me@julik.nl"
|
17
17
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: microget
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julik Tarkhanov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puma
|