native_ext_fetcher 0.1.0 → 0.1.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
  SHA1:
3
- metadata.gz: 4e631820654fb2882e0bcc0b2304e1364e1c615e
4
- data.tar.gz: 35277f285157e5bb2164e43c640f9c53c2ed7f35
3
+ metadata.gz: 5900074441769b6286c0912b8b6ee114e7f38d55
4
+ data.tar.gz: a4e9ac16a2158deb70a21c125b75c0d155d9665b
5
5
  SHA512:
6
- metadata.gz: 096fac5a0deb44edf0b7ab988ee52a4b7973ef46856f4ab0f83d434e8a32c6a8cf37f2eefa230f30701c2d6eb0515f6b3c29263a25842c84d7345b278367a6a7
7
- data.tar.gz: c0fabcfa8da1b706c6f23669d82d92ec20b68ead9501e018260d40d17b2ca559f8f7480673a8f62aa18d33828727320620b23109c3cfe1e954ce6a591ede3f2b
6
+ metadata.gz: 9ca720bcb2ae582ac942caf6b810c05d2cb61c44a48718f4591172dbb3a3030615095074c4bb8b67d9d257297b602ed1e7131dad7ecea0bd5edfcfbca228b91f
7
+ data.tar.gz: eb2b6c72f45431cd120e942c2ce61bbbd2a2be2ef02d0126b8f5cbecaaddc3e6bcfcef45a42e4840ed1d5ee2d841052cfaa36a8c363d6c31aa75d3243b59d2be
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016 Michael Coyne
3
+ Copyright (c) 2016 DefWare LLC (michael@defware.io)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -53,7 +53,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
53
53
 
54
54
  ## Contributing
55
55
 
56
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/native_ext_fetcher. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
56
+ Bug reports and pull requests are welcome on GitHub at https://github.com/DefWare/native_ext_fetcher. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
57
57
 
58
58
 
59
59
  ## License
@@ -15,6 +15,14 @@ module NativeExtFetcher
15
15
  @options = options
16
16
 
17
17
  @download_path = expand_download_path
18
+
19
+ if options[:static]
20
+ @file_ext = Platform.native_extension_static_file_ext
21
+ @file_postfix = Platform.native_extension_static_file_postfix
22
+ else
23
+ @file_ext = Platform.native_extension_file_ext
24
+ @file_postfix = Platform.native_extension_file_postfix
25
+ end
18
26
  end
19
27
 
20
28
  def fetch!(library)
@@ -32,26 +40,28 @@ module NativeExtFetcher
32
40
 
33
41
  protected
34
42
 
35
- def http_client
36
- @http_client ||= Http.new(@options)
37
- end
38
-
39
43
  def expected_digest
40
44
  @checksums[Platform.native_extension_key]
41
45
  end
42
46
 
47
+ def expand_download_path
48
+ File.join(@lib_path, 'native', *Platform.native_extension_tuple).tap do |native_path|
49
+ FileUtils.mkdir_p native_path
50
+ end
51
+ end
52
+
43
53
  def library_local_path(library)
44
- File.join @download_path, "#{library}#{Platform.native_extension_file_ext}"
54
+ File.join @download_path, "#{library}#{@file_ext}"
45
55
  end
46
56
 
47
57
  def library_request_uri(library)
48
- "https://#{@host}/#{library}#{Platform.native_extension_file_postfix}"
58
+ "https://#{@host}/#{library}#{@file_postfix}"
49
59
  end
50
60
 
51
- def expand_download_path
52
- File.join(@lib_path, 'native', *Platform.native_extension_tuple).tap do |native_path|
53
- FileUtils.mkdir_p native_path
54
- end
61
+ private
62
+
63
+ def http_client
64
+ @http_client ||= Http.new(@options)
55
65
  end
56
66
  end
57
67
  end
@@ -46,11 +46,11 @@ module NativeExtFetcher
46
46
  retry
47
47
  end
48
48
 
49
- raise MaxRetries, "max retries; #{e.message}"
49
+ raise MaxRetries, "max retries; #{e.message} (#{uri})"
50
50
  end
51
51
  end
52
52
 
53
- raise MaxRedirect, 'max redirects hit'
53
+ raise MaxRedirect, "max redirects hit (#{uri})"
54
54
  end
55
55
 
56
56
  protected
@@ -43,12 +43,23 @@ module NativeExtFetcher
43
43
  def determine_host_dlext
44
44
  RbConfig::CONFIG['DLEXT'].downcase
45
45
  end
46
+
47
+ def determine_host_static_ext(os)
48
+ case os
49
+ when 'windows'
50
+ 'lib'
51
+ else
52
+ 'a'
53
+ end
54
+ end
46
55
  end
47
56
 
48
57
  HOST_OS = determine_host_os.freeze
49
58
  HOST_ARCH = determine_host_arch.freeze
50
59
  HOST_DLEXT = determine_host_dlext.freeze
51
60
 
61
+ HOST_STATIC_EXT = determine_host_static_ext(HOST_OS).freeze
62
+
52
63
  def self.native_extension_key
53
64
  :"#{HOST_OS}_#{HOST_ARCH}"
54
65
  end
@@ -57,10 +68,18 @@ module NativeExtFetcher
57
68
  "-#{HOST_OS}-#{HOST_ARCH}.#{HOST_DLEXT}"
58
69
  end
59
70
 
71
+ def self.native_extension_static_file_postfix
72
+ "-#{HOST_OS}-#{HOST_ARCH}.#{HOST_STATIC_EXT}"
73
+ end
74
+
60
75
  def self.native_extension_file_ext
61
76
  ".#{HOST_DLEXT}"
62
77
  end
63
78
 
79
+ def self.native_extension_static_file_ext
80
+ ".#{HOST_STATIC_EXT}"
81
+ end
82
+
64
83
  def self.native_extension_tuple
65
84
  [HOST_OS, HOST_ARCH]
66
85
  end
@@ -1,3 +1,3 @@
1
1
  module NativeExtFetcher
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: native_ext_fetcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - DefWare LLC
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-13 00:00:00.000000000 Z
11
+ date: 2016-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler