prebundler 0.10.0 → 0.11.4

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: f85ac1db1104a8d0cef038b2957c5745cabe60744cd042ec4d2f6112faba0dda
4
- data.tar.gz: 70595a0b3f049f1a77066542107d74a5297e0e7572bcdcbc2a3603edcfcf331e
3
+ metadata.gz: 8a1d8c42efac97a9a231f819c72b4882edaa990267bdba2409f67cbb0a475e44
4
+ data.tar.gz: a34cacca7e651248c255c46d357b52c8ac3535f50972cd56d696f7bfe6f121cb
5
5
  SHA512:
6
- metadata.gz: a339b1e9a90f87c3a67e1c418518902ac88663f1360511f9c04a2fe28469b295dbb947b5bc8689c716c87adea10dc4a4835a3133613ca6890d9bd02ff7f457fd
7
- data.tar.gz: f64888ba39a9f1eb347cf395d1628f6e4c4e9aad714ab895ea84311813e1ab1240885543a7e40c6c82494a046d0d27d7a93de9d28f4499e78bd1985c7cfab1ef
6
+ metadata.gz: 4d7008ebbf5314f02bbf992e4a6a8a7a2c05fae161427b902a12565a46bb70747a0d2e3c912d4ed45e557cc5b8616d7c906cf3d12dbade1733206664971f15e5
7
+ data.tar.gz: 63a314e575817c6123e3895322c507349753c383afd541a92343c6d0999306d9ea1d381492057febe7779c6098a0dd10078328bd87080ead9a99d9dbe1e0f76d
@@ -1,3 +1,25 @@
1
+ 0.11.4
2
+ ===
3
+ - Ensure .bundle/config directory exists before writing to it.
4
+
5
+ 0.11.3
6
+ ===
7
+ - Support (well, add stubs for) `ruby` and `git_source` methods in Gemfiles.
8
+ - Don't attempt to install gems we can't get a spec for.
9
+
10
+ 0.11.2
11
+ ===
12
+ - Always run `bundle install` just in case.
13
+ - Make sure `bundle check` is the _last_ thing that runs.
14
+
15
+ 0.11.1
16
+ ===
17
+ - Exit with nonzero status code if fallback `bundle install` fails.
18
+
19
+ 0.11.0
20
+ ===
21
+ - Allow the caller to pass in a s3 client for non-standard setups
22
+
1
23
  0.10.0
2
24
  ===
3
25
  - Update aws-sdk client creation to be able to support non-aws s3 api endpoints (e.g. minio)
@@ -6,13 +6,26 @@ require 'yaml'
6
6
 
7
7
  module Prebundler
8
8
  module Cli
9
+ class BundleFailedError < StandardError
10
+ attr_reader :exitstatus
11
+
12
+ def initialize(message, exitstatus)
13
+ super(message)
14
+ @exitstatus = exitstatus
15
+ end
16
+ end
17
+
9
18
  class Install < Base
10
19
  def run
11
20
  prepare
12
21
  install
13
22
  update_bundle_config
14
23
  generate_binstubs
15
- check
24
+ # always run `bundle install` just in case
25
+ bundle_install
26
+ rescue BundleFailedError => e
27
+ out.puts e.message
28
+ exit e.exitstatus
16
29
  end
17
30
 
18
31
  private
@@ -105,6 +118,7 @@ module Prebundler
105
118
  config = File.exist?(file) ? YAML.load_file(file) : {}
106
119
  config['BUNDLE_WITH'] = with_groups.join(':') unless with_groups.empty?
107
120
  config['BUNDLE_WITHOUT'] = without_groups.join(':') unless without_groups.empty?
121
+ FileUtils.mkdir_p(File.dirname(file))
108
122
  File.write(file, YAML.dump(config))
109
123
  end
110
124
 
@@ -124,12 +138,19 @@ module Prebundler
124
138
  out.puts 'Done generating binstubs'
125
139
  end
126
140
 
127
- def check
141
+ def bundle_install
142
+ system "bundle install #{bundle_install_args}"
143
+
144
+ if $?.exitstatus != 0
145
+ raise BundleFailedError.new(
146
+ "bundler exited with status code #{$?.exitstatus}", $?.exitstatus
147
+ )
148
+ end
149
+
128
150
  system "bundle check --gemfile #{gemfile_path}"
