Skip to content
This repository
Browse code

Enable tgz-ed source file

  • Loading branch information...
commit 5b8e6665057b768e432e3e787b0cad5457bd126d 1 parent 792f4c1
tomykaira authored June 06, 2012

Showing 1 changed file with 9 additions and 4 deletions. Show diff stats Hide diff stats

  1. 13  lib/vulcan/cli.rb
13  lib/vulcan/cli.rb
@@ -24,7 +24,7 @@ class Vulcan::CLI < Thor
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 => "the source directory to build from"
  27
+  method_option :source,  :aliases => "-s", :desc => "the source directory to build from or the tgz-ed source archive"
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
 
@@ -40,11 +40,16 @@ def build
40 40
     server  = URI.parse(ENV["VULCAN_HOST"] || "http://#{app}.herokuapp.com")
41 41
 
42 42
     Dir.mktmpdir do |dir|
43  
-      action "Packaging local directory" do
44  
-        %x{ cd #{source} && tar czvf #{dir}/input.tgz . 2>&1 }
  43
+      input_tgz = "#{dir}/input.tgz"
  44
+      if source.match(/.tgz$/)
  45
+        input_tgz = source
  46
+      else
  47
+        action "Packaging local directory" do
  48
+          %x{ cd #{source} && tar czvf #{input_tgz} . 2>&1 }
  49
+        end
45 50
       end
46 51
 
47  
-      File.open("#{dir}/input.tgz", "r") do |input|
  52
+      File.open(input_tgz, "r") do |input|
48 53
         request = Net::HTTP::Post::Multipart.new "/make",
49 54
           "code" => UploadIO.new(input, "application/octet-stream", "input.tgz"),
50 55
           "command" => command,

0 notes on commit 5b8e666

Please sign in to comment.
Something went wrong with that request. Please try again.