bundler-inject 2.0.0 → 2.1.0

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: 25b3400016d442200c1a6f29666d07e91ac273b6d2926c31c8ca4bd198af07b1
4
- data.tar.gz: 7fc849b9e6becf2ce112be77a84416aca98b49fc2ff26ff46985a3965cc7bd4b
3
+ metadata.gz: 2242653c6fcf2c5a650a7a04463a1c90eb8c432f40dd590e9882f168faf1f9f0
4
+ data.tar.gz: 2bf3b7781f285f4d7be9b4ed137158c3859022934427d8328fc9e8cb8f0315d8
5
5
  SHA512:
6
- metadata.gz: a02c79078741a7d8573d64a3584ddd4f01c68384ff47b697cfcbe2c6ed2f0d4e04b3a2f7dbb4579c7a69c98f9fdbd435e79096f5c6204d3622b5e522fd42c19e
7
- data.tar.gz: fd9a7dc81f857689fea84b09cd935b01d061f08102a89737a2171c617536e591c76de241d16649367c3f27c0486d9ba843cc071ce4d3e66dd75bfeadc2e0b340
6
+ metadata.gz: aaacd8b7d630a81188417f100b30acccb690318cef37c65006225ba7a52d35b869d13a73ae7e68fb7c7d8f6f07f65b2694d10e10882e0075a7b69985fea50457
7
+ data.tar.gz: 4d20624d891c22507001a59bc4f79d6a6b7fdf790192a1ac463e6b83aa5f0241724bb98e0728e8c7c7bc5b8b2094a63941cc83902b10755b66569738bc8a2e14
@@ -0,0 +1,45 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ schedule:
7
+ - cron: '0 0 * * 0'
8
+
9
+ jobs:
10
+ ci:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ ruby-version:
16
+ - '2.7'
17
+ - '3.0'
18
+ - '3.1'
19
+ - '3.2'
20
+ bundler-version:
21
+ - '2.1'
22
+ - '2.2'
23
+ - '2.3'
24
+ - '2.4'
25
+ include:
26
+ - ruby-version: '2.6'
27
+ bundler-version: '2.0'
28
+ env:
29
+ TEST_BUNDLER_VERSION: ${{ matrix.bundler-version }}
30
+ CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+ - name: Set up Ruby
34
+ uses: ruby/setup-ruby@v1
35
+ with:
36
+ ruby-version: ${{ matrix.ruby-version }}
37
+ bundler: ${{ matrix.bundler-version }}
38
+ bundler-cache: true
39
+ timeout-minutes: 30
40
+ - name: Run tests
41
+ run: bundle exec rake
42
+ - name: Report code coverage
43
+ if: ${{ github.ref == 'refs/heads/master' && matrix.ruby-version == '3.2' && matrix.bundler-version == '2.4' }}
44
+ continue-on-error: true
45
+ uses: paambaati/codeclimate-action@v5
data/.rspec CHANGED
@@ -1,4 +1,3 @@
1
- --format documentation
2
- --color
3
1
  --require spec_helper
2
+ --color
4
3
  --order random
