remote_files 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/remote_files/file_store.rb +1 -1
- data/lib/remote_files/fog_store.rb +10 -1
- data/lib/remote_files/version.rb +1 -1
- data/test/fog_store_test.rb +9 -1
- data/test/test_helper.rb +5 -2
- metadata +9 -3
@@ -35,7 +35,7 @@ module RemoteFiles
|
|
35
35
|
def url(identifier)
|
36
36
|
case options[:provider]
|
37
37
|
when 'AWS'
|
38
|
-
"https
|
38
|
+
"https://#{aws_host}/#{directory_name}/#{Fog::AWS.escape(identifier)}"
|
39
39
|
when 'Rackspace'
|
40
40
|
"https://storage.cloudfiles.com/#{directory_name}/#{Fog::Rackspace.escape(identifier, '/')}"
|
41
41
|
else
|
@@ -77,6 +77,15 @@ module RemoteFiles
|
|
77
77
|
|
78
78
|
protected
|
79
79
|
|
80
|
+
def aws_host
|
81
|
+
case options[:region]
|
82
|
+
when nil, 'us-east-1'
|
83
|
+
's3.amazonaws.com'
|
84
|
+
else
|
85
|
+
"s3-#{options[:region]}.amazonaws.com"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
80
89
|
def lookup_directory
|
81
90
|
connection.directories.get(directory_name)
|
82
91
|
end
|
data/lib/remote_files/version.rb
CHANGED
data/test/fog_store_test.rb
CHANGED
@@ -95,6 +95,14 @@ describe RemoteFiles::FogStore do
|
|
95
95
|
it 'should return an S3 url' do
|
96
96
|
@store.url('identifier').must_equal('https://s3.amazonaws.com/directory/identifier')
|
97
97
|
end
|
98
|
+
|
99
|
+
describe 'in a different region' do
|
100
|
+
before { @store.options[:region] = 'us-west-1' }
|
101
|
+
|
102
|
+
it 'should return an S3 url' do
|
103
|
+
@store.url('identifier').must_equal('https://s3-us-west-1.amazonaws.com/directory/identifier')
|
104
|
+
end
|
105
|
+
end
|
98
106
|
end
|
99
107
|
|
100
108
|
describe 'for CloudFiles connections' do
|
@@ -161,7 +169,7 @@ describe RemoteFiles::FogStore do
|
|
161
169
|
@store.directory.files.create(
|
162
170
|
:body => 'content',
|
163
171
|
:content_type => 'text/plain',
|
164
|
-
:key => 'identifier'
|
172
|
+
:key => 'identifier'
|
165
173
|
)
|
166
174
|
end
|
167
175
|
|
data/test/test_helper.rb
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
require 'bundler/setup'
|
2
2
|
|
3
|
-
|
3
|
+
begin
|
4
|
+
require 'debugger'
|
5
|
+
rescue LoadError => e
|
6
|
+
end
|
4
7
|
|
5
8
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
9
|
require 'remote_files'
|
7
10
|
|
8
11
|
require 'minitest/autorun'
|
9
12
|
|
10
|
-
require 'mocha'
|
13
|
+
require 'mocha/setup'
|
11
14
|
|
12
15
|
Fog.mock!
|
13
16
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remote_files
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
@@ -147,15 +147,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
147
|
- - ! '>='
|
148
148
|
- !ruby/object:Gem::Version
|
149
149
|
version: '0'
|
150
|
+
segments:
|
151
|
+
- 0
|
152
|
+
hash: 2260676373008999041
|
150
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
154
|
none: false
|
152
155
|
requirements:
|
153
156
|
- - ! '>='
|
154
157
|
- !ruby/object:Gem::Version
|
155
158
|
version: '0'
|
159
|
+
segments:
|
160
|
+
- 0
|
161
|
+
hash: 2260676373008999041
|
156
162
|
requirements: []
|
157
163
|
rubyforge_project:
|
158
|
-
rubygems_version: 1.8.
|
164
|
+
rubygems_version: 1.8.25
|
159
165
|
signing_key:
|
160
166
|
specification_version: 3
|
161
167
|
summary: The purpose of the library is to implement a simple interface for uploading
|