Skip to content

Commit

Permalink
Move loading of 'git' library nearer to where it's used.
Browse files Browse the repository at this point in the history
This is necessary because `require "git"` (at time of writing) will
error if the `git` program is not available.

Upstream (ruby git) issue:
ruby-git/ruby-git#311

Related fpm issues: #1748, #1751
  • Loading branch information
jordansissel committed Jun 19, 2021
1 parent bf9bcc8 commit 4eed9d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/fpm/package/gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
require "fileutils"
require "fpm/util"
require "yaml"
require "git"

# A rubygems package.
#
Expand Down Expand Up @@ -105,6 +104,7 @@ def download(gem_name, gem_version=nil)
FileUtils.mkdir(download_dir) unless File.directory?(download_dir)

if attributes[:gem_git_repo]
require "git"
logger.debug("Git cloning in directory #{download_dir}")
g = Git.clone(attributes[:gem_git_repo],gem_name,:path => download_dir)
if attributes[:gem_git_branch]
Expand Down

0 comments on commit 4eed9d6

Please sign in to comment.