data/.whitesource ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "settingsInheritedFrom": "ManageIQ/whitesource-config@master"
3
+ }
data/CHANGELOG.md CHANGED
@@ -7,11 +7,25 @@ a nice looking [Changelog](http://keepachangelog.com).
7
7
 
8
8
  ## Version [HEAD] <sub><sup>now</sub></sup>
9
9
 
10
+ ## Version [2.1.0] <sub><sup>2024-01-09</sub></sup>
11
+
12
+ ### Fixed
13
+ * Remove remnants of bundler 1.x support ([#20](https://github.com/ManageIQ/bundler-inject/pull/20))
14
+ * Fix detection of bundler version ([#21](https://github.com/ManageIQ/bundler-inject/pull/21))
15
+ * Fix spec issues after release of bundler 2.4.17 ([#32](https://github.com/ManageIQ/bundler-inject/pull/32))
16
+
17
+ ### Added
18
+ * Switch to GitHub Actions ([#25](https://github.com/ManageIQ/bundler-inject/pull/25))
19
+ * Add bundler 2.4 to the test matrix ([#28](https://github.com/ManageIQ/bundler-inject/pull/28))
20
+ * Add Ruby 3.1 and 3.2 to test matrix ([#29](https://github.com/ManageIQ/bundler-inject/pull/29))
21
+ * Allow user to specify a PATH to search for gem overrides ([#34](https://github.com/ManageIQ/bundler-inject/pull/34))
22
+
10
23
  ## Version [2.0.0] <sub><sup>2021-05-01</sub></sup>
11
24
 
12
25
  * **BREAKING**: Drops support for bundler below 2.0
13
26
  * **BREAKING**: Drops support for Ruby below 2.6
14
27
  * Adds support for running as a service (with no user / HOME set)
15
28
 
16
- [HEAD]: https://github.com/ManageIQ/bundler-inject/compare/v2.0.0...HEAD
29
+ [HEAD]: https://github.com/ManageIQ/bundler-inject/compare/v2.1.0...HEAD
30
+ [2.1.0]: https://github.com/ManageIQ/bundler-inject/compare/v2.0.0...v2.1.0
17
31
  [2.0.0]: https://github.com/ManageIQ/bundler-inject/compare/v1.1.0...v2.0.0
data/Gemfile CHANGED
@@ -1,6 +1,4 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
3
  # Specify your gem's dependencies in bundler-inject.gemspec
6
4
  gemspec
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # bundler-inject
2
2
 
3
- [![Build Status](https://travis-ci.org/ManageIQ/bundler-inject.svg?branch=master)](https://travis-ci.org/ManageIQ/bundler-inject)
4
- [![Maintainability](https://api.codeclimate.com/v1/badges/e4650d6dd7cbcd981057/maintainability)](https://codeclimate.com/github/ManageIQ/bundler-inject/maintainability)
5
- [![Test Coverage](https://api.codeclimate.com/v1/badges/e4650d6dd7cbcd981057/test_coverage)](https://codeclimate.com/github/ManageIQ/bundler-inject/test_coverage)
6
- [![Security](https://hakiri.io/github/ManageIQ/bundler-inject/master.svg)](https://hakiri.io/github/ManageIQ/bundler-inject/master)
3
+ [![Gem Version](https://badge.fury.io/rb/bundler-inject.svg)](http://badge.fury.io/rb/bundler-inject)
4
+ [![CI](https://github.com/ManageIQ/bundler-inject/actions/workflows/ci.yaml/badge.svg)](https://github.com/ManageIQ/bundler-inject/actions/workflows/ci.yaml)
5
+ [![Code Climate](https://codeclimate.com/github/ManageIQ/bundler-inject.svg)](https://codeclimate.com/github/ManageIQ/bundler-inject)
6
+ [![Test Coverage](https://codeclimate.com/github/ManageIQ/bundler-inject/badges/coverage.svg)](https://codeclimate.com/github/ManageIQ/bundler-inject/coverage)
7
7
 
8
8
  **bundler-inject** is a [bundler plugin](https://bundler.io/guides/bundler_plugins.html)
9
9
  that allows a developer to extend a project with their own personal gems and/or
@@ -79,6 +79,8 @@ original declaration.
79
79
 
80
80
  ## Configuration
81
81
 
82
+ ### Disabling warnings
83
+
82
84
  To disable warnings that are output to the console when `override_gem` or
83
85
  `ensure_gem` is in use, you can update a bundler setting:
84
86
 
@@ -95,6 +97,32 @@ $ export BUNDLE_BUNDLER_INJECT__DISABLE_WARN_OVERRIDE_GEM=true
95
97
  There is a fallback for those that will check the `RAILS_ENV` environment
96
98
  variable, and will disable the warning when in `"production"`.
97
99
 
100
+ ### Specifying gem source directories
101
+
102
+ Many developers checkout gems into a single directory for enhancement.
103
+ Instead of specifying the full path of gems every time, specify a gem path
104
+ to locate these directories. This can be defined with a bundler setting:
105
+
106
+ ```console
107
+ $ bundle config bundler_inject.gem_path ~/src:~/gem_src
108
+ ```
109
+
110
+ or use an environment variable:
111
+
112
+ ```console
113
+ $ export BUNDLE_BUNDLER_INJECT__GEM_PATH=~/src:~/gem_src
114
+ ```
115
+
116
+ An override will find a gem in either of these two directories or in the directory
117
+ where the Gemfile override is located.
118
+
119
+ ```Gemfile
120
+ # located in ~/src/ansi
121
+ override_gem "ansi"
122
+ # located in $PWD/mime_override
123
+ override_gem "mime/type", path: "mime_override"
124
+ ```
125
+
98
126
  ## What is this sorcery?
99
127
 
100
128
  While this is technically a bundler plugin, bundler-inject does not use the
@@ -1,4 +1,4 @@
1
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path("lib", __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require "bundler/inject/version"
4
4
 
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  # Specify which files should be added to the gem when it is released.
24
24
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
26
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
27
  end
28
28
  spec.bindir = "exe"
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency "bundler"
33
33
  spec.add_development_dependency "colorize"
34
34
  spec.add_development_dependency "manageiq-style"
35
- spec.add_development_dependency "rake", "~> 10.0"
36
- spec.add_development_dependency "rspec", "~> 3.0"
37
- spec.add_development_dependency "simplecov"
35
+ spec.add_development_dependency "rake"
36
+ spec.add_development_dependency "rspec", "~> 3.0"
37
+ spec.add_development_dependency "simplecov", ">= 0.21.2"
38
38
  end
@@ -8,7 +8,7 @@ module Bundler
8
8
  calling_file = "#{calling_loc.path}:#{calling_loc.lineno}"
9
9
 
10
10
  remove_dependencies_and_sources(dependency)
11
- expand_gem_path(args, calling_file)
11
+ expand_gem_path(name, args, calling_file)
12
12
  gem(name, *args).tap do
13
13
  warn_override_gem(calling_file, name, args)
14
14
  end
@@ -59,13 +59,21 @@ module Bundler
59
59
  end
60
60
  end
61
61
 
62
- def expand_gem_path(args, calling_file)
62
+ # Determine the path for the gem
63
+ #
64
+ # This is used when an override has no options or a path is specified
65
+ # This path is turned into an absolute path
66
+ def expand_gem_path(name, args, calling_file)
67
+ args << {:path => name} if args.empty?
63
68
  return unless args.last.kind_of?(Hash) && args.last[:path]
64
- args.last[:path] = File.expand_path(args.last[:path], File.dirname(calling_file))
69
+
70
+ possible_paths = [File.dirname(calling_file)] + bundler_inject_gem_path
71
+ full_path = possible_paths.map { |p| File.expand_path(args.last[:path], p) }.detect { |f| File.exist?(f) }
72
+ args.last[:path] = full_path if full_path
65
73
  end
66
74
 
67
75
  def extract_version_opts(args)
68
- args.last.is_a?(Hash) ? [args[0..-2], args[-1]] : [args, {}]
76
+ args.last.kind_of?(Hash) ? [args[0..-2], args[-1]] : [args, {}]
69
77
  end
70
78
 
71
79
  def warn_override_gem(calling_file, name, args)
@@ -82,7 +90,7 @@ module Bundler
82
90
  end
83
91
 
84
92
  def load_global_bundler_d
85
- if ENV["HOME"]
93
+ if Dir.home
86
94
  load_bundler_d(File.join(Dir.home, ".bundler.d"))
87
95
  end
88
96
  end
@@ -93,10 +101,26 @@ module Bundler
93
101
 
94
102
  def load_bundler_d(dir)
95
103
  Dir.glob(File.join(dir, '*.rb')).sort.each do |f|
96
- Bundler.ui.debug "Injecting #{f}..."
104
+ Bundler.ui.debug("Injecting #{f}...")
97
105
  eval_gemfile(f)
98
106
  end
99
107
  end
108
+
109
+ # Path to search for override gems
110
+ #
111
+ # The gem path can be set in two ways:
112
+ #
113
+ # - Via bundler's Bundler::Settings
114
+ #
115
+ # bundle config bundler_inject.gem_path ~/src:~/gems_src
116
+ #
117
+ # - Via an environment variable
118
+ #
119
+ # BUNDLE_BUNDLER_INJECT__GEM_PATH=~/src:~/gems_src
120
+ #
121
+ def bundler_inject_gem_path
122
+ @bundler_inject_gem_path ||= (Bundler.settings["bundler_inject.gem_path"] || "").split(File::PATH_SEPARATOR)
123
+ end
100
124
  end
101
125
  end
102
126
  end
@@ -1,5 +1,5 @@
1
1
  module Bundler
2
2
  module Inject
3
- VERSION = "2.0.0"
3
+ VERSION = "2.1.0".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler-inject
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ManageIQ Authors
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-04 00:00:00.000000000 Z
11
+ date: 2024-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '0'
62
62
  type: :development
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: '10.0'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 0.21.2
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: 0.21.2
97
97
  description: bundler-inject is a bundler plugin that allows a developer to extend
98
98
  a project with their own personal gems and/or override existing gems, without having
99
99
  to modify the Gemfile, thus avoiding accidental modification of git history.
@@ -103,12 +103,13 @@ extensions: []
103
103
  extra_rdoc_files: []
104
104
  files:
105
105
  - ".codeclimate.yml"
106
+ - ".github/workflows/ci.yaml"
106
107
  - ".gitignore"
107
108
  - ".rspec"
108
109
  - ".rubocop.yml"
109
110
  - ".rubocop_cc.yml"
110
111
  - ".rubocop_local.yml"
111
- - ".travis.yml"
112
+ - ".whitesource"
112
113
  - CHANGELOG.md
113
114
  - Gemfile
114
115
  - LICENSE.txt
@@ -144,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
145
  - !ruby/object:Gem::Version
145
146
  version: '0'
146
147
  requirements: []
147
- rubygems_version: 3.1.4
148
+ rubygems_version: 3.2.33
148
149
  signing_key:
149
150
  specification_version: 4
150
151
  summary: A bundler plugin that allows extension of a project with personal and overridden
data/.travis.yml DELETED
@@ -1,23 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.7.3
6
- - 3.0.1
7
- env:
8
- - TEST_BUNDLER_VERSION=2.1
9
- - TEST_BUNDLER_VERSION=2.2
10
- jobs:
11
- include:
12
- - rvm: 2.6.7
13
- env: TEST_BUNDLER_VERSION=2.0
14
- before_install:
15
- - 'echo ''gem: --no-ri --no-rdoc --no-document'' > ~/.gemrc'
16
- - gem install bundler -v "~> $TEST_BUNDLER_VERSION.0"
17
- before_script:
18
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
19
- > ./cc-test-reporter
20
- - chmod +x ./cc-test-reporter
21
- - "./cc-test-reporter before-build"
22
- after_script:
23
- - "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT"