anvil-cli 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/anvil/engine.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "anvil"
2
2
  require "anvil/builder"
3
+ require "anvil/helpers"
3
4
  require "anvil/manifest"
4
5
  require "anvil/version"
5
6
  require "progress"
@@ -8,6 +9,8 @@ require "uri"
8
9
 
9
10
  class Anvil::Engine
10
11
 
12
+ extend Anvil::Helpers
13
+
11
14
  def self.build(source, options={})
12
15
  if options[:pipeline]
13
16
  old_stdout = $stdout.dup
@@ -23,7 +26,9 @@ class Anvil::Engine
23
26
  builder = if is_url?(source)
24
27
  Anvil::Builder.new(source)
25
28
  else
26
- manifest = Anvil::Manifest.new(File.expand_path(source))
29
+ manifest = Anvil::Manifest.new(File.expand_path(source),
30
+ :cache => read_anvil_metadata(source, "cache"),
31
+ :ignore => options[:ignore])
27
32
  upload_missing manifest
28
33
  manifest
29
34
  end
@@ -15,10 +15,11 @@ class Anvil::Manifest
15
15
  attr_reader :dir
16
16
  attr_reader :manifest
17
17
 
18
- def initialize(dir=nil, cache_url=nil)
18
+ def initialize(dir=nil, options={})
19
19
  @dir = dir
20
- @manifest = @dir ? directory_manifest(@dir) : {}
21
- @cache_url = cache_url
20
+ @ignore = options[:ignore] || []
21
+ @manifest = @dir ? directory_manifest(@dir, :ignore => @ignore) : {}
22
+ @cache_url = options[:cache]
22
23
  end
23
24
 
24
25
  def build(options={})
@@ -110,17 +111,20 @@ private
110
111
  ENV["ANVIL_HOST"] || "https://api.anvilworks.org"
111
112
  end
112
113
 
113
- def directory_manifest(dir)
114
+ def directory_manifest(dir, options={})
114
115
  root = Pathname.new(dir)
116
+ ignore = options[:ignore] || []
115
117
 
116
118
  Dir.glob(File.join(dir, "**", "*"), File::FNM_DOTMATCH).inject({}) do |hash, file|
119
+ relative = Pathname.new(file).relative_path_from(root).to_s
120
+ next(hash) if ignore.include?(relative)
117
121
  next(hash) if %w( . .. ).include?(File.basename(file))
118
122
  next(hash) if File.directory?(file)
119
123
  next(hash) if File.pipe?(file)
120
124
  next(hash) if file =~ /\.git/
121
125
  next(hash) if file =~ /\.swp$/
122
126
  next(hash) unless file =~ /^[A-Za-z0-9\-\_\.\/]*$/
123
- hash[Pathname.new(file).relative_path_from(root).to_s] = file_manifest(file)
127
+ hash[relative] = file_manifest(file)
124
128
  hash
125
129
  end
126
130
  end
data/lib/anvil/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Anvil
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anvil-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-09-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: progress
16
- requirement: &70297907289980 !ruby/object:Gem::Requirement
16
+ requirement: &70276172888580 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.4.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70297907289980
24
+ version_requirements: *70276172888580
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rest-client
27
- requirement: &70297907288800 !ruby/object:Gem::Requirement
27
+ requirement: &70276172887600 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.6.7
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70297907288800
35
+ version_requirements: *70276172887600
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: thor
38
- requirement: &70297907287880 !ruby/object:Gem::Requirement
38
+ requirement: &70276172886560 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 0.15.2
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70297907287880
46
+ version_requirements: *70276172886560
47
47
  description: Alternate Heroku build workflow
48
48
  email: david@dollar.io
49
49
  executables: