gem-dependencies 0.1.9 → 0.2.0

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: aaba358cbe264b03da89c480fe1af1770d22e0c1
4
- data.tar.gz: 939670d117b0fe8d56254af9cb3b586e4ef71cae
3
+ metadata.gz: 82454adc88a4b3b11ab715a20615a44c4e4e581b
4
+ data.tar.gz: b99d0dcc685fe2c51b123da8ec2a223f6e2f4a20
5
5
  SHA512:
6
- metadata.gz: 03ed104d610a1e95cd4c3badc49f45ab13f874cf9847ff6d655fa5c9b98e615efdc9d8be6a3c56c920aa6b76d5ac83446187b8e16213af841e2f7fef71ee2a54
7
- data.tar.gz: 08aeb1d16a5948db7405df0e0f01d281e5923471a53a5db401c05272f912122927a2e25b7aab633394db587a8b2019473121745dc0e14b408b2933d10bfc8003
6
+ metadata.gz: ddb9b340194a31bf3efc8ab19839970e7b2faf569b83887b156aa91f0a32e54ba07d233a1ce02cfc487cfd90ab7bc31077f9e314c2d9c64741eaeb93a6fe5bcc
7
+ data.tar.gz: ef5c81bb07d0433acb9152816ce34de3a3d5089f639ac82df797f8b8a8638384b8716e9c3742259b2ec61eaf1a185b482c704457c86beb65f08a4a309c78da3b
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -25,17 +25,12 @@ gems:
25
25
  "*":
26
26
  command: sudo apk --update add ${packages}
27
27
  bcrypt:
28
- "~> 2.0, <= 3.1":
28
+ "~> 2.0, <= 3.3":
29
29
  - bcrypt-2.1
30
- - libxml2-3.4
31
- - libyagni-1.0c
32
- "~> 3.1.5": "bcrypt-3.1.10.tar.gz tree"
30
+ - "*"
33
31
  nokogiri:
34
- "~> 2.0, <= 3.1":
35
- - bcrypt-2.1
36
- - libxml2-3.4
37
- - libyagni-1.0c
38
- "~> 3.1.5": "s3://one:two@s3.amazon.com/three/bcrypt-3.1.10.tar.gz tree"
32
+ "~> 1.6.2, < 1.8": "* libxml2-dev libxslt-dev"
33
+ "1.2.8": "s3://one:two@s3.amazon.com/three/* tree"
39
34
  ```
40
35
 
41
36
  After determining the runtime dependencies and creating a compiled extensions tarball, edit the dependency index to add a key with the name of the new gem and sub-keys to indicate the version requirements. The values of these sub-key are either an array of package dependencies and extension tarballs or a space-delimited string of the same. All items ending in ```.tar.gz``` are considered to be extension tarballs and everything else is considered to be a package dependency. Extension tarballs can also be given as a file system path or an http, https, git, or s3 url.
@@ -59,7 +54,7 @@ The dependency index will be downloaded and searched for the requested gem and v
59
54
  Note that a version requirement can also be specified in the ```gem install``` command. For example, the following are all valid:
60
55
 
61
56
  ```shell
