uc 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uc/unicorn_config.rb +79 -0
- data/lib/uc/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e969b2c0b29d88608f5c8c2c8aae9e73593b3390
|
4
|
+
data.tar.gz: c26f2fa6790d5061f8a9ebe7ef5191699b77e951
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f51bc62d0b3994aeed08b9daadc55ba064a90a374080d4ab17fb1e08dd5c12edcc4b650f0130ed04b431cce9f37e5eb5e30cb96b23202626998080b243d2f961
|
7
|
+
data.tar.gz: a8e4f5ae161f8a37aa3fa8e4c3420da3f58e918e3a5e19ca0fad6041a105a1c54bdb3e43df9eda91d42e58c5fb3a22cac922a3bb1cf0f487c8e2853af80bddec
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'uc/logger'
|
3
|
+
module Uc
|
4
|
+
class UnicornConfig
|
5
|
+
|
6
|
+
include ::Uc::Logger
|
7
|
+
|
8
|
+
attr_reader :app_dir
|
9
|
+
|
10
|
+
def initialize(app_dir)
|
11
|
+
@app_dir = app_dir
|
12
|
+
end
|
13
|
+
|
14
|
+
def config_path
|
15
|
+
rpath "config/unicorn.rb"
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
def stdout_log
|
20
|
+
rpath "log/unicorn.stdout_log"
|
21
|
+
end
|
22
|
+
|
23
|
+
def stderr_log
|
24
|
+
rpath "log/unicorn.stderr_log"
|
25
|
+
end
|
26
|
+
|
27
|
+
def socket_file
|
28
|
+
rpath "tmp/sockets/unicorn.sock"
|
29
|
+
end
|
30
|
+
|
31
|
+
def pid_file
|
32
|
+
rpath "tmp/pids/unicorn.pid"
|
33
|
+
end
|
34
|
+
|
35
|
+
def rack_path
|
36
|
+
rpath "config.ru"
|
37
|
+
end
|
38
|
+
|
39
|
+
def read_pid
|
40
|
+
pid = (File.read pid_file).to_i
|
41
|
+
pid == 0 ? -1 : pid
|
42
|
+
rescue
|
43
|
+
return -1
|
44
|
+
end
|
45
|
+
|
46
|
+
def check_dirs
|
47
|
+
logger.debug "Using app_dir => #{app_dir}"
|
48
|
+
raise ::Uc::Error, %{app_dir not readable} if not path_readable? app_dir
|
49
|
+
Dir.chdir app_dir do
|
50
|
+
raise ::Uc::Error, %{no config.ru found in app_dir} if not path_readable? rack_path
|
51
|
+
raise ::Uc::Error, %{no unicorn config found %} if not path_readable? config_path
|
52
|
+
end
|
53
|
+
@dirs_checked = true
|
54
|
+
end
|
55
|
+
|
56
|
+
def dirs_checked?
|
57
|
+
@dirs_checked
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
def rpath(path)
|
64
|
+
path = Pathname.new(path)
|
65
|
+
raise "absolute path specified: #{path}" if path.absolute?
|
66
|
+
"#{app_dir}/#{path}"
|
67
|
+
end
|
68
|
+
|
69
|
+
def rpathname(path)
|
70
|
+
Pathname.new(rpath(path))
|
71
|
+
end
|
72
|
+
|
73
|
+
def path_readable?(path_str)
|
74
|
+
path = Pathname.new(path_str)
|
75
|
+
path.readable?
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
data/lib/uc/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neeraj
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- lib/uc/server.rb
|
73
73
|
- lib/uc/shell_helper.rb
|
74
74
|
- lib/uc/unicorn.rb
|
75
|
+
- lib/uc/unicorn_config.rb
|
75
76
|
- lib/uc/version.rb
|
76
77
|
- uc.gemspec
|
77
78
|
homepage: ''
|
@@ -94,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
95
|
version: '0'
|
95
96
|
requirements: []
|
96
97
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.2.
|
98
|
+
rubygems_version: 2.2.2
|
98
99
|
signing_key:
|
99
100
|
specification_version: 4
|
100
101
|
summary: Unicorn controller
|