On 12/11/2009 07:47, Charles Roper wrote:
On 11/11/2009 09:17, Charles Roper wrote:
Hi,

First post here - just getting to grips with Radiant.

I'm trying to install the Paperclipped extension on a test site and have
run into a couple of issues. I'm on Windows, using the RubyInstaller
(which recently went RC1):

> ruby -v
ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32]

I've done some further digging and found the problem. I've created an
issue on Github:

http://github.com/radiant/radiant/issues/#issue/69

I've created a patch (attached) that should fix this issue.

Cheers,
Charles

>From 6f474b743c36f1a9a19cac023422a15033ed27b9 Mon Sep 17 00:00:00 2001
From: Charles Roper <charles.ro...@gmail.com>
Date: Thu, 12 Nov 2009 18:15:00 +0000
Subject: [PATCH] Cross-platform fixes for extension installer script.

---
 lib/radiant/extension/script.rb |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/lib/radiant/extension/script.rb b/lib/radiant/extension/script.rb
index 4998c4c..eabd818 100644
--- a/lib/radiant/extension/script.rb
+++ b/lib/radiant/extension/script.rb
@@ -95,7 +95,7 @@ Install type:   #{install_type}
 
     def checkout
       self.path = File.join(Dir.tmpdir, name)
-      system "cd #{Dir.tmpdir}; #{checkout_command}"
+      FileUtils.cd(Dir.tmpdir) { system "#{checkout_command}" }
     end
   end
 
@@ -136,10 +136,14 @@ Install type:   #{install_type}
     def checkout
       if project_in_git?
         system "git submodule add #{url} vendor/extensions/#{name}"
-        system "cd vendor/extensions/#{name}; git submodule init && git 
submodule update"
+        FileUtils.cd(File.join('vendor', 'extensions', name)) do
+          system "git submodule init && git submodule update"
+        end
       else
         super
-        system "cd #{path}; git submodule init && git submodule update"
+        FileUtils.cd(path) do
+          system "git submodule init && git submodule update"
+        end
       end
     end
     
@@ -166,7 +170,10 @@ Install type:   #{install_type}
     end
 
     def unpack
-      output = `cd #{Dir.tmpdir}; gem unpack #{filename.split('-').first}`
+      output = nil
+      FileUtils.cd(Dir.tmpdir) do
+        output = `gem unpack #{filename.split('-').first}`
+      end
       self.path = output.match(/'(.*)'/)[1]
     end
   end
@@ -177,7 +184,8 @@ Install type:   #{install_type}
     end
 
     def unpack
-      output = `cd #{Dir.tmpdir}; tar xvf #{filename}`
+      outputs = nil
+      FileUtils.cd(Dir.tmpdir) { output = `tar xvf #{filename}` }
       self.path = File.join(Dir.tmpdir, 
output.split(/\n/).first.split('/').first)
     end
   end
@@ -188,7 +196,7 @@ Install type:   #{install_type}
     end
 
     def unpack
-      system "cd #{Dir.tmpdir}; gunzip #{self.filename}"
+      FileUtils.cd(Dir.tmpdir) { system "gunzip #{self.filename}" }
       @unpacked = true
       super
     end
@@ -200,7 +208,7 @@ Install type:   #{install_type}
     end
 
     def unpack
-      system "cd #{Dir.tmpdir}; bunzip2 #{self.filename}"
+      FileUtils.cd(Dir.tmpdir) { system "bunzip2 #{self.filename}" }
       @unpacked = true
       super
     end
@@ -208,7 +216,8 @@ Install type:   #{install_type}
 
   class Zip < Download
     def unpack
-      output = `cd #{Dir.tmpdir}; unzip #{filename} -d #{name}`
+      output = nil
+      FileUtils.cd(Dir.tmpdir) { output = `unzip #{filename} -d #{name}` }
       self.path = File.join(Dir.tmpdir, name)
     end
   end
-- 
1.6.5.1.1367.gcd48

_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to