Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Bundler to manage vendor directory #4895

Merged
merged 1 commit into from
Sep 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@
**/.bundle/cache
**/vendor/bundle
**/vendor/ruby
**/vendor/bundle-standalone/ruby/*/cache
**/vendor/bundle-standalone/ruby/*/gems/*/*
**/vendor/bundle-standalone/ruby/*/specifications

# Unignore vendored gems
!**/vendor/bundle-standalone/ruby/*/gems/*/lib

# Ignore backports gem (we don't need all files)
**/vendor/bundle-standalone/ruby/*/gems/backports-*/lib
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires git add -f to add additional backports files but I think it's the best approach to avoid making this .gitignore very messy and backports-specific.


# Ignore `bin` contents (again).
/bin
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cask/artifact/pkg.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "vendor/plist/plist"
require "plist"

require "cask/artifact/abstract_artifact"

Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/string.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Contains backports from newer versions of Ruby
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is perhaps no longer needed as it's a bit more obvious from the require what's going on here.

require_relative "../vendor/backports/string"
require "backports/2.4.0/string/match"

class String
# String.chomp, but if result is empty: returns nil instead.
Expand Down
2 changes: 2 additions & 0 deletions Library/Homebrew/load_path.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s)
$LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.to_s)
end

require "vendor/bundle-standalone/bundler/setup"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check below if interested; this file is generated by bundler and sets up the load path for all the relevant gems. This means they can live in versioned directories but we never need to manually update the names of those directories.

2 changes: 1 addition & 1 deletion Library/Homebrew/os/mac/mach.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "vendor/macho/macho"
require "macho"
require "os/mac/architecture_list"

module MachOShim
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/system_command.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "open3"
require "ostruct"
require "vendor/plist/plist"
require "plist"
require "shellwords"

require "extend/io"
Expand Down
4 changes: 4 additions & 0 deletions Library/Homebrew/vendor/.bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
BUNDLE_PATH: "bundle-standalone"
BUNDLE_DISABLE_SHARED_GEMS: "true"
BUNDLE_BIN: "false"
5 changes: 5 additions & 0 deletions Library/Homebrew/vendor/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source "https://rubygems.org"

gem "backports"
gem "plist"
gem "ruby-macho"
17 changes: 17 additions & 0 deletions Library/Homebrew/vendor/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
GEM
remote: https://rubygems.org/
specs:
backports (3.8.0)
plist (3.3.0)
ruby-macho (2.0.0)

PLATFORMS
ruby

DEPENDENCIES
backports
plist
ruby-macho

BUNDLED WITH
1.16.4
9 changes: 9 additions & 0 deletions Library/Homebrew/vendor/bundle-standalone/bundler/setup.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require 'rbconfig'
# ruby 1.8.7 doesn't define RUBY_ENGINE
ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
ruby_version = RbConfig::CONFIG["ruby_version"]
path = File.expand_path('..', __FILE__)
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/backports-3.8.0/lib"
$:.unshift "#{path}/"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.3.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.0.0/lib"
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Taken from https://github.com/marcandre/backports/blob/v3.8.0/lib/backports/2.4.0/string/match.rb
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is not present in the upstream file so was removed by Bundler.

unless String.method_defined? :match?
class String
def match?(*args)
Expand Down
6 changes: 3 additions & 3 deletions Library/Homebrew/vendor/plist/plist.rb → .../ruby/2.3.0/gems/plist-3.3.0/lib/plist.rb
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
require 'cgi'
require 'stringio'

require_relative 'plist/generator'
require_relative 'plist/parser'
require_relative 'plist/version'
require 'plist/generator'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are not present in the upstream file so were removed by Bundler.

require 'plist/parser'
require 'plist/version'

module Plist
end
File renamed without changes.
File renamed without changes.