iostreams 0.17.0 → 0.17.1

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
2
  SHA256:
3
- metadata.gz: afb047a3682e7cbb9d953c303ebf2f525ff9975248ac550b6eded486ff73a72b
4
- data.tar.gz: b14b13f5c23663b1b173d4ee767a93ea74b381f4c89ae5b44e4610bfbe4fabe4
3
+ metadata.gz: 7b91433de5d43d10f489ab1034e9ddc79913e580a856333a4edf975b64b494ca
4
+ data.tar.gz: 1d2940ff36fa882774cf3b11bb5a4d5a8a27c6511eabc938088eda006f5d1863
5
5
  SHA512:
6
- metadata.gz: 00a5fa08bf88bbcc9cc3c1418f90d2dd55c3da0b129cd472ef571e27f0dec653214f2f1780069801e8fd87c676c70e097fd79e86085fcbd63e3def501f779ec5
7
- data.tar.gz: e193d7dacbd65625c9159fb61d13d3d0b005bd40e373047e2ece791c91c5c1798c881a398c0246fda8c424bd875dead9be3c5d3cc00765b0b2977d3decf3a08d
6
+ metadata.gz: 2b6a0a299ada19de5fb9bf32f54201c12623b1a3fd59d30732cffe04dc8825f0d4d35dc3f895765dd16d10d2e7a5a6e0c51c069b382beac5a271b222c7bafa30
7
+ data.tar.gz: 5fc609c806c825e3230264942eb19d7ae0982e2d7afdafe218542d6b19706dcd7a979e0db541d15f3f1a3b62f698e9b5fc273489c9c605e719cc81e0f23477f6
@@ -5,6 +5,8 @@ module IOStreams
5
5
  def self.open(uri, region: nil, **args, &block)
6
6
  raise(ArgumentError, 'file_name must be a URI string') unless uri.is_a?(String)
7
7
 
8
+ IOStreams::S3.load_dependencies
9
+
8
10
  s3 = region.nil? ? Aws::S3::Resource.new : Aws::S3::Resource.new(region: region)
9
11
  options = IOStreams::S3.parse_uri(uri)
10
12
  object = s3.bucket(options[:bucket]).object(options[:key])
@@ -5,6 +5,8 @@ module IOStreams
5
5
  def self.open(uri, region: nil, **args, &block)
6
6
  raise(ArgumentError, 'file_name must be a URI string') unless uri.is_a?(String)
7
7
 
8
+ IOStreams::S3.load_dependencies
9
+
8
10
  options = IOStreams::S3.parse_uri(uri)
9
11
  s3 = region.nil? ? Aws::S3::Resource.new : Aws::S3::Resource.new(region: region)
10
12
  object = s3.bucket(options[:bucket]).object(options[:key])
data/lib/io_streams/s3.rb CHANGED
@@ -1,9 +1,3 @@
1
- begin
2
- require 'aws-sdk-s3'
3
- rescue LoadError => exc
4
- raise(LoadError, "Install gem 'aws-sdk-s3' to read and write AWS S3 files: #{exc.message}")
5
- end
6
-
7
1
  require 'uri'
8
2
  module IOStreams
9
3
  module S3
@@ -16,8 +10,16 @@ module IOStreams
16
10
  raise "Invalid URI. Required Format: 's3://<bucket_name>/<key>'" unless uri.scheme == 's3'
17
11
  {
18
12
  bucket: uri.host,
19
- key: uri.path.sub(/\A\//, '')
13
+ key: uri.path.sub(/\A\//, '')
20
14
  }
21
15
  end
16
+
17
+ def self.load_dependencies
18
+ return unless defined?(::Aws::S3::Resource)
19
+
20
+ require 'aws-sdk-s3'
21
+ rescue LoadError => exc
22
+ raise(LoadError, "Install gem 'aws-sdk-s3' to read and write AWS S3 files: #{exc.message}")
23
+ end
22
24
  end
23
25
  end
@@ -1,3 +1,3 @@
1
1
  module IOStreams
2
- VERSION = '0.17.0'
2
+ VERSION = '0.17.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iostreams
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison