sprout 0.7.227 → 0.7.228

Sign up to get free protection for your applications and to get access to all the features.
data/lib/platform.rb CHANGED
@@ -54,9 +54,9 @@ module Platform #:nodoc:
54
54
  elsif RUBY_PLATFORM =~ /netbsd/i
55
55
  os = :unix
56
56
  impl = :netbsd
57
- elsif RUBY_PLATFORM =~ /solaris/i
57
+ elsif RUBY_PLATFORM =~ /solaris/i
58
58
  os = :unix
59
- impl = :solaris
59
+ impl = :linux # Our platform checks currently examine 'impl' instead of 'os'
60
60
  elsif RUBY_PLATFORM =~ /vista/i
61
61
  os = :win32
62
62
  impl = :vista
@@ -6,7 +6,7 @@ module Sprout
6
6
  # Unpack downloaded files from a variety of common archive types.
7
7
  # This library should efficiently extract archived files
8
8
  # on OS X, Win XP, Vista, DOS, Cygwin, and Linux.
9
- #
9
+ #
10
10
  # It will attempt to infer the archive type by standard mime-type file
11
11
  # extensions, but if there is a file with no extension, the unpack_archive
12
12
  # method can be provided with an @archive_type symbol argument that is one
@@ -20,16 +20,16 @@ module Sprout
20
20
  # :dmg
21
21
  class ArchiveUnpacker #:nodoc:
22
22
  include Archive::Tar
23
-
23
+
24
24
  def unpack_archive(file_name, dir, force=false, archive_type=nil)
25
25
  archive_type ||= inferred_archive_type(file_name)
26
26
  suffix = suffix_for_archive_type(archive_type)
27
-
27
+
28
28
  unpacked = unpacked_file_name(file_name, dir, suffix)
29
29
  if(File.exists?(unpacked) && force)
30
30
  FileUtils.rm_rf(unpacked)
31
31
  end
32
-
32
+
33
33
  if(!File.exists?(unpacked))
34
34
  case archive_type.to_s
35
35
  when 'zip'
@@ -40,15 +40,18 @@ module Sprout
40
40
  unpack_dmg(file_name, dir)
41
41
  when 'exe'
42
42
  FileUtils.mkdir_p(dir)
43
- File.mv(file_name, dir)
44
- when 'swc' || 'rb'
43
+ File.move(file_name, dir)
44
+ when 'swc'
45
+ FileUtils.mkdir_p(dir)
46
+ File.move(file_name, dir)
47
+ when 'rb'
45
48
  return
46
49
  else
47
50
  raise ArchiveUnpackerError.new("ArchiveUnpacker does not know how to unpack files of type: #{archive_type} for file_name: #{file_name}")
48
51
  end
49
52
  end
50
53
  end
51
-
54
+
52
55
  def unpack_zip(zip_file, dir)
53
56
  # Avoid the rubyzip Segmentation Fault bug
54
57
  # at least on os x...
@@ -70,12 +73,12 @@ module Sprout
70
73
  FileUtils.mkdir_p(File.dirname(fpath))
71
74
  # Disgusting, Gross Hack to fix DOS/Ruby Bug
72
75
  # That makes the zip library throw a ZipDestinationFileExistsError
73
- # When the zip archive includes two files whose names
76
+ # When the zip archive includes two files whose names
74
77
  # differ only by extension.
75
78
  # This bug actually appears in the File.exists? implementation
76
79
  # throwing false positives!
77
80
  # If you're going to use this code, be sure you extract
78
- # into a new, empty directory as existing files will be
81
+ # into a new, empty directory as existing files will be
79
82
  # clobbered...
80
83
  begin
81
84
  if(File.exists?(fpath) && !File.directory?(fpath))
@@ -101,30 +104,30 @@ module Sprout
101
104
  end
102
105
  end
103
106
  end
104
-
107
+
105
108
  def unpacked_file_name(file, dir, suffix=nil)
106
109
  basename = File.basename(file, suffix)
107
110
  path = File.expand_path(dir)
108
111
  return File.join(path, basename)
109
112
  end
110
-
113
+
111
114
  def unpack_targz(tgz_file, dir)
112
115
  if(!File.exists?(dir))
113
116
  FileUtils.makedirs(dir)
114
117
  end
115
118
  tar = Zlib::GzipReader.new(File.open(tgz_file, 'rb'))
116
119
  Minitar.unpack(tar, dir)
117
-
118
- # Recurse and unpack gzipped children (Adobe did this double
120
+
121
+ # Recurse and unpack gzipped children (Adobe did this double
119
122
  # gzip with the Linux FlashPlayer for some reason)
120
123
  Dir.glob("#{dir}/**/*.tar.gz").each do |child|
121
124
  if(child != tgz_file)
122
125
  unpack_targz(child, File.dirname(child))
123
126
  end
124
127
  end
125
-
128
+
126
129
  end
127
-
130
+
128
131
  # This is actually not unpacking the FlashPlayer
129
132
  # Binary file as expected...
130
133
  # OSX is treated the player binary as if it is
@@ -141,10 +144,10 @@ module Sprout
141
144
  if(!File.exists?(full_mounted_path))
142
145
  system("hdiutil mount #{dmg_file}")
143
146
  end
144
-
147
+
145
148
  begin
146
149
  mounted_target = File.join(full_mounted_path, extracted_file)
147
-
150
+
148
151
  # Copy the DMG contents using system copy rather than ruby utils
149
152
  # Because OS X does something special with .app files that the
150
153
  # Ruby FileUtils and File classes break...
@@ -152,7 +155,7 @@ module Sprout
152
155
  # from = File.join(full_mounted_path, extracted_file)
153
156
  to = File.join(@user.downloads, @name.to_s, extracted_file)
154
157
  FileUtils.makedirs(File.dirname(to))
155
-
158
+
156
159
  if(File.exists?(from))
157
160
  `ditto '#{from}' '#{to}'`
158
161
  end
@@ -162,7 +165,7 @@ module Sprout
162
165
  end
163
166
  end
164
167
  end
165
-
168
+
166
169
  def suffix_for_archive_type(type)
167
170
  if(type == :targz)
168
171
  return '.tar.gz'
@@ -170,7 +173,7 @@ module Sprout
170
173
  return ".#{type.to_s}"
171
174
  end
172
175
  end
173
-
176
+
174
177
  def inferred_archive_type(file_name)
175
178
  if is_zip?(file_name)
176
179
  return :zip
@@ -189,34 +192,34 @@ module Sprout
189
192
  else
190
193
  return nil
191
194
  end
192
-
195
+
193
196
  end
194
-
197
+
195
198
  def is_zip?(file)
196
199
  return (file.split('.').pop == 'zip')
197
200
  end
198
-
201
+
199
202
  def is_targz?(file)
200
203
  parts = file.split('.')
201
204
  part = parts.pop
202
205
  return (part == 'tgz' || part == 'gz' && parts.pop == 'tar')
203
206
  end
204
-
207
+
205
208
  def is_gzip?(file)
206
209
  return (file.split('.').pop == 'gz')
207
210
  end
208
-
211
+
209
212
  def is_swc?(file)
210
213
  return (file.split('.').pop == 'swc')
211
214
  end
212
-
215
+
213
216
  def is_rb?(file)
214
217
  return (file.split('.').pop == 'rb')
215
218
  end
216
-
219
+
217
220
  def is_dmg?(file)
218
221
  return (file.split('.').pop == 'dmg')
219
- end
222
+ end
220
223
 
221
224
  def is_exe?(file)
222
225
  return (file.split('.').pop == 'exe')
@@ -27,7 +27,7 @@ module Sprout
27
27
 
28
28
  # :include: ../../../doc/Library
29
29
  class LibraryTask < Rake::Task
30
-
30
+
31
31
  # The RubyGems gem version string for this library (e.g., +version = '0.0.1'+)
32
32
  attr_accessor :version
33
33
 
@@ -44,22 +44,22 @@ module Sprout
44
44
  def gem_name
45
45
  @gem_name ||= "sprout-#{clean_name}-library"
46
46
  end
47
-
47
+
48
48
  # Ensure that namespaced rake tasks only use
49
49
  # the final part for name-based features
50
50
  def clean_name
51
51
  return name.split(':').pop
52
52
  end
53
-
53
+
54
54
  # The path to the library source or swc that will be copied into your project.
55
55
  # This can actually be any full or relative path on your system, but should almost
56
56
  # always be left alone for automatic resolution.
57
57
  def library_path
58
58
  @library_path ||= nil
59
59
  end
60
-
60
+
61
61
  # Override the the project folder where the library will be installed.
62
- #
62
+ #
63
63
  # By default, libraries are installed into Sprout::ProjectModel +lib_dir+.
64
64
  def project_lib
65
65
  if(library_path.index('.swc'))
@@ -68,18 +68,18 @@ module Sprout
68
68
  @project_lib ||= ProjectModel.instance.lib_dir
69
69
  end
70
70
  end
71
-
72
- # Unlike other rake tasks, Library tasks are actually
71
+
72
+ # Unlike other rake tasks, Library tasks are actually
73
73
  # resolved at 'define' time. This allows the tool tasks
74
74
  # to build their own dependencies (like file deps)
75
- # (I'm sure there's a better way to do this, if you know how to fix this,
75
+ # (I'm sure there's a better way to do this, if you know how to fix this,
76
76
  # and would like to contribute to sprouts, this might be a good spot for it)
77
77
  def define
78
78
  @file_target = sprout(gem_name, version)
79
79
  @library_path = File.join(@file_target.installed_path, @file_target.archive_path)
80
80
  define_file_task(library_path, project_path)
81
81
  end
82
-
82
+
83
83
  def execute(*args) # :nodoc:
84
84
  super
85
85
  end
@@ -94,13 +94,13 @@ module Sprout
94
94
  File.join(project_lib, File.basename(@file_target.archive_path))
95
95
  end
96
96
  end
97
-
97
+
98
98
  private
99
-
99
+
100
100
  def define_file_task(source, destination)
101
101
  file destination do |t|
102
102
  lib_path = library_path
103
- FileUtils.makedirs(destination)
103
+ #FileUtils.makedirs(destination)
104
104
  if(File.directory?(lib_path))
105
105
  lib_path = "#{lib_path}/."
106
106
  end
@@ -108,7 +108,7 @@ module Sprout
108
108
  end
109
109
  prerequisites << destination
110
110
  end
111
-
111
+
112
112
  end
113
113
  end
114
114
 
@@ -3,7 +3,7 @@ module Sprout
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = 0
5
5
  MINOR = 7
6
- TINY = 227
6
+ TINY = 228
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY].join('.')
9
9
  MAJOR_MINOR = [MAJOR, MINOR].join('.')
data/rakefile.rb CHANGED
@@ -139,7 +139,7 @@ def fix_x86_mswin
139
139
  files.each do |name|
140
140
  new_name = name.gsub('-x86', '')
141
141
  puts "Renaming x86-mswin gem from #{name} to #{new_name}"
142
- File.mv(name, new_name)
142
+ File.move(name, new_name)
143
143
  end
144
144
  end
145
145
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.227
4
+ version: 0.7.228
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Bayes
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-24 00:00:00 -08:00
12
+ date: 2010-02-25 00:00:00 -08:00
13
13
  default_executable: sprout
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency