sprout 1.0.5.pre → 1.0.8.pre

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sprout might be problematic. Click here for more details.

@@ -23,17 +23,41 @@ module Sprout
23
23
  end
24
24
 
25
25
  # Unpack zip archives on any platform.
26
+ #
27
+ # In case you're wondering... Ruby sucks...
28
+ # This code corrupts the FlashPlayer executable
29
+ # on OSX but if the file is manually unpacked,
30
+ # it works fine.
31
+ #
26
32
  def unpack_zip archive, destination, clobber=nil
27
33
  validate archive, destination
28
34
 
29
- Zip::ZipFile.open archive do |zipfile|
30
- zipfile.each do |entry|
31
- next if entry.name =~ /__MACOSX/ or entry.name =~ /\.DS_Store/
32
- unpack_zip_entry entry, destination, clobber
35
+ if is_darwin?
36
+ unpack_zip_on_darwin archive, destination, clobber
37
+ else
38
+ Zip::ZipFile.open archive do |zipfile|
39
+ zipfile.each do |entry|
40
+ next if entry.name =~ /__MACOSX/ or entry.name =~ /\.DS_Store/
41
+ unpack_zip_entry entry, destination, clobber
42
+ end
33
43
  end
34
44
  end
35
45
  end
36
46
 
47
+ def is_darwin?
48
+ Sprout.current_system == Sprout::System::OSXSystem
49
+ end
50
+
51
+ def unpack_zip_on_darwin archive, destination, clobber
52
+ # Unzipping on OS X
53
+ FileUtils.makedirs destination
54
+ zip_dir = File.expand_path File.dirname(archive)
55
+ zip_name = File.basename archive
56
+ output = File.expand_path destination
57
+ # puts ">> zip_dir: #{zip_dir} zip_name: #{zip_name} output: #{output}"
58
+ %x(cd #{zip_dir};unzip #{zip_name} -d #{output})
59
+ end
60
+
37
61
  # Unpack tar.gz or .tgz files on any platform.
38
62
  def unpack_tgz archive, destination, clobber=nil
39
63
  validate archive, destination
@@ -96,18 +96,10 @@ module Sprout::System
96
96
 
97
97
  ##
98
98
  # Execute a new process in a separate thread.
99
- # This can be useful for processes that take
100
- # an especially long time to execute.
101
- #
102
- # Threads are complicated - use with caution...
103
99
  #
104
100
  def execute_thread(tool, options='')
105
- if(Log.debug)
106
- return ThreadMock.new
107
- else
108
- return Thread.new do
109
- execute(tool, options)
110
- end
101
+ return Thread.new do
102
+ execute(tool, options)
111
103
  end
112
104
  end
113
105
 
@@ -182,7 +182,7 @@ module SproutTestCase # :nodoc:[all]
182
182
  # Return the fixtures folder if found:
183
183
  return fixture_path if File.directory? fixture_path
184
184
  # Move up one directory and try again:
185
- return find_fixtures File.dirname(path)
185
+ return find_fixtures File.dirname(path) unless File.dirname(path) == path
186
186
  end
187
187
 
188
188
  end
@@ -6,7 +6,7 @@ module Sprout
6
6
  module VERSION #:nodoc:
7
7
  MAJOR = 1
8
8
  MINOR = 0
9
- TINY = 5
9
+ TINY = 8
10
10
  RELEASE = 'pre'
11
11
 
12
12
  STRING = [MAJOR, MINOR, TINY, RELEASE].join('.')
@@ -40,6 +40,12 @@ class ArchiveUnpackerTest < Test::Unit::TestCase
40
40
  end
41
41
  end
42
42
 
43
+ should "unpack zip on darwin specially" do
44
+ @unpacker.stubs(:is_darwin?).returns true
45
+ @unpacker.expects(:unpack_zip_on_darwin)
46
+ @unpacker.unpack @zip_file, temp_path
47
+ end
48
+
43
49
  ['exe', 'swc', 'rb'].each do |format|
44
50
  should "copy #{format} files" do
45
51
  file = eval("@#{format}_file")
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 5
8
+ - 8
9
9
  - pre
10
- version: 1.0.5.pre
10
+ version: 1.0.8.pre
11
11
  platform: ruby
12
12
  authors:
13
13
  - Luke Bayes
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-20 00:00:00 -07:00
18
+ date: 2010-06-24 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency