prebundler 0.11.3 → 0.11.8

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
  SHA256:
3
- metadata.gz: 58c4ae382f45ded05a5d464ece05649f9908040cffc272d7b3969e1916b3a8f8
4
- data.tar.gz: 2cc5be058b8c06f8b116e857175de0e98f5d5267719098fe59944730cac1016c
3
+ metadata.gz: 2b7bea8849dcfbf9020cff5c2c1b9b680cf791db9d2c9b8f3281433001e33bb2
4
+ data.tar.gz: 121f2dc97ae36b8fa7da226bb87de592597b7dfcd97f3a26b90e3c85e2270ad1
5
5
  SHA512:
6
- metadata.gz: 144ea989dddf9d08228df39b9546de46359f44a751732f8d550caff65c3cc2ccb052d6b8140d2180082708ad7ac4e8662d07fb4d28edb24185057ffc9e1b4aa4
7
- data.tar.gz: 10787d0ae6fea5816c31effcd1c1ca68e7bb74420d6696a209b234e158751f3d3bcb523f51839a58dc951f7abad1d85628e546e91ff233f0b4aaa151e1c334f6
6
+ metadata.gz: 20fd4208dbef759aa79fc2c98364073fe02a58d277eecb8f27192b7c1ac112cd6112d8b381b77f4d31c2225cbbff91bd96322f360d7708d060e8d5d62b1272fc
7
+ data.tar.gz: 3d5d817a64373717bab3e2e40ae46db92d1e20d05cd637c5efbbd41fe27404214ac0bb034c3fb76cca16592220680b0f7810122f7ba52258482916828c5281e0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ 0.11.8
2
+ ===
3
+ - Don't store gems in the backend if they failed to install.
4
+ - Use an absolute bundle path.
5
+ - Only consider a gem from the lockfile if it matches the current platform.
6
+ - Fix `#install` methods so they all return true/false.
7
+
8
+ 0.11.7
9
+ ===
10
+ - Fix bug causing platform-specific gems to be installed from source even if they were already present in the backend.
11
+
12
+ 0.11.6
13
+ ===
14
+ - Fix bug causing native extension compile errors.
15
+ - Fix bug causing executables to not be included in tarballs.
16
+ - Fix bug (maybe introduced by bundler 2?) causing incorrect directory to be tarred. Directory can now include platform apparently.
17
+
18
+ 0.11.5
19
+ ===
20
+ - Add `--retry` flag to CLI (currently does nothing).
21
+
22
+ 0.11.4
23
+ ===
24
+ - Ensure .bundle/config directory exists before writing to it.
25
+
1
26
  0.11.3
2
27
  ===
3
28
  - Support (well, add stubs for) `ruby` and `git_source` methods in Gemfiles.
data/bin/prebundle CHANGED
@@ -51,6 +51,10 @@ command :install do |c|
51
51
  c.default_value true
52
52
  c.switch :binstubs
53
53
 
54
+ c.desc 'Retry failed network requests n times (currently not implemented).'
55
+ c.default_value 1
56
+ c.flag [:retry], type: Integer
57
+
54
58
  c.action do |global_options, options, args|
55
59
  raise 'Must specify a non-zero number of jobs' if options[:jobs] < 1
56
60
  Prebundler::Cli::Install.run($out, global_options, options, args)
@@ -102,8 +102,12 @@ module Prebundler
102
102
  FileUtils.rm(dest_file)
103
103
  else
104
104
  out.puts "Installing #{gem_ref.id} from source"
105
- gem_ref.install
106
- store_gem(gem_ref, dest_file) if gem_ref.storable?
105
+
106
+ if gem_ref.install
107
+ store_gem(gem_ref, dest_file) if gem_ref.storable?
108
+ else
109
+ out.puts "Failed to install #{gem_ref.id} from source"
110
+ end
107
111
  end
108
112
  end
109
113
 
@@ -118,6 +122,7 @@ module Prebundler
118
122
  config = File.exist?(file) ? YAML.load_file(file) : {}
119
123
  config['BUNDLE_WITH'] = with_groups.join(':') unless with_groups.empty?
120
124
  config['BUNDLE_WITHOUT'] = without_groups.join(':') unless without_groups.empty?
125
+ FileUtils.mkdir_p(File.dirname(file))
121
126
  File.write(file, YAML.dump(config))
122
127
  end
123
128
 
@@ -178,7 +183,7 @@ module Prebundler
178
183
  end
179
184
 
180
185
  def bundle_path
181
- options.fetch(:'bundle-path')
186
+ File.expand_path(options.fetch(:'bundle-path'))
182
187
  end
183
188
 
184
189
  def config
@@ -48,8 +48,19 @@ module Prebundler
48
48
  end
49
49
 
50
50
  def install
