s3deployer 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +4 -0
- data/Gemfile.lock +14 -1
- data/Makefile +2 -0
- data/README.markdown +0 -2
- data/lib/s3deployer/version.rb +1 -1
- data/lib/s3deployer.rb +5 -4
- data/spec/s3deployer_spec.rb +33 -0
- metadata +6 -4
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
s3deployer (0.0.
|
4
|
+
s3deployer (0.0.2)
|
5
5
|
aws-s3
|
6
6
|
|
7
7
|
GEM
|
@@ -12,11 +12,24 @@ GEM
|
|
12
12
|
mime-types
|
13
13
|
xml-simple
|
14
14
|
builder (3.0.0)
|
15
|
+
diff-lcs (1.1.3)
|
15
16
|
mime-types (1.17.2)
|
17
|
+
rspec (2.8.0)
|
18
|
+
rspec-core (~> 2.8.0)
|
19
|
+
rspec-expectations (~> 2.8.0)
|
20
|
+
rspec-mocks (~> 2.8.0)
|
21
|
+
rspec-core (2.8.0)
|
22
|
+
rspec-expectations (2.8.0)
|
23
|
+
diff-lcs (~> 1.1.2)
|
24
|
+
rspec-mocks (2.8.0)
|
25
|
+
rspec-spies (2.1.0)
|
26
|
+
rspec (~> 2.0)
|
16
27
|
xml-simple (1.1.1)
|
17
28
|
|
18
29
|
PLATFORMS
|
19
30
|
ruby
|
20
31
|
|
21
32
|
DEPENDENCIES
|
33
|
+
rspec
|
34
|
+
rspec-spies
|
22
35
|
s3deployer!
|
data/Makefile
ADDED
data/README.markdown
CHANGED
data/lib/s3deployer/version.rb
CHANGED
data/lib/s3deployer.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'aws/s3'
|
2
2
|
class S3Deployer
|
3
3
|
attr_accessor :directory_to_deploy, :bucket_name
|
4
|
-
def initialize(
|
5
|
-
|
6
|
-
@bucket_name = bucket_name
|
4
|
+
def initialize(access_key, secret_key)
|
5
|
+
AWS::S3::Base.establish_connection!(access_key, secret_key)
|
7
6
|
end
|
8
|
-
def deploy
|
7
|
+
def deploy(directory_to_deploy, bucket_name)
|
8
|
+
@bucket_name = bucket_name
|
9
|
+
@directory_to_deploy = directory_to_deploy
|
9
10
|
iterate_through_and_deploy(directory_to_deploy)
|
10
11
|
end
|
11
12
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require_relative "../lib/s3deployer"
|
2
|
+
require 'rspec-spies'
|
3
|
+
describe S3Deployer do
|
4
|
+
before do
|
5
|
+
AWS::S3::Base.stub(:establish_connection!)
|
6
|
+
Dir.mkdir('files') unless Dir.exists?('files')
|
7
|
+
AWS::S3::S3Object.stub(:store)
|
8
|
+
subject.stub(:open).and_return('asdf')
|
9
|
+
end
|
10
|
+
subject { S3Deployer.new("abc", "123") }
|
11
|
+
describe "instantiation" do
|
12
|
+
it "Connects to Amazon S3 with access and secret keys" do
|
13
|
+
S3Deployer.new("abc", "123")
|
14
|
+
AWS::S3::Base.should have_received(:establish_connection!).with('abc','123')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
describe "deploy" do
|
18
|
+
context "with multiple files" do
|
19
|
+
it "uploads them to S3" do
|
20
|
+
create_file("thing", "asdf");
|
21
|
+
create_file("hiphopper", "qwer");
|
22
|
+
subject.deploy("#{Dir.pwd}/files", 'bucket')
|
23
|
+
AWS::S3::S3Object.should have_received(:store).with('/thing', "asdf", 'bucket')
|
24
|
+
AWS::S3::S3Object.should have_received(:store).with('/hiphopper', "asdf", 'bucket')
|
25
|
+
File.delete("#{Dir.pwd}/files/thing")
|
26
|
+
File.delete("#{Dir.pwd}/files/hiphopper")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
def create_file(filename, content)
|
32
|
+
File.open("#{Dir.pwd}/files/#{filename}", 'w') { |f| f.write(content) }
|
33
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: s3deployer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-s3
|
16
|
-
requirement: &
|
16
|
+
requirement: &70093094693620 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70093094693620
|
25
25
|
description: A simple way to deploy a directory to Amazon s3
|
26
26
|
email:
|
27
27
|
- zee@zeespencer.com
|
@@ -32,11 +32,13 @@ files:
|
|
32
32
|
- .rvmrc
|
33
33
|
- Gemfile
|
34
34
|
- Gemfile.lock
|
35
|
+
- Makefile
|
35
36
|
- README.markdown
|
36
37
|
- Rakefile
|
37
38
|
- lib/s3deployer.rb
|
38
39
|
- lib/s3deployer/version.rb
|
39
40
|
- s3deployer.gemspec
|
41
|
+
- spec/s3deployer_spec.rb
|
40
42
|
homepage: https://github.com/zspencer/s3deployer
|
41
43
|
licenses: []
|
42
44
|
post_install_message:
|