microstatic 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
data/lib/microstatic/rake.rb
CHANGED
@@ -4,7 +4,7 @@ require 'rake/tasklib'
|
|
4
4
|
module Microstatic module Rake
|
5
5
|
|
6
6
|
class S3DeployTask < ::Rake::TaskLib
|
7
|
-
attr_accessor :name, :bucket_name, :source_dir, :aws_access_key_id, :aws_secret_access_key
|
7
|
+
attr_accessor :name, :bucket_name, :source_dir, :exclude, :aws_access_key_id, :aws_secret_access_key
|
8
8
|
|
9
9
|
def initialize( opts = {} )
|
10
10
|
if opts.is_a?(String) || opts.is_a?(Symbol)
|
@@ -16,6 +16,7 @@ class S3DeployTask < ::Rake::TaskLib
|
|
16
16
|
@aws_secret_access_key = opts.fetch( :aws_secret_access_key ) { ENV.fetch('AWS_SECRET_ACCESS_KEY') }
|
17
17
|
@bucket_name = opts.fetch( :bucket_name, false )
|
18
18
|
@source_dir = opts.fetch( :source_dir, false )
|
19
|
+
@exclude = opts.fetch( :exclude, false )
|
19
20
|
end
|
20
21
|
|
21
22
|
def define
|
@@ -34,6 +35,7 @@ class S3DeployTask < ::Rake::TaskLib
|
|
34
35
|
desc "deploy to the '#{bucket_name}' S3 bucket" unless ::Rake.application.last_comment
|
35
36
|
task name do
|
36
37
|
deployer = Microstatic::S3Deployer.new( source_dir, bucket_name, aws_creds )
|
38
|
+
deployer.file_list.exclude(@exclude) if @exclude
|
37
39
|
deployer.upload
|
38
40
|
end
|
39
41
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'digest/md5'
|
2
2
|
require 'pathname'
|
3
|
+
require 'rake/file_list'
|
3
4
|
|
4
5
|
module Microstatic
|
5
6
|
|
@@ -7,16 +8,21 @@ module Microstatic
|
|
7
8
|
# shared by Giles Alexander (@gga)
|
8
9
|
class S3Deployer
|
9
10
|
include UsesFog
|
11
|
+
|
12
|
+
attr_reader :file_list # TODO: don't expose this directly
|
13
|
+
|
10
14
|
def initialize( local_dir, bucket, aws_creds )
|
11
15
|
check_and_store_aws_creds(aws_creds)
|
12
16
|
|
13
17
|
@local_dir = Pathname.new(local_dir)
|
18
|
+
@file_list = ::Rake::FileList.new( (@local_dir+"**/*").to_s )
|
14
19
|
@bucket = bucket
|
15
20
|
end
|
16
21
|
|
17
22
|
def upload
|
18
|
-
|
19
|
-
|
23
|
+
@file_list.each do |entry|
|
24
|
+
entry = Pathname.new(entry)
|
25
|
+
upload_file(entry) unless entry.directory?
|
20
26
|
end
|
21
27
|
end
|
22
28
|
|
data/lib/microstatic/version.rb
CHANGED
data/microstatic.gemspec
CHANGED
@@ -18,8 +18,8 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.add_runtime_dependency "fog", ">=1"
|
19
19
|
gem.add_runtime_dependency "thor", ">=0.15" # 0.15 is an arbitrary guess at what might be API-compatible
|
20
20
|
gem.add_runtime_dependency "rainbow", ">= 2.0"
|
21
|
+
gem.add_runtime_dependency "rake" # we use Rake::FileList to specify which files to upload
|
21
22
|
|
22
|
-
gem.add_development_dependency "rake"
|
23
23
|
gem.add_development_dependency "bundler"
|
24
24
|
gem.add_development_dependency "rspec", "~>2.13.0"
|
25
25
|
gem.add_development_dependency "pry-nav", "~> 0.2.3"
|
@@ -0,0 +1 @@
|
|
1
|
+
please ignore me
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: microstatic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-08-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- - ! '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
|
-
type: :
|
70
|
+
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
@@ -153,6 +153,7 @@ files:
|
|
153
153
|
- spec/integration/fixtures/example_file.txt
|
154
154
|
- spec/integration/fixtures/subdir/another_file.txt
|
155
155
|
- spec/integration/fixtures/subdir/foo.txt
|
156
|
+
- spec/integration/fixtures/subdir/ignored/ignored-file.txt
|
156
157
|
- spec/integration/fixtures/subdir/subsubdir/deep.txt
|
157
158
|
- spec/integration/spec_helper.rb
|
158
159
|
- spec/integration/upload_to_test_bucket_spec.rb
|
@@ -171,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
171
172
|
version: '0'
|
172
173
|
segments:
|
173
174
|
- 0
|
174
|
-
hash: -
|
175
|
+
hash: -1270358842069851857
|
175
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
177
|
none: false
|
177
178
|
requirements:
|
@@ -180,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
181
|
version: '0'
|
181
182
|
segments:
|
182
183
|
- 0
|
183
|
-
hash: -
|
184
|
+
hash: -1270358842069851857
|
184
185
|
requirements: []
|
185
186
|
rubyforge_project:
|
186
187
|
rubygems_version: 1.8.25
|
@@ -191,6 +192,7 @@ test_files:
|
|
191
192
|
- spec/integration/fixtures/example_file.txt
|
192
193
|
- spec/integration/fixtures/subdir/another_file.txt
|
193
194
|
- spec/integration/fixtures/subdir/foo.txt
|
195
|
+
- spec/integration/fixtures/subdir/ignored/ignored-file.txt
|
194
196
|
- spec/integration/fixtures/subdir/subsubdir/deep.txt
|
195
197
|
- spec/integration/spec_helper.rb
|
196
198
|
- spec/integration/upload_to_test_bucket_spec.rb
|