prebundler 0.11.8 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +103 -109
- data/bin/prebundle +3 -127
- data/lib/prebundler/cli/install.rb +5 -0
- data/lib/prebundler/commands.rb +146 -0
- data/lib/prebundler/gem_ref.rb +51 -19
- data/lib/prebundler/gemfile_interpreter.rb +4 -3
- data/lib/prebundler/s3_backend.rb +1 -1
- data/lib/prebundler/version.rb +1 -1
- data/lib/prebundler.rb +5 -4
- data/prebundler.gemspec +2 -2
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d4afddbb8d00634313f892422e9c2b379b9bf5d1740ea4f2797cd92f8d5e603
|
4
|
+
data.tar.gz: 12d9ee04ea5d4799914980894b9c206d4b4bd33ed452f66f127aabd7918ac202
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f868e1979de154b496ea55734d1929b13a63cb34851da9347bb721c0f8cc47e7ee2e0eb82746fc5899e24de63490250fcb1525f98e4944c9accbad2d3786799
|
7
|
+
data.tar.gz: 80182f23a6473242cea7cb8b3eb05c44903e94fbc237d3d8bd20b6b28b2e4187de0afc66f4e9f03039aae9f872b3fd17cf77a48750d89450f18786cd65099d1f
|
data/CHANGELOG.md
CHANGED
@@ -1,109 +1,103 @@
|
|
1
|
-
0.
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
0.11.
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
0.11.
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
0.
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
0.
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
0.
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
0.
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
0.5.1
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
0.0.
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
===
|
105
|
-
- Better CLI interface.
|
106
|
-
|
107
|
-
0.0.1
|
108
|
-
===
|
109
|
-
- Birthday!
|
1
|
+
## 0.14.1
|
2
|
+
* Set file permissions when extracting tarballs.
|
3
|
+
|
4
|
+
## 0.14.0
|
5
|
+
* Add `prebundle binstubs` command, which simply invokes `bundle binstubs`.
|
6
|
+
|
7
|
+
## 0.13.0
|
8
|
+
* Support the `eval_gemfile` function in gemfiles.
|
9
|
+
* Avoid shelling out to the `tar` command.
|
10
|
+
- The GNU and BSD versions annoyingly don't accept the same flags, meaning Prebundler can succeed or fail depending on the system it's run on.
|
11
|
+
- All tar files are now read and written using pure Ruby.
|
12
|
+
* Upgrade S3 client to non-EOL version.
|
13
|
+
* Stop ignoring gems that don't match the current platform.
|
14
|
+
- Prebundler shells out to `gem install` when installing individual gems. Older versions of rubygems would fetch gems for the "ruby" platform when the `--ignore-dependencies` option was given, ignoring any platform-specific gems. This resulted in either a) unnecessarily building a bunch of native extensions, or b) installing a gem for the wrong platform (i.e. when no gem existed for the "ruby" platform, eg. helm-rb). I addressed the problem by instructing Prebundler to ignore gems with native extensions, relying on `bundle install` to fix them up. However, the bug has been fixed in modern versions of rubygems, so we can stop ignoring gems.
|
15
|
+
* Run `bundle lock` before storing or installing gems to make sure the lockfile matches the Gemfile.
|
16
|
+
|
17
|
+
## 0.12.0
|
18
|
+
* Switch out ohai for ohey, which has many fewer dependencies.
|
19
|
+
|
20
|
+
## 0.11.8
|
21
|
+
* Don't store gems in the backend if they failed to install.
|
22
|
+
* Use an absolute bundle path.
|
23
|
+
* Only consider a gem from the lockfile if it matches the current platform.
|
24
|
+
* Fix `#install` methods so they all return true/false.
|
25
|
+
|
26
|
+
## 0.11.7
|
27
|
+
* Fix bug causing platform-specific gems to be installed from source even if they were already present in the backend.
|
28
|
+
|
29
|
+
## 0.11.6
|
30
|
+
* Fix bug causing native extension compile errors.
|
31
|
+
* Fix bug causing executables to not be included in tarballs.
|
32
|
+
* Fix bug (maybe introduced by bundler 2?) causing incorrect directory to be tarred. Directory can now include platform apparently.
|
33
|
+
|
34
|
+
## 0.11.5
|
35
|
+
* Add `--retry` flag to CLI (currently does nothing).
|
36
|
+
|
37
|
+
## 0.11.4
|
38
|
+
* Ensure .bundle/config directory exists before writing to it.
|
39
|
+
|
40
|
+
## 0.11.3
|
41
|
+
* Support (well, add stubs for) `ruby` and `git_source` methods in Gemfiles.
|
42
|
+
* Don't attempt to install gems we can't get a spec for.
|
43
|
+
|
44
|
+
## 0.11.2
|
45
|
+
* Always run `bundle install` just in case.
|
46
|
+
* Make sure `bundle check` is the _last_ thing that runs.
|
47
|
+
|
48
|
+
## 0.11.1
|
49
|
+
* Exit with nonzero status code if fallback `bundle install` fails.
|
50
|
+
|
51
|
+
## 0.11.0
|
52
|
+
* Allow the caller to pass in a s3 client for non-standard setups
|
53
|
+
|
54
|
+
## 0.10.0
|
55
|
+
* Update aws-sdk client creation to be able to support non-aws s3 api endpoints (e.g. minio)
|
56
|
+
|
57
|
+
## 0.9.1
|
58
|
+
* Woops, also use platform version when determining the gems that have already been built.
|
59
|
+
* Fix the subsetter so it outputs gems inside correct source blocks.
|
60
|
+
|
61
|
+
## 0.9.0
|
62
|
+
* Include platform version when uploading gem tarballs to the storage backend (this will cause bundles installed by previous versions of prebundler to be rebuilt).
|
63
|
+
|
64
|
+
## 0.8.1
|
65
|
+
* Fix bug causing config to not be loaded.
|
66
|
+
|
67
|
+
## 0.8.0
|
68
|
+
* Add the subset command for generating subsets of gemfiles.
|
69
|
+
|
70
|
+
## 0.7.2
|
71
|
+
* Fix use of continuation token when listing remote files in S3 backend.
|
72
|
+
|
73
|
+
## 0.7.1
|
74
|
+
* Support git-based gems with non-standard repo names.
|
75
|
+
* Fix `bundle install` fallback (group args were wrong).
|
76
|
+
|
77
|
+
## 0.7.0
|
78
|
+
* Add prefix option to install command.
|
79
|
+
|
80
|
+
## 0.6.2
|
81
|
+
* Provide CLI option to generate binstubs.
|
82
|
+
|
83
|
+
## 0.5.2
|
84
|
+
* Set `BUNDLE_GEMFILE` during prepare step so bundler doesn't complain when we try to call `Bundler.app_config_path`.
|
85
|
+
|
86
|
+
## 0.5.1
|
87
|
+
* Remove pry-byebug require.
|
88
|
+
|
89
|
+
## 0.5.0
|
90
|
+
* Works for a repository with a significant number of dependencies (~ 400).
|
91
|
+
* Testing on staging server indicates bundle is installed correctly.
|
92
|
+
|
93
|
+
## 0.0.4
|
94
|
+
* Pass bundle path to `gem install`.
|
95
|
+
|
96
|
+
## 0.0.3
|
97
|
+
* Add --with and --without flags to install command.
|
98
|
+
|
99
|
+
## 0.0.2
|
100
|
+
* Better CLI interface.
|
101
|
+
|
102
|
+
## 0.0.1
|
103
|
+
* Birthday!
|
data/bin/prebundle
CHANGED
@@ -1,130 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
require 'etc'
|
5
|
-
require 'bundler'
|
6
|
-
require 'prebundler'
|
7
|
-
require 'prebundler/version'
|
8
|
-
|
9
|
-
$out = Prebundler::WritePipe.new
|
10
|
-
|
11
|
-
include GLI::App
|
12
|
-
|
13
|
-
program_desc 'Gem dependency prebuilder'
|
14
|
-
|
15
|
-
version Prebundler::VERSION
|
16
|
-
|
17
|
-
subcommand_option_handling :normal
|
18
|
-
arguments :strict
|
19
|
-
|
20
|
-
desc "Don't log to stdout"
|
21
|
-
switch [:s, :silent]
|
22
|
-
|
23
|
-
desc 'Path to config file.'
|
24
|
-
default_value './.prebundle_config'
|
25
|
-
flag [:c, :config]
|
26
|
-
|
27
|
-
desc 'Install gems from the Gemfile.lock.'
|
28
|
-
command :install do |c|
|
29
|
-
c.desc 'Maximum number of parallel gem installs.'
|
30
|
-
c.default_value Etc.nprocessors
|
31
|
-
c.flag [:j, :jobs], type: Integer
|
32
|
-
|
33
|
-
c.desc 'Path to the gemfile to install gems from.'
|
34
|
-
c.default_value ENV.fetch('BUNDLE_GEMFILE', './Gemfile')
|
35
|
-
c.flag [:g, :gemfile]
|
36
|
-
|
37
|
-
c.desc 'Path to the bundle installation directory.'
|
38
|
-
c.default_value ENV.fetch('BUNDLE_PATH', Bundler.bundle_path.to_s)
|
39
|
-
c.flag [:b, :'bundle-path']
|
40
|
-
|
41
|
-
c.desc 'Backend prefix (i.e. path) at which to store gems.'
|
42
|
-
c.flag [:prefix]
|
43
|
-
|
44
|
-
c.desc 'A comma-separated list of groups referencing gems to install.'
|
45
|
-
c.flag :with
|
46
|
-
|
47
|
-
c.desc 'A comma-separated list of groups referencing gems to skip during installation.'
|
48
|
-
c.flag :without
|
49
|
-
|
50
|
-
c.desc 'Generate binstubs for installed gems.'
|
51
|
-
c.default_value true
|
52
|
-
c.switch :binstubs
|
53
|
-
|
54
|
-
c.desc 'Retry failed network requests n times (currently not implemented).'
|
55
|
-
c.default_value 1
|
56
|
-
c.flag [:retry], type: Integer
|
3
|
+
$stdout.sync = true
|
57
4
|
|
58
|
-
|
59
|
-
|
60
|
-
Prebundler::Cli::Install.run($out, global_options, options, args)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
desc 'List each gem and associated source.'
|
65
|
-
command :list do |c|
|
66
|
-
c.desc 'Path to the gemfile.'
|
67
|
-
c.default_value ENV.fetch('BUNDLE_GEMFILE', './Gemfile')
|
68
|
-
c.flag [:g, :gemfile]
|
69
|
-
|
70
|
-
c.desc 'Filter by source. Will perform partial matching.'
|
71
|
-
c.flag [:s, :source], multiple: true
|
72
|
-
|
73
|
-
c.action do |global_options, options, args|
|
74
|
-
Prebundler::Cli::List.run($out, global_options, options, args)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
desc 'Generate a subset of a Gemfile.'
|
79
|
-
command :subset do |c|
|
80
|
-
c.desc 'Path to the gemfile.'
|
81
|
-
c.default_value ENV.fetch('BUNDLE_GEMFILE', './Gemfile')
|
82
|
-
c.flag [:g, :gemfile]
|
83
|
-
|
84
|
-
c.desc 'Path to the bundle installation directory.'
|
85
|
-
c.default_value ENV.fetch('BUNDLE_PATH', Bundler.bundle_path.to_s)
|
86
|
-
c.flag [:b, :'bundle-path']
|
87
|
-
|
88
|
-
c.desc 'Gem (and dependencies) to include in the subset.'
|
89
|
-
c.flag [:i, :include], multiple: true
|
90
|
-
|
91
|
-
c.desc "Add an additional gem to the subset. The gem doesn't have to be part of the original Gemfile."
|
92
|
-
c.flag [:a, :add], multiple: true
|
93
|
-
|
94
|
-
c.desc 'Include development dependencies of subsetted gems.'
|
95
|
-
c.default_value false
|
96
|
-
c.switch [:d, :development]
|
97
|
-
|
98
|
-
c.desc 'File path to output the resulting Gemfile into. Use - for standard output.'
|
99
|
-
c.default_value '-'
|
100
|
-
c.flag [:o, :output]
|
101
|
-
|
102
|
-
c.action do |global_options, options, args|
|
103
|
-
Prebundler::Cli::Subset.run($out, global_options, options, args)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
pre do |global, command, options, args|
|
108
|
-
# Pre logic here
|
109
|
-
# Return true to proceed; false to abort and not call the
|
110
|
-
# chosen command
|
111
|
-
# Use skips_pre before a command to skip this block
|
112
|
-
# on that command only
|
113
|
-
$out.silence! if global[:silent]
|
114
|
-
load global[:config] if global[:config]
|
115
|
-
true
|
116
|
-
end
|
117
|
-
|
118
|
-
post do |global, command, options, args|
|
119
|
-
# Post logic here
|
120
|
-
# Use skips_post before a command to skip this
|
121
|
-
# block on that command only
|
122
|
-
end
|
123
|
-
|
124
|
-
on_error do |exception|
|
125
|
-
# Error logic here
|
126
|
-
# return false to skip default error handling
|
127
|
-
true
|
128
|
-
end
|
129
|
-
|
130
|
-
exit run(ARGV)
|
5
|
+
require 'prebundler'
|
6
|
+
exit Prebundler::Commands.run(ARGV)
|
@@ -17,6 +17,7 @@ module Prebundler
|
|
17
17
|
|
18
18
|
class Install < Base
|
19
19
|
def run
|
20
|
+
lock
|
20
21
|
prepare
|
21
22
|
install
|
22
23
|
update_bundle_config
|
@@ -30,6 +31,10 @@ module Prebundler
|
|
30
31
|
|
31
32
|
private
|
32
33
|
|
34
|
+
def lock
|
35
|
+
system "bundle lock --gemfile #{gemfile_path}"
|
36
|
+
end
|
37
|
+
|
33
38
|
def prepare
|
34
39
|
FileUtils.mkdir_p(bundle_path)
|
35
40
|
ENV['BUNDLE_GEMFILE'] = gemfile_path
|
@@ -0,0 +1,146 @@
|
|
1
|
+
require 'gli'
|
2
|
+
require 'etc'
|
3
|
+
require 'bundler'
|
4
|
+
require 'prebundler'
|
5
|
+
require 'prebundler/version'
|
6
|
+
|
7
|
+
module Prebundler
|
8
|
+
class Commands
|
9
|
+
extend GLI::App
|
10
|
+
|
11
|
+
program_desc 'Gem dependency prebuilder'
|
12
|
+
|
13
|
+
version Prebundler::VERSION
|
14
|
+
|
15
|
+
subcommand_option_handling :normal
|
16
|
+
arguments :strict
|
17
|
+
|
18
|
+
def self.out
|
19
|
+
@out ||= Prebundler::WritePipe.new
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Don't log to stdout"
|
23
|
+
switch [:s, :silent]
|
24
|
+
|
25
|
+
desc 'Path to config file.'
|
26
|
+
default_value './.prebundle_config'
|
27
|
+
flag [:c, :config]
|
28
|
+
|
29
|
+
desc 'Install gems from the Gemfile.lock.'
|
30
|
+
command :install do |c|
|
31
|
+
c.desc 'Maximum number of parallel gem installs.'
|
32
|
+
c.default_value Etc.nprocessors
|
33
|
+
c.flag [:j, :jobs], type: Integer
|
34
|
+
|
35
|
+
c.desc 'Path to the gemfile to install gems from.'
|
36
|
+
c.default_value ENV.fetch('BUNDLE_GEMFILE', './Gemfile')
|
37
|
+
c.flag [:g, :gemfile]
|
38
|
+
|
39
|
+
c.desc 'Path to the bundle installation directory.'
|
40
|
+
c.default_value ENV.fetch('BUNDLE_PATH', Bundler.bundle_path.to_s)
|
41
|
+
c.flag [:b, :'bundle-path']
|
42
|
+
|
43
|
+
c.desc 'Backend prefix (i.e. path) at which to store gems.'
|
44
|
+
c.flag [:prefix]
|
45
|
+
|
46
|
+
c.desc 'A comma-separated list of groups referencing gems to install.'
|
47
|
+
c.flag :with
|
48
|
+
|
49
|
+
c.desc 'A comma-separated list of groups referencing gems to skip during installation.'
|
50
|
+
c.flag :without
|
51
|
+
|
52
|
+
c.desc 'Generate binstubs for installed gems.'
|
53
|
+
c.default_value true
|
54
|
+
c.switch :binstubs
|
55
|
+
|
56
|
+
c.desc 'Retry failed network requests n times (currently not implemented).'
|
57
|
+
c.default_value 1
|
58
|
+
c.flag [:retry], type: Integer
|
59
|
+
|
60
|
+
c.action do |global_options, options, args|
|
61
|
+
raise 'Must specify a non-zero number of jobs' if options[:jobs] < 1
|
62
|
+
Prebundler::Cli::Install.run(out, global_options, options, args)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
desc 'List each gem and associated source.'
|
67
|
+
command :list do |c|
|
68
|
+
c.desc 'Path to the gemfile.'
|
69
|
+
c.default_value ENV.fetch('BUNDLE_GEMFILE', './Gemfile')
|
70
|
+
c.flag [:g, :gemfile]
|
71
|
+
|
72
|
+
c.desc 'Filter by source. Will perform partial matching.'
|
73
|
+
c.flag [:s, :source], multiple: true
|
74
|
+
|
75
|
+
c.action do |global_options, options, args|
|
76
|
+
Prebundler::Cli::List.run(out, global_options, options, args)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
desc 'Generate a subset of a Gemfile.'
|
81
|
+
command :subset do |c|
|
82
|
+
c.desc 'Path to the gemfile.'
|
83
|
+
c.default_value ENV.fetch('BUNDLE_GEMFILE', './Gemfile')
|
84
|
+
c.flag [:g, :gemfile]
|
85
|
+
|
86
|
+
c.desc 'Path to the bundle installation directory.'
|
87
|
+
c.default_value ENV.fetch('BUNDLE_PATH', Bundler.bundle_path.to_s)
|
88
|
+
c.flag [:b, :'bundle-path']
|
89
|
+
|
90
|
+
c.desc 'Gem (and dependencies) to include in the subset.'
|
91
|
+
c.flag [:i, :include], multiple: true
|
92
|
+
|
93
|
+
c.desc "Add an additional gem to the subset. The gem doesn't have to be part of the original Gemfile."
|
94
|
+
c.flag [:a, :add], multiple: true
|
95
|
+
|
96
|
+
c.desc 'Include development dependencies of subsetted gems.'
|
97
|
+
c.default_value false
|
98
|
+
c.switch [:d, :development]
|
99
|
+
|
100
|
+
c.desc 'File path to output the resulting Gemfile into. Use - for standard output.'
|
101
|
+
c.default_value '-'
|
102
|
+
c.flag [:o, :output]
|
103
|
+
|
104
|
+
c.action do |global_options, options, args|
|
105
|
+
Prebundler::Cli::Subset.run(out, global_options, options, args)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
desc 'Generate binstubs. Accepts the same arguments as `bundle binstubs`.'
|
110
|
+
command :binstubs do
|
111
|
+
end
|
112
|
+
|
113
|
+
singleton_class.send(:prepend, Module.new do
|
114
|
+
def run(args)
|
115
|
+
if args[0] == 'binstubs'
|
116
|
+
exec "bundle binstubs #{args[1..-1].join(' ')}"
|
117
|
+
else
|
118
|
+
super
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end)
|
122
|
+
|
123
|
+
pre do |global, command, options, args|
|
124
|
+
# Pre logic here
|
125
|
+
# Return true to proceed; false to abort and not call the
|
126
|
+
# chosen command
|
127
|
+
# Use skips_pre before a command to skip this block
|
128
|
+
# on that command only
|
129
|
+
out.silence! if global[:silent]
|
130
|
+
load global[:config] if global[:config]
|
131
|
+
true
|
132
|
+
end
|
133
|
+
|
134
|
+
post do |global, command, options, args|
|
135
|
+
# Post logic here
|
136
|
+
# Use skips_post before a command to skip this
|
137
|
+
# block on that command only
|
138
|
+
end
|
139
|
+
|
140
|
+
on_error do |exception|
|
141
|
+
# Error logic here
|
142
|
+
# return false to skip default error handling
|
143
|
+
true
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
data/lib/prebundler/gem_ref.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'rubygems/package'
|
1
2
|
require 'fileutils'
|
2
3
|
require 'set'
|
3
4
|
|
@@ -48,8 +49,9 @@ module Prebundler
|
|
48
49
|
end
|
49
50
|
|
50
51
|
def install
|
51
|
-
# NOTE: the --platform argument
|
52
|
-
#
|
52
|
+
# NOTE: the --platform argument used to not work when --ignore-dependencies
|
53
|
+
# was specified, but has been fixed in modern versions of rubygems. See:
|
54
|
+
# https://github.com/rubygems/rubygems/pull/2446 for a very long rabbit hole.
|
53
55
|
Bundler.with_unbundled_env do
|
54
56
|
system(
|
55
57
|
{ "GEM_HOME" => bundle_path },
|
@@ -64,26 +66,45 @@ module Prebundler
|
|
64
66
|
end
|
65
67
|
|
66
68
|
def install_from_tar(tar_file)
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
69
|
+
File.open(tar_file) do |f|
|
70
|
+
Gem::Package::TarReader.new(f) do |tar|
|
71
|
+
tar.each do |entry|
|
72
|
+
path = File.join(bundle_path, entry.full_name)
|
73
|
+
|
74
|
+
if entry.directory?
|
75
|
+
FileUtils.mkdir_p(path)
|
76
|
+
else
|
77
|
+
FileUtils.mkdir_p(File.dirname(path))
|
78
|
+
File.open(path, 'wb') do |new_file|
|
79
|
+
new_file.write(entry.read)
|
80
|
+
end
|
81
|
+
File.chmod(entry.header.mode, path)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
78
85
|
end
|
79
86
|
|
80
|
-
|
81
|
-
|
82
|
-
|
87
|
+
true
|
88
|
+
rescue => e
|
89
|
+
return false
|
90
|
+
end
|
83
91
|
|
84
|
-
|
85
|
-
|
86
|
-
|
92
|
+
def add_to_tar(tar_file)
|
93
|
+
File.open(tar_file, 'wb') do |f|
|
94
|
+
Gem::Package::TarWriter.new(f) do |tar_io|
|
95
|
+
Dir.chdir(bundle_path) do
|
96
|
+
add_files_to_tar(
|
97
|
+
tar_io, Dir.glob(File.join(relative_gem_dir, '**', '*'))
|
98
|
+
)
|
99
|
+
|
100
|
+
add_files_to_tar(tar_io, relative_gemspec_files)
|
101
|
+
|
102
|
+
if File.directory?(extension_dir)
|
103
|
+
add_files_to_tar(
|
104
|
+
tar_io, Dir.glob(File.join(relative_extension_dir, '**', '*'))
|
105
|
+
)
|
106
|
+
end
|
107
|
+
end
|
87
108
|
end
|
88
109
|
end
|
89
110
|
end
|
@@ -155,6 +176,17 @@ module Prebundler
|
|
155
176
|
|
156
177
|
private
|
157
178
|
|
179
|
+
def add_files_to_tar(tar_io, files)
|
180
|
+
files.each do |file|
|
181
|
+
next if File.directory?(file)
|
182
|
+
|
183
|
+
mode = File.stat(file).mode
|
184
|
+
tar_io.add_file(file, mode) do |new_file|
|
185
|
+
new_file.write(File.binread(file))
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
158
190
|
def find_platform_dir(base)
|
159
191
|
platform = Bundler.local_platform.to_a
|
160
192
|
|
@@ -17,11 +17,8 @@ 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
|
21
20
|
|
22
21
|
lockfile.specs.each do |spec|
|
23
|
-
next if spec.platform != 'ruby' && spec.platform.to_s != local_platform
|
24
|
-
|
25
22
|
gems[spec.name] ||= GemRef.create(spec.name, bundle_path, options)
|
26
23
|
gems[spec.name].spec = spec
|
27
24
|
gems[spec.name].dependencies = spec.dependencies.map(&:name)
|
@@ -76,5 +73,9 @@ module Prebundler
|
|
76
73
|
def gemspec
|
77
74
|
# do nothing
|
78
75
|
end
|
76
|
+
|
77
|
+
def eval_gemfile(path)
|
78
|
+
instance_eval(File.read(path))
|
79
|
+
end
|
79
80
|
end
|
80
81
|
end
|
data/lib/prebundler/version.rb
CHANGED
data/lib/prebundler.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
require '
|
1
|
+
require 'ohey'
|
2
2
|
|
3
3
|
module Prebundler
|
4
4
|
autoload :Cli, 'prebundler/cli'
|
5
|
+
autoload :Commands, 'prebundler/commands'
|
5
6
|
autoload :Configurator, 'prebundler/configurator'
|
6
7
|
autoload :FileBackend, 'prebundler/file_backend'
|
7
8
|
autoload :PathGemRef, 'prebundler/path_gem_ref'
|
@@ -27,13 +28,13 @@ module Prebundler
|
|
27
28
|
end
|
28
29
|
|
29
30
|
def platform_version
|
30
|
-
@platform_version ||= "#{
|
31
|
+
@platform_version ||= "#{platform.name}-#{platform.version}"
|
31
32
|
end
|
32
33
|
|
33
34
|
private
|
34
35
|
|
35
|
-
def
|
36
|
-
|
36
|
+
def platform
|
37
|
+
@platform ||= Ohey.current_platform
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
data/prebundler.gemspec
CHANGED
@@ -14,10 +14,10 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.add_dependency 'bundler'
|
15
15
|
s.add_dependency 'parallel', '~> 1.0'
|
16
16
|
s.add_dependency 'gli', '~> 2.0'
|
17
|
-
s.add_dependency '
|
17
|
+
s.add_dependency 'ohey', '~> 1.0'
|
18
18
|
|
19
19
|
# @TODO: move s3 support into separate gem
|
20
|
-
s.add_dependency 'aws-sdk', '~>
|
20
|
+
s.add_dependency 'aws-sdk-s3', '~> 1.0'
|
21
21
|
|
22
22
|
s.executables << 'prebundle'
|
23
23
|
|
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.
|
4
|
+
version: 0.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cameron Dutro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -53,33 +53,33 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: ohey
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
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: '
|
68
|
+
version: '1.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: aws-sdk
|
70
|
+
name: aws-sdk-s3
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '1.0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '1.0'
|
83
83
|
description: Gem dependency prebuilder
|
84
84
|
email:
|
85
85
|
- camertron@gmail.com
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- lib/prebundler/cli/install.rb
|
100
100
|
- lib/prebundler/cli/list.rb
|
101
101
|
- lib/prebundler/cli/subset.rb
|
102
|
+
- lib/prebundler/commands.rb
|
102
103
|
- lib/prebundler/configurator.rb
|
103
104
|
- lib/prebundler/file_backend.rb
|
104
105
|
- lib/prebundler/gem_ref.rb
|
@@ -129,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
130
|
- !ruby/object:Gem::Version
|
130
131
|
version: '0'
|
131
132
|
requirements: []
|
132
|
-
rubygems_version: 3.
|
133
|
+
rubygems_version: 3.3.3
|
133
134
|
signing_key:
|
134
135
|
specification_version: 4
|
135
136
|
summary: Gem dependency prebuilder
|