From abd16a16f4374f4e5f69281fd2c8fbbf1e4980eb Mon Sep 17 00:00:00 2001 From: Maturin Date: Sat, 7 Jul 2012 12:36:31 +0200 Subject: [PATCH 1/2] Replaced obsolete Config with RbConfig. --- Rakefile | 4 ++-- install.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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..f38af9a 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" From 40ce20cbacf90aafac51dc196a4d2ddaff69fb67 Mon Sep 17 00:00:00 2001 From: Maturin Date: Sat, 7 Jul 2012 13:55:32 +0200 Subject: [PATCH 2/2] Windows / Ruby 1.9 specific changes and updated Peforce infos. --- install.rb | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/install.rb b/install.rb index f38af9a..bb917d6 100644 --- a/install.rb +++ b/install.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)