Skip to content

Commit

Permalink
Merge pull request #63 from cxr0715/install_dir
Browse files Browse the repository at this point in the history
add --install-dir option
  • Loading branch information
rdp authored Aug 2, 2024
2 parents 8f5425b + 8ce52b4 commit 3f26748
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ Or install in the users personal gem directory
$ gem specific_install https://github.com/orlandohill/waxeye -u
`

Or install in the install directory

`
$ gem specific_install https://github.com/cxr0715/cocoapods-TSPodfileTimeWatch.git -i /Users/bkdevops/TSPodfileTimeWatch_dir
`

PS: you should **export RUBYLIB=/Users/bkdevops/TSPodfileTimeWatch_dir/cocoapods-TSPodfileTimeWatch-0.0.6/lib:other_plug_path** to use -i install plug

The following URI types are accepted:

- http(s)://github.com/rdp/specific_install.git
Expand Down
10 changes: 10 additions & 0 deletions lib/rubygems/commands/specific_install_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ def initialize(output=STDOUT)
add_option('-u', '--user-install', arguments) do |userinstall, options|
options[:userinstall] = userinstall
end

add_option('-i', '--install-dir INSTALL_DIR', arguments) do |installdir, options|
options[:installdir] = installdir
end
end

def arguments
Expand All @@ -52,6 +56,7 @@ def execute
@branch ||= set_branch if set_branch
@ref ||= set_ref
@tag ||= set_tag
@installdir ||= set_installdir
if @loc.nil?
raise ArgumentError, "No location received. Use like `gem specific_install -l http://example.com/rdp/specific_install`"
end
Expand Down Expand Up @@ -194,6 +199,10 @@ def set_tag
options[:tag]
end

def set_installdir
options[:installdir]
end

def success_message
output.puts 'Successfully installed'
end
Expand All @@ -203,6 +212,7 @@ def install_gemspec
if gem
install_options = {}
install_options[:user_install] = options[:userinstall].nil? ? nil : true
install_options[:install_dir] = options[:installdir] if options[:installdir]
inst = Gem::DependencyInstaller.new install_options
inst.install gem
else
Expand Down

0 comments on commit 3f26748

Please sign in to comment.