s3 0.3.25 → 0.3.26

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 66cf7c8b5f8f96174d65bedf2a54160503f6036b
4
- data.tar.gz: f78a9262d7b9972116f2125ee8f118a467200c5e
2
+ SHA256:
3
+ metadata.gz: 4ba1a66cd1b2070360712c3ec3ad0bdc01b35821f87dc6241307558b3ec99f5a
4
+ data.tar.gz: 0afd07c4159fa258eb415e611f56d3d069d9f789563aa57225fda26c914eb448
5
5
  SHA512:
6
- metadata.gz: a61766e049d380fc82a53d709e68caa36e44e250f981412139264d7c23b6f3a4e68169c9a1389a194f3ee1e83208bbe70be9b91a8f23d7cd092cffbfc63af773
7
- data.tar.gz: 0135258cb2c6dc9b32f3c1b6e1b56c1984944f3a6d42365781c2b77b68ee92ccbed86902d55995ae93da9442734c8445aadb9ff35ee0e48fc0e5bbd32fb71e59
6
+ metadata.gz: 06aab60c71c763fe50bc79f6461ff580627f5d58d7016d433aab2fe83ab861faf22dcb723f18cae494ff9a5f440ff652110a56cbfb1897adfd2ac3d8ce9f36dd
7
+ data.tar.gz: 48aaf87bf566a218f2cd84b18186d77c82a74a550fccf465a6bef3c6a49490f463a9d2ea56f624c1c9c2fc42d94fbc94434311654c4944ce2b246f6a6ffaaa47
data/.gitignore CHANGED
@@ -1,7 +1,8 @@
1
- *.sw?
2
- .DS_Store
3
- coverage
4
- rdoc
5
- pkg
6
- *.gem
7
- .bundle
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
@@ -1,7 +1,5 @@
1
+ sudo: false
1
2
  language: ruby
2
3
  rvm:
3
- - 1.9.3
4
- - 2.0.0
5
- - 2.1
6
- - 2.2
7
- sudo: false
4
+ - 2.5.0
5
+ before_install: gem install bundler -v 1.16.1
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at kuba@jah.pl. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile CHANGED
@@ -1,2 +1,6 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in s3.gemspec
2
6
  gemspec
@@ -2,29 +2,33 @@ PATH
2
2
  remote: .
3
3
  specs:
4
4
  s3 (0.3.25)
5
- proxies (~> 0.2.0)
5
+ addressable
6
+ proxies
6
7
 
7
8
  GEM
8
- remote: http://rubygems.org/
9
+ remote: https://rubygems.org/
9
10
  specs:
11
+ addressable (2.5.2)
12
+ public_suffix (>= 2.0.2, < 4.0)
10
13
  metaclass (0.0.4)
11
- mocha (1.2.1)
14
+ mocha (1.3.0)
12
15
  metaclass (~> 0.0.1)
13
- power_assert (0.3.1)
14
- proxies (0.2.1)
15
- rake (11.3.0)
16
- test-unit (3.2.1)
16
+ power_assert (1.1.1)
17
+ proxies (0.2.3)
18
+ public_suffix (3.0.1)
19
+ rake (10.5.0)
20
+ test-unit (3.2.7)
17
21
  power_assert
18
22
 
19
23
  PLATFORMS
20
24
  ruby
21
25
 
22
26
  DEPENDENCIES
23
- bundler
27
+ bundler (~> 1.16)
24
28
  mocha
25
- rake
29
+ rake (~> 10.0)
26
30
  s3!
27
31
  test-unit
28
32
 
29
33
  BUNDLED WITH
30
- 1.12.5
34
+ 1.16.1
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Kuba Kuźma
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,21 +1,10 @@
1
- require "bundler"
2
- Bundler::GemHelper.install_tasks
3
- Bundler.setup
4
-
1
+ require "bundler/gem_tasks"
5
2
  require "rake/testtask"
6
- require "rdoc/task"
7
-
8
- Rake::TestTask.new(:test) do |test|
9
- test.libs << "lib" << "test"
10
- test.pattern = "test/**/*_test.rb"
11
- test.verbose = true
12
- end
13
3
 
14
- Rake::RDocTask.new do |rdoc|
15
- rdoc.rdoc_dir = "rdoc"
16
- rdoc.title = "s3 #{S3::VERSION}"
17
- rdoc.rdoc_files.include("README.rdoc")
18
- rdoc.rdoc_files.include("lib/**/*.rb")
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
19
8
  end
20
9
 
21
10
  task :default => :test
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "s3"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/lib/s3.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require "addressable/uri"
1
2
  require "base64"
2
3
  require "cgi"
3
4
  require "digest/md5"
@@ -23,7 +24,7 @@ require "s3/version"
23
24
 
24
25
  module S3
25
26
  class << self
