frizz 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd98be44204c71104dc4e9beffb9585aee906ffd
4
- data.tar.gz: 74ff1e15857a32f6f2f885eb18739b2c79eb9d3b
3
+ metadata.gz: b91f9450aa82504d7bcdd6682550c96b75ffd64d
4
+ data.tar.gz: 6589519b90da99e3a9665a343fa4b62c6e0b9503
5
5
  SHA512:
6
- metadata.gz: 7f6eb8e8f85760394202ac6fbdff28c33f93087b8f1d189ee671b9803778a8c9a77b5d294ed8d9172397b6c564a31b962076749f05bfa22645218612ab7eee0b
7
- data.tar.gz: 672554e30b5de992ced207b98cb36528c5c5e17a6df9b0d9fe11cd4b4776dcda8019ca6868c874f50189ddbb4efeb74bb535e31e0c2df1767f69f8fc9d84d442
6
+ metadata.gz: 7154646f33a7963bb27646b8e0acfdff1313729e8aa89ec115412bcd80cb24dd6099fd7f24e06b15dd6681102b0c4501ccee1dd094cc11a159eae3b41d40a646
7
+ data.tar.gz: 77a3fbfbd4c0876c0668b4f0f2b151cd359b73b576b4e02ee6f686302c93ce4c0838ca4934202d499d33304e4aa39a74866c8cccc407ec8023b16473c4617643
data/README.md CHANGED
@@ -83,6 +83,19 @@ site = Frizz::Site.new("my-bucket", distribution: "DISTRIBUTION_ID")
83
83
  site.deploy!
