tirofinale 0.1.1 → 0.1.2

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: 98d14d0be1c92b1fa1526826f64265c88951c343
4
- data.tar.gz: 3cc0324fd9efd9cf8c7df8ff1affd354bb3f955f
3
+ metadata.gz: 6473dccfd6113d1e14c05c01284b0b820a2d22c7
4
+ data.tar.gz: e14ab35527721a2278b7bc2ebad75b2c64420edc
5
5
  SHA512:
6
- metadata.gz: 8e1b4d508aa151a593ba3702c54b0b613cd5470375a2b0583c80d0129da80b38daf37834cbf0840cb9c775b7f5b18329b6b86345386ae8efa9531fea0d4ccae6
7
- data.tar.gz: 16cd87cad22b39a0c9f12bb09af850555003471ba8e2d7d6f53792709ae58f32900a771fa051254732f15ebecf7863f2d2848d4933edeb61df18e90d7c431976
6
+ metadata.gz: cf94c7682abcf38f765e7029b7237c6a913d291a63d4fa2c9b79f34065bc82e837288fb726632cddd73009d8239a6fd5a717bcf1f6b88a4cf904e205d185fd72
7
+ data.tar.gz: 25bd9fa89dac14b7e4d1018b847ca6814806fe59ea5e8fd12d31a3fb967920da8da688167042d60145515ad77cb95407e978bf7831701b11c6547e1a873952b0
data/README.md CHANGED
@@ -10,20 +10,36 @@ This is experimental gem and not work fine yet for any enviroment and gem.
10
10
  # gem install tirofinale
11
11
  ~~~~
12
12
 
13
+ ## Requirements
14
+
15
+ Alpine Linux from v2.6 to v3.4 only.
16
+
13
17
  ## Usage
14
18
 
15
- On Alpine Linux v3.4 only.
19
+ ~~~~
20
+ Usage: tirofinale [options]
21
+ --dist-version VERSION
22
+ --gem GEM_NAME
23
+ ~~~~
24
+
25
+ Show packages which is required to build `nokogiri` gem on Alpine Linux v3.4.
16
26
 
17
- Show packages which is required to build `nokogiri` gem.
27
+ ~~~~
28
+ $ tirofinale --dist-version 3.4 --gem nokogiri
29
+ ruby-dev libxml2-dev libxslt-dev
30
+ ~~~~
31
+
32
+ Auto detect Alpine Linux version by run without `--dist-version` parameter.
18
33
 
19
34
  ~~~~
20
- $ tirofinale nokogiri
35
+ $ tirofinale --gem nokogiri
21
36
  ruby-dev libxml2-dev libxslt-dev
22
37
  ~~~~
23
- You can install packages by `apk` following line.
38
+
39
+ You can install packages by `apk` following command.
24
40
 
25
41
  ~~~~
26
- # apk add `tirofinale nokogiri`
42
+ # apk add `tirofinale --gem nokogiri`
27
43
  ~~~~
28
44
 
29
45
  ## License
data/exe/tirofinale CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- #
3
2
  require 'open-uri'
3
+ require 'optparse'
4
+ require 'pp'
4
5
 
5
6
  def detect_version_alpine
6
7
  content = open('/etc/alpine-release'){|f| f.read }
@@ -21,12 +22,53 @@ def search_apkbuild(gem_name, alpine_version)
21
22
  false
22
23
  end
23
24
 
24
- gem_name = ARGV[0]
25
+ def extract_makedepends(apkbuild)
26
+ variables = []
25
27
 
26
- alpine_version = detect_version_alpine()
28
+ apkbuild.each_line{|l|
29
+ if m = l.match(/^([^\s]+)=(.*)$/)
30
+ key = m[1]
31
+ value = m[2]
32
+
33
+ variables << {:key => key, :value => value}
34
+ end
35
+ }
36
+
37
+ variables.sort_by!{|var| var[:key].length * -1}
38
+
39
+ variables.each{|var|
40
+ if m = var[:value].match(/^"(.*)"$/)
41
+ var[:value] = m[1]
42
+ end
43
+ }
44
+
45
+ variables.each{|var|
46
+ while var[:value].include?('$')
47
+ result = nil
48
+ variables.each{|var2|
49
+ result = result || var[:value].gsub!("$#{var2[:key]}", var2[:value])
50
+ }
51
+ break unless result
52
+ end
53
+ }
54
+
55
+ variables.select{|var| var[:key] == 'makedepends'}.first[:value]
56
+ end
57
+
58
+ alpine_version = nil
59
+ gem_name = nil
60
+
61
+ op = OptionParser.new
62
+ op.on('--dist-version VERSION'){|val| alpine_version = val}
63
+ op.on('--gem GEM_NAME'){|val| gem_name = val}
64
+ op.parse(ARGV)
65
+
66
+ alpine_version ||= detect_version_alpine()
27
67
 
28
68
  apkbuild = search_apkbuild(gem_name, alpine_version)
29
69
 
30
- makedepends = apkbuild.match(/^makedepends="(.*?)"/).to_a[1].strip.split(' ')
70
+ makedepends = extract_makedepends(apkbuild)
71
+
72
+ packages = makedepends.strip.split(' ')
31
73
 
32
- print makedepends.join(' ')
74
+ print packages.join(' ')
@@ -1,3 +1,3 @@
1
1
  module Tirofinale
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tirofinale
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - xmisao
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-21 00:00:00.000000000 Z
11
+ date: 2016-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler