Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Enable tgz-ed source file #23

Merged
merged 1 commit into from Jun 25, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions lib/vulcan/cli.rb
Expand Up @@ -24,7 +24,7 @@ class Vulcan::CLI < Thor
method_option :name, :aliases => "-n", :desc => "the name of the library (defaults to the directory name)"
method_option :output, :aliases => "-o", :desc => "output build artifacts to this file"
method_option :prefix, :aliases => "-p", :desc => "vulcan will look in this path for the compiled artifacts"
method_option :source, :aliases => "-s", :desc => "the source directory to build from"
method_option :source, :aliases => "-s", :desc => "the source directory to build from or the tgz-ed source archive"
method_option :deps, :aliases => "-d", :desc => "urls of vulcan compiled libraries to build with", :type=>:array
method_option :verbose, :aliases => "-v", :desc => "show the full build output", :type => :boolean

Expand All @@ -40,11 +40,16 @@ def build
server = URI.parse(ENV["VULCAN_HOST"] || "http://#{app}.herokuapp.com")

Dir.mktmpdir do |dir|
action "Packaging local directory" do
%x{ cd #{source} && tar czvf #{dir}/input.tgz . 2>&1 }
input_tgz = "#{dir}/input.tgz"
if source.match(/.tgz$/)
input_tgz = source
else
action "Packaging local directory" do
%x{ cd #{source} && tar czvf #{input_tgz} . 2>&1 }
end
end

File.open("#{dir}/input.tgz", "r") do |input|
File.open(input_tgz, "r") do |input|
request = Net::HTTP::Post::Multipart.new "/make",
"code" => UploadIO.new(input, "application/octet-stream", "input.tgz"),
"command" => command,
Expand Down