commonthread-fluffy 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/VERSION +1 -1
- data/fluffy.gemspec +2 -2
- data/lib/fluffy.rb +7 -7
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/fluffy.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{fluffy}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Ben Wyrosdick"]
|
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
s.rdoc_options = ["--charset=UTF-8"]
|
34
34
|
s.require_paths = ["lib"]
|
35
35
|
s.rubygems_version = %q{1.3.4}
|
36
|
-
s.summary = %q{
|
36
|
+
s.summary = %q{TODO}
|
37
37
|
s.test_files = [
|
38
38
|
"test/fluffy_test.rb",
|
39
39
|
"test/test_helper.rb"
|
data/lib/fluffy.rb
CHANGED
@@ -17,7 +17,7 @@ File.instance_eval do
|
|
17
17
|
alias :original_open :open
|
18
18
|
|
19
19
|
def open(filename, mode = 'r', &block)
|
20
|
-
Fluffy.cloud_runner(:open, filename) do |s3_path, key|
|
20
|
+
Fluffy.cloud_runner(self, :open, filename) do |s3_path, key|
|
21
21
|
s3io = Fluffy::S3Io.new(s3_path, key, mode)
|
22
22
|
|
23
23
|
if block_given?
|
@@ -32,7 +32,7 @@ File.instance_eval do
|
|
32
32
|
alias :original_exists? :exists?
|
33
33
|
|
34
34
|
def exists?(filename)
|
35
|
-
Fluffy.cloud_runner(:exists?, filename) do |s3_path, key|
|
35
|
+
Fluffy.cloud_runner(self, :exists?, filename) do |s3_path, key|
|
36
36
|
s3_path.bucket.key(key).exists?
|
37
37
|
end
|
38
38
|
end
|
@@ -49,7 +49,7 @@ File.instance_eval do
|
|
49
49
|
|
50
50
|
def unlink(*filepaths)
|
51
51
|
filepaths.each do |filename|
|
52
|
-
Fluffy.cloud_runner(:unlink, filename) do |s3_path, key|
|
52
|
+
Fluffy.cloud_runner(self, :unlink, filename) do |s3_path, key|
|
53
53
|
s3_path.bucket.key(key).delete
|
54
54
|
end
|
55
55
|
end
|
@@ -60,7 +60,7 @@ Dir.instance_eval do
|
|
60
60
|
alias :original_unlink :unlink
|
61
61
|
|
62
62
|
def unlink(dirpath)
|
63
|
-
Fluffy.cloud_runner(:unlink, dirpath) do |s3_path, key|
|
63
|
+
Fluffy.cloud_runner(self, :unlink, dirpath) do |s3_path, key|
|
64
64
|
s3_path.bucket.key(key).delete
|
65
65
|
end
|
66
66
|
end
|
@@ -75,15 +75,15 @@ Dir.instance_eval do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
module Fluffy
|
78
|
-
def self.cloud_runner(method_name, filename, &block)
|
78
|
+
def self.cloud_runner(klass, method_name, filename, &block)
|
79
79
|
expanded_filename = File.expand_path(filename)
|
80
80
|
if s3_path = File.s3_paths.find {|path| expanded_filename =~ /^#{path.file_path}/}
|
81
81
|
starting_position = s3_path.file_path.length + 1
|
82
82
|
raise 'You must specify a key' unless expanded_filename.length > starting_position
|
83
83
|
key = expanded_filename[starting_position .. -1]
|
84
|
-
yield(s3_path, key)
|
84
|
+
yield(s3_path, File.join(s3_path.start_path, key).gsub(/^\W/, ''))
|
85
85
|
else
|
86
|
-
|
86
|
+
klass.send("original_#{method_name}", filename)
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commonthread-fluffy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Wyrosdick
|
@@ -63,7 +63,7 @@ rubyforge_project:
|
|
63
63
|
rubygems_version: 1.2.0
|
64
64
|
signing_key:
|
65
65
|
specification_version: 3
|
66
|
-
summary:
|
66
|
+
summary: TODO
|
67
67
|
test_files:
|
68
68
|
- test/fluffy_test.rb
|
69
69
|
- test/test_helper.rb
|