fakes3 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -2
- data/Gemfile.lock +3 -1
- data/MIT-LICENSE +20 -0
- data/Rakefile +4 -2
- data/bin/fakes3 +1 -0
- data/fakes3.gemspec +2 -2
- data/lib/fakes3/file_store.rb +5 -4
- data/lib/fakes3/version.rb +1 -1
- data/test/right_aws_commands_test.rb +1 -1
- data/test/s3_commands_test.rb +1 -1
- data/test/s3cmd_test.rb +1 -5
- data/test/test_helper.rb +2 -6
- metadata +20 -6
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fakes3 (0.1.
|
4
|
+
fakes3 (0.1.5)
|
5
5
|
builder
|
6
6
|
thor
|
7
7
|
|
@@ -14,6 +14,7 @@ GEM
|
|
14
14
|
xml-simple
|
15
15
|
builder (3.0.0)
|
16
16
|
mime-types (1.18)
|
17
|
+
rake (0.9.2.2)
|
17
18
|
right_aws (3.0.4)
|
18
19
|
right_http_connection (>= 1.2.5)
|
19
20
|
right_http_connection (1.3.0)
|
@@ -27,4 +28,5 @@ DEPENDENCIES
|
|
27
28
|
aws-s3
|
28
29
|
bundler (>= 1.0.0)
|
29
30
|
fakes3!
|
31
|
+
rake
|
30
32
|
right_aws
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011,2012 Curtis W Spencer (@jubos) and Spool
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
1
2
|
require 'bundler'
|
2
3
|
require 'rake/testtask'
|
3
4
|
include Rake::DSL
|
4
5
|
Bundler::GemHelper.install_tasks
|
5
6
|
|
6
7
|
Rake::TestTask.new(:test) do |t|
|
8
|
+
t.libs << "."
|
7
9
|
t.test_files = FileList['test/*_test.rb']
|
8
|
-
t.ruby_opts = ['-rubygems'] if defined? Gem
|
9
|
-
t.ruby_opts << '-I.'
|
10
10
|
end
|
11
11
|
|
12
12
|
desc "Run the test_server"
|
13
13
|
task :test_server do |t|
|
14
14
|
system("bundle exec bin/fakes3 --port 10453 --root test_root")
|
15
15
|
end
|
16
|
+
|
17
|
+
task :default => :test
|
data/bin/fakes3
CHANGED
data/fakes3.gemspec
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
require "fakes3/version"
|
2
|
+
require File.join(File.dirname(__FILE__), 'lib', 'fakes3', 'version')
|
4
3
|
|
5
4
|
Gem::Specification.new do |s|
|
6
5
|
s.name = "fakes3"
|
@@ -17,6 +16,7 @@ Gem::Specification.new do |s|
|
|
17
16
|
s.add_development_dependency "bundler", ">= 1.0.0"
|
18
17
|
s.add_development_dependency "aws-s3"
|
19
18
|
s.add_development_dependency "right_aws"
|
19
|
+
s.add_development_dependency "rake"
|
20
20
|
#s.add_development_dependency "aws-sdk"
|
21
21
|
#s.add_development_dependency "ruby-debug"
|
22
22
|
#s.add_development_dependency "ruby-debug19"
|
data/lib/fakes3/file_store.rb
CHANGED
@@ -75,15 +75,16 @@ module FakeS3
|
|
75
75
|
begin
|
76
76
|
real_obj = S3Object.new
|
77
77
|
obj_root = File.join(@root,bucket,object_name,SHUCK_METADATA_DIR)
|
78
|
-
metadata = YAML.
|
78
|
+
metadata = YAML.load(File.open(File.join(obj_root,"metadata"),'rb'))
|
79
79
|
real_obj.name = object_name
|
80
|
-
real_obj.md5 = metadata[:md5]
|
81
|
-
real_obj.content_type = metadata
|
80
|
+
real_obj.md5 = metadata[:md5]
|
81
|
+
real_obj.content_type = metadata.fetch(:content_type) { "application/octet-stream" }
|
82
82
|
#real_obj.io = File.open(File.join(obj_root,"content"),'rb')
|
83
83
|
real_obj.io = RateLimitableFile.open(File.join(obj_root,"content"),'rb')
|
84
84
|
return real_obj
|
85
85
|
rescue
|
86
86
|
puts $!
|
87
|
+
$!.backtrace.each { |line| puts line }
|
87
88
|
return nil
|
88
89
|
end
|
89
90
|
end
|
@@ -94,7 +95,7 @@ module FakeS3
|
|
94
95
|
def copy_object(src_bucket_name,src_name,dst_bucket_name,dst_name)
|
95
96
|
src_root = File.join(@root,src_bucket_name,src_name,SHUCK_METADATA_DIR)
|
96
97
|
src_metadata_filename = File.join(src_root,"metadata")
|
97
|
-
src_metadata = YAML.
|
98
|
+
src_metadata = YAML.load(File.open(src_metadata_filename,'rb').read)
|
98
99
|
src_content_filename = File.join(src_root,"content")
|
99
100
|
|
100
101
|
dst_filename= File.join(@root,dst_bucket_name,dst_name)
|
data/lib/fakes3/version.rb
CHANGED
data/test/s3_commands_test.rb
CHANGED
@@ -124,7 +124,7 @@ class S3CommandsTest < Test::Unit::TestCase
|
|
124
124
|
S3Object.delete("something_to_delete","ruby_aws_s3")
|
125
125
|
|
126
126
|
assert_raise AWS::S3::NoSuchKey do
|
127
|
-
should_throw = S3Object.find("something_to_delete","
|
127
|
+
should_throw = S3Object.find("something_to_delete","ruby_aws_s3")
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
data/test/s3cmd_test.rb
CHANGED
@@ -1,13 +1,10 @@
|
|
1
1
|
require 'test/test_helper'
|
2
2
|
require 'fileutils'
|
3
3
|
|
4
|
-
# You need to have s3cmd installed to use this
|
5
|
-
# Also, s3cmd doesn't support path style requests, so in order to properly test
|
6
|
-
# it you need to modify your dns by changing /etc/hosts or using dnsmasq
|
7
4
|
class S3CmdTest < Test::Unit::TestCase
|
8
|
-
|
9
5
|
def setup
|
10
6
|
config = File.expand_path(File.join(File.dirname(__FILE__),'local_s3_cfg'))
|
7
|
+
raise "Please install s3cmd" if `which s3cmd`.empty?
|
11
8
|
@s3cmd = "s3cmd --config #{config}"
|
12
9
|
end
|
13
10
|
|
@@ -52,5 +49,4 @@ class S3CmdTest < Test::Unit::TestCase
|
|
52
49
|
|
53
50
|
def test_intra_bucket_copy
|
54
51
|
end
|
55
|
-
|
56
52
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,8 +1,4 @@
|
|
1
1
|
require 'test/unit'
|
2
|
+
require 'rubygems'
|
2
3
|
require 'bundler/setup'
|
3
|
-
|
4
|
-
testdir = File.dirname(__FILE__)
|
5
|
-
$LOAD_PATH.unshift testdir unless $LOAD_PATH.include?(testdir)
|
6
|
-
|
7
|
-
libdir = File.dirname(File.dirname(__FILE__)) + '/lib'
|
8
|
-
$LOAD_PATH.unshift libdir unless $LOAD_PATH.include?(libdir)
|
4
|
+
require 'fakes3'
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 5
|
9
|
+
version: 0.1.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Curtis Spencer
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-04-
|
17
|
+
date: 2012-04-20 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
type: :development
|
60
60
|
version_requirements: *id003
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
62
|
+
name: rake
|
63
63
|
prerelease: false
|
64
64
|
requirement: &id004 !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
@@ -69,10 +69,10 @@ dependencies:
|
|
69
69
|
segments:
|
70
70
|
- 0
|
71
71
|
version: "0"
|
72
|
-
type: :
|
72
|
+
type: :development
|
73
73
|
version_requirements: *id004
|
74
74
|
- !ruby/object:Gem::Dependency
|
75
|
-
name:
|
75
|
+
name: thor
|
76
76
|
prerelease: false
|
77
77
|
requirement: &id005 !ruby/object:Gem::Requirement
|
78
78
|
none: false
|
@@ -84,6 +84,19 @@ dependencies:
|
|
84
84
|
version: "0"
|
85
85
|
type: :runtime
|
86
86
|
version_requirements: *id005
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: builder
|
89
|
+
prerelease: false
|
90
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
segments:
|
96
|
+
- 0
|
97
|
+
version: "0"
|
98
|
+
type: :runtime
|
99
|
+
version_requirements: *id006
|
87
100
|
description: Use FakeS3 to test basic S3 functionality without actually connecting to S3
|
88
101
|
email:
|
89
102
|
- thorin@gmail.com
|
@@ -97,6 +110,7 @@ files:
|
|
97
110
|
- .gitignore
|
98
111
|
- Gemfile
|
99
112
|
- Gemfile.lock
|
113
|
+
- MIT-LICENSE
|
100
114
|
- README.md
|
101
115
|
- Rakefile
|
102
116
|
- bin/fakes3
|