bundix 2.0.8 → 2.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/bundix +46 -0
- data/lib/bundix.rb +1 -2
- data/lib/bundix/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87cf20e1b2e08de0727b71f244018c6b2cfe9355
|
4
|
+
data.tar.gz: c199408c5f4f5f27bd4ef589284aa15b95cd83ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36656b7e9c98794fd16c1171ae976abdbb0f7630f4d4a18b2f9ec8f25bac254e2b9f1c10b1c4f4ede4a7920578db19d420cfa78a09f17f1df10efbaf673a925b
|
7
|
+
data.tar.gz: 8fe879cc5fc86951c37d4f4f7b5f7cdf27ca40391951a5b0c48111cc640e331838d1f3fc42992a163ecb45df51070162f2420d1bc63a21ee457133750efafe55
|
data/bin/bundix
CHANGED
@@ -1,14 +1,35 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'optparse'
|
4
|
+
require 'tmpdir'
|
5
|
+
require 'pathname'
|
4
6
|
|
5
7
|
require_relative '../lib/bundix'
|
6
8
|
|
7
9
|
options = {
|
10
|
+
ruby: 'ruby',
|
11
|
+
bundle_pack_path: 'vendor/bundle',
|
12
|
+
lockfile: 'Gemfile.lock',
|
8
13
|
gemset: 'gemset.nix'
|
9
14
|
}
|
10
15
|
|
11
16
|
op = OptionParser.new do |o|
|
17
|
+
o.on '-m', '--magic', 'lock, pack, and write dependencies' do
|
18
|
+
options[:magic] = true
|
19
|
+
end
|
20
|
+
|
21
|
+
o.on '--ruby=ruby', 'ruby version to use for magic and init, defaults to latest' do |value|
|
22
|
+
options[:ruby] = value
|
23
|
+
end
|
24
|
+
|
25
|
+
o.on '--bundle-pack-path=vendor/bundle', "path to pack the magic" do |value|
|
26
|
+
options[:bundle_pack_path] = value
|
27
|
+
end
|
28
|
+
|
29
|
+
o.on '-i', '--init', "initialize a new shell.nix for nix-shell (won't overwrite old ones)" do
|
30
|
+
options[:init] = true
|
31
|
+
end
|
32
|
+
|
12
33
|
o.on '--gemset=gemset.nix', 'path to the gemset.nix' do |value|
|
13
34
|
options[:gemset] = File.expand_path(value)
|
14
35
|
end
|
@@ -33,6 +54,31 @@ end
|
|
33
54
|
|
34
55
|
op.parse!
|
35
56
|
$VERBOSE = !options[:quiet]
|
57
|
+
|
58
|
+
if options[:magic]
|
59
|
+
fail unless system(
|
60
|
+
Bundix::NIX_SHELL, '-p', options[:ruby],
|
61
|
+
"bundler.override { ruby = #{options[:ruby]}; }",
|
62
|
+
"--command", "bundle lock --lockfile=#{options[:lockfile]}")
|
63
|
+
fail unless system(
|
64
|
+
Bundix::NIX_SHELL, '-p', options[:ruby],
|
65
|
+
"bundler.override { ruby = #{options[:ruby]}; }",
|
66
|
+
"--command", "bundle pack --all --path #{options[:bundle_pack_path]}")
|
67
|
+
end
|
68
|
+
|
69
|
+
if options[:init]
|
70
|
+
if File.file?('shell.nix')
|
71
|
+
warn "won't override existing shell.nix"
|
72
|
+
else
|
73
|
+
shell_nix = File.read(File.expand_path('../template/shell.nix', __dir__))
|
74
|
+
shell_nix.gsub!('PROJECT', File.basename(Dir.pwd))
|
75
|
+
shell_nix.gsub!('RUBY', options[:ruby])
|
76
|
+
shell_nix.gsub!('LOCKFILE', "./#{Pathname(options[:lockfile]).relative_path_from(Pathname('./'))}")
|
77
|
+
shell_nix.gsub!('GEMSET', "./#{Pathname(options[:gemset]).relative_path_from(Pathname('./'))}")
|
78
|
+
File.write('shell.nix', shell_nix)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
36
82
|
gemset = Bundix.new(options).convert
|
37
83
|
|
38
84
|
tempfile = Tempfile.new('gemset.nix', encoding: 'UTF-8')
|
data/lib/bundix.rb
CHANGED
@@ -12,6 +12,7 @@ class Bundix
|
|
12
12
|
NIX_PREFETCH_URL = 'nix-prefetch-url'
|
13
13
|
NIX_PREFETCH_GIT = 'nix-prefetch-git'
|
14
14
|
NIX_HASH = 'nix-hash'
|
15
|
+
NIX_SHELL = 'nix-shell'
|
15
16
|
|
16
17
|
SHA256_32 = %r(^[a-z0-9]{52}$)
|
17
18
|
SHA256_16 = %r(^[a-f0-9]{64}$)
|
@@ -20,8 +21,6 @@ class Bundix
|
|
20
21
|
|
21
22
|
def initialize(options)
|
22
23
|
@options = {
|
23
|
-
gemset: './gemset.nix',
|
24
|
-
lockfile: './Gemfile.lock',
|
25
24
|
quiet: false,
|
26
25
|
tempfile: nil,
|
27
26
|
deps: false
|
data/lib/bundix/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bundix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael 'manveru' Fellinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
55
|
version: '0'
|
56
56
|
requirements: []
|
57
57
|
rubyforge_project:
|
58
|
-
rubygems_version: 2.
|
58
|
+
rubygems_version: 2.6.2
|
59
59
|
signing_key:
|
60
60
|
specification_version: 4
|
61
61
|
summary: Creates Nix packages from Gemfiles.
|