anaconda 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a362cf9690829d3184624cbf62dc7a0b91cc555
4
- data.tar.gz: e3fed3967d2f2c8eb7adbee4a64a1f2fa35ecd2b
3
+ metadata.gz: ee4ffc83e23081c0ec4b6d113ade0f8d4cf29ee5
4
+ data.tar.gz: 2cedf6106ce7add799fa92cedc853aca72fec6d9
5
5
  SHA512:
6
- metadata.gz: bc25838f832c4fe24971d5c054dd8da3923781ee02ffc0f3f71415a636ca37646b257697970f7764922d2e11722ca1ab042b5337acdd78abcae6302c87536be8
7
- data.tar.gz: fe04aefa077d7d1da356b7a8fdbd70dbb304321101ed542e5b779b1939e67a738398010942bf5ea37ab1d1b51cb8863ba28e28e2f89d1d7ea42d59fbe90fd705
6
+ metadata.gz: 1ed1a97fbb2cc1c39151f68d871411288b967c4cb055b35e7daf6277621407a6a1e99a5aaf063f29b9a38e61462c072bf2f4fdc0fac99acb9caea4d32ec5eb8d
7
+ data.tar.gz: 3e323b34bcf69aeef2eeea9a71a24c0e959cfa7b590f41aba72a7f76703c9c1a49f897268b977e9b819adbbe5bca97239ac0f3c6d5c8af9087de514368a9ce9e
@@ -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.2
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
 
@@ -23,4 +23,6 @@ Gem::Specification.new do |s|
23
23
 
24
24
  s.add_dependency "jquery-fileupload-rails", "~> 0.4.1"
25
25
  s.add_dependency "javascript_dlog-rails", "~> 1.0.1"
26
+ s.add_dependency "simple_form", "3.0.2"
27
+ s.add_dependency "fog", "~> 1.21"
26
28
  end
@@ -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 => true})
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 => true})
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])}s3.amazonaws.com/#{Anaconda.aws[:aws_bucket]}/#{send("#{column_name}_file_path")}"
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 => true})
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
@@ -1,5 +1,7 @@
1
1
  require 'rails/railtie'
2
2
  require 'anaconda/form_builder_helpers'
3
+ require 'simple_form'
4
+ require 'fog'
3
5
 
4
6
  module Anaconda
5
7
  class Railtie < ::Rails::Railtie
@@ -47,7 +47,7 @@ module Anaconda
47
47
  end
48
48
 
49
49
  def url
50
- "https://s3.amazonaws.com/#{@options[:bucket]}/"
50
+ "https://#{Anaconda.aws[:aws_endpoint]}/"
51
51
  end
52
52
 
53
53
  def policy
@@ -1,5 +1,5 @@
1
1
  module Anaconda
2
2
  module Rails
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  end
@@ -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.2
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: []