62
- bcrypt, bcrypt:3.1.4, "bcrypt:~>3.1.8", "bcrypt > 3.1.4, ~3.2, < 3.8"
57
+ bcrypt, bcrypt:3.1.4, "bcrypt:~>3.1.8", "bcrypt > 3.1.4, ~> 3.2, < 3.8"
63
58
  ```
64
59
 
65
60
  Using this approach, a runtime system can quickly and efficiently install dependencies and extensions without the need to compile them locally.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "gem-dependencies"
5
- s.version = "0.1.9"
5
+ s.version = "0.2.0"
6
6
  s.summary = "RubyGems plugin to simplify installing binary gems on runtime systems."
7
7
  s.description = "This gem makes it easy to install binary gems on machines without a compiler."
8
8
  s.homepage = "https://github.com/shreeve/gem-dependencies"
@@ -2,7 +2,7 @@
2
2
  # gem_dependencies.rb: Simplifies installing binary gems on runtime systems
3
3
  #
4
4
  # Author: Steve Shreeve <steve.shreeve@gmail.com>
5
- # Date: June 11, 2015
5
+ # Date: June 12, 2015
6
6
  # Legal: MIT License
7
7
  # =============================================================================
8
8
 
@@ -37,26 +37,45 @@ module Gem
37
37
  true
38
38
  end
39
39
 
40
- # locate a match and return [pkgs, exts]
40
+ # return a gem's packages and extensions
41
41
  def find_dependencies(env)
42
42
  require 'rubygems/remote_fetcher'
43
43
  @@deps = YAML.load(fetch(env))['gems'] unless defined?(@@deps)
44
+ @@deps.key?[spec.name] or return
44
45
 
46
+ # find dependencies
45
47
  case deps = @@deps[spec.name]
46
- when nil # no deps provided, assume one extension file relative to the index
47
- path = File.join(File.dirname(env.split(/[?;#]/,2).first), "#{spec.full_name}.tar.gz")
48
- path << "?raw=true" if path.start_with?("https://github.com/")
49
- deps = [path]
48
+ when nil, "*" # for nil or '*', use the default extension name
49
+ deps = ["*"]
50
50
  when String # string of space-delimited dependencies and extensions
51
51
  when Array # array of dependencies and extensions
52
52
  when Hash # hash of dependencies and extensions, indexed by version requirements
53
- reqs, deps = deps.find do |reqs, info|
53
+ reqs, deps = deps.find do |reqs, info| # deps is an array or space-delimited string
54
54
  Gem::Requirement.new(reqs.split(',')).satisfied_by?(spec.version)
55
55
  end
56
+ deps or return #!# what about nil here? should it be the same as non-hash version?
56
57
  end
57
- deps or return
58
58
  deps = deps.strip.split(/\s+/) if deps.is_a?(String)
59
- deps.compact.uniq.partition {|item| item =~ REGEXP_SCHEMA || item.end_with?(".tar.gz")}.reverse
59
+ deps = deps.compact.uniq
60
+
61
+ # helpful variables
62
+ bcwd = Dir.pwd
63
+ benv = File.dirname(env.split(/[?;#]/,2).first)
64
+ name = "#{spec.full_name}.tar.gz"
65
+
66
+ # return packages and extensions
67
+ exts, pkgs = deps.partition {|item| item.include?("*") || item =~ REGEXP_SCHEMA || item.include?(".tar.gz")}
68
+ exts.map! do |item|
69
+ case item
70
+ when "*" then item = File.join(benv, name) # use complete default tarball name
71
+ when /\A\*/ then item[0,1] = benv # path relative to env variable
72
+ when /\A[^\/]/ then item[0,0] = bcwd + "/" # path relative to current directory
73
+ end
74
+ item.gsub!("*", name) # swap inline wildcards with default tarball name
75
+ item << "?raw=true" if item.start_with?("https://github.com/")
76
+ item
77
+ end
78
+ [pkgs, exts]
60
79
  end
61
80
 
62
81
  def install_os_packages(*args)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-dependencies
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Shreeve
@@ -30,7 +30,7 @@ cert_chain:
30
30
  4PkbTeqnzZJmSZjUBwvnQFNhXY08hPUs7aASHu9deACBbOBY+Hg6tiSOdfw50uYS
31
31
  ksjokeQosImFuxgjMrlyoRcpbZmyfQ33yImqtLH6FMWF3hpoxJq9wPk=
32
32
  -----END CERTIFICATE-----
33
- date: 2015-06-12 00:00:00.000000000 Z
33
+ date: 2015-06-13 00:00:00.000000000 Z
34
34
  dependencies: []
35
35
  description: This gem makes it easy to install binary gems on machines without a compiler.
36
36
  email: steve.shreeve@gmail.com
metadata.gz.sig CHANGED
@@ -1 +1,2 @@
1
- 7_؃�`2{u�П-5�Λf�~b^.Ph�?�����n��V淳߳ܧC/֛�w{#΅�t1Z[\ۤ�`���� Uy��q>��2;�S�+,�,Ñ�,f��i���y�%-���a�F�V���0�q��h���?L�n˂���0 �[��2����o�]>�z�P9�Uy��C�6r�h����7�=�� �X��Z�������=�n,�f�8�r���^K!v1�f��D����L^���Ηߠ���
1
+ $�#��BT3������T �*����2�7�����v'z��}�L�?�ޥm����񊲿�H�=N��uk`�o���~8���}z�u��"
2
+ ��6�2u�ABv�^#[X�N�Z8 #���8