129
151
 
130
152
  if $?.exitstatus != 0
131
- out.puts 'Bundle not satisfied, falling back to `bundle install`'
132
- system "bundle install #{bundle_install_args}"
153
+ raise BundleFailedError.new('bundle could not be satisfied', $?.exitstatus)
133
154
  end
134
155
  end
135
156
 
@@ -23,6 +23,12 @@ module Prebundler
23
23
  gems[spec.name].spec = spec
24
24
  gems[spec.name].dependencies = spec.dependencies.map(&:name)
25
25
  end
26
+
27
+ # Get rid of gems without a spec, as they are likely not supposed
28
+ # to be installed. This happens for gems like tzinfo-data which are
29
+ # listed in the standard rails Gemfile but only installed on
30
+ # certain platforms.
31
+ gems.reject! { |_, g| g.spec.nil? }
26
32
  end
27
33
 
28
34
  def current_context
@@ -34,6 +40,13 @@ module Prebundler
34
40
  }
35
41
  end
36
42
 
43
+ def ruby(*args)
44
+ end
45
+
46
+ # this is probably the wrong thing to do
47
+ def git_source(*args)
48
+ end
49
+
37
50
  def gem(name, *args)
38
51
  options = args.find { |a| a.is_a?(Hash) } || {}
39
52
  gems[name] = GemRef.create(name, bundle_path, current_context.merge(options))
@@ -1,16 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'aws-sdk'
2
4
 
3
5
  module Prebundler
4
6
  class S3Backend
5
- attr_reader :access_key_id, :secret_access_key, :bucket, :region, :endpoint, :force_path_style
7
+ attr_reader :access_key_id, :secret_access_key, :bucket, :region
6
8
 
7
9
  def initialize(options = {})
8
- @access_key_id = options.fetch(:access_key_id)
9
- @secret_access_key = options.fetch(:secret_access_key)
10
- @bucket = options.fetch(:bucket)
11
- @region = options.fetch(:region) { 'us-east-1' }
12
- @endpoint = options.fetch(:endpoint) { 's3.amazonaws.com' }
13
- @force_path_style = options.fetch(:force_path_style) { false }
10
+ @bucket = options.fetch(:bucket)
11
+
12
+ @client = options.fetch(:client, nil)
13
+ @access_key_id = options.fetch(:access_key_id, nil)
14
+ @secret_access_key = options.fetch(:secret_access_key, nil)
15
+ @region = options.fetch(:region) { ENV['AWS_REGION'] || 'us-east-1' }
14
16
  end
15
17
 
16
18
  def store_file(source_file, dest_file)
@@ -33,7 +35,7 @@ module Prebundler
33
35
  files = []
34
36
  base_options = {
35
37
  bucket: bucket,
36
- prefix: "#{Bundler.local_platform.to_s}/#{Prebundler.platform_version}/#{Gem.extension_api_version.to_s}"
38
+ prefix: "#{Bundler.local_platform}/#{Prebundler.platform_version}/#{Gem.extension_api_version}"
37
39
  }
38
40
 
39
41
  while truncated
@@ -62,7 +64,7 @@ module Prebundler
62
64
  private
63
65
 
64
66
  def client
65
- @client ||= Aws::S3::Client.new(region: region, credentials: credentials, endpoint: endpoint, force_path_style: force_path_style)
67
+ @client ||= Aws::S3::Client.new(region: region, credentials: credentials)
66
68
  end
67
69
 
68
70
  def credentials
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Prebundler
4
- VERSION = '0.10.0'
4
+ VERSION = '0.11.4'
5
5
  end
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.10.0
4
+ version: 0.11.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-02 00:00:00.000000000 Z
11
+ date: 2020-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -114,7 +114,7 @@ files:
114
114
  homepage: http://github.com/camertron
115
115
  licenses: []
116
116
  metadata: {}
117
- post_install_message:
117
+ post_install_message:
118
118
  rdoc_options: []
119
119
  require_paths:
120
120
  - lib
@@ -129,9 +129,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  requirements: []
132
- rubyforge_project:
133
- rubygems_version: 2.7.6
134
- signing_key:
132
+ rubygems_version: 3.1.4
133
+ signing_key:
135
134
  specification_version: 4
136
135
  summary: Gem dependency prebuilder
137
136
  test_files: []