janky-flow 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/janky/flow/app.rb +11 -5
- data/lib/janky/flow/hubot.rb +26 -15
- data/lib/janky/flow/version.rb +1 -1
- metadata +3 -3
data/lib/janky/flow/app.rb
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
module Janky
|
2
|
-
|
2
|
+
module Flow
|
3
|
+
class App < Sinatra::Base
|
4
|
+
|
5
|
+
get %r{\/\*\/([-_\+\.a-zA-z0-9\/]+)} do |branch_name|
|
6
|
+
authorize_index
|
7
|
+
@builds = Build.queued.where(:branch_id => Branch.where(:name => branch_name)).first(50)
|
8
|
+
mustache :index
|
9
|
+
end
|
3
10
|
|
4
|
-
get %r{\/\*\/([-_\+\.a-zA-z0-9\/]+)} do |branch_name|
|
5
|
-
authorize_index
|
6
|
-
@builds = Build.queued.where(:branch_id => Branch.where(:name => branch_name)).first(50)
|
7
|
-
mustache :index
|
8
11
|
end
|
12
|
+
end
|
9
13
|
|
14
|
+
class App
|
15
|
+
use Janky::Flow::App
|
10
16
|
end
|
11
17
|
end
|
data/lib/janky/flow/hubot.rb
CHANGED
@@ -1,24 +1,35 @@
|
|
1
1
|
module Janky
|
2
|
-
|
2
|
+
module Flow
|
3
|
+
class Hubot < Sinatra::Base
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
5
|
+
get '/help' do
|
6
|
+
fail "downstream app not set" unless @app.respond_to? :call
|
7
|
+
status, headers, body = @app.call env
|
8
|
+
@response.status = status
|
9
|
+
@response.body = body.body[0].sub! "ci status\n", "\\0ci status */develop\n"
|
10
|
+
@response.headers.merge! headers.reject { |k| k == 'Content-Length' }
|
11
|
+
nil
|
12
|
+
end
|
7
13
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
14
|
+
get %r{\/\*\/([-_\+\.a-zA-z0-9\/]+)} do |branch_name|
|
15
|
+
content_type "text/plain"
|
16
|
+
repos = Repository.all(:include => [:branches, :commits, :builds]).map do |repo|
|
17
|
+
branch = repo.branch_for(branch_name)
|
12
18
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
"%-17s %-13s %-10s %40s" % [
|
20
|
+
repo.name,
|
21
|
+
branch.status,
|
22
|
+
repo.campfire_room,
|
23
|
+
repo.uri
|
24
|
+
]
|
25
|
+
end
|
26
|
+
repos.join("\n")
|
19
27
|
end
|
20
|
-
|
28
|
+
|
21
29
|
end
|
30
|
+
end
|
22
31
|
|
32
|
+
class Hubot
|
33
|
+
use Janky::Flow::Hubot
|
23
34
|
end
|
24
35
|
end
|
data/lib/janky/flow/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: janky-flow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-11-
|
12
|
+
date: 2013-11-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: janky
|
@@ -38,7 +38,7 @@ files:
|
|
38
38
|
- lib/janky/flow/app.rb
|
39
39
|
- lib/janky/flow/hubot.rb
|
40
40
|
- lib/janky/flow/version.rb
|
41
|
-
homepage:
|
41
|
+
homepage: https://github.com/mal/janky-flow
|
42
42
|
licenses:
|
43
43
|
- MIT
|
44
44
|
post_install_message:
|