26
- attr_accessor :host # Default host serving S3 stuff
27
+ attr_writer :host # Default host serving S3 stuff
27
28
  def host
28
29
  @host ||= "s3.amazonaws.com"
29
30
  end
@@ -2,11 +2,9 @@ module S3
2
2
  class Bucket
3
3
  include Parser
4
4
  include Proxies
5
- extend Forwardable
6
5
 
7
6
  attr_reader :name, :service, :acl
8
7
 
9
- def_instance_delegators :service, :service_request
10
8
  private_class_method :new
11
9
 
12
10
  # Retrieves the bucket information from the server. Raises an
@@ -206,12 +204,11 @@ module S3
206
204
 
207
205
  def bucket_request(method, options = {})
208
206
  path = "#{path_prefix}#{options[:path]}"
209
- service_request(method, options.merge(:host => host, :path => path))
207
+ service.send(:service_request, method, options.merge(:host => host, :path => path))
210
208
  end
211
209
 
212
210
  def name_valid?(name)
213
211
  name =~ /\A[a-z0-9][a-z0-9\._-]{2,254}\Z/i and name !~ /\A#{URI::REGEXP::PATTERN::IPV4ADDR}\Z/
214
212
  end
215
-
216
213
  end
217
214
  end
@@ -62,7 +62,7 @@ module S3
62
62
 
63
63
  # Must be done before adding params
64
64
  # Encodes all characters except forward-slash (/) and explicitly legal URL characters
