diff options
-rw-r--r-- | Rakefile | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -1,8 +1,7 @@ require "rubygems" -require "highline/import" require "pty" require "fileutils" -require 'rake/testtask' +require "rake/testtask" ## ## HELPER @@ -40,21 +39,25 @@ task 'build' do run "gem build -V '#{$spec_path}'" file_name = File.basename(built_gem_path) FileUtils.mv(built_gem_path, 'pkg') - say "#{$spec.name} #{$spec.version} built to pkg/#{file_name}" + puts "#{$spec.name} #{$spec.version} built to pkg/#{file_name}" end 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'") + puts("Could not file #{$gem_path}. Try running 'rake build'") else if ENV["USER"] == "root" run "gem install '#{$gem_path}'" else 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" + puts "You are installing as an unprivileged user, which will result in the installation being placed in '#{home_gem_path}'." + print "Do you want to continue installing to #{home_gem_path}? [y/N] " + input = STDIN.readline + if input =~ /[yY]/ + puts "gem install '#{$gem_path}' --user-install" + else + puts "bailing out." end end end @@ -63,10 +66,10 @@ 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") + puts "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") + puts "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 |