anaconda 1.0.2 → 1.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.
- checksums.yaml +4 -4
- data/README.markdown +5 -1
- data/anaconda.gemspec +2 -0
- data/lib/anaconda.rb +6 -2
- data/lib/anaconda/anaconda_for.rb +3 -3
- data/lib/anaconda/railtie.rb +2 -0
- data/lib/anaconda/s3_uploader.rb +1 -1
- data/lib/anaconda/version.rb +1 -1
- data/lib/generators/anaconda/templates/config/initializers/anaconda.rb +2 -1
- metadata +29 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee4ffc83e23081c0ec4b6d113ade0f8d4cf29ee5
|
4
|
+
data.tar.gz: 2cedf6106ce7add799fa92cedc853aca72fec6d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ed1a97fbb2cc1c39151f68d871411288b967c4cb055b35e7daf6277621407a6a1e99a5aaf063f29b9a38e61462c072bf2f4fdc0fac99acb9caea4d32ec5eb8d
|
7
|
+
data.tar.gz: 3e323b34bcf69aeef2eeea9a71a24c0e959cfa7b590f41aba72a7f76703c9c1a49f897268b977e9b819adbbe5bca97239ac0f3c6d5c8af9087de514368a9ce9e
|
data/README.markdown
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Dead simple direct-to-s3 file uploading for your rails app.
|
4
4
|
|
5
|
-
Current Version: 1.0.
|
5
|
+
Current Version: 1.0.3
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -202,6 +202,10 @@ If you return false to the following events it will prevent the default behavior
|
|
202
202
|
From version 1.0.0 on we have used [Semantic Versioning](http://semver.org/).
|
203
203
|
|
204
204
|
## Changelog
|
205
|
+
* 1.0.3
|
206
|
+
* Properly define dependencies so they are included
|
207
|
+
* Add support for non US Standard region buckets. See new `aws_endpoint` option in the config
|
208
|
+
|
205
209
|
* 1.0.2
|
206
210
|
* Refactor S3Uploader into it's own class so it can be used outside of the form helper
|
207
211
|
|
data/anaconda.gemspec
CHANGED
data/lib/anaconda.rb
CHANGED
@@ -16,7 +16,8 @@ module Anaconda
|
|
16
16
|
@@aws = {
|
17
17
|
aws_access_key: "",
|
18
18
|
aws_secret_key: "",
|
19
|
-
aws_bucket: ""
|
19
|
+
aws_bucket: "",
|
20
|
+
aws_endpoint: ""
|
20
21
|
}
|
21
22
|
|
22
23
|
@@file_types = {
|
@@ -30,6 +31,9 @@ module Anaconda
|
|
30
31
|
# to create a fresh initializer with all configuration values.
|
31
32
|
def self.config
|
32
33
|
yield self
|
34
|
+
|
35
|
+
@@aws[:aws_endpoint] = "s3.amazonaws.com/#{@@aws[:aws_bucket]}" unless @@aws[:aws_endpoint].present?
|
36
|
+
@@aws[:path_style] = !@@aws[:aws_endpoint].starts_with?(@@aws[:aws_bucket])
|
33
37
|
end
|
34
38
|
|
35
39
|
def self.js_file_types
|
@@ -52,7 +56,7 @@ module Anaconda
|
|
52
56
|
end
|
53
57
|
|
54
58
|
def self.remove_s3_object_in_bucket_with_file_path(bucket, file_path)
|
55
|
-
aws = Fog::Storage.new({:provider => 'AWS', :aws_access_key_id => Anaconda.aws[:aws_access_key], :aws_secret_access_key => Anaconda.aws[:aws_secret_key], :path_style =>
|
59
|
+
aws = Fog::Storage.new({:provider => 'AWS', :aws_access_key_id => Anaconda.aws[:aws_access_key], :aws_secret_access_key => Anaconda.aws[:aws_secret_key], :path_style => @@aws[:path_style]})
|
56
60
|
aws.delete_object(bucket, file_path)
|
57
61
|
end
|
58
62
|
end
|
@@ -94,12 +94,12 @@ module Anaconda
|
|
94
94
|
logger.debug(options)
|
95
95
|
|
96
96
|
if send("#{column_name}_stored_privately")
|
97
|
-
aws = Fog::Storage.new({:provider => 'AWS', :aws_access_key_id => Anaconda.aws[:aws_access_key], :aws_secret_access_key => Anaconda.aws[:aws_secret_key], :path_style =>
|
97
|
+
aws = Fog::Storage.new({:provider => 'AWS', :aws_access_key_id => Anaconda.aws[:aws_access_key], :aws_secret_access_key => Anaconda.aws[:aws_secret_key], :path_style => Anaconda.aws[:path_style]})
|
98
98
|
aws.get_object_https_url(Anaconda.aws[:aws_bucket], send("#{column_name}_file_path"), 1.hour.from_now)
|
99
99
|
elsif self.anaconda_options[column_name.to_sym][:host]
|
100
100
|
"#{anaconda_protocol(column_name, options[:protocol])}#{self.anaconda_options[column_name.to_sym][:host]}/#{send("#{column_name}_file_path")}"
|
101
101
|
else
|
102
|
-
"#{anaconda_protocol(column_name, options[:protocol])}
|
102
|
+
"#{anaconda_protocol(column_name, options[:protocol])}#{Anaconda.aws[:aws_endpoint]}/#{send("#{column_name}_file_path")}"
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
@@ -107,7 +107,7 @@ module Anaconda
|
|
107
107
|
return nil unless send("#{column_name}_file_path").present?
|
108
108
|
|
109
109
|
options = {query: {"response-content-disposition" => "attachment;"}}
|
110
|
-
aws = Fog::Storage.new({:provider => 'AWS', :aws_access_key_id => Anaconda.aws[:aws_access_key], :aws_secret_access_key => Anaconda.aws[:aws_secret_key], :path_style =>
|
110
|
+
aws = Fog::Storage.new({:provider => 'AWS', :aws_access_key_id => Anaconda.aws[:aws_access_key], :aws_secret_access_key => Anaconda.aws[:aws_secret_key], :path_style => Anaconda.aws[:path_style]})
|
111
111
|
aws.get_object_https_url(Anaconda.aws[:aws_bucket], send("#{column_name}_file_path"), 1.hour.from_now, options)
|
112
112
|
|
113
113
|
end
|
data/lib/anaconda/railtie.rb
CHANGED
data/lib/anaconda/s3_uploader.rb
CHANGED
data/lib/anaconda/version.rb
CHANGED
@@ -3,7 +3,8 @@ Anaconda.config do |config|
|
|
3
3
|
config.aws = {
|
4
4
|
aws_access_key: ENV["AWS_ACCESS_KEY"] || nil,
|
5
5
|
aws_secret_key: ENV["AWS_SECRET_KEY"] || nil,
|
6
|
-
aws_bucket: ENV["AWS_BUCKET"] || nil
|
6
|
+
aws_bucket: ENV["AWS_BUCKET"] || nil,
|
7
|
+
aws_endpoint: ENV["AWS_ENDPOINT"] || nil, # example: anaconda-demo.s3-us-west-2.amazonaws.com or s3.amazonaws.com/not.dns.friendly.bucket
|
7
8
|
}
|
8
9
|
config.file_types = {
|
9
10
|
audio: /(\.|\/)(wav|mp3|m4a|aiff|ogg|flac)$/,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anaconda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben McFadden
|
@@ -39,6 +39,34 @@ dependencies:
|
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: 1.0.1
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: simple_form
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 3.0.2
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 3.0.2
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: fog
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.21'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.21'
|
42
70
|
description: Dead simple file uploading to S3
|
43
71
|
email: ben@forgeapps.com
|
44
72
|
executables: []
|