juici-interface 0.0.0.alpha1 → 0.0.0
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.
- data/lib/juici/interface.rb +0 -5
- metadata +6 -8
- data/bin/juicic +0 -54
data/lib/juici/interface.rb
CHANGED
metadata
CHANGED
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: juici-interface
|
|
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-11-
|
|
12
|
+
date: 2012-11-02 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: Interface definition for JuiCI callbacks and API
|
|
15
15
|
email:
|
|
16
16
|
- richo@psych0tik.net
|
|
17
|
-
executables:
|
|
18
|
-
- juicic
|
|
17
|
+
executables: []
|
|
19
18
|
extensions: []
|
|
20
19
|
extra_rdoc_files: []
|
|
21
20
|
files:
|
|
22
21
|
- lib/juici/interface.rb
|
|
23
|
-
- bin/juicic
|
|
24
22
|
homepage: http://github.com/richo/juici
|
|
25
23
|
licenses: []
|
|
26
24
|
post_install_message:
|
|
@@ -36,9 +34,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
36
34
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
37
35
|
none: false
|
|
38
36
|
requirements:
|
|
39
|
-
- - ! '
|
|
37
|
+
- - ! '>='
|
|
40
38
|
- !ruby/object:Gem::Version
|
|
41
|
-
version:
|
|
39
|
+
version: '0'
|
|
42
40
|
requirements: []
|
|
43
41
|
rubyforge_project:
|
|
44
42
|
rubygems_version: 1.8.24
|
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)
|