diff options
author | elijah <elijah@riseup.net> | 2012-11-08 13:59:14 -0800 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2012-11-08 13:59:14 -0800 |
commit | c1fe1ef9193b1923c6e2c8f438fb6440e71eb9ad (patch) | |
tree | 2f66db874dbf837350a9a1752b5fafa0cb73182d /Rakefile | |
parent | 1debcaa921fbcea96b2a58696dcdc2aaab0de383 (diff) | |
download | leap_cli-c1fe1ef9193b1923c6e2c8f438fb6440e71eb9ad.tar.gz leap_cli-c1fe1ef9193b1923c6e2c8f438fb6440e71eb9ad.tar.bz2 |
rakefile: better language for install, added uninstall.
Diffstat (limited to 'Rakefile')
-rw-r--r-- | Rakefile | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -43,7 +43,7 @@ task 'build' do say "#{$spec.name} #{$spec.version} built to pkg/#{file_name}" end -desc "Build and install #{$spec.name}-#{$spec.version}.gem into either system-wide or user gems" +desc "Install #{$spec.name}-#{$spec.version}.gem into either system-wide or user gems" task 'install' do if !File.exists?($gem_path) say("Could not file #{$gem_path}. Try running 'rake build'") @@ -51,14 +51,26 @@ task 'install' do if ENV["USER"] == "root" run "gem install '#{$gem_path}'" else - say("A system-wide install requires that you run 'rake install' as root, which you are not.") - if agree("Do you want to continue installing to #{Gem.path.grep /home/}? ") + home_gem_path = Gem.path.grep(/home/).first + say("You are installing as an unprivileged user, which will result in the installation being placed in '#{home_gem_path}'.") + if agree("Do you want to continue installing to #{home_gem_path}? ") run "gem install '#{$gem_path}' --user-install" end end end end +desc "Uninstall #{$spec.name}-#{$spec.version}.gem from either system-wide or user gems" +task 'uninstall' do + if ENV["USER"] == "root" + say("Removing #{$spec.name}-#{$spec.version}.gem from system-wide gems") + run "gem uninstall '#{$spec.name}' --version #{$spec.version} --verbose -x -I" + else + say("Removing #{$spec.name}-#{$spec.version}.gem from user's gems") + run "gem uninstall '#{$spec.name}' --version #{$spec.version} --verbose --user-install -x -I" + end +end + ## ## TESTING ## |