Skip to content

Commit

Permalink
Drop Ruby<2.0 support
Browse files Browse the repository at this point in the history
Users requiring ruby 1.9 or older should use the main fog gem.
  • Loading branch information
tbrisker committed Oct 23, 2017
1 parent e36bccc commit 5cb6eda
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 64 deletions.
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ branches:
matrix:
fast_finish: true
include:
- rvm: 1.8.7
gemfile: gemfiles/Gemfile-ruby-1.8.7
- rvm: 1.9.3
gemfile: gemfiles/Gemfile-ruby-1.9
- rvm: 2.0.0
gemfile: gemfiles/Gemfile-ruby-2.0
- rvm: 2.1.0
Expand All @@ -27,8 +23,6 @@ matrix:
gemfile: gemfiles/Gemfile-edge
- rvm: 2.3.0
gemfile: Gemfile
- rvm: jruby-19mode
gemfile: gemfiles/Gemfile-ruby-1.9
- rvm: jruby-head
gemfile: Gemfile
allow_failures:
Expand Down
2 changes: 2 additions & 0 deletions fog-aws.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

spec.required_ruby_version = '>= 2.0.0'

spec.add_development_dependency 'bundler', '~> 1.15'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'shindo', '~> 0.3'
Expand Down
6 changes: 0 additions & 6 deletions gemfiles/Gemfile-ruby-1.8.7

This file was deleted.

7 changes: 0 additions & 7 deletions gemfiles/Gemfile-ruby-1.9

This file was deleted.

3 changes: 1 addition & 2 deletions lib/fog/aws/requests/kinesis/put_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ def put_record(options={})
data = options.delete("Data")
partition_key = options.delete("PartitionKey")

