gem-dependencies 0.3.0.rc1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -4
- data.tar.gz.sig +0 -0
- data/README.md +49 -26
- data/gem-dependencies.gemspec +1 -1
- data/lib/rubygems/gem_dependencies.rb +2 -1
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48e537e935fc53d692b9201da1dc041e24f507b7
|
4
|
+
data.tar.gz: 64aba8b026e76a42d3f48f178e2d4a03d29fd7d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d62549925836ce0b67f80d577fd417d387a0a393ea0ac495e2130967254154741927eb1fbfa3683f13d3fa87582b8cf60fd2df620afe341eff261a5266040c1f
|
7
|
+
data.tar.gz: a62a407d896e691909fbdadc5dd8a9786b298bd6280c06233128ceb6cd5eb0089dfa65715b1f44ab11761998115b259f708f622a3756760fd10ca243eecfae77
|
checksums.yaml.gz.sig
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -2,15 +2,17 @@
|
|
2
2
|
|
3
3
|
A RubyGems plugin that simplifies working with gems that have binary extensions. It does this through the use of a succinct dependency index file. For development systems, this file specifies build dependencies and arguments necessary to compile and create a tarball with a gem's binary extensions. For runtime systems, which are lightweight and might not have access to a compiler, the dependency index file provides a list of runtime dependencies that must first be installed and also specifies the tarball which contains the pre-built binary extension files.
|
4
4
|
|
5
|
-
|
5
|
+
## TL;DR
|
6
|
+
|
7
|
+
Think of ```gem-dependencies``` as a helper that allows lightweight systems, such as docker containers, to be able to use native rubygems without having a compiler installed. At the moment that ```gem install``` would normally try to compile a binary extension, ```gem-dependencies``` will lookup the gem in it's dependency index and, if a matching version is found, install any required runtime packages and then download and extract any pre-compiled binary extensions. Everything works seamlessly and efficiently.
|
6
8
|
|
7
9
|
## Usage
|
8
10
|
|
9
|
-
You don't need to do anything special, just use ```gem install``` as normal. The resulting behavior is controlled by the value of the ```GEM_DEPENDENCIES``` environment variable. If this environment variable is not set, then this gem has no effect and is simply ignored.
|
11
|
+
You don't need to do anything special, just use ```gem install``` as normal. The resulting behavior is controlled by the value of the ```GEM_DEPENDENCIES``` environment variable. If this environment variable is not set, then this gem has no effect and is simply ignored. If ```GEM_DEPENDENCIES``` is set to a file system path or an http, https, git, or s3 url, then this value will be used to fetch the dependency index. As an additional help, all urls that begin with ```https://github.com/``` will be automatically suffixed with ```?raw=true```.
|
10
12
|
|
11
13
|
## Dependency index
|
12
14
|
|
13
|
-
The dependency index is a YAML file that contains information necessary to compile gems on a development system or install them on a runtime system.
|
15
|
+
The dependency index is a YAML file that contains information necessary to compile gems on a development system or install them on a runtime system. A dependency index file looks like this:
|
14
16
|
|
15
17
|
```yaml
|
16
18
|
gems:
|
@@ -18,13 +20,13 @@ gems:
|
|
18
20
|
command: apk --update add ${packages}
|
19
21
|
bcrypt:
|
20
22
|
mysql2: "* mariadb-libs"
|
21
|
-
nokogiri: "* libxml2 libxslt +libxml2-dev +libxslt -- --use-system-libraries"
|
23
|
+
nokogiri: "* libxml2 libxslt +libxml2-dev +libxslt-dev -- --use-system-libraries"
|
22
24
|
pokogiri:
|
23
25
|
- "*"
|
24
26
|
- libxml2
|
25
27
|
- libxslt
|
26
28
|
- +libxml2-dev
|
27
|
-
- +libxslt
|
29
|
+
- +libxslt-dev
|
28
30
|
- --
|
29
31
|
- --use-system-libraries
|
30
32
|
unf_ext:
|
@@ -33,47 +35,68 @@ gems:
|
|
33
35
|
"< 0.0.4": "s3://foo:bar@s3.amazon.com/baz/* one two three"
|
34
36
|
```
|
35
37
|
|
36
|
-
The format of this file is quite flexible. Keys in the above hash represent gems that have binary extensions. The hash values can be:
|
37
|
-
|
38
|
-
* ```nil``` (like ```bcrypt``` above)
|
39
|
-
* ```String``` (like ```mysql``` above)
|
40
|
-
* ```Array``` (like ```pokogiri``` above)
|
41
|
-
* ```Hash``` (like ```unf_ext``` above)
|
42
|
-
|
38
|
+
The format of this file is quite flexible. Keys in the above hash represent gems that have binary extensions. The hash values can be ```nil``` (see ```bcrypt```), a ```String``` (see ```mysql2```), an ```Array``` (see ```pokogiri```), or a version-indexed ```Hash``` (see ```enf_ext```). Shortcuts are defined for each space-delimited ```String``` or ```Array``` element such that:
|
43
39
|
|
40
|
+
* a ```nil``` or ```*``` is a sibling file to the dependency index, named ```${gemname}-${version}.tar.gz```
|
41
|
+
* a leading ```*``` will be replaced with the base directory of the dependency index
|
42
|
+
* a subsequent ```*``` will be replaced with ```${gemname}-${version}.tar.gz```
|
43
|
+
* a leading ```+``` indicates a development dependency
|
44
|
+
* a leading ```-``` indicates a build-time argument to the ```gem``` command
|
45
|
+
* a value containing ```.tar.gz``` indicates a binary extensions tarball
|
44
46
|
|
45
|
-
|
47
|
+
Wildcards can be combined such as ```unf_ext``` where the values for one version range includes ```*/old-gems/*```. In this example, this gives ```https://github.com/shreeve/gemdeps-alpine-3.2-x86_64-2.2.0/blob/master/old-gems/unf_ext-0.0.6.tar.gz```. These shortcuts are much easier to type and they will dynamically use the proper gem versions.
|
46
48
|
|
47
|
-
|
49
|
+
## Development system
|
48
50
|
|
51
|
+
Make sure your development system has the same architecture as your runtime system. Development systems are indicated by a leading ```+``` in the value of the ```GEM_DEPENDENCIES``` environment variable. Suppose the following variable is set:
|
49
52
|
|
53
|
+
```shell
|
54
|
+
export GEM_DEPENDENCIES="+https://github.com/shreeve/gemdeps-alpine-3.2-x86_64-2.2.0/blob/master/INDEX.yaml"
|
55
|
+
```
|
50
56
|
|
57
|
+
Then, this command:
|
51
58
|
|
52
|
-
|
59
|
+
```shell
|
60
|
+
gem install nokogiri
|
61
|
+
```
|
53
62
|
|
54
|
-
|
63
|
+
will lookup the dependency index, finding:
|
55
64
|
|
56
|
-
```
|
57
|
-
|
65
|
+
```yaml
|
66
|
+
nokogiri: "* libxml2 libxslt +libxml2-dev +libxslt-dev -- --use-system-libraries"
|
58
67
|
```
|
59
68
|
|
60
|
-
|
69
|
+
which will:
|
70
|
+
|
71
|
+
* Install the ```libxml2-dev``` and ```libxslt-dev``` packages (these start with ```+```)
|
72
|
+
* Execute ```gem install nokogiri -- --use-system-libraries``` (these start with ```-```)
|
73
|
+
* Create a binary extensions tarball (e.g. ```nokogiri-1.6.6.2.tar.gz```) in the current directory
|
61
74
|
|
62
75
|
## Runtime system
|
63
76
|
|
64
|
-
|
77
|
+
Suppose the following variable is set (without the leading ```+``` character):
|
65
78
|
|
66
79
|
```shell
|
67
80
|
export GEM_DEPENDENCIES="https://github.com/shreeve/gemdeps-alpine-3.2-x86_64-2.2.0/blob/master/INDEX.yaml"
|
68
|
-
gem install bcrypt
|
69
81
|
```
|
70
82
|
|
71
|
-
|
83
|
+
Then, this command:
|
84
|
+
|
85
|
+
```shell
|
86
|
+
gem install nokogiri
|
87
|
+
```
|
88
|
+
|
89
|
+
will lookup the dependency index, finding:
|
90
|
+
|
91
|
+
```yaml
|
92
|
+
nokogiri: "* libxml2 libxslt +libxml2-dev +libxslt-dev -- --use-system-libraries"
|
93
|
+
```
|
94
|
+
|
95
|
+
which will:
|
72
96
|
|
73
|
-
*
|
74
|
-
*
|
75
|
-
*
|
76
|
-
* compiled extension tarballs will be downloaded and installed
|
97
|
+
* Install the ```libxml2``` and ```libxslt``` packages
|
98
|
+
* Execute ```gem install nokogiri```, but will skip the ```build_extensions``` step
|
99
|
+
* Download and extract the default extensions tarball at ```https://github.com/shreeve/gemdeps-alpine-3.2-x86_64-2.2.0/blob/master/nokogiri-1.6.6.2.tar.gz```
|
77
100
|
|
78
101
|
Note that a version requirement can also be specified in the ```gem install``` command. For example, the following are all valid:
|
79
102
|
|
data/gem-dependencies.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "gem-dependencies"
|
5
|
-
s.version = "0.3.0
|
5
|
+
s.version = "0.3.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 systems without a compiler."
|
8
8
|
s.homepage = "https://github.com/shreeve/gem-dependencies"
|
@@ -61,7 +61,8 @@ module Gem
|
|
61
61
|
reqs, deps = deps.find do |reqs, info| # deps is an array or space-delimited string
|
62
62
|
Gem::Requirement.new(reqs.split(',')).satisfied_by?(spec.version)
|
63
63
|
end
|
64
|
-
|
64
|
+
reqs or return # can't find the right version
|
65
|
+
deps ||= ["*"] # deps are nil, use the default extension name
|
65
66
|
end
|
66
67
|
deps = deps.strip.split(/\s+/) if deps.is_a?(String)
|
67
68
|
deps = deps.compact.uniq
|
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.3.0
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Shreeve
|
@@ -59,9 +59,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
59
59
|
version: '0'
|
60
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
|
-
- - "
|
62
|
+
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version:
|
64
|
+
version: '0'
|
65
65
|
requirements: []
|
66
66
|
rubyforge_project:
|
67
67
|
rubygems_version: 2.4.7
|
metadata.gz.sig
CHANGED
Binary file
|