51
- system({ "GEM_HOME" => bundle_path }, "gem install -N --ignore-dependencies --source #{source} #{name} -v #{version}")
52
- $?.exitstatus
51
+ # NOTE: the --platform argument doesn't work when --ignore-dependencies
52
+ # is specified, no idea why
53
+ Bundler.with_unbundled_env do
54
+ system(
55
+ { "GEM_HOME" => bundle_path },
56
+ 'gem install -N --ignore-dependencies '\
57
+ "--source #{source} #{name} "\
58
+ "--version #{version} "\
59
+ "--platform #{Bundler.local_platform.to_s}"
60
+ )
61
+ end
62
+
63
+ $?.exitstatus == 0
53
64
  end
54
65
 
55
66
  def install_from_tar(tar_file)
@@ -70,8 +81,10 @@ module Prebundler
70
81
  system "tar -C #{bundle_path} -rf #{tar_file} #{relative_extension_dir}"
71
82
  end
72
83
 
73
- executables.each do |executable|
74
- system "tar -C #{bundle_path} -rf #{tar_file} #{File.join('bin', executable)}"
84
+ gemspecs.each do |gemspec|
85
+ gemspec.executables.each do |executable|
86
+ system "tar -C #{bundle_path} -rf #{tar_file} #{File.join(relative_gem_dir, gemspec.bindir, executable)}"
87
+ end
75
88
  end
76
89
  end
77
90
 
@@ -102,7 +115,13 @@ module Prebundler
102
115
  end
103
116
 
104
117
  def install_dir
105
- File.join(install_path, id)
118
+ @install_dir ||= begin
119
+ base = File.join(install_path, id)
120
+
121
+ find_platform_dir(base) do |dir|
122
+ File.directory?(dir)
123
+ end
124
+ end
106
125
  end
107
126
 
108
127
  def extension_dir
@@ -114,7 +133,13 @@ module Prebundler
114
133
  end
115
134
 
116
135
  def relative_gem_dir
117
- File.join('gems', id)
136
+ @relative_gem_dir ||= begin
137
+ base = File.join('gems', id)
138
+
139
+ find_platform_dir(base) do |dir|
140
+ File.directory?(File.join(bundle_path, dir))
141
+ end
142
+ end
118
143
  end
119
144
 
120
145
  def relative_gemspec_files
@@ -127,5 +152,18 @@ module Prebundler
127
152
  file = File.join(Bundler.local_platform.to_s, Prebundler.platform_version, Gem.extension_api_version.to_s, "#{id}.tar")
128
153
  prefix && !prefix.empty? ? File.join(prefix, file) : file
129
154
  end
155
+
156
+ private
157
+
158
+ def find_platform_dir(base)
159
+ platform = Bundler.local_platform.to_a
160
+
161
+ platform.size.downto(0) do |i|
162
+ dir = [base, *platform[0...i]].join('-')
163
+ return dir if yield(dir)
164
+ end
165
+
166
+ base
167
+ end
130
168
  end
131
169
  end
@@ -17,8 +17,11 @@ module Prebundler
17
17
  instance_eval(File.read(gemfile_path))
18
18
 
19
19
  lockfile = Bundler::LockfileParser.new(File.read("#{gemfile_path}.lock"))
20
+ local_platform = Bundler.local_platform.to_s
20
21
 
21
22
  lockfile.specs.each do |spec|
23
+ next if spec.platform != 'ruby' && spec.platform.to_s != local_platform
24
+
22
25
  gems[spec.name] ||= GemRef.create(spec.name, bundle_path, options)
23
26
  gems[spec.name].spec = spec
24
27
  gems[spec.name].dependencies = spec.dependencies.map(&:name)
@@ -22,15 +22,15 @@ module Prebundler
22
22
  FileUtils.mkdir_p(install_path)
23
23
  FileUtils.mkdir_p(cache_path)
24
24
 
25
- return if File.exist?(cache_dir) || File.exist?(install_dir)
25
+ return true if File.exist?(cache_dir) || File.exist?(install_dir)
26
26
  system "git clone #{uri} \"#{cache_dir}\" --bare --no-hardlinks --quiet"
27
- return $? if $?.exitstatus != 0
27
+ return false if $?.exitstatus != 0
28
28
  system "git clone --no-checkout --quiet \"#{cache_dir}\" \"#{install_dir}\""
29
- return $? if $?.exitstatus != 0
29
+ return false if $?.exitstatus != 0
30
30
  Dir.chdir(install_dir) { system "git reset --hard --quiet #{revision}" }
31
31
  serialize_gemspecs
32
32
  copy_gemspecs
33
- $?
33
+ $?.exitstatus == 0
34
34
  end
35
35
 
36
36
  def to_gem
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Prebundler
4
- VERSION = '0.11.3'
4
+ VERSION = '0.11.8'
5
5
  end
data/prebundler.gemspec CHANGED
@@ -9,9 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.homepage = 'http://github.com/camertron'
10
10
 
11
11
  s.description = s.summary = 'Gem dependency prebuilder'
12
-
13
12
  s.platform = Gem::Platform::RUBY
14
- s.has_rdoc = true
15
13
 
16
14
  s.add_dependency 'bundler'
17
15
  s.add_dependency 'parallel', '~> 1.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prebundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.3
4
+ version: 0.11.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-09 00:00:00.000000000 Z
11
+ date: 2021-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler