juici 0.0.0.alpha1 → 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -4
- data/Gemfile.lock +9 -19
- data/README.md +6 -45
- data/Rakefile +0 -24
- data/config/mongoid.yml.sample +5 -20
- data/juici.gemspec +3 -7
- data/lib/juici.rb +3 -8
- data/lib/juici/app.rb +23 -19
- data/lib/juici/build_environment.rb +1 -1
- data/lib/juici/build_logic.rb +1 -10
- data/lib/juici/build_queue.rb +3 -30
- data/lib/juici/callback.rb +5 -9
- data/lib/juici/config.rb +0 -4
- data/lib/juici/controllers/build_controller.rb +0 -0
- data/lib/juici/controllers/{trigger.rb → trigger_controller.rb} +5 -24
- data/lib/juici/database.rb +13 -19
- data/lib/juici/helpers/url_helpers.rb +0 -28
- data/lib/juici/models/build.rb +24 -81
- data/lib/juici/models/project.rb +1 -1
- data/lib/juici/server.rb +40 -103
- data/lib/juici/url_helpers.rb +15 -0
- data/lib/juici/views/README.markdown +6 -45
- data/lib/juici/views/about.erb +5 -5
- data/lib/juici/views/builds/list.erb +33 -26
- data/lib/juici/views/builds/new.erb +37 -42
- data/lib/juici/views/builds/show.erb +28 -4
- data/lib/juici/views/index.erb +13 -30
- data/lib/juici/views/layout.erb +13 -22
- data/lib/juici/views/partials/builds/debug.erb +18 -12
- data/lib/juici/watcher.rb +25 -33
- data/public/styles/builds.css +8 -59
- data/public/styles/juici.css +2 -226
- data/spec/build_callback_spec.rb +1 -46
- data/spec/build_process_spec.rb +5 -71
- data/spec/build_queue_spec.rb +1 -3
- data/spec/juici_app_spec.rb +15 -0
- data/spec/spec_helper.rb +0 -13
- metadata +12 -76
- data/.gitignore +0 -2
- data/bin/juicic +0 -54
- data/juici-interface.gemspec +0 -19
- data/lib/juici/controllers.rb +0 -6
- data/lib/juici/controllers/base.rb +0 -26
- data/lib/juici/controllers/build_queue.rb +0 -14
- data/lib/juici/controllers/builds.rb +0 -74
- data/lib/juici/controllers/index.rb +0 -20
- data/lib/juici/exceptions.rb +0 -2
- data/lib/juici/find_logic.rb +0 -11
- data/lib/juici/helpers/form_helpers.rb +0 -11
- data/lib/juici/helpers/html_helpers.rb +0 -4
- data/lib/juici/interface.rb +0 -13
- data/lib/juici/version.rb +0 -8
- data/lib/juici/views/builds/edit.erb +0 -23
- data/lib/juici/views/not_found.erb +0 -3
- data/lib/juici/views/partials/builds/output.erb +0 -1
- data/lib/juici/views/partials/builds/show.erb +0 -19
- data/lib/juici/views/partials/builds/sidebar.erb +0 -13
- data/lib/juici/views/partials/index/recently_built.erb +0 -19
- data/lib/juici/views/queue/list.erb +0 -6
- data/public/favicon.ico +0 -0
- data/public/images/black_denim.png +0 -0
- data/public/vendor/bootstrap.css +0 -6004
- data/public/vendor/bootstrap.js +0 -2036
- data/public/vendor/img/glyphicons-halflings-white.png +0 -0
- data/public/vendor/jquery.js +0 -9440
- data/script/cibuild +0 -10
- data/spec/controllers/builds_spec.rb +0 -68
- data/spec/controllers/index_spec.rb +0 -28
- data/spec/models/build_spec.rb +0 -54
data/spec/build_queue_spec.rb
CHANGED
@@ -33,9 +33,7 @@ describe Juici::BuildQueue do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it "Should remove a given build by id" do
|
36
|
-
|
37
|
-
subject.delete(3)
|
38
|
-
@builds.collect(&:_id).should == [1, 2, 4, 5, 6]
|
36
|
+
pending("To be implemented")
|
39
37
|
end
|
40
38
|
|
41
39
|
it "Should return a low priority job from #next_child" do
|
data/spec/juici_app_spec.rb
CHANGED
@@ -2,7 +2,22 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
2
|
|
3
3
|
describe Juici::App do
|
4
4
|
it "instanciates cleanly and exits cleanly" do
|
5
|
+
threads = Thread.list.length
|
6
|
+
|
5
7
|
app = Juici::App.new
|
8
|
+
Thread.list.length.should == threads + 1
|
9
|
+
|
10
|
+
Juici::App.shutdown
|
11
|
+
Thread.list.length.should == threads
|
12
|
+
end
|
13
|
+
|
14
|
+
it "Can be started without workers" do
|
15
|
+
threads = Thread.list.length
|
16
|
+
|
17
|
+
app = Juici::App.new(workers: 0)
|
18
|
+
Thread.list.length.should == threads
|
19
|
+
|
6
20
|
Juici::App.shutdown
|
21
|
+
Thread.list.length.should == threads
|
7
22
|
end
|
8
23
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
-
ENV['RACK_ENV'] ||= "test"
|
2
|
-
|
3
1
|
require 'juici'
|
4
2
|
require 'mocha'
|
5
3
|
|
6
4
|
require 'fileutils'
|
7
|
-
require 'timeout'
|
8
5
|
|
9
6
|
Dir["#{File.expand_path(File.dirname(__FILE__))}/helpers/**/*.rb"].each do |f|
|
10
7
|
puts "Requiring #{f}"
|
@@ -14,13 +11,3 @@ end
|
|
14
11
|
RSpec.configure do |config|
|
15
12
|
config.mock_framework = :mocha
|
16
13
|
end
|
17
|
-
|
18
|
-
def poll_build(build)
|
19
|
-
loop do
|
20
|
-
sleep(0.1)
|
21
|
-
build.reload
|
22
|
-
break if build.status != Juici::BuildStatus::START
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
Juici::Database.initialize!
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: juici
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Richo Healey
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
@@ -27,22 +27,6 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: thin
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '0'
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
46
30
|
- !ruby/object:Gem::Dependency
|
47
31
|
name: json
|
48
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,17 +48,17 @@ dependencies:
|
|
64
48
|
requirement: !ruby/object:Gem::Requirement
|
65
49
|
none: false
|
66
50
|
requirements:
|
67
|
-
- -
|
51
|
+
- - ~>
|
68
52
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
53
|
+
version: '2'
|
70
54
|
type: :runtime
|
71
55
|
prerelease: false
|
72
56
|
version_requirements: !ruby/object:Gem::Requirement
|
73
57
|
none: false
|
74
58
|
requirements:
|
75
|
-
- -
|
59
|
+
- - ~>
|
76
60
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
61
|
+
version: '2'
|
78
62
|
- !ruby/object:Gem::Dependency
|
79
63
|
name: bson_ext
|
80
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,22 +91,6 @@ dependencies:
|
|
107
91
|
- - ! '>='
|
108
92
|
- !ruby/object:Gem::Version
|
109
93
|
version: '0'
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: ansible
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
|
-
requirements:
|
115
|
-
- - ! '>='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
|
-
requirements:
|
123
|
-
- - ! '>='
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
126
94
|
- !ruby/object:Gem::Dependency
|
127
95
|
name: rake
|
128
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -179,7 +147,6 @@ executables:
|
|
179
147
|
extensions: []
|
180
148
|
extra_rdoc_files: []
|
181
149
|
files:
|
182
|
-
- .gitignore
|
183
150
|
- Gemfile
|
184
151
|
- Gemfile.lock
|
185
152
|
- Procfile
|
@@ -187,9 +154,7 @@ files:
|
|
187
154
|
- Rakefile
|
188
155
|
- TODO.md
|
189
156
|
- bin/juici
|
190
|
-
- bin/juicic
|
191
157
|
- config/mongoid.yml.sample
|
192
|
-
- juici-interface.gemspec
|
193
158
|
- juici.gemspec
|
194
159
|
- lib/juici.rb
|
195
160
|
- lib/juici/app.rb
|
@@ -198,61 +163,35 @@ files:
|
|
198
163
|
- lib/juici/build_queue.rb
|
199
164
|
- lib/juici/callback.rb
|
200
165
|
- lib/juici/config.rb
|
201
|
-
- lib/juici/controllers.rb
|
202
|
-
- lib/juici/controllers/
|
203
|
-
- lib/juici/controllers/build_queue.rb
|
204
|
-
- lib/juici/controllers/builds.rb
|
205
|
-
- lib/juici/controllers/index.rb
|
206
|
-
- lib/juici/controllers/trigger.rb
|
166
|
+
- lib/juici/controllers/build_controller.rb
|
167
|
+
- lib/juici/controllers/trigger_controller.rb
|
207
168
|
- lib/juici/database.rb
|
208
|
-
- lib/juici/exceptions.rb
|
209
|
-
- lib/juici/find_logic.rb
|
210
|
-
- lib/juici/helpers/form_helpers.rb
|
211
|
-
- lib/juici/helpers/html_helpers.rb
|
212
169
|
- lib/juici/helpers/url_helpers.rb
|
213
|
-
- lib/juici/interface.rb
|
214
170
|
- lib/juici/models/build.rb
|
215
171
|
- lib/juici/models/build_process.rb
|
216
172
|
- lib/juici/models/project.rb
|
217
173
|
- lib/juici/server.rb
|
218
|
-
- lib/juici/
|
174
|
+
- lib/juici/url_helpers.rb
|
219
175
|
- lib/juici/views/README.markdown
|
220
176
|
- lib/juici/views/about.erb
|
221
177
|
- lib/juici/views/builds.erb
|
222
|
-
- lib/juici/views/builds/edit.erb
|
223
178
|
- lib/juici/views/builds/list.erb
|
224
179
|
- lib/juici/views/builds/new.erb
|
225
180
|
- lib/juici/views/builds/show.erb
|
226
181
|
- lib/juici/views/index.erb
|
227
182
|
- lib/juici/views/layout.erb
|
228
|
-
- lib/juici/views/not_found.erb
|
229
183
|
- lib/juici/views/partials/builds/debug.erb
|
230
|
-
- lib/juici/views/partials/builds/output.erb
|
231
|
-
- lib/juici/views/partials/builds/show.erb
|
232
|
-
- lib/juici/views/partials/builds/sidebar.erb
|
233
|
-
- lib/juici/views/partials/index/recently_built.erb
|
234
|
-
- lib/juici/views/queue/list.erb
|
235
184
|
- lib/juici/views/redirect.erb
|
236
185
|
- lib/juici/views/support.erb
|
237
186
|
- lib/juici/watcher.rb
|
238
|
-
- public/favicon.ico
|
239
|
-
- public/images/black_denim.png
|
240
187
|
- public/styles/builds.css
|
241
188
|
- public/styles/juici.css
|
242
|
-
- public/vendor/bootstrap.css
|
243
|
-
- public/vendor/bootstrap.js
|
244
|
-
- public/vendor/img/glyphicons-halflings-white.png
|
245
|
-
- public/vendor/jquery.js
|
246
189
|
- sample/mongod.conf
|
247
|
-
- script/cibuild
|
248
190
|
- spec/build_callback_spec.rb
|
249
191
|
- spec/build_environment_spec.rb
|
250
192
|
- spec/build_process_spec.rb
|
251
193
|
- spec/build_queue_spec.rb
|
252
|
-
- spec/controllers/builds_spec.rb
|
253
|
-
- spec/controllers/index_spec.rb
|
254
194
|
- spec/juici_app_spec.rb
|
255
|
-
- spec/models/build_spec.rb
|
256
195
|
- spec/spec_helper.rb
|
257
196
|
homepage: http://github.com/richo/juici
|
258
197
|
licenses: []
|
@@ -269,9 +208,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
269
208
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
270
209
|
none: false
|
271
210
|
requirements:
|
272
|
-
- - ! '
|
211
|
+
- - ! '>='
|
273
212
|
- !ruby/object:Gem::Version
|
274
|
-
version:
|
213
|
+
version: '0'
|
275
214
|
requirements: []
|
276
215
|
rubyforge_project:
|
277
216
|
rubygems_version: 1.8.24
|
@@ -283,8 +222,5 @@ test_files:
|
|
283
222
|
- spec/build_environment_spec.rb
|
284
223
|
- spec/build_process_spec.rb
|
285
224
|
- spec/build_queue_spec.rb
|
286
|
-
- spec/controllers/builds_spec.rb
|
287
|
-
- spec/controllers/index_spec.rb
|
288
225
|
- spec/juici_app_spec.rb
|
289
|
-
- spec/models/build_spec.rb
|
290
226
|
- spec/spec_helper.rb
|
data/.gitignore
DELETED
data/bin/juicic
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'net/http'
|
3
|
-
require 'json'
|
4
|
-
require 'juici/interface'
|
5
|
-
|
6
|
-
# TODO Refactor
|
7
|
-
def main(args)
|
8
|
-
action = args.shift.to_sym
|
9
|
-
options = {}
|
10
|
-
|
11
|
-
until args.empty?
|
12
|
-
case args.shift
|
13
|
-
when "--command"
|
14
|
-
command = args.shift
|
15
|
-
options[:command] = if command == "-"
|
16
|
-
File.read(command)
|
17
|
-
else
|
18
|
-
command
|
19
|
-
end
|
20
|
-
when "--host"
|
21
|
-
options[:host] = args.shift
|
22
|
-
when "--title"
|
23
|
-
options[:title] = args.shift
|
24
|
-
when "--project"
|
25
|
-
options[:project] = args.shift
|
26
|
-
when "--priority"
|
27
|
-
options[:priority] = args.shift
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
send(action, options)
|
32
|
-
end
|
33
|
-
|
34
|
-
def build(opts)
|
35
|
-
host = URI(opts[:host])
|
36
|
-
Net::HTTP.start(host.host, host.port) do |h|
|
37
|
-
req = Net::HTTP::Post.new(Juici::Routes::NEW_BUILD)
|
38
|
-
req.body = _create_payload(opts)
|
39
|
-
h.request req
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def _create_payload(opts)
|
44
|
-
URI.encode_www_form({
|
45
|
-
"project" => opts[:project],
|
46
|
-
"environment" => (opts[:environment] || {}).to_json,
|
47
|
-
"command" => opts[:command],
|
48
|
-
"priority" => opts[:priority] || 1,
|
49
|
-
"callbacks" => (opts[:callbacks] || []).to_json,
|
50
|
-
"title" => opts[:title]
|
51
|
-
})
|
52
|
-
end
|
53
|
-
|
54
|
-
main(ARGV.dup)
|
data/juici-interface.gemspec
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# vim: ft=ruby
|
2
|
-
#
|
3
|
-
require File.expand_path("../lib/juici/version", __FILE__)
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = "juici-interface"
|
7
|
-
s.version = Juici::VERSION
|
8
|
-
s.authors = ["Richo Healey"]
|
9
|
-
s.email = ["richo@psych0tik.net"]
|
10
|
-
s.homepage = "http://github.com/richo/juici"
|
11
|
-
s.summary = "Interface definition for JuiCI callbacks and API"
|
12
|
-
s.description = s.summary
|
13
|
-
|
14
|
-
s.files = "lib/juici/interface.rb"
|
15
|
-
s.require_paths = ["lib"]
|
16
|
-
s.executables = "juicic"
|
17
|
-
end
|
18
|
-
|
19
|
-
|
data/lib/juici/controllers.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
module Juici::Controllers
|
2
|
-
class Base
|
3
|
-
|
4
|
-
NotFound = Sinatra::NotFound
|
5
|
-
|
6
|
-
attr_accessor :params
|
7
|
-
def initialize(params)
|
8
|
-
@params = params
|
9
|
-
end
|
10
|
-
|
11
|
-
def build_opts(opts)
|
12
|
-
default_opts.merge(opts)
|
13
|
-
end
|
14
|
-
|
15
|
-
def default_opts
|
16
|
-
{
|
17
|
-
:styles => styles
|
18
|
-
}
|
19
|
-
end
|
20
|
-
|
21
|
-
def styles
|
22
|
-
[]
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module Juici::Controllers
|
2
|
-
class BuildQueue < Base
|
3
|
-
|
4
|
-
def list
|
5
|
-
builds = $build_queue.builds.sort_by(&:priority)
|
6
|
-
yield [:"queue/list", opts(:builds => builds)]
|
7
|
-
end
|
8
|
-
|
9
|
-
def opts(_opts={})
|
10
|
-
{:active => :queue}.merge(_opts)
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
14
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
module Juici::Controllers
|
2
|
-
class Builds < Base
|
3
|
-
|
4
|
-
def list
|
5
|
-
params[:page] = params[:page] ? params[:page].to_i : 0
|
6
|
-
|
7
|
-
project = ::Juici::Project.find_or_raise(NotFound, name: params[:project])
|
8
|
-
|
9
|
-
builds = ::Juici::Build.where(parent: project.name)
|
10
|
-
|
11
|
-
pages = (builds.count.to_f / ::Juici::Config.builds_per_page).ceil
|
12
|
-
|
13
|
-
builds = builds.desc(:_id).
|
14
|
-
limit(::Juici::Config.builds_per_page).
|
15
|
-
skip(params[:page].to_i * ::Juici::Config.builds_per_page)
|
16
|
-
|
17
|
-
yield [:"builds/list", build_opts({:project => project, :builds => builds, :pages => pages})]
|
18
|
-
end
|
19
|
-
|
20
|
-
def show
|
21
|
-
project = ::Juici::Project.find_or_raise(NotFound, name: params[:project])
|
22
|
-
build = ::Juici::Build.find_or_raise(NotFound, parent: project.name, _id: params[:id])
|
23
|
-
# return 404 unless project && build
|
24
|
-
yield [:"builds/show", build_opts({:project => project, :build => build})]
|
25
|
-
end
|
26
|
-
|
27
|
-
def kill
|
28
|
-
project = ::Juici::Project.find_or_raise(NotFound, name: params[:project])
|
29
|
-
build = ::Juici::Build.find_or_raise(NotFound, parent: project.name, _id: params[:id])
|
30
|
-
|
31
|
-
::Juici.dbgp "Killing off build #{build[:_id]}"
|
32
|
-
build.kill! if build.status == ::Juici::BuildStatus::START
|
33
|
-
return build
|
34
|
-
end
|
35
|
-
|
36
|
-
def cancel
|
37
|
-
project = ::Juici::Project.find_or_raise(NotFound, name: params[:project])
|
38
|
-
build = ::Juici::Build.find_or_raise(NotFound, parent: project.name, _id: params[:id])
|
39
|
-
|
40
|
-
::Juici.dbgp "Cancelling build #{build[:_id]}"
|
41
|
-
build.cancel if build.status == ::Juici::BuildStatus::WAIT
|
42
|
-
return build
|
43
|
-
end
|
44
|
-
|
45
|
-
def new
|
46
|
-
yield [:"builds/new", {:active => :new_build}]
|
47
|
-
end
|
48
|
-
|
49
|
-
def styles
|
50
|
-
["builds"]
|
51
|
-
end
|
52
|
-
|
53
|
-
def edit
|
54
|
-
project = ::Juici::Project.find_or_raise(NotFound, name: params[:project])
|
55
|
-
build = ::Juici::Build.find_or_raise(NotFound, parent: project.name, _id: params[:id])
|
56
|
-
# return 404 unless project && build
|
57
|
-
yield [:"builds/edit", {:project => project, :build => build}]
|
58
|
-
end
|
59
|
-
|
60
|
-
def update!
|
61
|
-
project = ::Juici::Project.find_or_raise(NotFound, name: params[:project])
|
62
|
-
build = ::Juici::Build.find_or_raise(NotFound, parent: project.name, _id: params[:id])
|
63
|
-
|
64
|
-
::Juici::Build::EDITABLE_ATTRIBUTES[:string].each do |attr|
|
65
|
-
build[attr] = params[attr] if params[attr]
|
66
|
-
end
|
67
|
-
# binding.pry
|
68
|
-
build.tap do |b|
|
69
|
-
b.save!
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
end
|