65
- path = URI.escape(path, /[^#{URI::REGEXP::PATTERN::UNRESERVED}\/]/)
65
+ path = Addressable::URI.escape(path)
66
66
 
67
67
  if params
68
68
  params = params.is_a?(String) ? params : self.class.parse_params(params)
@@ -118,7 +118,7 @@ module S3
118
118
  # Returns Object's URL using protocol specified in service,
119
119
  # e.g. <tt>http://domain.com.s3.amazonaws.com/key/with/path.extension</tt>
120
120
  def url
121
- "#{protocol}#{host}/#{path_prefix}#{URI.escape(key, /[^#{URI::REGEXP::PATTERN::UNRESERVED}\/]/)}"
121
+ "#{protocol}#{host}/#{path_prefix}#{Addressable::URI.escape(key)}"
122
122
  end
123
123
 
124
124
  # Returns a temporary url to the object that expires on the
@@ -138,7 +138,7 @@ module S3
138
138
  # have to set the CNAME in your DNS before using the CNAME URL
139
139
  # schema).
140
140
  def cname_url
141
- URI.escape("#{protocol}#{name}/#{key}") if bucket.vhost?
141
+ Addressable::URI.escape("#{protocol}#{name}/#{key}") if bucket.vhost?
142
142
  end
143
143
 
144
144
  def inspect #:nodoc:
@@ -147,7 +147,7 @@ module S3
147
147
 
148
148
  private
149
149
 
150
- attr_writer :last_modified, :etag, :size, :original_key, :bucket
150
+ attr_writer :size, :original_key, :bucket
151
151
 
152
152
  def copy_object(options = {})
153
153
  key = options[:key] or raise ArgumentError, "No key given"
@@ -206,6 +206,21 @@ module S3
206
206
  end
207
207
 
208
208
  def initialize(bucket, options = {})
209
+ @content_type = nil
210
+ @content_encoding = nil
211
+ @content_disposition = nil
212
+ @cache_control = nil
213
+ @acl = nil
214
+ @last_modified = nil
215
+ @etag = nil
216
+ @size = nil
217
+ @bucket = nil
218
+ @key = nil
219
+ @acl = nil
220
+ @storage_class = nil
221
+ @metadata = nil
222
+ @content = nil
223
+
209
224
  self.bucket = bucket
210
225
  self.key = options[:key]
211
226
  self.last_modified = options[:last_modified]
@@ -61,30 +61,30 @@ module S3
61
61
 
62
62
  private
63
63
 
64
- def convert_uri_to_group_name(uri)
65
- case uri
66
- when "http://acs.amazonaws.com/groups/global/AllUsers"
67
- return "Everyone"
68
- when "http://acs.amazonaws.com/groups/global/AuthenticatedUsers"
69
- return "Authenticated Users"
70
- when "http://acs.amazonaws.com/groups/s3/LogDelivery"
71
- return "Log Delivery"
72
- else
73
- return uri
74
- end
64
+ def convert_uri_to_group_name(uri)
65
+ case uri
66
+ when "http://acs.amazonaws.com/groups/global/AllUsers"
67
+ return "Everyone"
68
+ when "http://acs.amazonaws.com/groups/global/AuthenticatedUsers"
69
+ return "Authenticated Users"
70
+ when "http://acs.amazonaws.com/groups/s3/LogDelivery"
71
+ return "Log Delivery"
72
+ else
73
+ return uri
75
74
  end
75
+ end
76
76
 
77
- def extract_grantee(grant)
78
- grants = {}
79
- grant.each_element_with_attribute("xsi:type", "Group") do |grantee|
80
- group_name = convert_uri_to_group_name(grantee.get_text("URI").value)
81
- grants[group_name] = grant.get_text("Permission").value
82
- end
83
- grant.each_element_with_attribute("xsi:type", "CanonicalUser") do |grantee|
84
- user_name = grantee.get_text("DisplayName").value
85
- grants[user_name] = grant.get_text("Permission").value
86
- end
87
- grants
88
- end
77
+ def extract_grantee(grant)
78
+ grants = {}
79
+ grant.each_element_with_attribute("xsi:type", "Group") do |grantee|
80
+ group_name = convert_uri_to_group_name(grantee.get_text("URI").value)
81
+ grants[group_name] = grant.get_text("Permission").value
82
+ end
83
+ grant.each_element_with_attribute("xsi:type", "CanonicalUser") do |grantee|
84
+ user_name = grantee.get_text("DisplayName").value
85
+ grants[user_name] = grant.get_text("Permission").value
86
+ end
87
+ grants
88
+ end
89
89
  end
90
90
  end
@@ -52,13 +52,12 @@ module S3
52
52
  def self.generate_temporary_url_signature(options)
53
53
  bucket = options[:bucket]
54
54
  resource = options[:resource]
55
- secret_access_key = options[:secret_access_key]
56
55
  expires = options[:expires_at]
57
56
 
58
57
  headers = options[:headers] || {}
59
58
  headers.merge!("date" => expires.to_i.to_s)
60
59
 
61
- resource = "/#{URI.escape(resource, /[^#{URI::REGEXP::PATTERN::UNRESERVED}\/]/)}"
60
+ resource = "/#{Addressable::URI.escape(resource)}"
62
61
  resource = "/#{bucket}" + resource unless options[:add_bucket_to_host]
63
62
 
64
63
  options.merge!(:resource => resource,
@@ -113,7 +112,6 @@ module S3
113
112
  headers = options[:headers] || {}
114
113
  host = options[:host] || ""
115
114
  resource = options[:resource]
116
- access_key_id = options[:access_key_id]
117
115
  secret_access_key = options[:secret_access_key]
118
116
 
119
117
  http_verb = options[:method].to_s.upcase
@@ -1,3 +1,3 @@
1
1
  module S3
2
- VERSION = "0.3.25"
2
+ VERSION = "0.3.26"
3
3
  end
data/s3.gemspec CHANGED
@@ -1,31 +1,31 @@
1
- # -*- encoding: utf-8 -*-
1
+ # coding: utf-8
2
2
 
3
- # Load version requiring the canonical "s3/version", otherwise Ruby will think
4
- # is a different file and complaint about a double declaration of S3::VERSION.
5
- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
3
+ lib = File.expand_path("../lib", __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
5
  require "s3/version"
7
6
 
8
- Gem::Specification.new do |s|
9
- s.name = "s3"
10
- s.version = S3::VERSION
11
- s.platform = Gem::Platform::RUBY
12
- s.authors = ["Kuba Kuźma"]
13
- s.email = ["kuba@jah.pl"]
14
- s.homepage = "http://github.com/qoobaa/s3"
15
- s.summary = "Library for accessing S3 objects and buckets"
16
- s.description = "S3 library provides access to Amazon's Simple Storage Service. It supports both: European and US buckets through REST API."
17
- s.license = "MIT"
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "s3"
9
+ spec.version = S3::VERSION
10
+ spec.authors = ["Kuba Kuźma"]
11
+ spec.email = ["kuba@jah.pl"]
18
12
 
19
- s.required_rubygems_version = ">= 1.3.6"
20
- s.rubyforge_project = "s3"
13
+ spec.summary = "Library for accessing S3 objects and buckets"
14
+ spec.description = "S3 library provides access to Amazon's Simple Storage Service."
15
+ spec.homepage = "http://github.com/qoobaa/s3"
16
+ spec.license = "MIT"
21
17
 
22
- s.add_dependency "proxies", "~> 0.2.0"
23
- s.add_development_dependency "rake"
24
- s.add_development_dependency "test-unit"
25
- s.add_development_dependency "mocha"
26
- s.add_development_dependency "bundler"
18
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
+ f.match(%r{^(test|spec|features)/})
20
+ end
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
27
24
 
28
- s.files = `git ls-files`.split("\n")
29
- s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
30
- s.require_path = "lib"
25
+ spec.add_development_dependency "bundler", "~> 1.16"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "test-unit"
28
+ spec.add_development_dependency "mocha"
29
+ spec.add_dependency "addressable"
30
+ spec.add_dependency "proxies"
31
31
  end