buildbox 0.2.1 → 0.2.2
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/Gemfile.lock +1 -1
- data/lib/buildbox.rb +1 -1
- data/lib/buildbox/{worker.rb → agent.rb} +3 -3
- data/lib/buildbox/api.rb +2 -2
- data/lib/buildbox/cli.rb +14 -14
- data/lib/buildbox/configuration.rb +5 -5
- data/lib/buildbox/server.rb +4 -4
- data/lib/buildbox/version.rb +1 -1
- data/spec/buildbox/buildbox/agent_spec.rb +4 -0
- metadata +5 -5
- data/spec/buildbox/buildbox/worker_spec.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f440103d7897a20e804e7a4a24b81699cd29e3b3
|
4
|
+
data.tar.gz: 1c70d6f1809989aba284dd197a9804bf84693e1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fe2b5ab4c51c94ccd7efa13d69757decc2f48448ce206ef51f0ae4735090b05a947b257590bf21e1e6647f7a53b0bde114813afdd74abd729b7c7caaebd104c
|
7
|
+
data.tar.gz: f3a8445fe4b4af7aa8eaf8d16f8935980b051461de31638afbd2509f5e0979dc174cadabe2469d8c53c0fd53671bde7457601f516d80c129a2d3c4b55cb69497
|
data/Gemfile.lock
CHANGED
data/lib/buildbox.rb
CHANGED
@@ -13,7 +13,7 @@ module Buildbox
|
|
13
13
|
autoload :Script, "buildbox/script"
|
14
14
|
autoload :Server, "buildbox/server"
|
15
15
|
autoload :UTF8, "buildbox/utf8"
|
16
|
-
autoload :
|
16
|
+
autoload :Agent, "buildbox/agent"
|
17
17
|
autoload :VERSION, "buildbox/version"
|
18
18
|
|
19
19
|
def self.config
|
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'celluloid'
|
3
3
|
|
4
4
|
module Buildbox
|
5
|
-
class
|
5
|
+
class Agent
|
6
6
|
include Celluloid::Logger
|
7
7
|
|
8
8
|
def initialize(access_token, api)
|
@@ -23,9 +23,9 @@ module Buildbox
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def projects
|
26
|
-
@api.
|
26
|
+
@api.agent(@access_token, hostname).projects
|
27
27
|
rescue Faraday::Error::ClientError
|
28
|
-
warn "
|
28
|
+
warn "Agent #{@access_token} doesn't exist"
|
29
29
|
[] # return empty array to avoid breakage
|
30
30
|
end
|
31
31
|
|
data/lib/buildbox/api.rb
CHANGED
@@ -14,8 +14,8 @@ module Buildbox
|
|
14
14
|
get("user")
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
18
|
-
put("
|
17
|
+
def agent(access_token, hostname)
|
18
|
+
put("agents/#{access_token}", :hostname => hostname)
|
19
19
|
end
|
20
20
|
|
21
21
|
def scheduled_builds(project)
|
data/lib/buildbox/cli.rb
CHANGED
@@ -18,20 +18,20 @@ module Buildbox
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
@commands['
|
22
|
-
opts.banner = "Usage: buildbox
|
21
|
+
@commands['agent:start'] = OptionParser.new do |opts|
|
22
|
+
opts.banner = "Usage: buildbox agent:start"
|
23
23
|
|
24
24
|
opts.on("--help", "You're looking at it.") do
|
25
|
-
puts @commands['
|
25
|
+
puts @commands['agent:start']
|
26
26
|
exit
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
@commands['
|
31
|
-
opts.banner = "Usage: buildbox
|
30
|
+
@commands['agent:setup'] = OptionParser.new do |opts|
|
31
|
+
opts.banner = "Usage: buildbox setup:add [token]"
|
32
32
|
|
33
33
|
opts.on("--help", "You're looking at it.") do
|
34
|
-
puts @commands['
|
34
|
+
puts @commands['setup:add']
|
35
35
|
exit
|
36
36
|
end
|
37
37
|
end
|
@@ -59,20 +59,20 @@ module Buildbox
|
|
59
59
|
exit
|
60
60
|
end
|
61
61
|
|
62
|
-
if command == "
|
62
|
+
if command == "agent:start"
|
63
63
|
Buildbox::Server.new.start
|
64
|
-
elsif command == "
|
64
|
+
elsif command == "setup:add"
|
65
65
|
if @argv.length == 0
|
66
66
|
puts "No token provided"
|
67
67
|
exit 1
|
68
68
|
end
|
69
69
|
|
70
70
|
access_token = @argv.first
|
71
|
-
|
72
|
-
Buildbox.config.update(:
|
71
|
+
agent_access_tokens = Buildbox.config.agent_access_tokens
|
72
|
+
Buildbox.config.update(:agent_access_tokens => agent_access_tokens << access_token)
|
73
73
|
|
74
|
-
puts "Successfully added
|
75
|
-
puts "You can now start the
|
74
|
+
puts "Successfully added agent access token"
|
75
|
+
puts "You can now start the agent with: buildbox agent:start"
|
76
76
|
elsif command == "auth:login"
|
77
77
|
if @argv.length == 0
|
78
78
|
puts "No api key provided"
|
@@ -86,7 +86,7 @@ module Buildbox
|
|
86
86
|
Buildbox.config.update(:api_key => api_key)
|
87
87
|
|
88
88
|
puts "Successfully added your api_key"
|
89
|
-
puts "You can now add
|
89
|
+
puts "You can now add agents with: buildbox setup:add [agent_token]"
|
90
90
|
rescue
|
91
91
|
puts "Could not authenticate your api_key"
|
92
92
|
exit 1
|
@@ -111,7 +111,7 @@ module Buildbox
|
|
111
111
|
def help
|
112
112
|
<<HELP
|
113
113
|
|
114
|
-
|
114
|
+
agent # agent management (setup, server)
|
115
115
|
version # display version
|
116
116
|
|
117
117
|
HELP
|
@@ -4,13 +4,13 @@ require 'json'
|
|
4
4
|
|
5
5
|
module Buildbox
|
6
6
|
class Configuration < Hashie::Mash
|
7
|
-
def
|
8
|
-
|
7
|
+
def agent_access_tokens
|
8
|
+
env_agents = ENV['BUILDBOX_WORKERS']
|
9
9
|
|
10
|
-
if
|
11
|
-
self[:
|
10
|
+
if env_agents.nil?
|
11
|
+
self[:agent_access_tokens] || []
|
12
12
|
else
|
13
|
-
|
13
|
+
env_agents.to_s.split(",")
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
data/lib/buildbox/server.rb
CHANGED
@@ -12,8 +12,8 @@ module Buildbox
|
|
12
12
|
@config.check
|
13
13
|
@config.reload
|
14
14
|
|
15
|
-
|
16
|
-
Buildbox::
|
15
|
+
agent_access_tokens.each do |access_token|
|
16
|
+
Buildbox::Agent.new(access_token, api).work
|
17
17
|
end
|
18
18
|
|
19
19
|
@logger.info "Sleeping for #{INTERVAL} seconds"
|
@@ -27,8 +27,8 @@ module Buildbox
|
|
27
27
|
@api ||= Buildbox::API.new
|
28
28
|
end
|
29
29
|
|
30
|
-
def
|
31
|
-
@config.
|
30
|
+
def agent_access_tokens
|
31
|
+
@config.agent_access_tokens
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
data/lib/buildbox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buildbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Pitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- bin/buildbox
|
99
99
|
- buildbox-ruby.gemspec
|
100
100
|
- lib/buildbox.rb
|
101
|
+
- lib/buildbox/agent.rb
|
101
102
|
- lib/buildbox/api.rb
|
102
103
|
- lib/buildbox/build.rb
|
103
104
|
- lib/buildbox/cli.rb
|
@@ -109,7 +110,7 @@ files:
|
|
109
110
|
- lib/buildbox/server.rb
|
110
111
|
- lib/buildbox/utf8.rb
|
111
112
|
- lib/buildbox/version.rb
|
112
|
-
-
|
113
|
+
- spec/buildbox/buildbox/agent_spec.rb
|
113
114
|
- spec/buildbox/buildbox/api_spec.rb
|
114
115
|
- spec/buildbox/buildbox/build_spec.rb
|
115
116
|
- spec/buildbox/buildbox/cli_spec.rb
|
@@ -121,7 +122,6 @@ files:
|
|
121
122
|
- spec/buildbox/buildbox/server_spec.rb
|
122
123
|
- spec/buildbox/buildbox/utf8_spec.rb
|
123
124
|
- spec/buildbox/buildbox/version_spec.rb
|
124
|
-
- spec/buildbox/buildbox/worker_spec.rb
|
125
125
|
- spec/fixtures/repo.git/HEAD
|
126
126
|
- spec/fixtures/repo.git/config
|
127
127
|
- spec/fixtures/repo.git/description
|
@@ -172,6 +172,7 @@ signing_key:
|
|
172
172
|
specification_version: 4
|
173
173
|
summary: Ruby client for buildbox
|
174
174
|
test_files:
|
175
|
+
- spec/buildbox/buildbox/agent_spec.rb
|
175
176
|
- spec/buildbox/buildbox/api_spec.rb
|
176
177
|
- spec/buildbox/buildbox/build_spec.rb
|
177
178
|
- spec/buildbox/buildbox/cli_spec.rb
|
@@ -183,7 +184,6 @@ test_files:
|
|
183
184
|
- spec/buildbox/buildbox/server_spec.rb
|
184
185
|
- spec/buildbox/buildbox/utf8_spec.rb
|
185
186
|
- spec/buildbox/buildbox/version_spec.rb
|
186
|
-
- spec/buildbox/buildbox/worker_spec.rb
|
187
187
|
- spec/fixtures/repo.git/HEAD
|
188
188
|
- spec/fixtures/repo.git/config
|
189
189
|
- spec/fixtures/repo.git/description
|