84
84
  ```
85
85
 
86
+ ### Ignore files in a deploy
87
+
88
+ If you want to ignore files or directories when syncing local with remote
89
+ (`logs/` for example), you can specify patterns to ignore for each environment
90
+ in `frizz.yml`:
91
+
92
+ ```yaml
93
+ environments:
94
+ production:
95
+ ignore:
96
+ - "logs/*"
97
+ ```
98
+
86
99
  ## Usage With Middleman
87
100
 
88
101
  Managing more than the basic two environments (dev and build) in a Middleman app
@@ -0,0 +1,14 @@
1
+ module Frizz
2
+ class Ignorance
3
+ attr_reader :patterns
4
+
5
+ def initialize(patterns)
6
+ @patterns = patterns || []
7
+ end
8
+
9
+ def ignore?(path)
10
+ return false unless patterns.count
11
+ patterns.any? { |p| ::File.fnmatch(p, path) }
12
+ end
13
+ end
14
+ end
data/lib/frizz/local.rb CHANGED
@@ -1,14 +1,15 @@
1
1
  module Frizz
2
2
  class Local
3
- def initialize(root_path)
3
+ def initialize(root_path, ignorance)
4
4
  @root_path = root_path
5
+ @ignorance = ignorance
5
6
  end
6
7
 
7
8
  def files
8
9
  @files ||= begin
9
10
  Dir.chdir(root_path) do
10
11
  Dir["**/*"].map do |local_path|
11
- File.new(expand_path(local_path), local_path) unless ::File.directory?(local_path)
12
+ File.new(expand_path(local_path), local_path) unless ignore?(local_path)
12
13
  end.compact
13
14
  end
14
15
  end
@@ -20,12 +21,16 @@ module Frizz
20
21
 
21
22
  private
22
23
 
23
- attr_reader :root_path
24
+ attr_reader :root_path, :ignorance
24
25
 
25
26
  def expand_path(local_path)
26
27
  ::File.join root_path, local_path
27
28
  end
28
29
 
30
+ def ignore?(path)
31
+ ::File.directory?(path) || ignorance.ignore?(path)
32
+ end
33
+
29
34
  class File
30
35
  attr_reader :path, :key
31
36
 
@@ -39,4 +44,4 @@ module Frizz
39
44
  end
40
45
  end
41
46
  end
42
- end
47
+ end
@@ -35,7 +35,7 @@ module Frizz
35
35
  relevant_environments.each do |name, env|
36
36
  desc "Deploy build dir to #{env.name}: #{env.bucket}"
37
37
  task env.name do
38
- Frizz::Site.new(env.bucket, distribution: env.distribution).deploy!
38
+ Frizz::Site.new(env.bucket, distribution: env.distribution, ignore: env.ignore).deploy!
39
39
  end
40
40
  end
41
41
  end
data/lib/frizz/remote.rb CHANGED
@@ -3,12 +3,13 @@ require "mime-types"
3
3
 
4
4
  module Frizz
5
5
  class Remote
6
- def initialize(bucket_name)
6
+ def initialize(bucket_name, ignorance)
7
7
  @bucket_name = bucket_name
8
+ @ignorance = ignorance
8
9
  end
9
10
 
10
11
  def files
11
- @files ||= bucket.objects
12
+ @files ||= bucket.objects.reject { |o| ignore?(o) }
12
13
  end
13
14
 
14
15
  def upload(file, key)
@@ -21,7 +22,11 @@ module Frizz
21
22
 
22
23
  private
23
24
 
24
- attr_reader :bucket_name
25
+ attr_reader :bucket_name, :ignorance
26
+
27
+ def ignore?(object)
28
+ ignorance.ignore?(object.key)
29
+ end
25
30
 
26
31
  def bucket
27
32
  @bucket ||= service.buckets.find(bucket_name)
@@ -34,4 +39,4 @@ module Frizz
34
39
  )
35
40
  end
36
41
  end
37
- end
42
+ end
data/lib/frizz/site.rb CHANGED
@@ -3,12 +3,14 @@ module Frizz
3
3
  def initialize(host, options={})
4
4
  @options = { from: "build" }.merge options
5
5
 
6
- @local = Local.new(path_to_deploy)
7
- @remote = Remote.new(host)
6
+ @ignorance = Ignorance.new(@options[:ignore])
8
7
 
9
8
  if @options[:distribution]
10
9
  @distribution = Distribution.new(@options[:distribution])
11
10
  end
11
+
12
+ @local = Local.new(path_to_deploy, ignorance)
13
+ @remote = Remote.new(host, ignorance)
12
14
  end
13
15
 
14
16
  def deploy!
@@ -18,10 +20,10 @@ module Frizz
18
20
 
19
21
  private
20
22
 
21
- attr_reader :local, :remote, :options, :distribution
23
+ attr_reader :local, :remote, :options, :distribution, :ignorance
22
24
 
23
25
  def path_to_deploy
24
26
  File.expand_path(options[:from])
25
27
  end
26
28
  end
27
- end
29
+ end
data/lib/frizz/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Frizz
2
- VERSION = "1.5.0"
2
+ VERSION = "1.6.0"
3
3
  end
data/lib/frizz.rb CHANGED
@@ -9,6 +9,7 @@ module Frizz
9
9
  autoload :Sync, "frizz/sync"
10
10
  autoload :Configuration, "frizz/configuration"
11
11
  autoload :Environment, "frizz/environment"
12
+ autoload :Ignorance, "frizz/ignorance"
12
13
 
13
14
  class << self
14
15
  def configure
@@ -19,4 +20,4 @@ module Frizz
19
20
  @configuration ||= Configuration.new
20
21
  end
21
22
  end
22
- end
23
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frizz
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - patbenatar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-04 00:00:00.000000000 Z
11
+ date: 2014-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -125,6 +125,7 @@ files:
125
125
  - lib/frizz/configuration.rb
126
126
  - lib/frizz/distribution.rb
127
127
  - lib/frizz/environment.rb
128
+ - lib/frizz/ignorance.rb
128
129
  - lib/frizz/local.rb
129
130
  - lib/frizz/middleman/extension.rb
130
131
  - lib/frizz/middleman/tasks.rb