buildbox 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/bin/buildbox +31 -0
- data/buildbox-ruby.gemspec +25 -0
- data/lib/buildbox.rb +37 -0
- data/lib/buildbox/api.rb +80 -0
- data/lib/buildbox/build.rb +50 -0
- data/lib/buildbox/client.rb +78 -0
- data/lib/buildbox/command.rb +67 -0
- data/lib/buildbox/configuration.rb +56 -0
- data/lib/buildbox/pid_file.rb +25 -0
- data/lib/buildbox/result.rb +7 -0
- data/lib/buildbox/utf8.rb +50 -0
- data/lib/buildbox/version.rb +3 -0
- data/lib/buildbox/worker.rb +25 -0
- data/spec/buildbox/buildbox/build_spec.rb +66 -0
- data/spec/buildbox/buildbox/command_spec.rb +115 -0
- data/spec/buildbox/buildbox/configuration_spec.rb +9 -0
- data/spec/buildbox/buildbox_spec.rb +4 -0
- data/spec/fixtures/repo.git/HEAD +1 -0
- data/spec/fixtures/repo.git/config +6 -0
- data/spec/fixtures/repo.git/description +1 -0
- data/spec/fixtures/repo.git/hooks/applypatch-msg.sample +15 -0
- data/spec/fixtures/repo.git/hooks/commit-msg.sample +24 -0
- data/spec/fixtures/repo.git/hooks/post-update.sample +8 -0
- data/spec/fixtures/repo.git/hooks/pre-applypatch.sample +14 -0
- data/spec/fixtures/repo.git/hooks/pre-commit.sample +50 -0
- data/spec/fixtures/repo.git/hooks/pre-push.sample +53 -0
- data/spec/fixtures/repo.git/hooks/pre-rebase.sample +169 -0
- data/spec/fixtures/repo.git/hooks/prepare-commit-msg.sample +36 -0
- data/spec/fixtures/repo.git/hooks/update.sample +128 -0
- data/spec/fixtures/repo.git/info/exclude +6 -0
- data/spec/fixtures/repo.git/objects/2d/762cdfd781dc4077c9f27a18969efbd186363c +2 -0
- data/spec/fixtures/repo.git/objects/3e/0c65433b241ff2c59220f80bcdcd2ebb7e4b96 +2 -0
- data/spec/fixtures/repo.git/objects/95/73fff3f9e2c38ccdd7755674ec87c31ca08270 +0 -0
- data/spec/fixtures/repo.git/objects/c4/01f49fe0172add6a09aec8a7808112ce5894dd +0 -0
- data/spec/fixtures/repo.git/objects/c9/3cd4edd7e0b6fd4c69e65fc7f25cbf06ac855c +0 -0
- data/spec/fixtures/repo.git/objects/e9/8d8a9be514ef53609a52c9e1b820dbcc8e6603 +0 -0
- data/spec/fixtures/repo.git/refs/heads/master +1 -0
- data/spec/fixtures/rspec/test_spec.rb +5 -0
- data/spec/integration/running_a_build_spec.rb +89 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/support/dotenv.rb +3 -0
- data/spec/support/silence_logger.rb +7 -0
- metadata +177 -0
@@ -0,0 +1 @@
|
|
1
|
+
2d762cdfd781dc4077c9f27a18969efbd186363c
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'running a build' do
|
4
|
+
let(:commit) { "3e0c65433b241ff2c59220f80bcdcd2ebb7e4b96" }
|
5
|
+
let(:command) { "rspec test_spec.rb" }
|
6
|
+
let(:build) { Buildbox::Build.new(:project_id => 1, :build_id => 1, :repo => FIXTURES_PATH.join("repo.git").to_s, :commit => commit, :command => command) }
|
7
|
+
|
8
|
+
before do
|
9
|
+
Buildbox.stub(:root_path).and_return(TEMP_PATH)
|
10
|
+
end
|
11
|
+
|
12
|
+
after do
|
13
|
+
TEMP_PATH.rmtree if TEMP_PATH.exist?
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'running a working build' do
|
17
|
+
it "returns a successfull result" do
|
18
|
+
result = build.start
|
19
|
+
|
20
|
+
result.should be_success
|
21
|
+
result.output.should =~ /1 example, 0 failures/
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'running a failing build' do
|
26
|
+
let(:commit) { "2d762cdfd781dc4077c9f27a18969efbd186363c" }
|
27
|
+
|
28
|
+
it "returns a unsuccessfull result" do
|
29
|
+
result = build.start
|
30
|
+
|
31
|
+
result.should_not be_success
|
32
|
+
result.output.should =~ /1 example, 1 failure/
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'running a build with a broken command' do
|
37
|
+
let(:command) { 'foobar' }
|
38
|
+
|
39
|
+
it "returns a unsuccessfull result" do
|
40
|
+
result = build.start
|
41
|
+
|
42
|
+
result.should_not be_success
|
43
|
+
# ubuntu: sh: 1: foobar: not found
|
44
|
+
# osx: sh: foobar: command not found
|
45
|
+
result.output.should =~ /foobar.+not found/
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'running multiple builds in a row' do
|
50
|
+
it "returns a successfull result when the build passes" do
|
51
|
+
first_result = build.start
|
52
|
+
second_result = build.start
|
53
|
+
|
54
|
+
first_result.should be_success
|
55
|
+
first_result.output.should =~ /1 example, 0 failures/
|
56
|
+
|
57
|
+
second_result.should be_success
|
58
|
+
second_result.output.should =~ /1 example, 0 failures/
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'running a working build from a thread' do
|
63
|
+
it "returns a successfull result" do
|
64
|
+
result = nil
|
65
|
+
thread = Thread.new do
|
66
|
+
result = build.start
|
67
|
+
end
|
68
|
+
thread.join
|
69
|
+
|
70
|
+
result.should be_success
|
71
|
+
result.output.should =~ /1 example, 0 failures/
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'running a failing build from a thread' do
|
76
|
+
let(:commit) { "2d762cdfd781dc4077c9f27a18969efbd186363c" }
|
77
|
+
|
78
|
+
it "returns a successfull result" do
|
79
|
+
result = nil
|
80
|
+
thread = Thread.new do
|
81
|
+
result = build.start
|
82
|
+
end
|
83
|
+
thread.join
|
84
|
+
|
85
|
+
result.should_not be_success
|
86
|
+
result.output.should =~ /1 example, 1 failure/
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require 'buildbox'
|
5
|
+
|
6
|
+
SPEC_PATH = Pathname.new(File.expand_path('..', __FILE__))
|
7
|
+
FIXTURES_PATH = SPEC_PATH.join('fixtures')
|
8
|
+
TEMP_PATH = SPEC_PATH.join('tmp')
|
9
|
+
|
10
|
+
Dir[SPEC_PATH.join("support/**/*.rb")].each { |f| require f }
|
11
|
+
|
12
|
+
RSpec.configure do |config|
|
13
|
+
# Run specs in random order to surface order dependencies. If you find an
|
14
|
+
# order dependency and want to debug it, you can fix the order by providing
|
15
|
+
# the seed, which is printed after each run.
|
16
|
+
# --seed 1234
|
17
|
+
config.order = "random"
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: buildbox
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Keith Pitt
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-06-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: dotenv
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Ruby client for buildbox
|
70
|
+
email:
|
71
|
+
- me@keithpitt.com
|
72
|
+
executables:
|
73
|
+
- buildbox
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- .gitignore
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- bin/buildbox
|
83
|
+
- buildbox-ruby.gemspec
|
84
|
+
- lib/buildbox.rb
|
85
|
+
- lib/buildbox/api.rb
|
86
|
+
- lib/buildbox/build.rb
|
87
|
+
- lib/buildbox/client.rb
|
88
|
+
- lib/buildbox/command.rb
|
89
|
+
- lib/buildbox/configuration.rb
|
90
|
+
- lib/buildbox/pid_file.rb
|
91
|
+
- lib/buildbox/result.rb
|
92
|
+
- lib/buildbox/utf8.rb
|
93
|
+
- lib/buildbox/version.rb
|
94
|
+
- lib/buildbox/worker.rb
|
95
|
+
- spec/buildbox/buildbox/build_spec.rb
|
96
|
+
- spec/buildbox/buildbox/command_spec.rb
|
97
|
+
- spec/buildbox/buildbox/configuration_spec.rb
|
98
|
+
- spec/buildbox/buildbox_spec.rb
|
99
|
+
- spec/fixtures/repo.git/HEAD
|
100
|
+
- spec/fixtures/repo.git/config
|
101
|
+
- spec/fixtures/repo.git/description
|
102
|
+
- spec/fixtures/repo.git/hooks/applypatch-msg.sample
|
103
|
+
- spec/fixtures/repo.git/hooks/commit-msg.sample
|
104
|
+
- spec/fixtures/repo.git/hooks/post-update.sample
|
105
|
+
- spec/fixtures/repo.git/hooks/pre-applypatch.sample
|
106
|
+
- spec/fixtures/repo.git/hooks/pre-commit.sample
|
107
|
+
- spec/fixtures/repo.git/hooks/pre-push.sample
|
108
|
+
- spec/fixtures/repo.git/hooks/pre-rebase.sample
|
109
|
+
- spec/fixtures/repo.git/hooks/prepare-commit-msg.sample
|
110
|
+
- spec/fixtures/repo.git/hooks/update.sample
|
111
|
+
- spec/fixtures/repo.git/info/exclude
|
112
|
+
- spec/fixtures/repo.git/objects/2d/762cdfd781dc4077c9f27a18969efbd186363c
|
113
|
+
- spec/fixtures/repo.git/objects/3e/0c65433b241ff2c59220f80bcdcd2ebb7e4b96
|
114
|
+
- spec/fixtures/repo.git/objects/95/73fff3f9e2c38ccdd7755674ec87c31ca08270
|
115
|
+
- spec/fixtures/repo.git/objects/c4/01f49fe0172add6a09aec8a7808112ce5894dd
|
116
|
+
- spec/fixtures/repo.git/objects/c9/3cd4edd7e0b6fd4c69e65fc7f25cbf06ac855c
|
117
|
+
- spec/fixtures/repo.git/objects/e9/8d8a9be514ef53609a52c9e1b820dbcc8e6603
|
118
|
+
- spec/fixtures/repo.git/refs/heads/master
|
119
|
+
- spec/fixtures/rspec/test_spec.rb
|
120
|
+
- spec/integration/running_a_build_spec.rb
|
121
|
+
- spec/spec_helper.rb
|
122
|
+
- spec/support/dotenv.rb
|
123
|
+
- spec/support/silence_logger.rb
|
124
|
+
homepage: ''
|
125
|
+
licenses:
|
126
|
+
- MIT
|
127
|
+
metadata: {}
|
128
|
+
post_install_message:
|
129
|
+
rdoc_options: []
|
130
|
+
require_paths:
|
131
|
+
- lib
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - '>='
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
requirements: []
|
143
|
+
rubyforge_project:
|
144
|
+
rubygems_version: 2.0.0
|
145
|
+
signing_key:
|
146
|
+
specification_version: 4
|
147
|
+
summary: Ruby client for buildbox
|
148
|
+
test_files:
|
149
|
+
- spec/buildbox/buildbox/build_spec.rb
|
150
|
+
- spec/buildbox/buildbox/command_spec.rb
|
151
|
+
- spec/buildbox/buildbox/configuration_spec.rb
|
152
|
+
- spec/buildbox/buildbox_spec.rb
|
153
|
+
- spec/fixtures/repo.git/HEAD
|
154
|
+
- spec/fixtures/repo.git/config
|
155
|
+
- spec/fixtures/repo.git/description
|
156
|
+
- spec/fixtures/repo.git/hooks/applypatch-msg.sample
|
157
|
+
- spec/fixtures/repo.git/hooks/commit-msg.sample
|
158
|
+
- spec/fixtures/repo.git/hooks/post-update.sample
|
159
|
+
- spec/fixtures/repo.git/hooks/pre-applypatch.sample
|
160
|
+
- spec/fixtures/repo.git/hooks/pre-commit.sample
|
161
|
+
- spec/fixtures/repo.git/hooks/pre-push.sample
|
162
|
+
- spec/fixtures/repo.git/hooks/pre-rebase.sample
|
163
|
+
- spec/fixtures/repo.git/hooks/prepare-commit-msg.sample
|
164
|
+
- spec/fixtures/repo.git/hooks/update.sample
|
165
|
+
- spec/fixtures/repo.git/info/exclude
|
166
|
+
- spec/fixtures/repo.git/objects/2d/762cdfd781dc4077c9f27a18969efbd186363c
|
167
|
+
- spec/fixtures/repo.git/objects/3e/0c65433b241ff2c59220f80bcdcd2ebb7e4b96
|
168
|
+
- spec/fixtures/repo.git/objects/95/73fff3f9e2c38ccdd7755674ec87c31ca08270
|
169
|
+
- spec/fixtures/repo.git/objects/c4/01f49fe0172add6a09aec8a7808112ce5894dd
|
170
|
+
- spec/fixtures/repo.git/objects/c9/3cd4edd7e0b6fd4c69e65fc7f25cbf06ac855c
|
171
|
+
- spec/fixtures/repo.git/objects/e9/8d8a9be514ef53609a52c9e1b820dbcc8e6603
|
172
|
+
- spec/fixtures/repo.git/refs/heads/master
|
173
|
+
- spec/fixtures/rspec/test_spec.rb
|
174
|
+
- spec/integration/running_a_build_spec.rb
|
175
|
+
- spec/spec_helper.rb
|
176
|
+
- spec/support/dotenv.rb
|
177
|
+
- spec/support/silence_logger.rb
|