Permalink
Browse files

update anvil

  • Loading branch information...
1 parent 4548d97 commit e319e8d7767de592d711c53a3dde8e3f4974dfe0 @ddollar committed Jan 4, 2013
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- anvil-cli (0.13.0)
+ anvil-cli (0.15.0)
progress (~> 2.4.0)
rest-client (~> 1.6.7)
thor (~> 0.15.2)
@@ -38,7 +38,8 @@ def build(options={})
"buildpack" => options[:buildpack],
"cache" => options[:cache],
"env" => json_encode(options[:env] || {}),
- "source" => source
+ "source" => source,
+ "type" => options[:type]
})
slug_url = nil
@@ -15,6 +15,7 @@ class Anvil::CLI < Thor
method_option :buildpack, :type => :string, :aliases => "-b", :desc => "Use a specific buildpack"
method_option :pipeline, :type => :boolean, :aliases => "-p", :desc => "Pipe compile output to stderr and put the slug url on stdout"
+ method_option :type, :type => :string, :aliases => "-t", :desc => "Build a specific slug type (tgz, deb)"
def build(source=nil)
Anvil::Engine.build(source, options)
@@ -22,7 +22,8 @@ def self.build(source, options={})
buildpack = options[:buildpack] || read_anvil_metadata(source, "buildpack")
build_options = {
- :buildpack => prepare_buildpack(buildpack)
+ :buildpack => prepare_buildpack(buildpack),
+ :type => options[:type] || "tgz"
}
builder = if is_url?(source)
@@ -4,6 +4,7 @@
require "net/https"
require "pathname"
require "rest_client"
+require "find"
class Anvil::Manifest
@@ -48,7 +49,8 @@ def build(options={})
"cache" => @cache_url,
"env" => json_encode(options[:env] || {}),
"keepalive" => "1",
- "manifest" => self.to_json
+ "manifest" => self.to_json,
+ "type" => options[:type]
})
slug_url = nil
@@ -126,7 +128,7 @@ def anvil_host
def directory_manifest(dir, options={})
root = Pathname.new(dir)
- ignore = options[:ignore] || []
+ ignore = (options[:ignore] || []) + [".anvil", ".git"]
if File.exists?("#{dir}/.slugignore")
File.read("#{dir}/.slugignore").split("\n").each do |match|
@@ -136,19 +138,21 @@ def directory_manifest(dir, options={})
end
end
- Dir.glob(File.join(dir, "**", "*"), File::FNM_DOTMATCH).inject({}) do |hash, file|
- relative = Pathname.new(file).relative_path_from(root).to_s
- next(hash) if ignore.include?(relative)
- next(hash) if %w( . .. ).include?(File.basename(file))
- next(hash) if File.directory?(file)
- next(hash) if File.pipe?(file)
- next(hash) if file =~ /\.anvil/
- next(hash) if file =~ /\.git/
- next(hash) if file =~ /\.swp$/
- next(hash) unless file =~ /^[A-Za-z0-9\-\_\.\/]*$/
- hash[relative] = file_manifest(file)
- hash
+ manifest = {}
+ Find.find(dir) do |path|
+ relative = Pathname.new(path).relative_path_from(root).to_s
+ if File.directory?(path)
+ Find.prune if ignore.include?(relative) || ignore.include?(relative + "/")
+ next
+ end
+ next if ignore.include?(relative)
+ next if %w( . .. ).include?(File.basename(path))
+ next if File.pipe?(path)
+ next if path =~ /\.swp$/
+ next unless path =~ /^[A-Za-z0-9\-\_\.\/]*$/
+ manifest[relative] = file_manifest(path)
end
+ manifest
end
def file_manifest(file)
@@ -1,3 +1,3 @@
module Anvil
- VERSION = "0.13.0"
+ VERSION = "0.15.0"
end

0 comments on commit e319e8d

Please sign in to comment.