jamesmacaulay-asset_cloud 0.5.3 → 0.5.4
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/asset_cloud.gemspec +2 -2
- data/lib/asset_cloud/asset.rb +8 -0
- data/lib/asset_cloud/bucket.rb +4 -7
- data/spec/asset_spec.rb +14 -2
- data/spec/memory_bucket_spec.rb +6 -0
- data/spec/versioned_memory_bucket_spec.rb +6 -0
- metadata +4 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.4
|
data/asset_cloud.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{asset_cloud}
|
5
|
-
s.version = "0.5.
|
5
|
+
s.version = "0.5.4"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Shopify"]
|
9
|
-
s.date = %q{2009-
|
9
|
+
s.date = %q{2009-08-04}
|
10
10
|
s.description = %q{An abstraction layer around arbitrary and diverse asset stores.}
|
11
11
|
s.email = %q{developers@shopify.com}
|
12
12
|
s.extra_rdoc_files = [
|
data/lib/asset_cloud/asset.rb
CHANGED
@@ -118,6 +118,10 @@ module AssetCloud
|
|
118
118
|
def bucket_name
|
119
119
|
@key.split('/').first
|
120
120
|
end
|
121
|
+
|
122
|
+
def bucket
|
123
|
+
cloud.buckets[bucket_name.to_sym]
|
124
|
+
end
|
121
125
|
|
122
126
|
def inspect
|
123
127
|
"#<#{self.class.name}: #{key}>"
|
@@ -125,6 +129,10 @@ module AssetCloud
|
|
125
129
|
|
126
130
|
# versioning
|
127
131
|
|
132
|
+
def versioned?
|
133
|
+
bucket.versioned?
|
134
|
+
end
|
135
|
+
|
128
136
|
def rollback(version)
|
129
137
|
self.value = cloud.read_version(key, version)
|
130
138
|
self
|
data/lib/asset_cloud/bucket.rb
CHANGED
@@ -31,13 +31,10 @@ module AssetCloud
|
|
31
31
|
end
|
32
32
|
|
33
33
|
# versioning
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
def versions(key)
|
40
|
-
raise NotImplementedError
|
34
|
+
#
|
35
|
+
# implement #read_version(key, version) and #versions(key) in subclasses
|
36
|
+
def versioned?
|
37
|
+
respond_to?(:read_version)
|
41
38
|
end
|
42
39
|
end
|
43
40
|
end
|
data/spec/asset_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe "Asset" do
|
|
5
5
|
include AssetCloud
|
6
6
|
|
7
7
|
before do
|
8
|
-
@cloud = mock('
|
8
|
+
@cloud = mock('Cloud')
|
9
9
|
end
|
10
10
|
|
11
11
|
describe "when first created (without a value)" do
|
@@ -41,7 +41,11 @@ describe "Asset" do
|
|
41
41
|
it "should have a bucket_name" do
|
42
42
|
@asset.bucket_name.should == 'products'
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
|
+
it "should have a bucket" do
|
46
|
+
@cloud.should_receive(:buckets).and_return(:products => :products_bucket)
|
47
|
+
@asset.bucket.should == :products_bucket
|
48
|
+
end
|
45
49
|
|
46
50
|
it "should store data to the bucket" do
|
47
51
|
@cloud.should_receive(:write).with("products/key.txt", 'value')
|
@@ -133,6 +137,14 @@ describe "Asset" do
|
|
133
137
|
|
134
138
|
@asset.url.should == 'http://assets/products/key.txt'
|
135
139
|
end
|
140
|
+
|
141
|
+
it "should ask the bucket whether or not it is versioned" do
|
142
|
+
bucket = mock('Bucket')
|
143
|
+
@cloud.should_receive(:buckets).and_return(:products => bucket)
|
144
|
+
bucket.should_receive(:versioned?).and_return(true)
|
145
|
+
|
146
|
+
@asset.versioned?.should == true
|
147
|
+
end
|
136
148
|
end
|
137
149
|
|
138
150
|
|
data/spec/memory_bucket_spec.rb
CHANGED
@@ -14,6 +14,12 @@ describe AssetCloud::VersionedMemoryBucket do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
describe '#versioned?' do
|
18
|
+
it "should return true" do
|
19
|
+
@fs.buckets[:memory].versioned?.should == true
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
17
23
|
describe '#read_version' do
|
18
24
|
it "should return the appropriate data when given a key and version" do
|
19
25
|
@fs.read_version('memory/foo', 1).should == 'one'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jamesmacaulay-asset_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-04 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- spec/versioned_memory_bucket_spec.rb
|
67
67
|
has_rdoc: false
|
68
68
|
homepage: http://github.com/Shopify/asset_cloud
|
69
|
+
licenses:
|
69
70
|
post_install_message:
|
70
71
|
rdoc_options:
|
71
72
|
- --charset=UTF-8
|
@@ -86,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
87
|
requirements: []
|
87
88
|
|
88
89
|
rubyforge_project:
|
89
|
-
rubygems_version: 1.
|
90
|
+
rubygems_version: 1.3.5
|
90
91
|
signing_key:
|
91
92
|
specification_version: 3
|
92
93
|
summary: An abstraction layer around arbitrary and diverse asset stores.
|