rain_forest 0.4.6 → 0.5.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.
- checksums.yaml +4 -4
- data/README.markdown +1 -0
- data/VERSION +1 -1
- data/lib/rain_forest/s3.rb +21 -0
- data/rain_forest.gemspec +2 -2
- data/spec/rain_forest/s3_spec.rb +27 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a37d7f36902e2ba7b2a7fe0d9ecbb090d93b21d5
|
4
|
+
data.tar.gz: c62b59f476b098d527d8c703d83e803d8ee4ce57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c12bd24794aaf2f4caaf408abdec378ccb049380e2789b315874aab2961db4b313843b429adc56f9e41748735a10e189a17ecbb7072c0f07d0143cae8f29dc0
|
7
|
+
data.tar.gz: 89fce60a41d4cdb1506871a5c96665d42fb2198cb99a16e2b7b94275dd85e37df0eda88659174fec8a76a307671b4742665f676ad081ca5fcf4683cb19601483
|
data/README.markdown
CHANGED
@@ -60,6 +60,7 @@ config/initializers/rain_forest.rb
|
|
60
60
|
RainForest::S3.move(source_key, dest_key)
|
61
61
|
RainForest::S3.content_length(storage_key)
|
62
62
|
RainForest::S3.delete_objects(prefix)
|
63
|
+
RainForest::S3.set_index_document(index_document)
|
63
64
|
RainForest::CloudFront.get_distribution(distribution_id)
|
64
65
|
RainForest::CloudFront.get_distribution_status(distribution_id)
|
65
66
|
RainForest::CloudFront.update_origin(distribution_id, new_origin)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.3
|
data/lib/rain_forest/s3.rb
CHANGED
@@ -46,6 +46,10 @@ module RainForest
|
|
46
46
|
self.new.delete_objects(prefix)
|
47
47
|
end
|
48
48
|
|
49
|
+
def self.set_index_document(index_document)
|
50
|
+
self.new.set_index_document(index_document)
|
51
|
+
end
|
52
|
+
|
49
53
|
def write(storage_key, data, options={})
|
50
54
|
attrs = {
|
51
55
|
bucket: @bucket,
|
@@ -118,5 +122,22 @@ module RainForest
|
|
118
122
|
return -1
|
119
123
|
end
|
120
124
|
end
|
125
|
+
|
126
|
+
def set_index_document(index_document)
|
127
|
+
begin
|
128
|
+
resp = @client.put_bucket_website(
|
129
|
+
bucket: @bucket,
|
130
|
+
website_configuration: {
|
131
|
+
index_document: {
|
132
|
+
suffix: index_document
|
133
|
+
}
|
134
|
+
}
|
135
|
+
)
|
136
|
+
rescue Exception => e
|
137
|
+
return false, e.message
|
138
|
+
end
|
139
|
+
|
140
|
+
return true, nil
|
141
|
+
end
|
121
142
|
end
|
122
143
|
end
|
data/rain_forest.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "rain_forest"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.5.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Lukas Beaton"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2017-10-11"
|
13
13
|
s.description = "A simplified adaptor for Amazon Web Services. Only S3 is supported at the moment."
|
14
14
|
s.email = "lukas.beaton@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/rain_forest/s3_spec.rb
CHANGED
@@ -146,4 +146,31 @@ describe RainForest::S3 do
|
|
146
146
|
expect(message).to eq("KABOOM!")
|
147
147
|
end
|
148
148
|
end
|
149
|
+
|
150
|
+
describe "#set_index_document" do
|
151
|
+
it "works" do
|
152
|
+
expect(client).to receive(:put_bucket_website).with(
|
153
|
+
bucket: ENV["RAIN_FOREST_AWS_BUCKET"],
|
154
|
+
website_configuration: {
|
155
|
+
index_document: {
|
156
|
+
suffix: "INDEX-DOCUMENT"
|
157
|
+
}
|
158
|
+
}
|
159
|
+
)
|
160
|
+
|
161
|
+
success, message = RainForest::S3.set_index_document("INDEX-DOCUMENT")
|
162
|
+
|
163
|
+
expect(success).to eq(true)
|
164
|
+
expect(message).to eq(nil)
|
165
|
+
end
|
166
|
+
|
167
|
+
it "handles errors" do
|
168
|
+
expect(client).to receive(:put_bucket_website).and_raise(Exception.new("KABOOM!"))
|
169
|
+
|
170
|
+
success, message = RainForest::S3.set_index_document("INDEX-DOCUMENT")
|
171
|
+
|
172
|
+
expect(success).to eq(false)
|
173
|
+
expect(message).to eq("KABOOM!")
|
174
|
+
end
|
175
|
+
end
|
149
176
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rain_forest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas Beaton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|