vulcan 0.7.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vulcan/cli.rb +48 -27
- data/lib/vulcan/version.rb +1 -1
- data/server/web.coffee +29 -14
- metadata +10 -10
data/lib/vulcan/cli.rb
CHANGED
@@ -24,7 +24,7 @@ if no COMMAND is specified, a sensible default will be chosen for you
|
|
24
24
|
method_option :name, :aliases => "-n", :desc => "the name of the library (defaults to the directory name)"
|
25
25
|
method_option :output, :aliases => "-o", :desc => "output build artifacts to this file"
|
26
26
|
method_option :prefix, :aliases => "-p", :desc => "vulcan will look in this path for the compiled artifacts"
|
27
|
-
method_option :source, :aliases => "-s", :desc => "
|
27
|
+
method_option :source, :aliases => "-s", :desc => "directory, tarball, or url containing the source"
|
28
28
|
method_option :deps, :aliases => "-d", :desc => "urls of vulcan compiled libraries to build with", :type=>:array
|
29
29
|
method_option :verbose, :aliases => "-v", :desc => "show the full build output", :type => :boolean
|
30
30
|
|
@@ -32,50 +32,71 @@ if no COMMAND is specified, a sensible default will be chosen for you
|
|
32
32
|
app = read_config[:app] || "need a server first, use vulcan create"
|
33
33
|
|
34
34
|
source = options[:source] || Dir.pwd
|
35
|
-
name = options[:name] || File.basename(source)
|
35
|
+
name = options[:name] || File.basename(source, File.extname(source))
|
36
36
|
output = options[:output] || "/tmp/#{name}.tgz"
|
37
37
|
prefix = options[:prefix] || "/app/vendor/#{name}"
|
38
38
|
command = options[:command] || "./configure --prefix #{prefix} && make install"
|
39
39
|
deps = options[:deps] || []
|
40
40
|
server = URI.parse(ENV["VULCAN_HOST"] || "http://#{app}.herokuapp.com")
|
41
41
|
|
42
|
+
source_is_url = URI.parse(source).scheme
|
43
|
+
|
42
44
|
Dir.mktmpdir do |dir|
|
43
|
-
|
44
|
-
|
45
|
+
unless source_is_url
|
46
|
+
input_tgz = "#{dir}/input.tgz"
|
47
|
+
if File.directory?(source)
|
48
|
+
action "Packaging local directory" do
|
49
|
+
%x{ cd #{source} && tar czvf #{input_tgz} . 2>&1 }
|
50
|
+
end
|
51
|
+
else
|
52
|
+
input_tgz = source
|
53
|
+
end
|
54
|
+
input = File.open(input_tgz, "r")
|
55
|
+
end
|
56
|
+
|
57
|
+
make_options = {
|
58
|
+
"command" => command,
|
59
|
+
"prefix" => prefix,
|
60
|
+
"secret" => config[:secret],
|
61
|
+
"deps" => deps
|
62
|
+
}
|
63
|
+
|
64
|
+
if source_is_url
|
65
|
+
make_options["code_url"] = source
|
66
|
+
else
|
67
|
+
make_options["code"] = UploadIO.new(input, "application/octet-stream", "input.tgz")
|
45
68
|
end
|
46
69
|
|
47
|
-
|
48
|
-
request = Net::HTTP::Post::Multipart.new "/make",
|
49
|
-
"code" => UploadIO.new(input, "application/octet-stream", "input.tgz"),
|
50
|
-
"command" => command,
|
51
|
-
"prefix" => prefix,
|
52
|
-
"secret" => config[:secret],
|
53
|
-
"deps" => deps
|
70
|
+
request = Net::HTTP::Post::Multipart.new "/make", make_options
|
54
71
|
|
72
|
+
if source_is_url
|
73
|
+
print "Initializing build... "
|
74
|
+
else
|
55
75
|
print "Uploading source package... "
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
76
|
+
end
|
77
|
+
|
78
|
+
response = Net::HTTP.start(server.host, server.port) do |http|
|
79
|
+
http.request(request) do |response|
|
80
|
+
response.read_body do |chunk|
|
81
|
+
unless chunk == 0.chr + "\n"
|
82
|
+
print chunk if options[:verbose]
|
62
83
|
end
|
63
84
|
end
|
64
85
|
end
|
86
|
+
end
|
65
87
|
|
66
|
-
|
88
|
+
error "Unknown error, no build output given" unless response["X-Make-Id"]
|
67
89
|
|
68
|
-
|
90
|
+
puts ">> Downloading build artifacts to: #{output}"
|
69
91
|
|
70
|
-
|
71
|
-
|
92
|
+
output_url = "#{server}/output/#{response["X-Make-Id"]}"
|
93
|
+
puts " (available at #{output_url})"
|
72
94
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
end
|
95
|
+
File.open(output, "w") do |output|
|
96
|
+
begin
|
97
|
+
output.print RestClient.get(output_url)
|
98
|
+
rescue Exception => ex
|
99
|
+
puts ex.inspect
|
79
100
|
end
|
80
101
|
end
|
81
102
|
end
|
data/lib/vulcan/version.rb
CHANGED
data/server/web.coffee
CHANGED
@@ -2,7 +2,9 @@ coffee = require("coffee-script")
|
|
2
2
|
express = require("express")
|
3
3
|
fs = require("fs")
|
4
4
|
logger = require("logger")
|
5
|
+
rest = require("restler")
|
5
6
|
spawner = require("spawner").init()
|
7
|
+
url = require("url")
|
6
8
|
util = require("util")
|
7
9
|
uuid = require("node-uuid")
|
8
10
|
|
@@ -34,23 +36,36 @@ app.post "/make", (req, res, next) ->
|
|
34
36
|
db.save id, command:command, prefix:prefix, deps:deps, (err, doc) ->
|
35
37
|
return log.error(util.inspect(err)) if err
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
save_attachment = (source, cb) ->
|
40
|
+
source.pipe(
|
41
|
+
db.saveAttachment {id:doc.id, rev:doc.rev}, {name:"input", "Content-Type":"application/octet-stream"}, (err, data) ->
|
42
|
+
return log.error(err.reason) if err && err.error != "conflict"
|
43
|
+
cb())
|
42
44
|
|
43
|
-
|
44
|
-
|
45
|
-
|
45
|
+
build = ->
|
46
|
+
res.write "done\n"
|
47
|
+
res.write "Building with: #{command}\n"
|
48
|
+
log.info "spawning build"
|
49
|
+
make = spawner.spawn "bin/make \"#{id}\"", env:
|
50
|
+
CLOUDANT_URL: process.env.CLOUDANT_URL
|
51
|
+
PATH: process.env.PATH
|
52
|
+
make.on "error", (err) -> log.error(err)
|
53
|
+
make.on "data", (data) -> res.write data
|
54
|
+
make.on "end", (code) -> res.end()
|
46
55
|
|
47
|
-
|
48
|
-
|
49
|
-
|
56
|
+
if (req.files.code)
|
57
|
+
log.info "saving attachment - [id:#{doc.id} rev:#{doc.rev}]"
|
58
|
+
save_attachment fs.createReadStream(req.files.code.path), ->
|
59
|
+
build()
|
50
60
|
|
51
|
-
|
52
|
-
|
53
|
-
|
61
|
+
else if (req.body.code_url)
|
62
|
+
log.info "downloading attachment: #{req.body.code_url}"
|
63
|
+
parts = url.parse(req.body.code_url)
|
64
|
+
client = if parts.protocol is "https:" then require("https") else require("http")
|
65
|
+
get = client.request parts, (res) ->
|
66
|
+
save_attachment res, ->
|
67
|
+
build()
|
68
|
+
get.end()
|
54
69
|
|
55
70
|
app.get "/output/:id", (req, res, next) ->
|
56
71
|
log = logger.init(res, next, req.params.id)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vulcan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-06-25 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: heroku
|
16
|
-
requirement: &
|
16
|
+
requirement: &70103648157100 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -24,10 +24,10 @@ dependencies:
|
|
24
24
|
version: '3.0'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
|
-
version_requirements: *
|
27
|
+
version_requirements: *70103648157100
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: multipart-post
|
30
|
-
requirement: &
|
30
|
+
requirement: &70103648154600 !ruby/object:Gem::Requirement
|
31
31
|
none: false
|
32
32
|
requirements:
|
33
33
|
- - ~>
|
@@ -35,10 +35,10 @@ dependencies:
|
|
35
35
|
version: 1.1.3
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
|
-
version_requirements: *
|
38
|
+
version_requirements: *70103648154600
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: rest-client
|
41
|
-
requirement: &
|
41
|
+
requirement: &70103648153680 !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
44
44
|
- - ~>
|
@@ -46,10 +46,10 @@ dependencies:
|
|
46
46
|
version: 1.6.7
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
|
-
version_requirements: *
|
49
|
+
version_requirements: *70103648153680
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
51
|
name: thor
|
52
|
-
requirement: &
|
52
|
+
requirement: &70103648152920 !ruby/object:Gem::Requirement
|
53
53
|
none: false
|
54
54
|
requirements:
|
55
55
|
- - ~>
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
version: 0.14.6
|
58
58
|
type: :runtime
|
59
59
|
prerelease: false
|
60
|
-
version_requirements: *
|
60
|
+
version_requirements: *70103648152920
|
61
61
|
description: Build software in the cloud
|
62
62
|
email: ddollar@gmail.com
|
63
63
|
executables:
|
@@ -808,7 +808,7 @@ files:
|
|
808
808
|
- server/vendor/gems/specifications/multi_json-1.0.3.gemspec
|
809
809
|
- server/vendor/gems/specifications/rest-client-1.6.7.gemspec
|
810
810
|
- server/web.coffee
|
811
|
-
homepage:
|
811
|
+
homepage: https://github.com/heroku/vulcan
|
812
812
|
licenses: []
|
813
813
|
post_install_message: Please run 'vulcan update' to update your build server.
|
814
814
|
rdoc_options: []
|