Sha256: 6ec7b8499e855b8f040270d1e17a0086b3960a31c3891602699e623cf5d91d48
Contents?: true
Size: 1.12 KB
Versions: 4
Compression:
Stored size: 1.12 KB
Contents
#!/usr/bin/env ruby require 'net/http' require 'json' require 'juici/interface' # TODO Refactor def main(args) action = args.shift.to_sym options = {} until args.empty? case args.shift when "--command" command = args.shift options[:command] = if command == "-" File.read(command) else command end when "--host" options[:host] = args.shift when "--title" options[:title] = args.shift when "--project" options[:project] = args.shift when "--priority" options[:priority] = args.shift end end send(action, options) end def build(opts) host = URI(opts[:host]) Net::HTTP.start(host.host, host.port) do |h| req = Net::HTTP::Post.new(Juici::Routes::NEW_BUILD) req.body = _create_payload(opts) h.request req end end def _create_payload(opts) URI.encode_www_form({ "project" => opts[:project], "environment" => (opts[:environment] || {}).to_json, "command" => opts[:command], "priority" => opts[:priority] || 1, "callbacks" => (opts[:callbacks] || []).to_json, "title" => opts[:title] }) end main(ARGV.dup)
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
juici-interface-0.0.1.alpha1 | bin/juicic |
juici-0.0.1.alpha1 | bin/juicic |
juici-0.0.0.alpha1 | bin/juicic |
juici-interface-0.0.0.alpha1 | bin/juicic |