sweatshop_gears 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/FUTURE.md +9 -0
- data/Gemfile.lock +25 -2
- data/README.md +4 -10
- data/bin/sweatshop-gears +1 -2
- data/lib/robot_sweatshop/gears/metadata.rb +4 -5
- data/lib/robot_sweatshop/gears/packages.rb +2 -1
- data/lib/robot_sweatshop/gears/scripts.rb +1 -4
- data/lib/robot_sweatshop/gears/services.rb +23 -12
- data/lib/robot_sweatshop/gears/templates/frontpage.html.eruby +6 -0
- data/lib/robot_sweatshop/gears/{sweatshop_gears.eye.eruby → templates/sweatshop_gears.eye.eruby} +3 -7
- data/sweatshop_gears.gemspec +4 -2
- metadata +38 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99c8425479c3e8e5d9d1e728249d98329e5d8292
|
4
|
+
data.tar.gz: 0f93afe8a5b6152d80a8eb992b4bcd6280ea9d55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4c6c5dc3f9d5cc467aa0b56fc7c23d16594a0e7dc1f1c65f310bd520896341c8160a42b12a3ccc1729fe5722b8e5e779ce3bbab77c4b1608d78776c85fe5b78
|
7
|
+
data.tar.gz: 01aacf504642f0631122054ad7d2e48b9c297f0f2d6aa2d2bc7c0d57925d3c0b753aac866dff7c81b383b55b22003bb10dc1ed2fcfcf7838525de3b4656cfa4b
|
data/FUTURE.md
ADDED
data/Gemfile.lock
CHANGED
@@ -7,12 +7,15 @@ PATH
|
|
7
7
|
contracts
|
8
8
|
erubis
|
9
9
|
git
|
10
|
+
rack-reverse-proxy
|
10
11
|
robot_sweatshop
|
12
|
+
sinatra
|
11
13
|
terminal-announce
|
12
14
|
|
13
15
|
GEM
|
14
16
|
remote: http://rubygems.org/
|
15
17
|
specs:
|
18
|
+
addressable (2.3.8)
|
16
19
|
celluloid (0.15.2)
|
17
20
|
timers (~> 1.1.0)
|
18
21
|
celluloid-io (0.15.0)
|
@@ -24,6 +27,8 @@ GEM
|
|
24
27
|
contracts (0.9)
|
25
28
|
daybreak (0.3.0)
|
26
29
|
docile (1.1.5)
|
30
|
+
domain_name (0.5.24)
|
31
|
+
unf (>= 0.0.5, < 1.0.0)
|
27
32
|
erubis (2.7.0)
|
28
33
|
exponential-backoff (0.0.2)
|
29
34
|
eye (0.6.4)
|
@@ -36,21 +41,35 @@ GEM
|
|
36
41
|
ffi-rzmq (~> 2.0)
|
37
42
|
faker (1.4.3)
|
38
43
|
i18n (~> 0.5)
|
39
|
-
ffi (1.9.
|
44
|
+
ffi (1.9.9)
|
40
45
|
ffi-rzmq (2.0.4)
|
41
46
|
ffi-rzmq-core (>= 1.0.1)
|
42
47
|
ffi-rzmq-core (1.0.3)
|
43
48
|
ffi (~> 1.9)
|
44
49
|
git (1.2.9.1)
|
45
50
|
highline (1.7.2)
|
51
|
+
http (0.8.12)
|
52
|
+
addressable (~> 2.3)
|
53
|
+
http-cookie (~> 1.0)
|
54
|
+
http-form_data (~> 1.0.1)
|
55
|
+
http_parser.rb (~> 0.6.0)
|
56
|
+
http-cookie (1.0.2)
|
57
|
+
domain_name (~> 0.5)
|
58
|
+
http-form_data (1.0.1)
|
59
|
+
http_parser.rb (0.6.0)
|
46
60
|
i18n (0.7.0)
|
47
61
|
json (1.8.3)
|
48
62
|
moneta (0.8.0)
|
49
63
|
nio4r (1.1.0)
|
50
64
|
oj (2.12.9)
|
51
|
-
rack (1.6.
|
65
|
+
rack (1.6.4)
|
52
66
|
rack-protection (1.5.3)
|
53
67
|
rack
|
68
|
+
rack-proxy (0.5.17)
|
69
|
+
rack
|
70
|
+
rack-reverse-proxy (0.8.1)
|
71
|
+
rack (>= 1.0.0)
|
72
|
+
rack-proxy (~> 0.5)
|
54
73
|
rainbow (2.0.0)
|
55
74
|
rake (10.4.2)
|
56
75
|
redislike (0.2.5)
|
@@ -96,11 +115,15 @@ GEM
|
|
96
115
|
thor (0.19.1)
|
97
116
|
tilt (2.0.1)
|
98
117
|
timers (1.1.0)
|
118
|
+
unf (0.1.4)
|
119
|
+
unf_ext
|
120
|
+
unf_ext (0.0.7.1)
|
99
121
|
|
100
122
|
PLATFORMS
|
101
123
|
ruby
|
102
124
|
|
103
125
|
DEPENDENCIES
|
126
|
+
http
|
104
127
|
rake
|
105
128
|
riot
|
106
129
|
simplecov
|
data/README.md
CHANGED
@@ -2,18 +2,12 @@
|
|
2
2
|
|
3
3
|
Package management for [Robot Sweatshop](https://github.com/JScott/robot_sweatshop) scripts.
|
4
4
|
|
5
|
+
## Usage
|
6
|
+
|
5
7
|
`sweatshop gears install <package-name>`
|
6
8
|
|
7
9
|
If you can't create `/usr/local/gears`, use the `--path` flag to install everything to somewhere you can.
|
8
10
|
|
9
|
-
##
|
11
|
+
## What packages?
|
10
12
|
|
11
|
-
-
|
12
|
-
- Source from custom repo
|
13
|
-
- More commands:
|
14
|
-
- show <package>
|
15
|
-
- list [--all]
|
16
|
-
- uninstall
|
17
|
-
- update
|
18
|
-
- Package versioning
|
19
|
-
- Scaffolding scripts?
|
13
|
+
Right now it only supports pulling from the [official repository](https://github.com/JScott/sweatshop-gears-packages). The plan is to support 3rd party repositories of scripts in the future.
|
data/bin/sweatshop-gears
CHANGED
@@ -19,8 +19,7 @@ command :init do |c|
|
|
19
19
|
options.default path: '/usr/local/gears'
|
20
20
|
FileUtils.mkpath options.path
|
21
21
|
Gears::Metadata.download to_path: options.path
|
22
|
-
|
23
|
-
Gears::Metadata.create_runtime_paths # TODO: ensure robot_sweatshop ran and the compiled config exists? Only errors in Services
|
22
|
+
Gears::Services.create_paths
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
@@ -24,11 +24,10 @@ module Gears
|
|
24
24
|
YAML.load File.read("#{package_path}/metadata.yaml")
|
25
25
|
end
|
26
26
|
|
27
|
-
def self.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
FileUtils.mkpath "#{config[:pidfile_path]}/gears"
|
27
|
+
def self.sweatshop_config
|
28
|
+
path = File.expand_path '~/.robot_sweatshop/compiled_config.yaml'
|
29
|
+
fail 'Please run `sweatshop start` first' unless File.exist? path
|
30
|
+
YAML.load File.read(path)
|
32
31
|
end
|
33
32
|
end
|
34
33
|
end
|
@@ -38,7 +38,8 @@ module Gears
|
|
38
38
|
Gears::Dependencies.install from_path: install_path
|
39
39
|
expose plural_type, from_path: install_path
|
40
40
|
Announce.success "#{package_name} installed"
|
41
|
-
rescue
|
41
|
+
rescue => error
|
42
|
+
puts error
|
42
43
|
Announce.failure 'Error occurred, rolling back installation'
|
43
44
|
FileUtils.rm_rf install_path
|
44
45
|
end
|
@@ -17,10 +17,7 @@ module Gears
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.scripts_path
|
20
|
-
|
21
|
-
fail 'Please run `sweatshop start` again' unless File.exist? config
|
22
|
-
config = YAML.load File.read(config)
|
23
|
-
config[:scripts_path]
|
20
|
+
Gears::Metadata.sweatshop_config[:scripts_path]
|
24
21
|
end
|
25
22
|
end
|
26
23
|
end
|
@@ -6,36 +6,47 @@ module Gears
|
|
6
6
|
# Installs Gears service packages
|
7
7
|
module Services
|
8
8
|
def self.expose(from_path:)
|
9
|
+
services_path = File.expand_path "#{from_path}/.."
|
10
|
+
dynamically_load_eye_from services_path
|
9
11
|
service = File.basename from_path
|
10
|
-
dynamically_load_eye from_path
|
11
12
|
Announce.success "Loaded #{service} into Eye"
|
12
13
|
end
|
13
14
|
|
14
15
|
def self.write_and_load(eye_config)
|
15
|
-
eye_file = '/tmp/.sweatshop_gears.eye'
|
16
16
|
File.write eye_file, eye_config
|
17
17
|
puts `eye load #{eye_file}`
|
18
18
|
puts `eye stop sweatshop_gears`
|
19
|
-
File.delete eye_file
|
20
19
|
end
|
21
20
|
|
22
|
-
def self.
|
23
|
-
|
24
|
-
|
21
|
+
def self.installed_in(path)
|
22
|
+
services = Dir.glob("#{path}/*").select { |path| File.directory? path }
|
23
|
+
services.map { |path| File.basename path }
|
25
24
|
end
|
26
25
|
|
27
|
-
def self.
|
28
|
-
|
26
|
+
def self.eye_file
|
27
|
+
'/tmp/.sweatshop_gears.eye'
|
29
28
|
end
|
30
29
|
|
31
|
-
def self.
|
30
|
+
def self.first_port
|
31
|
+
34871
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.dynamically_load_eye_from(services_path)
|
32
35
|
context = {
|
33
|
-
|
34
|
-
|
36
|
+
config: Gears::Metadata.sweatshop_config,
|
37
|
+
services: installed_in(services_path),
|
38
|
+
services_path: services_path,
|
39
|
+
first_port: first_port
|
35
40
|
}
|
36
|
-
input = File.read "#{__dir__}/sweatshop_gears.eye.eruby"
|
41
|
+
input = File.read "#{__dir__}/templates/sweatshop_gears.eye.eruby"
|
37
42
|
eruby = Erubis::Eruby.new input
|
38
43
|
write_and_load eruby.result(context)
|
39
44
|
end
|
45
|
+
|
46
|
+
def self.create_paths
|
47
|
+
config = Gears::Metadata.sweatshop_config
|
48
|
+
FileUtils.mkpath "#{config[:logfile_path]}/gears"
|
49
|
+
FileUtils.mkpath "#{config[:pidfile_path]}/gears"
|
50
|
+
end
|
40
51
|
end
|
41
52
|
end
|
data/lib/robot_sweatshop/gears/{sweatshop_gears.eye.eruby → templates/sweatshop_gears.eye.eruby}
RENAMED
@@ -1,8 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# TODO: config not guaranteed to be there. sweatshop has to run first
|
4
|
-
CONFIG_PATH = File.expand_path '~/.robot_sweatshop/compiled_config.yaml'
|
5
|
-
CONFIG = YAML.load_file CONFIG_PATH
|
1
|
+
CONFIG = <%= config %>
|
6
2
|
PID_PATH = CONFIG[:pidfile_path]
|
7
3
|
LOG_PATH = CONFIG[:logfile_path]
|
8
4
|
|
@@ -15,11 +11,11 @@ Eye.application :sweatshop_gears do
|
|
15
11
|
check :cpu, every: 10.seconds, below: 100, times: 3
|
16
12
|
working_dir CONFIG[:working_path]
|
17
13
|
|
18
|
-
<%
|
14
|
+
<% services.each_with_index do |service, index| %>
|
19
15
|
process :'<%= service %>' do
|
20
16
|
pid_file "#{PID_PATH}/gears/<%= service %>.pid"
|
21
17
|
stdall "#{LOG_PATH}/gears/<%= service %>.log"
|
22
|
-
start_command "<%=
|
18
|
+
start_command "<%= services_path %>/<%= service %>/<%= service %> <%= first_port+index %>"
|
23
19
|
daemonize true
|
24
20
|
end
|
25
21
|
<% end %>
|
data/sweatshop_gears.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = 'sweatshop_gears'
|
3
|
-
gem.version = '1.0.
|
3
|
+
gem.version = '1.0.5'
|
4
4
|
gem.licenses = 'MIT'
|
5
5
|
gem.authors = ['Justin Scott']
|
6
6
|
gem.email = 'jvscott@gmail.com'
|
@@ -17,13 +17,15 @@ Gem::Specification.new do |gem|
|
|
17
17
|
|
18
18
|
gem.add_runtime_dependency 'bundler'
|
19
19
|
gem.add_runtime_dependency 'commander'
|
20
|
-
gem.add_runtime_dependency 'robot_sweatshop'
|
21
20
|
gem.add_runtime_dependency 'contracts'
|
22
21
|
gem.add_runtime_dependency 'terminal-announce'
|
23
22
|
gem.add_runtime_dependency 'git'
|
24
23
|
gem.add_runtime_dependency 'erubis'
|
24
|
+
gem.add_runtime_dependency 'sinatra'
|
25
|
+
gem.add_runtime_dependency 'rack-reverse-proxy'
|
25
26
|
|
26
27
|
gem.add_development_dependency 'rake'
|
27
28
|
gem.add_development_dependency 'riot'
|
28
29
|
gem.add_development_dependency 'simplecov'
|
30
|
+
gem.add_development_dependency 'http'
|
29
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sweatshop_gears
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Scott
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: contracts
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: terminal-announce
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: git
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: erubis
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -95,7 +95,21 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: sinatra
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rack-reverse-proxy
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - ">="
|
@@ -150,6 +164,20 @@ dependencies:
|
|
150
164
|
- - ">="
|
151
165
|
- !ruby/object:Gem::Version
|
152
166
|
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: http
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
153
181
|
description: Package management for Robot Sweatshop
|
154
182
|
email: jvscott@gmail.com
|
155
183
|
executables:
|
@@ -159,6 +187,7 @@ extra_rdoc_files: []
|
|
159
187
|
files:
|
160
188
|
- ".gitignore"
|
161
189
|
- ".rubocop.yml"
|
190
|
+
- FUTURE.md
|
162
191
|
- Gemfile
|
163
192
|
- Gemfile.lock
|
164
193
|
- LICENSE
|
@@ -171,7 +200,8 @@ files:
|
|
171
200
|
- lib/robot_sweatshop/gears/packages.rb
|
172
201
|
- lib/robot_sweatshop/gears/scripts.rb
|
173
202
|
- lib/robot_sweatshop/gears/services.rb
|
174
|
-
- lib/robot_sweatshop/gears/
|
203
|
+
- lib/robot_sweatshop/gears/templates/frontpage.html.eruby
|
204
|
+
- lib/robot_sweatshop/gears/templates/sweatshop_gears.eye.eruby
|
175
205
|
- sweatshop_gears.gemspec
|
176
206
|
- test/help_test.rb
|
177
207
|
- test/init_test.rb
|