prebundler 0.11.4 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a1d8c42efac97a9a231f819c72b4882edaa990267bdba2409f67cbb0a475e44
4
- data.tar.gz: a34cacca7e651248c255c46d357b52c8ac3535f50972cd56d696f7bfe6f121cb
3
+ metadata.gz: b42e430112189e660d94c9d8c1b95217b88b96da88a546c4786061b446c892d8
4
+ data.tar.gz: e06e950923a142dd513d8331d732a65b7f09a004381289895a5541ea6315faeb
5
5
  SHA512:
6
- metadata.gz: 4d7008ebbf5314f02bbf992e4a6a8a7a2c05fae161427b902a12565a46bb70747a0d2e3c912d4ed45e557cc5b8616d7c906cf3d12dbade1733206664971f15e5
7
- data.tar.gz: 63a314e575817c6123e3895322c507349753c383afd541a92343c6d0999306d9ea1d381492057febe7779c6098a0dd10078328bd87080ead9a99d9dbe1e0f76d
6
+ metadata.gz: 3dae5bd84ab46ddbe6263997c1c453ff9c0534141c5e250d5d2af89e3213584e875821d0430c35886e407af45f727c0a105110a790e78fac165a0a12a1fcb90a
7
+ data.tar.gz: db940690b64c743540cb952651f9c8f729965392a9d93dc1b4607a39dc7b765f1600d1d51bbd2ea62ed52e4f40c45448b62c3670c7e503eb0c9f8320e577d7f5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ 0.12.0
2
+ ===
3
+ - Switch out ohai for ohey.
4
+
5
+ 0.11.8
6
+ ===
7
+ - Don't store gems in the backend if they failed to install.
8
+ - Use an absolute bundle path.
9
+ - Only consider a gem from the lockfile if it matches the current platform.
10
+ - Fix `#install` methods so they all return true/false.
11
+
12
+ 0.11.7
13
+ ===
14
+ - Fix bug causing platform-specific gems to be installed from source even if they were already present in the backend.
15
+
16
+ 0.11.6
17
+ ===
18
+ - Fix bug causing native extension compile errors.
19
+ - Fix bug causing executables to not be included in tarballs.
20
+ - Fix bug (maybe introduced by bundler 2?) causing incorrect directory to be tarred. Directory can now include platform apparently.
21
+
22
+ 0.11.5
23
+ ===
24
+ - Add `--retry` flag to CLI (currently does nothing).
25
+
1
26
  0.11.4
2
27
  ===
3
28
  - Ensure .bundle/config directory exists before writing to it.
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)
data/lib/prebundler.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'ohai'
1
+ require 'ohey'
2
2
 
3
3
  module Prebundler
4
4
  autoload :Cli, 'prebundler/cli'
@@ -27,13 +27,13 @@ module Prebundler
27
27
  end
28
28
 
29
29
  def platform_version
30
- @platform_version ||= "#{system_info['platform']}-#{system_info['platform_version']}"
30
+ @platform_version ||= "#{platform.name}-#{platform.version}"
31
31
  end
32
32
 
33
33
  private
34
34
 
35
- def system_info
36
- @@system_info ||= Ohai::System.new.all_plugins(['platform'])
35
+ def platform
36
+ @platform ||= Ohey.current_platform
37
37
  end
38
38
  end
39
39
  end
@@ -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
 
@@ -179,7 +183,7 @@ module Prebundler
179
183
  end
180
184
 
181
185
  def bundle_path
182
- options.fetch(:'bundle-path')
186
+ File.expand_path(options.fetch(:'bundle-path'))
183
187
  end
184
188
 
185
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.4'
4
+ VERSION = '0.12.0'
5
5
  end
data/prebundler.gemspec CHANGED
@@ -9,14 +9,12 @@ 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'
18
16
  s.add_dependency 'gli', '~> 2.0'
19
- s.add_dependency 'ohai', '~> 14.0'
17
+ s.add_dependency 'ohey', '~> 1.0'
20
18
 
21
19
  # @TODO: move s3 support into separate gem
22
20
  s.add_dependency 'aws-sdk', '~> 2.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.4
4
+ version: 0.12.0
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-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -53,19 +53,19 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: ohai
56
+ name: ohey
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '14.0'
61
+ version: '1.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '14.0'
68
+ version: '1.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: aws-sdk
71
71
  requirement: !ruby/object:Gem::Requirement