bait 0.3.0 → 0.3.1
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/README.md +37 -38
- data/VERSION +2 -0
- data/lib/bait/api.rb +8 -0
- data/lib/bait/build.rb +4 -4
- data/lib/bait/project.rb +6 -1
- data/lib/bait/version.rb +1 -1
- data/lib/bait/views/builds.haml +1 -0
- data/spec/lib/bait/api_spec.rb +20 -6
- data/spec/lib/bait/build_spec.rb +13 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79b2349cec35ff210520cda8f7a1e42a8cf337bd
|
4
|
+
data.tar.gz: d94204410a8ddc0d5a808e018ac416d74c162783
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 826bd09db46bfd8df6df60210954f18ff602189f4a5730513255a978a47eaf86785260ec0a2f0a80a8e0ef481e621f7ad2a5fd3e42d4f3870848fd0bb02e1346
|
7
|
+
data.tar.gz: 4d132ee6b67f6af921ed23e6d9a5c462cdf19a81dd9811dc1737abfb48be5b39e7718ef8c275fa0d6dbcfaf01befc7c438bbc53bdcb9e03b930f54481e56722d
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -9,19 +9,13 @@ Install the gem and then just run `bait`
|
|
9
9
|
|
10
10
|
A sinatra server will start up. YAML files will be stored in ~/.bait
|
11
11
|
|
12
|
-
|
12
|
+
Go to 0.0.0.0:8417
|
13
13
|
|
14
|
-
|
14
|
+
You can set your Github to notify the server on that port.
|
15
15
|
|
16
|
-
|
16
|
+
When github notifies bait, bait will clone the project and execute ~/.bait/test.sh and record exit value and output
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
As a Ruby on Rails developer, this was invaluable... But the iOS developers we hired disliked it and did not maintain the RubyMotion stuff.
|
21
|
-
|
22
|
-
Fast forward a year or so later and the app is complex, has no test suite, and our QA testers can barely keep up.
|
23
|
-
|
24
|
-
Scribbeo-motion proved that this works, and so bait is a service I'm envisioning for as the first stop between Github and the rest of my continuous integration pipeline.
|
18
|
+
You may also test manually by inputting a clone URL within the UI
|
25
19
|
|
26
20
|
# Architectural Overview
|
27
21
|
|
@@ -42,20 +36,26 @@ ______________________ \./
|
|
42
36
|
| \|/ /|\ |
|
43
37
|
| \[build]\ |
|
44
38
|
| \|/ /|\ |
|
45
|
-
|
|
46
|
-
|
|
39
|
+
| _____________ \|/ /|\ |
|
40
|
+
| [ your project] +------------+ |
|
47
41
|
| [.bait/test.sh]------|Bait::Tester| |
|
48
|
-
|
|
42
|
+
| [status/output] +------------+ |
|
49
43
|
| |
|
50
44
|
+-----------------------------------------------+
|
51
45
|
|
52
46
|
Bait::Build -- Persistent ToyStore
|
53
47
|
|
54
|
-
Bait::Tester -- Runs your tests and
|
48
|
+
Bait::Tester -- Runs your tests and persists results in Bait::Build
|
55
49
|
```
|
56
50
|
|
57
51
|
*Created with [JavE](http://www.jave.de/)*
|
58
52
|
|
53
|
+
# Datastore
|
54
|
+
|
55
|
+
You can use any datastore you want that is supported in [Moneta](https://github.com/minad/moneta)
|
56
|
+
|
57
|
+
By default, bait will store the data as YAML files in `~/bait`
|
58
|
+
|
59
59
|
# Functional Overview
|
60
60
|
|
61
61
|
## Github Webhook Support
|
@@ -70,12 +70,12 @@ project. This file must exist in order to use bait: `.bait/test.sh`
|
|
70
70
|
In this file you will run your test suite. **Be sure to make it
|
71
71
|
executable `chmod a+x .bait/test.sh`**
|
72
72
|
|
73
|
-
This file should output whatever you want to STDOUT/STDERR and
|
74
|
-
|
73
|
+
This file should output whatever you want to STDOUT and/or STDERR and
|
74
|
+
return 0 for passing and non-zero for failure.
|
75
75
|
|
76
76
|
### Examples
|
77
77
|
|
78
|
-
#### Ruby
|
78
|
+
#### Ruby Projects
|
79
79
|
|
80
80
|
##### [project root]/.bait/test.sh
|
81
81
|
```bash
|
@@ -89,7 +89,7 @@ bundle install > /dev/null 2>&1
|
|
89
89
|
bundle exec rspec spec
|
90
90
|
```
|
91
91
|
|
92
|
-
#### RubyMotion
|
92
|
+
#### RubyMotion Projects
|
93
93
|
|
94
94
|
##### [project root]/.bait/test.sh
|
95
95
|
```bash
|
@@ -113,34 +113,33 @@ properly, that's why we are using
|
|
113
113
|
[motion-specwrap](https://github.com/mdks/motion-specwrap) to run the
|
114
114
|
tests and report the correct exit value
|
115
115
|
|
116
|
-
|
117
|
-
|
118
|
-
So you can see how bait will run any test suite via arbitrary bash
|
119
|
-
scripts upon a Github hook.
|
116
|
+
#### Objective-C Projects
|
120
117
|
|
121
|
-
|
118
|
+
Objective-C projects are supported if you're using [Calabash](http://calaba.sh)
|
122
119
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
120
|
+
##### [project root]/.bait/test.sh
|
121
|
+
```bash
|
122
|
+
#!/bin/bash
|
123
|
+
bait_dir=$(dirname $0)
|
124
|
+
project_dir="$bait_dir/.."
|
125
|
+
cd $project_dir
|
128
126
|
|
129
|
-
|
130
|
-
Motion::Project::App.setup do |app|
|
131
|
-
app.name = 'My Wrapped Project'
|
127
|
+
export BUNDLE_GEMFILE=$project_dir/Gemfile
|
132
128
|
|
133
|
-
|
134
|
-
|
129
|
+
echo "bundling"
|
130
|
+
bundle install > /dev/null 2>&1
|
131
|
+
bundle exec cucumber
|
135
132
|
```
|
136
133
|
|
137
|
-
|
138
|
-
and conventional and then report my findings here.
|
134
|
+
#### Other Projects
|
139
135
|
|
140
|
-
|
136
|
+
Create a file `.bait/test.sh` and `exit 0` if it passes or non-zero if
|
137
|
+
it does not pass. Output whatever you want to STDOUT or STDERR.
|
141
138
|
|
142
|
-
|
139
|
+
Feel free to send pull requests with examples if you end up using bait.
|
143
140
|
|
144
|
-
|
141
|
+
# Future Goals
|
145
142
|
|
143
|
+
## Static Code Analysis
|
146
144
|
|
145
|
+
Integrate [metric-fu](http://metric-fu.rubyforge.org/) for ruby apps and [OCLint](http://oclint.org/) for objective-c apps, JSLint and JSure for javascript.
|
data/VERSION
ADDED
data/lib/bait/api.rb
CHANGED
data/lib/bait/build.rb
CHANGED
data/lib/bait/project.rb
CHANGED
@@ -8,7 +8,12 @@ module Bait
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def glob pattern
|
11
|
-
|
11
|
+
cache ||= {}
|
12
|
+
if value = cache[pattern]
|
13
|
+
value
|
14
|
+
else
|
15
|
+
cache[pattern] = Dir.glob @path.join("**/#{pattern}")
|
16
|
+
end
|
12
17
|
end
|
13
18
|
|
14
19
|
def ordered_dependencies file_pattern, klass
|
data/lib/bait/version.rb
CHANGED
data/lib/bait/views/builds.haml
CHANGED
data/spec/lib/bait/api_spec.rb
CHANGED
@@ -61,9 +61,7 @@ describe "Sinatra App" do
|
|
61
61
|
build.ref.should eq "refs/heads/master"
|
62
62
|
end
|
63
63
|
|
64
|
-
it
|
65
|
-
build.should_not be_tested
|
66
|
-
end
|
64
|
+
it { build.should be_queued }
|
67
65
|
end
|
68
66
|
|
69
67
|
describe "GET /" do
|
@@ -88,24 +86,40 @@ describe "Sinatra App" do
|
|
88
86
|
|
89
87
|
describe "POST /build/create" do
|
90
88
|
let(:test_url){ "http://github.com/defunkt/github" }
|
91
|
-
|
89
|
+
before do
|
92
90
|
post '/build/create', {clone_url:test_url}
|
91
|
+
end
|
92
|
+
it "can create a build manually" do
|
93
93
|
build.clone_url.should eq test_url
|
94
94
|
end
|
95
|
+
specify { build.should be_queued }
|
95
96
|
end
|
96
97
|
|
97
98
|
describe "GET /build/remove/#" do
|
98
99
|
before do
|
99
100
|
@build = Bait::Build.create(name: "quickfox", clone_url:'...')
|
100
101
|
@sandbox = @build.tester.sandbox_directory
|
102
|
+
get "/build/remove/#{@build.id}"
|
101
103
|
end
|
102
104
|
it "removes the build from store and its files from the filesystem" do
|
103
|
-
Bait::Build.ids.should have(1).item
|
104
|
-
get "/build/remove/#{@build.id}"
|
105
105
|
expect{@build.reload}.to raise_error Toy::NotFound
|
106
106
|
Bait::Build.ids.should be_empty
|
107
107
|
Pathname.new(@sandbox).should_not exist
|
108
108
|
end
|
109
|
+
it { should be_redirect }
|
110
|
+
end
|
111
|
+
|
112
|
+
describe "GET /build/retest/#" do
|
113
|
+
before do
|
114
|
+
@build = Bait::Build.create(name: "quickfox", clone_url:'...')
|
115
|
+
@build.tested = true
|
116
|
+
@build.save
|
117
|
+
get "/build/retest/#{@build.id}"
|
118
|
+
end
|
119
|
+
it "queues the build for retesting" do
|
120
|
+
build.should be_queued
|
121
|
+
end
|
122
|
+
it { should be_redirect }
|
109
123
|
end
|
110
124
|
end
|
111
125
|
end
|
data/spec/lib/bait/build_spec.rb
CHANGED
@@ -62,4 +62,17 @@ describe Bait::Build do
|
|
62
62
|
Bait::Build.ids.should be_empty
|
63
63
|
end
|
64
64
|
end
|
65
|
+
|
66
|
+
describe "#queued" do
|
67
|
+
subject { build }
|
68
|
+
context "already tested" do
|
69
|
+
before { build.tested = true ; build.save }
|
70
|
+
it { should_not be_queued }
|
71
|
+
end
|
72
|
+
|
73
|
+
context "not tested" do
|
74
|
+
before { build.tested = false ; build.save }
|
75
|
+
it { should be_queued }
|
76
|
+
end
|
77
|
+
end
|
65
78
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bait
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keyvan Fatehi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -209,6 +209,7 @@ files:
|
|
209
209
|
- LICENSE
|
210
210
|
- README.md
|
211
211
|
- Rakefile
|
212
|
+
- VERSION
|
212
213
|
- bait.gemspec
|
213
214
|
- bin/bait
|
214
215
|
- lib/bait.rb
|
@@ -252,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
252
253
|
version: '0'
|
253
254
|
requirements: []
|
254
255
|
rubyforge_project:
|
255
|
-
rubygems_version: 2.0.
|
256
|
+
rubygems_version: 2.0.5
|
256
257
|
signing_key:
|
257
258
|
specification_version: 4
|
258
259
|
summary: build and integration test service
|