diff --git a/Rakefile b/Rakefile index 57f33b7..5ee89c8 100644 --- a/Rakefile +++ b/Rakefile @@ -38,8 +38,8 @@ end task :update_docs do ruby_path = File.join( - Config::CONFIG["bindir"], - Config::CONFIG["RUBY_INSTALL_NAME"]) + RbConfig::CONFIG["bindir"], + RbConfig::CONFIG["RUBY_INSTALL_NAME"]) help = "--help" command = "ruby #{File.basename(INSTALLER)} #{help}" diff --git a/install.rb b/install.rb index 18c80c8..bb917d6 100644 --- a/install.rb +++ b/install.rb @@ -12,7 +12,7 @@ class Installer include FileUtils - CONFIG = Config::CONFIG + CONFIG = RbConfig::CONFIG BIT64 = (1.size == 8) RB_BASENAME = Pathname.new "P4.rb" @@ -29,12 +29,17 @@ class Installer ] SERVER = "ftp.perforce.com" - SERVER_TOP_DIR = Pathname.new "perforce" + SERVER_TOP_DIR = Pathname.new "pub/perforce" # Mysterious "ghost" releases which lack files - HOSED_VERSIONS = %w[09.3 11.1] + HOSED_VERSIONS = %w[09.3 11.1 12.2] + + if RUBY_PLATFORM == 'i386-mingw32' + P4API_REMOTE_BASENAME = Pathname.new "p4api.zip" + else + P4API_REMOTE_BASENAME = Pathname.new "p4api.tgz" + end - P4API_REMOTE_BASENAME = Pathname.new "p4api.tgz" P4RUBY_REMOTE_BASENAME = Pathname.new "p4ruby.tgz" WORK_DIR = Pathname.new "work" @@ -199,6 +204,8 @@ def guess_platform(opts = {}) if config_os =~ %r!cygwin!i "cygwin" + windows_cpu + elsif (config_os =~ %r!mingw!i) && (CONFIG["MAJOR"].to_i == 1) && (CONFIG["MINOR"].to_i == 9) + "mingw" + windows_cpu elsif config_os =~ %r!(mswin|mingw)!i "nt" + windows_cpu elsif @s.local @@ -253,7 +260,11 @@ def sys(*args) end def unpack(distfile, target_dir) - sys("tar", "zxvf", distfile.to_s, "-C", target_dir.to_s) + if File.extname(distfile.to_s).downcase == '.zip' + sys('unzip', distfile.to_s, '-d', target_dir.to_s) + else + sys("tar", "zxvf", distfile.to_s, "-C", target_dir.to_s) + end end def fetch_spec(spec)