paperclip-azure 0.3.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.autotest +25 -0
- data/History.txt +6 -0
- data/Manifest.txt +12 -0
- data/README.txt +110 -0
- data/Rakefile +24 -0
- data/lib/paperclip-azure.rb +2 -2
- data/lib/paperclip/azure.rb +5 -0
- data/lib/paperclip/storage/azure.rb +15 -12
- data/lib/paperclip/storage/azure/environment.rb +19 -0
- data/spec/paperclip/storage/azure/environment_spec.rb +26 -0
- data/spec/spec_helper.rb +30 -0
- metadata +58 -74
- data/LICENSE.txt +0 -20
- data/README.md +0 -63
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a233ac7477aced4158a50fbed0ed87a16be96cc9
|
4
|
+
data.tar.gz: f2fd4c35c33316c5fa8da7bae2e2506b0d8390f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbf61c97fadc054badbb6f946502458303af5dde02c628ee0dd70acae763799c58b6925b88a8d5e76c59c7fb9e6ed23fe023ecc121abfc2af40e23aa16f2180b
|
7
|
+
data.tar.gz: edaee95e6fbd6a7965fadfc4964d69b696025bdeedc4c3af6d6d12b64d604742c169787dbf6ddbf277c0a3ef9da8b276d45488f26941666f69e37e72b14668da
|
data/.autotest
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require "autotest/restart"
|
4
|
+
|
5
|
+
# Autotest.add_hook :initialize do |at|
|
6
|
+
# at.testlib = "minitest/unit"
|
7
|
+
#
|
8
|
+
# at.extra_files << "../some/external/dependency.rb"
|
9
|
+
#
|
10
|
+
# at.libs << ":../some/external"
|
11
|
+
#
|
12
|
+
# at.add_exception "vendor"
|
13
|
+
#
|
14
|
+
# at.add_mapping(/dependency.rb/) do |f, _|
|
15
|
+
# at.files_matching(/test_.*rb$/)
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# %w(TestA TestB).each do |klass|
|
19
|
+
# at.extra_class_map[klass] = "test/test_misc.rb"
|
20
|
+
# end
|
21
|
+
# end
|
22
|
+
|
23
|
+
# Autotest.add_hook :run_command do |at|
|
24
|
+
# system "rake build"
|
25
|
+
# end
|
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
.autotest
|
2
|
+
History.txt
|
3
|
+
Manifest.txt
|
4
|
+
README.txt
|
5
|
+
Rakefile
|
6
|
+
lib/azure/core/auth/shared_access_signature.rb
|
7
|
+
lib/paperclip/storage/azure/environment.rb
|
8
|
+
lib/paperclip/storage/azure.rb
|
9
|
+
lib/paperclip/azure.rb
|
10
|
+
lib/paperclip-azure.rb
|
11
|
+
spec/paperclip/storage/azure/environment_spec.rb
|
12
|
+
spec/spec_helper.rb
|
data/README.txt
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
= paperclip-azure
|
2
|
+
|
3
|
+
home :: https://github.com/supportify/paperclip-azure
|
4
|
+
code :: https://github.com/supportify/paperclip-azure
|
5
|
+
rdoc :: https://www.rubydoc.info/docs/paperclip-azure
|
6
|
+
bugs :: https://github.com/supportify/paperclip-azure/issues
|
7
|
+
|
8
|
+
== DESCRIPTION:
|
9
|
+
|
10
|
+
Paperclip-Azure is a [Paperclip](https://github.com/thoughtbot/paperclip) storage driver for storing files in a Microsoft Azure Blob.
|
11
|
+
|
12
|
+
== FEATURES/PROBLEMS:
|
13
|
+
|
14
|
+
* FIX (list of features or problems)
|
15
|
+
|
16
|
+
== SYNOPSIS:
|
17
|
+
|
18
|
+
The Azure storage engine has been developed to work as similarly to S3 storage configuration as is possible. This gem can be configured in a Paperclip initializer or environment file as follows:
|
19
|
+
|
20
|
+
Paperclip::Attachment.default_options[:storage] = :azure
|
21
|
+
Paperclip::Attachment.default_options[:url] = ':azure_path_url'
|
22
|
+
Paperclip::Attachment.default_options[:path] = ":class/:attachment/:id/:style/:filename"
|
23
|
+
Paperclip::Attachment.default_options[:storage] = :azure
|
24
|
+
Paperclip::Attachment.default_options[:azure_credentials] = {
|
25
|
+
storage_account_name: ENV['AZURE_STORAGE_ACCOUNT'],
|
26
|
+
access_key: ENV['AZURE_ACCESS_KEY'],
|
27
|
+
container: ENV['AZURE_CONTAINER_NAME']
|
28
|
+
}
|
29
|
+
|
30
|
+
Or, at the level of the model such as in the following example:
|
31
|
+
|
32
|
+
has_attached_file :download,
|
33
|
+
storage: :azure,
|
34
|
+
azure_credentials: {
|
35
|
+
storage_account_name: ENV['AZURE_STORAGE_ACCOUNT'],
|
36
|
+
access_key: ENV['AZURE_ACCESS_KEY'],
|
37
|
+
container: ENV['AZURE_CONTAINER_NAME']
|
38
|
+
}
|
39
|
+
|
40
|
+
=== Private Blob Access
|
41
|
+
|
42
|
+
In the even that are using a Blob that has been configured for Private access, you will need to use the Shared Access Signature functionality of Azure. This functionality has been baked in to the `Attachment#expiring_url` method. Simply specify a time and a style and you will get a proper URL as follows:
|
43
|
+
|
44
|
+
object.attachment.expiring_url(30.minutes.since, :thumb)
|
45
|
+
|
46
|
+
For more information about Azure Shared Access Signatures, please refer to [here](http://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-shared-access-signature-part-1/).
|
47
|
+
|
48
|
+
=== Azure Environments
|
49
|
+
|
50
|
+
Microsoft offers specialized Azure implementations for special circumstances should the need arise. As of the most recent update of this gem, the AzureChinaCloud, AzureUSGovernment, and AzureGermanCloud environments all offer specific storage URL's that differ from those of the standard AzureCloud. These regions can be specified via the `:region` key of the `:azure_credentials` dictionary by using the symbols `:cn`, `:usgovt`, and `:de` respectively. When working with one of these environments, simply update your credentials to include the region as follows:
|
51
|
+
|
52
|
+
Paperclip::Attachment.default_options[:azure_credentials] = {
|
53
|
+
storage_account_name: ENV['AZURE_STORAGE_ACCOUNT'],
|
54
|
+
access_key: ENV['AZURE_ACCESS_KEY'],
|
55
|
+
container: ENV['AZURE_CONTAINER_NAME'],
|
56
|
+
region: :de
|
57
|
+
}
|
58
|
+
|
59
|
+
Or, in the instance where the credentials are specified at the model level:
|
60
|
+
|
61
|
+
has_attached_file :download,
|
62
|
+
storage: :azure,
|
63
|
+
azure_credentials: {
|
64
|
+
storage_account_name: ENV['AZURE_STORAGE_ACCOUNT'],
|
65
|
+
access_key: ENV['AZURE_ACCESS_KEY'],
|
66
|
+
container: ENV['AZURE_CONTAINER_NAME'],
|
67
|
+
region: :cn
|
68
|
+
}
|
69
|
+
|
70
|
+
== REQUIREMENTS:
|
71
|
+
|
72
|
+
* An Azure storage account.
|
73
|
+
|
74
|
+
== INSTALL:
|
75
|
+
|
76
|
+
Add this line to your application's Gemfile after the Paperclip gem:
|
77
|
+
|
78
|
+
gem 'paperclip-azure', '~> 1.0'
|
79
|
+
|
80
|
+
And then execute:
|
81
|
+
|
82
|
+
$ bundle install
|
83
|
+
|
84
|
+
== DEVELOPERS:
|
85
|
+
|
86
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
87
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
88
|
+
* Fork the project.
|
89
|
+
* After checking out the source, run:
|
90
|
+
|
91
|
+
$ rake newb
|
92
|
+
|
93
|
+
This task will install any missing dependencies, run the tests/specs, and generate the RDoc.
|
94
|
+
* Start a feature/bugfix branch.
|
95
|
+
* Commit and push until you are happy with your contribution.
|
96
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
97
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
98
|
+
* Submit a pull request for the finished product's integration.
|
99
|
+
|
100
|
+
== LICENSE:
|
101
|
+
|
102
|
+
(The MIT License)
|
103
|
+
|
104
|
+
Copyright (c) 2017 Supportify, Inc.
|
105
|
+
|
106
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
107
|
+
|
108
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
109
|
+
|
110
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require "rubygems"
|
4
|
+
require "hoe"
|
5
|
+
|
6
|
+
Hoe.plugin :bundler
|
7
|
+
Hoe.plugin :debug
|
8
|
+
Hoe.plugin :git
|
9
|
+
Hoe.plugin :gemspec
|
10
|
+
Hoe.plugin :rubygems
|
11
|
+
|
12
|
+
Hoe.spec "paperclip-azure" do
|
13
|
+
developer("hireross.com", "help@hireross.com")
|
14
|
+
license "MIT" # this should match the license in the README
|
15
|
+
|
16
|
+
extra_deps << ['azure', '~> 0.7']
|
17
|
+
extra_deps << ['hashie', '~> 3.5']
|
18
|
+
extra_deps << ['addressable', '~> 2.5']
|
19
|
+
|
20
|
+
extra_dev_deps << ['rspec', '~> 3.0']
|
21
|
+
extra_dev_deps << ['simplecov', '~> 0.14']
|
22
|
+
end
|
23
|
+
|
24
|
+
# vim: syntax=ruby
|
data/lib/paperclip-azure.rb
CHANGED
@@ -8,8 +8,8 @@ module Azure
|
|
8
8
|
BlobService.class_eval do
|
9
9
|
def initialize(signer=Core::Auth::SharedKey.new, account_name=Azure.config.storage_account_name)
|
10
10
|
super(signer, account_name)
|
11
|
-
@host =
|
11
|
+
@host = Paperclip::Storage::AzureRegion.url_for account_name
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
15
|
-
end
|
15
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'paperclip/storage/azure/environment'
|
2
|
+
|
1
3
|
module Paperclip
|
2
4
|
module Storage
|
3
5
|
# Azure's container file hosting service is a scalable, easy place to store files for
|
@@ -49,6 +51,7 @@ module Paperclip
|
|
49
51
|
# to interpolate. Keys should be unique, like filenames, and despite the fact that
|
50
52
|
# Azure (strictly speaking) does not support directories, you can still use a / to
|
51
53
|
# separate parts of your file name.
|
54
|
+
# * +region+: Depending on the region, different base urls are used. Supported values :global, :de
|
52
55
|
|
53
56
|
module Azure
|
54
57
|
def self.extended base
|
@@ -122,14 +125,14 @@ module Paperclip
|
|
122
125
|
|
123
126
|
def obtain_azure_instance_for(options)
|
124
127
|
instances = (Thread.current[:paperclip_azure_instances] ||= {})
|
125
|
-
|
128
|
+
|
126
129
|
unless instances[options]
|
127
130
|
signer = ::Azure::Core::Auth::SharedKey.new options[:storage_account_name], options[:access_key]
|
128
131
|
service = ::Azure::BlobService.new(signer, options[:storage_account_name])
|
129
132
|
|
130
|
-
require 'azure/core/http/retry_policy' # For Some Reason, All Other Loading Locations Fail
|
133
|
+
require 'azure/core/http/retry_policy' # For Some Reason, All Other Loading Locations Fail
|
131
134
|
service.filters << ::Azure::Core::Http::RetryPolicy.new do |response, retry_data|
|
132
|
-
status_code = case
|
135
|
+
status_code = case
|
133
136
|
when !response.nil?
|
134
137
|
response.status_code
|
135
138
|
when !retry_data[:error].nil?
|
@@ -137,9 +140,9 @@ module Paperclip
|
|
137
140
|
else
|
138
141
|
500
|
139
142
|
end
|
140
|
-
status_code = 500 if status_code == 0
|
143
|
+
status_code = 500 if status_code == 0
|
141
144
|
retry_data[:count] ||= 0
|
142
|
-
|
145
|
+
|
143
146
|
if (!response.nil? && response.success? && retry_data[:error].nil?) ||
|
144
147
|
(status_code >= 300 && status_code < 500 && status_code != 408) ||
|
145
148
|
status_code == 501 ||
|
@@ -149,7 +152,7 @@ module Paperclip
|
|
149
152
|
retry_data[:count] = 0
|
150
153
|
else
|
151
154
|
retry_data[:count] += 1
|
152
|
-
|
155
|
+
|
153
156
|
sleep (retry_data[:count] - 1) * 5
|
154
157
|
end
|
155
158
|
|
@@ -159,7 +162,7 @@ module Paperclip
|
|
159
162
|
instances[options] = service
|
160
163
|
end
|
161
164
|
|
162
|
-
instances[options]
|
165
|
+
instances[options]
|
163
166
|
end
|
164
167
|
|
165
168
|
def azure_uri(style_name = default_style)
|
@@ -167,9 +170,9 @@ module Paperclip
|
|
167
170
|
end
|
168
171
|
|
169
172
|
def azure_base_url
|
170
|
-
|
173
|
+
Environment.url_for azure_account_name, @azure_credentials[:region]
|
171
174
|
end
|
172
|
-
|
175
|
+
|
173
176
|
def azure_container
|
174
177
|
@azure_container ||= azure_interface.get_container_properties container_name
|
175
178
|
end
|
@@ -218,7 +221,7 @@ module Paperclip
|
|
218
221
|
if e.status_code == 404
|
219
222
|
create_container
|
220
223
|
retry
|
221
|
-
else
|
224
|
+
else
|
222
225
|
raise
|
223
226
|
end
|
224
227
|
ensure
|
@@ -264,7 +267,7 @@ module Paperclip
|
|
264
267
|
|
265
268
|
def copy_to_local_file(style, local_dest_path)
|
266
269
|
log("copying #{path(style)} to local file #{local_dest_path}")
|
267
|
-
|
270
|
+
|
268
271
|
blob, content = azure_interface.get_blob(container_name, path(style).sub(%r{\A/},''))
|
269
272
|
|
270
273
|
::File.open(local_dest_path, 'wb') do |local_file|
|
@@ -272,7 +275,7 @@ module Paperclip
|
|
272
275
|
end
|
273
276
|
rescue ::Azure::Core::Http::HTTPError => e
|
274
277
|
raise unless e.status_code == 404
|
275
|
-
|
278
|
+
|
276
279
|
warn("#{e} - cannot copy #{path(style)} to local file #{local_dest_path}")
|
277
280
|
false
|
278
281
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Paperclip
|
2
|
+
module Storage
|
3
|
+
module Azure
|
4
|
+
class Environment
|
5
|
+
|
6
|
+
ENVIRONMENT_SUFFIX = {
|
7
|
+
global: 'core.windows.net',
|
8
|
+
cn: 'core.chinacloudapi.cn',
|
9
|
+
de: "core.cloudapi.de",
|
10
|
+
usgovt: 'core.usgovcloudapi.net'
|
11
|
+
}
|
12
|
+
|
13
|
+
def self.url_for(account_name, region = :global)
|
14
|
+
"#{account_name}.blob.#{ENVIRONMENT_SUFFIX[region]}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'paperclip/storage/azure/environment'
|
3
|
+
|
4
|
+
describe 'Paperclip::Storage::Azure::Environment' do
|
5
|
+
subject { Paperclip::Storage::Azure::Environment }
|
6
|
+
|
7
|
+
describe '#url_for' do
|
8
|
+
let(:account_name) { 'foo' }
|
9
|
+
|
10
|
+
describe 'when the region is not supplied' do
|
11
|
+
it { expect(subject.url_for(account_name)).to eq("#{account_name}.blob.core.windows.net")}
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'when the region is China' do
|
15
|
+
it { expect(subject.url_for(account_name, :cn)).to eq("#{account_name}.blob.core.chinacloudapi.cn")}
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'when the region is Germany' do
|
19
|
+
it { expect(subject.url_for(account_name, :de)).to eq("#{account_name}.blob.core.cloudapi.de")}
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'when the region is the US Govt' do
|
23
|
+
it { expect(subject.url_for(account_name, :usgovt)).to eq("#{account_name}.blob.core.usgovcloudapi.net")}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'rspec'
|
3
|
+
|
4
|
+
ROOT = Pathname(File.expand_path(File.join(File.dirname(__FILE__), '..')))
|
5
|
+
|
6
|
+
module SimpleCov::Configuration
|
7
|
+
def clean_filters
|
8
|
+
@filters = []
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
SimpleCov.configure do
|
13
|
+
clean_filters
|
14
|
+
load_adapter 'test_frameworks'
|
15
|
+
end
|
16
|
+
|
17
|
+
ENV["COVERAGE"] && SimpleCov.start do
|
18
|
+
add_filter "/.rvm/"
|
19
|
+
end
|
20
|
+
|
21
|
+
$LOAD_PATH << File.join(ROOT, 'lib')
|
22
|
+
$LOAD_PATH << File.join(ROOT, 'lib', 'paperclip')
|
23
|
+
require File.join(ROOT, 'lib', 'paperclip-azure.rb')
|
24
|
+
|
25
|
+
# Requires supporting files with custom matchers and macros, etc,
|
26
|
+
# in ./support/ and its subdirectories.
|
27
|
+
Dir[File.join(ROOT, 'spec', 'support', '**', '*.rb')].each{|f| require f }
|
28
|
+
|
29
|
+
RSpec.configure do |config|
|
30
|
+
end
|
metadata
CHANGED
@@ -1,177 +1,161 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperclip-azure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
- Supportify, Inc.
|
7
|
+
- hireross.com
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2017-07-31 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: azure
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
16
|
requirements:
|
18
|
-
- -
|
17
|
+
- - "~>"
|
19
18
|
- !ruby/object:Gem::Version
|
20
|
-
version: '0'
|
19
|
+
version: '0.7'
|
21
20
|
type: :runtime
|
22
21
|
prerelease: false
|
23
22
|
version_requirements: !ruby/object:Gem::Requirement
|
24
23
|
requirements:
|
25
|
-
- -
|
24
|
+
- - "~>"
|
26
25
|
- !ruby/object:Gem::Version
|
27
|
-
version: '0'
|
26
|
+
version: '0.7'
|
28
27
|
- !ruby/object:Gem::Dependency
|
29
28
|
name: hashie
|
30
29
|
requirement: !ruby/object:Gem::Requirement
|
31
30
|
requirements:
|
32
|
-
- -
|
31
|
+
- - "~>"
|
33
32
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
33
|
+
version: '3.5'
|
35
34
|
type: :runtime
|
36
35
|
prerelease: false
|
37
36
|
version_requirements: !ruby/object:Gem::Requirement
|
38
37
|
requirements:
|
39
|
-
- -
|
38
|
+
- - "~>"
|
40
39
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
40
|
+
version: '3.5'
|
42
41
|
- !ruby/object:Gem::Dependency
|
43
42
|
name: addressable
|
44
43
|
requirement: !ruby/object:Gem::Requirement
|
45
44
|
requirements:
|
46
|
-
- -
|
45
|
+
- - "~>"
|
47
46
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
47
|
+
version: '2.5'
|
49
48
|
type: :runtime
|
50
49
|
prerelease: false
|
51
50
|
version_requirements: !ruby/object:Gem::Requirement
|
52
51
|
requirements:
|
53
|
-
- -
|
52
|
+
- - "~>"
|
54
53
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
54
|
+
version: '2.5'
|
56
55
|
- !ruby/object:Gem::Dependency
|
57
56
|
name: rspec
|
58
57
|
requirement: !ruby/object:Gem::Requirement
|
59
58
|
requirements:
|
60
|
-
- - ~>
|
59
|
+
- - "~>"
|
61
60
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
61
|
+
version: '3.0'
|
63
62
|
type: :development
|
64
63
|
prerelease: false
|
65
64
|
version_requirements: !ruby/object:Gem::Requirement
|
66
65
|
requirements:
|
67
|
-
- - ~>
|
66
|
+
- - "~>"
|
68
67
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
68
|
+
version: '3.0'
|
70
69
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
70
|
+
name: simplecov
|
72
71
|
requirement: !ruby/object:Gem::Requirement
|
73
72
|
requirements:
|
74
|
-
- - ~>
|
73
|
+
- - "~>"
|
75
74
|
- !ruby/object:Gem::Version
|
76
|
-
version: '0.
|
75
|
+
version: '0.14'
|
77
76
|
type: :development
|
78
77
|
prerelease: false
|
79
78
|
version_requirements: !ruby/object:Gem::Requirement
|
80
79
|
requirements:
|
81
|
-
- - ~>
|
80
|
+
- - "~>"
|
82
81
|
- !ruby/object:Gem::Version
|
83
|
-
version: '0.
|
82
|
+
version: '0.14'
|
84
83
|
- !ruby/object:Gem::Dependency
|
85
84
|
name: rdoc
|
86
85
|
requirement: !ruby/object:Gem::Requirement
|
87
86
|
requirements:
|
88
|
-
- - ~>
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: '3.12'
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - ~>
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '3.12'
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: bundler
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - ~>
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: '1.0'
|
105
|
-
type: :development
|
106
|
-
prerelease: false
|
107
|
-
version_requirements: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - ~>
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '1.0'
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
name: jeweler
|
114
|
-
requirement: !ruby/object:Gem::Requirement
|
115
|
-
requirements:
|
116
|
-
- - ~>
|
87
|
+
- - "~>"
|
117
88
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
89
|
+
version: '4.0'
|
119
90
|
type: :development
|
120
91
|
prerelease: false
|
121
92
|
version_requirements: !ruby/object:Gem::Requirement
|
122
93
|
requirements:
|
123
|
-
- - ~>
|
94
|
+
- - "~>"
|
124
95
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
96
|
+
version: '4.0'
|
126
97
|
- !ruby/object:Gem::Dependency
|
127
|
-
name:
|
98
|
+
name: hoe
|
128
99
|
requirement: !ruby/object:Gem::Requirement
|
129
100
|
requirements:
|
130
|
-
- -
|
101
|
+
- - "~>"
|
131
102
|
- !ruby/object:Gem::Version
|
132
|
-
version: '
|
103
|
+
version: '3.16'
|
133
104
|
type: :development
|
134
105
|
prerelease: false
|
135
106
|
version_requirements: !ruby/object:Gem::Requirement
|
136
107
|
requirements:
|
137
|
-
- -
|
108
|
+
- - "~>"
|
138
109
|
- !ruby/object:Gem::Version
|
139
|
-
version: '
|
140
|
-
description:
|
141
|
-
|
110
|
+
version: '3.16'
|
111
|
+
description: Paperclip-Azure is a [Paperclip](https://github.com/thoughtbot/paperclip)
|
112
|
+
storage driver for storing files in a Microsoft Azure Blob.
|
113
|
+
email:
|
114
|
+
- help@hireross.com
|
142
115
|
executables: []
|
143
116
|
extensions: []
|
144
117
|
extra_rdoc_files:
|
145
|
-
-
|
146
|
-
-
|
118
|
+
- History.txt
|
119
|
+
- Manifest.txt
|
120
|
+
- README.txt
|
147
121
|
files:
|
148
|
-
-
|
149
|
-
-
|
122
|
+
- ".autotest"
|
123
|
+
- History.txt
|
124
|
+
- Manifest.txt
|
125
|
+
- README.txt
|
126
|
+
- Rakefile
|
150
127
|
- lib/azure/core/auth/shared_access_signature.rb
|
151
128
|
- lib/paperclip-azure.rb
|
129
|
+
- lib/paperclip/azure.rb
|
152
130
|
- lib/paperclip/storage/azure.rb
|
153
|
-
|
131
|
+
- lib/paperclip/storage/azure/environment.rb
|
132
|
+
- spec/paperclip/storage/azure/environment_spec.rb
|
133
|
+
- spec/spec_helper.rb
|
134
|
+
homepage: https://github.com/supportify/paperclip-azure
|
154
135
|
licenses:
|
155
136
|
- MIT
|
156
137
|
metadata: {}
|
157
138
|
post_install_message:
|
158
|
-
rdoc_options:
|
139
|
+
rdoc_options:
|
140
|
+
- "--main"
|
141
|
+
- README.txt
|
159
142
|
require_paths:
|
160
143
|
- lib
|
161
144
|
required_ruby_version: !ruby/object:Gem::Requirement
|
162
145
|
requirements:
|
163
|
-
- -
|
146
|
+
- - ">="
|
164
147
|
- !ruby/object:Gem::Version
|
165
148
|
version: '0'
|
166
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
150
|
requirements:
|
168
|
-
- -
|
151
|
+
- - ">="
|
169
152
|
- !ruby/object:Gem::Version
|
170
153
|
version: '0'
|
171
154
|
requirements: []
|
172
155
|
rubyforge_project:
|
173
|
-
rubygems_version: 2.
|
156
|
+
rubygems_version: 2.5.1
|
174
157
|
signing_key:
|
175
158
|
specification_version: 4
|
176
|
-
summary:
|
159
|
+
summary: Paperclip-Azure is a [Paperclip](https://github.com/thoughtbot/paperclip)
|
160
|
+
storage driver for storing files in a Microsoft Azure Blob.
|
177
161
|
test_files: []
|
data/LICENSE.txt
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2015 Jordan Yaker
|
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/README.md
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
# paperclip-azure
|
2
|
-
|
3
|
-
Paperclip-Azure is a [Paperclip](https://github.com/thoughtbot/paperclip) storage driver for storing files in a Microsoft Azure Blob.
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile after the Paperclip gem:
|
8
|
-
|
9
|
-
gem 'paperclip-azure'
|
10
|
-
|
11
|
-
And then execute:
|
12
|
-
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
## Usage
|
16
|
-
|
17
|
-
The Azure storage engine has been developed to work as similarly to S3 storage configuration as is possible. This gem can be configured in a Paperclip initializer as follows:
|
18
|
-
|
19
|
-
Paperclip::Attachment.default_options[:storage] = :azure
|
20
|
-
Paperclip::Attachment.default_options[:url] = ':azure_path_url'
|
21
|
-
Paperclip::Attachment.default_options[:path] = ":class/:attachment/:id/:style/:filename"
|
22
|
-
Paperclip::Attachment.default_options[:storage] = :azure
|
23
|
-
Paperclip::Attachment.default_options[:azure_credentials] = {
|
24
|
-
storage_account_name: ENV['AZURE_STORAGE_ACCOUNT'],
|
25
|
-
access_key: ENV['AZURE_ACCESS_KEY'],
|
26
|
-
container: ENV['AZURE_CONTAINER_NAME']
|
27
|
-
}
|
28
|
-
|
29
|
-
Or, at the level of the model such as in the following example:
|
30
|
-
|
31
|
-
has_attached_file :download,
|
32
|
-
storage: :azure,
|
33
|
-
azure_credentials: {
|
34
|
-
storage_account_name: ENV['AZURE_STORAGE_ACCOUNT'],
|
35
|
-
access_key: ENV['AZURE_ACCESS_KEY'],
|
36
|
-
container: ENV['AZURE_CONTAINER_NAME']
|
37
|
-
}
|
38
|
-
|
39
|
-
|
40
|
-
## Private Blob Access
|
41
|
-
|
42
|
-
In the even that are using a Blob that has been configured for Private access, you will need to use the Shared Access Signature functionality of Azure. This functionality has been baked in to the `Attachment#expiring_url` method. Simply specify a time and a style and you will get a proper URL as follows:
|
43
|
-
|
44
|
-
object.attachment.expiring_url(30.minutes.since, :thumb)
|
45
|
-
|
46
|
-
For more information about Azure Shared Access Signatures, please refer to [here](http://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-shared-access-signature-part-1/).
|
47
|
-
|
48
|
-
## Contributing to paperclip-azure
|
49
|
-
|
50
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
51
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
52
|
-
* Fork the project.
|
53
|
-
* Start a feature/bugfix branch.
|
54
|
-
* Commit and push until you are happy with your contribution.
|
55
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
56
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
57
|
-
* Submit a pull request for the finished product's integration.
|
58
|
-
|
59
|
-
## Copyright
|
60
|
-
|
61
|
-
Copyright (c) 2015. See [LICENSE](LICENSE.txt) for
|
62
|
-
further details.
|
63
|
-
|