brisk 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/brisk/server/pid.rb +9 -0
- data/lib/brisk/server/proxy.rb +18 -4
- data/lib/brisk/server/server.rb +5 -2
- data/lib/brisk/thin.rb +16 -3
- data/lib/brisk/version.rb +1 -1
- 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: 4daa16b5c768b4813fe28e5242b265f6d989e929
|
4
|
+
data.tar.gz: 9340e9f58325c4dea48080d982a75dfa92c75862
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 823564cfb0b65657dc8e54863307b9f81f61af90fa4bb27f9be4bddb6ec857f9f5365b0c7677cf53946472dc84ef47a5f48ec4b03fd205a52269b5b38c43d908
|
7
|
+
data.tar.gz: d4f7efb1f0894cc35fd11487ff9a760108d138d368bab952b13d53fb2b760a542639e2b85aefc88c45201517428159e27312043c95285af7e404058b5f2e4e98
|
data/lib/brisk/server/pid.rb
CHANGED
data/lib/brisk/server/proxy.rb
CHANGED
@@ -6,6 +6,7 @@ require 'brisk/server/brisk_request_helper'
|
|
6
6
|
require 'brisk/server/server'
|
7
7
|
require 'brisk/server/site'
|
8
8
|
require 'brisk/server/pid'
|
9
|
+
require 'net/http'
|
9
10
|
|
10
11
|
class AppProxy < Rack::Proxy
|
11
12
|
|
@@ -44,6 +45,7 @@ class AppProxy < Rack::Proxy
|
|
44
45
|
# Boot up the server
|
45
46
|
Server.start(valet_site_path)
|
46
47
|
|
48
|
+
# Check if proccess is up and running
|
47
49
|
started = Server.is_started(valet_site_path)
|
48
50
|
|
49
51
|
# Write the pid to a file so we can delete it later on
|
@@ -53,11 +55,23 @@ class AppProxy < Rack::Proxy
|
|
53
55
|
Site.write_site(valet_home_path, site)
|
54
56
|
end
|
55
57
|
|
56
|
-
|
58
|
+
run env
|
59
|
+
end
|
60
|
+
|
61
|
+
def run(env, counter = 0)
|
57
62
|
|
58
|
-
|
59
|
-
env["HTTP_HOST"] = "localhost:3000"
|
63
|
+
raise Exception.new "Brisk is not able to run the server.. Connection refused" if counter == 10
|
60
64
|
|
61
|
-
|
65
|
+
sleep(0.5)
|
66
|
+
uri = URI('http://localhost:3000')
|
67
|
+
|
68
|
+
begin
|
69
|
+
# Check if the server is up and running. Find a cleaner way to do this
|
70
|
+
Net::HTTP.get(uri)
|
71
|
+
env['HTTP_HOST'] = 'localhost:3000'
|
72
|
+
return env
|
73
|
+
rescue Errno::ECONNREFUSED
|
74
|
+
run(env, counter + 1)
|
75
|
+
end
|
62
76
|
end
|
63
77
|
end
|
data/lib/brisk/server/server.rb
CHANGED
data/lib/brisk/thin.rb
CHANGED
@@ -3,13 +3,14 @@ require 'colorize'
|
|
3
3
|
class Thin
|
4
4
|
|
5
5
|
def self.install
|
6
|
-
unless
|
7
|
-
system "gem install thin > /dev/null"
|
6
|
+
unless is_installed?
|
8
7
|
|
9
|
-
|
8
|
+
|
9
|
+
if download
|
10
10
|
puts "Successfuly installed thin".colorize(:green)
|
11
11
|
else
|
12
12
|
puts "Something went wrong while installing thin. The process gets stopped".colorize(:red)
|
13
|
+
exit
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
@@ -24,6 +25,18 @@ class Thin
|
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
28
|
+
def self.download
|
29
|
+
system "gem install thin > /dev/null"
|
30
|
+
|
31
|
+
$? == 0
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.is_installed?
|
35
|
+
system "gem list -i thin > /dev/null"
|
36
|
+
|
37
|
+
$? == 0
|
38
|
+
end
|
39
|
+
|
27
40
|
def self.restart
|
28
41
|
stop
|
29
42
|
|
data/lib/brisk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brisk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|