sample_method = RUBY_VERSION == "1.8.7" ? :choice : :sample
shard_id = stream["Shards"].send(sample_method)["ShardId"]
shard_id = stream["Shards"].sample["ShardId"]
shard = stream["Shards"].detect{ |shard| shard["ShardId"] == shard_id }
# store the records on the shard(s)
shard["Records"] << {
Expand Down
3 changes: 1 addition & 2 deletions lib/fog/aws/requests/kinesis/put_records.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def put_records(options={})
record_results = records.map { |r|
sequence_number = next_sequence_number

sample_method = RUBY_VERSION == "1.8.7" ? :choice : :sample
shard_id = stream["Shards"].send(sample_method)["ShardId"]
shard_id = stream["Shards"].sample["ShardId"]
shard = stream["Shards"].detect{ |shard| shard["ShardId"] == shard_id }
# store the records on the shard(s)
shard["Records"] << r.merge("SequenceNumber" => sequence_number)
Expand Down
1 change: 0 additions & 1 deletion lib/fog/aws/requests/storage/put_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class Real
# @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectPUT.html

def self.conforming_to_us_ascii!(keys, hash)
return if RUBY_VERSION =~ /^1\.8\./
keys.each do |k|
v = hash[k]
if !v.encode(::Encoding::US_ASCII, :undef => :replace).eql?(v)
Expand Down
6 changes: 0 additions & 6 deletions tests/helpers/collection_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ def collection_tests(collection, params = {}, mocks_implemented = true)
'none?', 'one?'
]

# JRuby 1.7.5+ issue causes a SystemStackError: stack level too deep
# https://github.com/jruby/jruby/issues/1265
if RUBY_PLATFORM == "java" and JRUBY_VERSION =~ /1\.7\.[5-8]/
methods.delete('all?')
end

methods.each do |enum_method|
if collection.respond_to?(enum_method)
tests("##{enum_method}").succeeds do
Expand Down
4 changes: 0 additions & 4 deletions tests/models/storage/file_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@
end

tests('#versions are all for the correct key').returns(true) do
# JRuby 1.7.5+ issue causes a SystemStackError: stack level too deep
# https://github.com/jruby/jruby/issues/1265
pending if RUBY_PLATFORM == "java" and JRUBY_VERSION =~ /1\.7\.[5-8]/

@instance.versions.all? { |v| v.key == @instance.key }
end
end
Expand Down
21 changes: 1 addition & 20 deletions tests/models/storage/url_tests.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# encoding: utf-8
Shindo.tests('AWS | url', ["aws"]) do


@storage = Fog::Storage.new(
:provider => 'AWS',
:aws_access_key_id => '123',
Expand All @@ -12,15 +11,7 @@
@file = @storage.directories.new(:key => 'fognonbucket').files.new(:key => 'test.txt')

now = Fog::Time.now
if RUBY_VERSION > '1.8.7' # ruby 1.8.x doesn't provide hash ordering
tests('#v4 url w/ response-cache-control').returns(
"https://fognonbucket.s3.amazonaws.com/test.txt?response-cache-control=No-cache&X-Amz-Expires=500&X-Amz-Date=#{now.to_iso8601_basic}&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=123/#{now.utc.strftime('%Y%m%d')}/us-east-1/s3/aws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature="
) do

@file.url(now + 500, :query => { 'response-cache-control' => 'No-cache' }).gsub(/(X-Amz-Signature=)[0-9a-f]+\z/,'\\1')
end
end


@storage = Fog::Storage.new(
:provider => 'AWS',
:aws_access_key_id => '123',
Expand All @@ -31,14 +22,4 @@

@file = @storage.directories.new(:key => 'fognonbucket').files.new(:key => 'test.txt')

if RUBY_VERSION > '1.8.7' # ruby 1.8.x doesn't provide hash ordering
tests('#v2 url w/ response-cache-control').returns(
"https://fognonbucket.s3.amazonaws.com/test.txt?response-cache-control=No-cache&AWSAccessKeyId=123&Signature=foo&Expires=#{now.to_i + 500}"
) do

@file.url(now + 500, :query => { 'response-cache-control' => 'No-cache' })
end
end


end
12 changes: 2 additions & 10 deletions tests/requests/storage/object_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@
Fog::Storage[:aws].put_object(@directory.identity, 'fog_object', lorem_file)
end

if RUBY_VERSION =~ /^1\.8\./
tests("#put_object('#{@directory.identity}', 'fog_object', lorem_file, {'x-amz-meta-json' => 'ä'}").succeeds do
Fog::Storage[:aws].put_object(@directory.identity, 'fog_object', lorem_file, {'x-amz-meta-json' => 'ä'})
end
end

tests("#copy_object('#{@directory.identity}', 'fog_object', '#{@directory.identity}', 'fog_other_object')").succeeds do
Fog::Storage[:aws].copy_object(@directory.identity, 'fog_object', @directory.identity, 'fog_other_object')
end
Expand Down Expand Up @@ -177,10 +171,8 @@
Fog::Storage[:aws].put_object(fognonbucket, 'fog_non_object', lorem_file)
end

unless RUBY_VERSION =~ /^1\.8\./
tests("#put_object('#{@directory.identity}', 'fog_object', lorem_file, {'x-amz-meta-json' => 'ä'}").raises(Excon::Errors::BadRequest) do
Fog::Storage[:aws].put_object(@directory.identity, 'fog_object', lorem_file, {'x-amz-meta-json' => 'ä'})
end
tests("#put_object('#{@directory.identity}', 'fog_object', lorem_file, {'x-amz-meta-json' => 'ä'}").raises(Excon::Errors::BadRequest) do
Fog::Storage[:aws].put_object(@directory.identity, 'fog_object', lorem_file, {'x-amz-meta-json' => 'ä'})
end

tests("#copy_object('#{fognonbucket}', 'fog_object', '#{@directory.identity}', 'fog_other_object')").raises(Excon::Errors::NotFound) do
Expand Down

0 comments on commit 5cb6eda

Please sign in to comment.