shart 3.0.1 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MzQ4MzIxZGRkNjM3Y2Q0NjRjMDRmMTUzMTZlM2UzYTIyMWNiN2VhZA==
5
+ data.tar.gz: !binary |-
6
+ ZmNlZjgzYzQyNGYwYWIyMmI4YjVhYjJiYWUxMDhlZjA0NTQ4YmFkZA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ OTllZjc4NjM0MGFiZjY1MjMyNmE2YTg1YWRlODJhMTY3OGI3ZjNlNTg3MjM0
10
+ MDQ0NjcwYmUwMDYwMDI4OGRkM2Q4MzIyNzE2Mjg5YjM1OWIzNDEwNDI3MjMx
11
+ ODYyZDFkZGQzOTcyYTE0OTk0ZWZjM2RiNGM2MDE5ZWVhMDQ3ZGQ=
12
+ data.tar.gz: !binary |-
13
+ YjQ4OTBlZDAzZjJlMTg0NGM1ZWVmYWNiODBjZGE2M2JiOGIzOWY3NDAwMmUw
14
+ NWMxNTJjYWM1MGNmNDI3ZjZjODIxM2RkOGU1ODZiZTM4MWI5MDVhMmZkMmRk
15
+ NDBiZDFlYjdhMWUyMTRlMWZjOTY0ZjQ5MjhlYTFhNWNkNTc3MjQ=
data/README.md CHANGED
@@ -4,15 +4,7 @@ Shart is a DRY approach to deploying websites generated by [Middleman](http://mi
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'shart'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
7
+ Install shart from RubyGems:
16
8
 
17
9
  $ gem install shart
18
10
 
@@ -42,7 +34,7 @@ After you successfully shart, be sure to [read the blog post about hosting a web
42
34
 
43
35
  Shart has only been tested with Amazon S3 buckets.
44
36
 
45
- In theory, you can shart into any [storage provider that Fog supports](http://fog.io/0.8.1/about/getting_started.html).
37
+ In theory, you can shart into any [storage provider that Fog supports](http://fog.io/about/getting_started.html).
46
38
 
47
39
  ## Contributing
48
40
 
@@ -1,3 +1,5 @@
1
+ # Encoding: UTF-8
2
+
1
3
  require "shart/version"
2
4
  require 'fog'
3
5
  require 'pathname'
@@ -35,7 +37,8 @@ module Shart
35
37
 
36
38
  def files(&block)
37
39
  Dir.glob(@root + '**/*').reject{ |p| File.directory?(p) }.inject Hash.new do |hash, source_path|
38
- hash[source_path] = Pathname.new(source_path).relative_path_from(@root).to_s # Give us the 'key' path that we'll publish to in the target.
40
+ key = Pathname.new(source_path).relative_path_from(@root).to_s
41
+ hash[key] = File.new(source_path) # Give us the 'key' path that we'll publish to in the target.
39
42
  hash
40
43
  end
41
44
  end
@@ -62,8 +65,11 @@ module Shart
62
65
  def self.shartfile(filename)
63
66
  sync = new.tap { |dsl| dsl.instance_eval(File.read(filename), filename) }.sync
64
67
  puts "Sharting from #{sync.source.root.to_s.inspect} to #{sync.target.directory_name.inspect}"
65
- sync.run do |path, key, file|
66
- puts " #{key}"
68
+ sync.upload do |file, object|
69
+ puts "#{file.path} #{object.public_url}"
70
+ end
71
+ sync.clean do |object|
72
+ puts "✗ #{object.public_url}"
67
73
  end
68
74
  end
69
75
  end
@@ -76,14 +82,26 @@ module Shart
76
82
  @source, @target = source, target
77
83
  end
78
84
 
79
- def run(&block)
80
- @source.files.each do |path, key|
81
- block.call path, key, @target.files.create({
85
+ # Upload files from target to the source.
86
+ def upload(&block)
87
+ @source.files.each do |key, file|
88
+ object = @target.files.create({
82
89
  :key => key,
83
- :body => File.open(path),
90
+ :body => file,
84
91
  :public => true,
85
92
  :cache_control => 'max-age=0' # Disable cache on S3 so that future sharts are visible if folks web browsers.
86
93
  })
94
+ block.call file, object
95
+ end
96
+ end
97
+
98
+ # Removes files from target that don't exist on the source.
99
+ def clean(&block)
100
+ @target.files.each do |object|
101
+ unless @source.files.include? object.key
102
+ block.call(object)
103
+ object.destroy
104
+ end
87
105
  end
88
106
  end
89
107
  end
@@ -1,3 +1,3 @@
1
1
  module Shart
2
- VERSION = "3.0.1"
2
+ VERSION = "3.1.1"
3
3
  end
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
8
8
  gem.version = Shart::VERSION
9
9
  gem.authors = ["Brad Gessler"]
10
10
  gem.email = ["brad@bradgessler.com"]
11
- gem.description = %q{Deploys static website to cloud storage providers.}
11
+ gem.description = %q{Deploys static websites like Middleman to cloud storage providers like S3.}
12
12
  gem.summary = %q{Shart makes it easy to deploy static websites to cloud storage providers. Works great with Middleman, Jekyll, or Dreamweaver websites.}
13
13
  gem.homepage = "http://github.com/polleverywhere/shart"
14
14
 
@@ -1,5 +1,6 @@
1
1
  source '/Users/bradgessler/projects/polleverywhere/tech-blog/build'
2
- target 'tech.polleverywhere.com', {
2
+
3
+ target ENV['AWS_BUCKET'], {
3
4
  provider: 'AWS',
4
5
  aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
5
6
  aws_access_key_id: ENV['AWS_ACCESS_KEY_ID']
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shart
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
5
- prerelease:
4
+ version: 3.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Brad Gessler
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-11 00:00:00.000000000 Z
11
+ date: 2013-04-07 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: fog
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,12 +20,12 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
- description: Deploys static website to cloud storage providers.
27
+ description: Deploys static websites like Middleman to cloud storage providers like
28
+ S3.
31
29
  email:
32
30
  - brad@bradgessler.com
33
31
  executables:
@@ -47,28 +45,28 @@ files:
47
45
  - spec/fixtures/Shartfile
48
46
  homepage: http://github.com/polleverywhere/shart
49
47
  licenses: []
48
+ metadata: {}
50
49
  post_install_message:
51
50
  rdoc_options: []
52
51
  require_paths:
53
52
  - lib
54
53
  required_ruby_version: !ruby/object:Gem::Requirement
55
- none: false
56
54
  requirements:
57
55
  - - ! '>='
58
56
  - !ruby/object:Gem::Version
59
57
  version: '0'
60
58
  required_rubygems_version: !ruby/object:Gem::Requirement
61
- none: false
62
59
  requirements:
63
60
  - - ! '>='
64
61
  - !ruby/object:Gem::Version
65
62
  version: '0'
66
63
  requirements: []
67
64
  rubyforge_project:
68
- rubygems_version: 1.8.24
65
+ rubygems_version: 2.0.3
69
66
  signing_key:
70
- specification_version: 3
67
+ specification_version: 4
71
68
  summary: Shart makes it easy to deploy static websites to cloud storage providers.
72
69
  Works great with Middleman, Jekyll, or Dreamweaver websites.
73
70
  test_files:
74
71
  - spec/fixtures/Shartfile
72
+ has_rdoc: