sprout 0.7.229-mswin32 → 0.7.233-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sprout.rb +2 -2
- data/lib/sprout/archive_unpacker.rb +29 -32
- data/lib/sprout/builder.rb +8 -1
- data/lib/sprout/remote_file_target.rb +35 -8
- data/lib/sprout/version.rb +1 -1
- metadata +2 -3
- data/TODO +0 -12
data/lib/sprout.rb
CHANGED
@@ -275,7 +275,7 @@ EOF
|
|
275
275
|
raise UsageError.new("Could not retrieve requested executable from path: #{exe}")
|
276
276
|
end
|
277
277
|
|
278
|
-
if(File.exists?(exe) && !File.directory?(exe) && File.stat(exe).executable?)
|
278
|
+
if(File.exists?(exe) && !File.directory?(exe) && !File.stat(exe).executable?)
|
279
279
|
File.chmod 0755, exe
|
280
280
|
end
|
281
281
|
|
@@ -303,7 +303,7 @@ EOF
|
|
303
303
|
end
|
304
304
|
if(File.exists?(sprout_spec_path))
|
305
305
|
# Ensure the requisite files get downloaded and unpacked
|
306
|
-
Builder.build(sprout_spec_path,
|
306
|
+
Builder.build(sprout_spec_path, gem_spec.name, gem_spec.version)
|
307
307
|
else
|
308
308
|
return gem_spec
|
309
309
|
end
|
@@ -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,18 +40,15 @@ module Sprout
|
|
40
40
|
unpack_dmg(file_name, dir)
|
41
41
|
when 'exe'
|
42
42
|
FileUtils.mkdir_p(dir)
|
43
|
-
|
44
|
-
when 'swc'
|
45
|
-
FileUtils.mkdir_p(dir)
|
46
|
-
FileUtils.mv(file_name, dir)
|
47
|
-
when 'rb'
|
43
|
+
File.mv(file_name, dir)
|
44
|
+
when 'swc' || 'rb'
|
48
45
|
return
|
49
46
|
else
|
50
47
|
raise ArchiveUnpackerError.new("ArchiveUnpacker does not know how to unpack files of type: #{archive_type} for file_name: #{file_name}")
|
51
48
|
end
|
52
49
|
end
|
53
50
|
end
|
54
|
-
|
51
|
+
|
55
52
|
def unpack_zip(zip_file, dir)
|
56
53
|
# Avoid the rubyzip Segmentation Fault bug
|
57
54
|
# at least on os x...
|
@@ -73,12 +70,12 @@ module Sprout
|
|
73
70
|
FileUtils.mkdir_p(File.dirname(fpath))
|
74
71
|
# Disgusting, Gross Hack to fix DOS/Ruby Bug
|
75
72
|
# That makes the zip library throw a ZipDestinationFileExistsError
|
76
|
-
# When the zip archive includes two files whose names
|
73
|
+
# When the zip archive includes two files whose names
|
77
74
|
# differ only by extension.
|
78
75
|
# This bug actually appears in the File.exists? implementation
|
79
76
|
# throwing false positives!
|
80
77
|
# If you're going to use this code, be sure you extract
|
81
|
-
# into a new, empty directory as existing files will be
|
78
|
+
# into a new, empty directory as existing files will be
|
82
79
|
# clobbered...
|
83
80
|
begin
|
84
81
|
if(File.exists?(fpath) && !File.directory?(fpath))
|
@@ -104,30 +101,30 @@ module Sprout
|
|
104
101
|
end
|
105
102
|
end
|
106
103
|
end
|
107
|
-
|
104
|
+
|
108
105
|
def unpacked_file_name(file, dir, suffix=nil)
|
109
106
|
basename = File.basename(file, suffix)
|
110
107
|
path = File.expand_path(dir)
|
111
108
|
return File.join(path, basename)
|
112
109
|
end
|
113
|
-
|
110
|
+
|
114
111
|
def unpack_targz(tgz_file, dir)
|
115
112
|
if(!File.exists?(dir))
|
116
113
|
FileUtils.makedirs(dir)
|
117
114
|
end
|
118
115
|
tar = Zlib::GzipReader.new(File.open(tgz_file, 'rb'))
|
119
116
|
Minitar.unpack(tar, dir)
|
120
|
-
|
121
|
-
# Recurse and unpack gzipped children (Adobe did this double
|
117
|
+
|
118
|
+
# Recurse and unpack gzipped children (Adobe did this double
|
122
119
|
# gzip with the Linux FlashPlayer for some reason)
|
123
120
|
Dir.glob("#{dir}/**/*.tar.gz").each do |child|
|
124
|
-
if(child != tgz_file)
|
121
|
+
if(child != tgz_file && dir != File.dirname(child))
|
125
122
|
unpack_targz(child, File.dirname(child))
|
126
123
|
end
|
127
124
|
end
|
128
|
-
|
125
|
+
|
129
126
|
end
|
130
|
-
|
127
|
+
|
131
128
|
# This is actually not unpacking the FlashPlayer
|
132
129
|
# Binary file as expected...
|
133
130
|
# OSX is treated the player binary as if it is
|
@@ -144,10 +141,10 @@ module Sprout
|
|
144
141
|
if(!File.exists?(full_mounted_path))
|
145
142
|
system("hdiutil mount #{dmg_file}")
|
146
143
|
end
|
147
|
-
|
144
|
+
|
148
145
|
begin
|
149
146
|
mounted_target = File.join(full_mounted_path, extracted_file)
|
150
|
-
|
147
|
+
|
151
148
|
# Copy the DMG contents using system copy rather than ruby utils
|
152
149
|
# Because OS X does something special with .app files that the
|
153
150
|
# Ruby FileUtils and File classes break...
|
@@ -155,7 +152,7 @@ module Sprout
|
|
155
152
|
# from = File.join(full_mounted_path, extracted_file)
|
156
153
|
to = File.join(@user.downloads, @name.to_s, extracted_file)
|
157
154
|
FileUtils.makedirs(File.dirname(to))
|
158
|
-
|
155
|
+
|
159
156
|
if(File.exists?(from))
|
160
157
|
`ditto '#{from}' '#{to}'`
|
161
158
|
end
|
@@ -165,7 +162,7 @@ module Sprout
|
|
165
162
|
end
|
166
163
|
end
|
167
164
|
end
|
168
|
-
|
165
|
+
|
169
166
|
def suffix_for_archive_type(type)
|
170
167
|
if(type == :targz)
|
171
168
|
return '.tar.gz'
|
@@ -173,7 +170,7 @@ module Sprout
|
|
173
170
|
return ".#{type.to_s}"
|
174
171
|
end
|
175
172
|
end
|
176
|
-
|
173
|
+
|
177
174
|
def inferred_archive_type(file_name)
|
178
175
|
if is_zip?(file_name)
|
179
176
|
return :zip
|
@@ -192,34 +189,34 @@ module Sprout
|
|
192
189
|
else
|
193
190
|
return nil
|
194
191
|
end
|
195
|
-
|
192
|
+
|
196
193
|
end
|
197
|
-
|
194
|
+
|
198
195
|
def is_zip?(file)
|
199
196
|
return (file.split('.').pop == 'zip')
|
200
197
|
end
|
201
|
-
|
198
|
+
|
202
199
|
def is_targz?(file)
|
203
200
|
parts = file.split('.')
|
204
201
|
part = parts.pop
|
205
202
|
return (part == 'tgz' || part == 'gz' && parts.pop == 'tar')
|
206
203
|
end
|
207
|
-
|
204
|
+
|
208
205
|
def is_gzip?(file)
|
209
206
|
return (file.split('.').pop == 'gz')
|
210
207
|
end
|
211
|
-
|
208
|
+
|
212
209
|
def is_swc?(file)
|
213
210
|
return (file.split('.').pop == 'swc')
|
214
211
|
end
|
215
|
-
|
212
|
+
|
216
213
|
def is_rb?(file)
|
217
214
|
return (file.split('.').pop == 'rb')
|
218
215
|
end
|
219
|
-
|
216
|
+
|
220
217
|
def is_dmg?(file)
|
221
218
|
return (file.split('.').pop == 'dmg')
|
222
|
-
end
|
219
|
+
end
|
223
220
|
|
224
221
|
def is_exe?(file)
|
225
222
|
return (file.split('.').pop == 'exe')
|
data/lib/sprout/builder.rb
CHANGED
@@ -9,7 +9,8 @@ module Sprout
|
|
9
9
|
# archives that are identified in the spec
|
10
10
|
class Builder # :nodoc:
|
11
11
|
|
12
|
-
def self.build(file_targets_yaml,
|
12
|
+
def self.build(file_targets_yaml, gem_name=nil, gem_version=nil)
|
13
|
+
destination = Builder.gem_file_cache(gem_name, gem_version)
|
13
14
|
data = nil
|
14
15
|
|
15
16
|
File.open(file_targets_yaml, 'r') do |f|
|
@@ -24,6 +25,8 @@ module Sprout
|
|
24
25
|
# When authoring a sprout.spec for libraries or tools,
|
25
26
|
# put the most specific RemoteFileTargets first, then
|
26
27
|
# universals to catch unexpected platforms.
|
28
|
+
target.gem_name = gem_name
|
29
|
+
target.gem_version = gem_version
|
27
30
|
if(target.platform == platform || target.platform == 'universal')
|
28
31
|
target.install_path = FileUtils.mkdir_p(destination)
|
29
32
|
target.resolve
|
@@ -34,6 +37,10 @@ module Sprout
|
|
34
37
|
end
|
35
38
|
|
36
39
|
private
|
40
|
+
|
41
|
+
def self.gem_file_cache(gem_name, gem_version)
|
42
|
+
Sprout.gem_file_cache(gem_name, gem_version)
|
43
|
+
end
|
37
44
|
|
38
45
|
def self.platform
|
39
46
|
@@platform ||= User.new.platform.to_s
|
@@ -5,6 +5,10 @@ module Sprout
|
|
5
5
|
|
6
6
|
class RemoteFileTarget # :nodoc:
|
7
7
|
|
8
|
+
|
9
|
+
attr_accessor :gem_name
|
10
|
+
attr_accessor :gem_version
|
11
|
+
|
8
12
|
attr_writer :archive_path
|
9
13
|
|
10
14
|
# The string environment variable name to check before downloading anything.
|
@@ -65,8 +69,10 @@ module Sprout
|
|
65
69
|
if(filename)
|
66
70
|
self.downloaded_path = File.join(File.dirname(downloaded_path), filename)
|
67
71
|
end
|
68
|
-
|
69
|
-
|
72
|
+
|
73
|
+
should_download = ( url && !File.exists?(installed_path) && !File.exists?(downloaded_path) )
|
74
|
+
|
75
|
+
if(should_download)
|
70
76
|
content = download(url, update)
|
71
77
|
FileUtils.makedirs(File.dirname(downloaded_path))
|
72
78
|
FileUtils.touch(downloaded_path)
|
@@ -75,7 +81,7 @@ module Sprout
|
|
75
81
|
end
|
76
82
|
end
|
77
83
|
|
78
|
-
if(!File.exists?(installed_path)
|
84
|
+
if(!File.exists?(installed_path) && !File.exists?(File.join(installed_path, archive_path)) )
|
79
85
|
archive_root = File.join(install_path, 'archive')
|
80
86
|
install(downloaded_path, archive_root, update, archive_type)
|
81
87
|
end
|
@@ -130,13 +136,33 @@ module Sprout
|
|
130
136
|
private
|
131
137
|
|
132
138
|
def inferred_installed_path
|
133
|
-
|
134
|
-
return ENV[environment]
|
135
|
-
end
|
136
|
-
|
137
|
-
return File.join(install_path, 'archive')
|
139
|
+
return environment_path || File.join(install_path, 'archive')
|
138
140
|
end
|
139
141
|
|
142
|
+
def environment_path
|
143
|
+
path_for_environmental_name(inferred_env_name_with_version) || path_for_environmental_name(inferred_env_name) || path_for_environmental_name(environment)
|
144
|
+
end
|
145
|
+
|
146
|
+
def path_for_environmental_name(name)
|
147
|
+
if(name && ENV[name])
|
148
|
+
if(!File.exist?(ENV[name]))
|
149
|
+
raise UsageError.new("Found Environmental variable at: #{name} but no files found at: #{ENV[name]}")
|
150
|
+
end
|
151
|
+
ENV[name]
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def inferred_env_name_with_version
|
156
|
+
return nil if (gem_version.nil? || gem_name.nil?)
|
157
|
+
version = gem_version.to_s.gsub('.', '_')
|
158
|
+
"#{inferred_env_name}_#{version}"
|
159
|
+
end
|
160
|
+
|
161
|
+
def inferred_env_name
|
162
|
+
return nil if gem_name.nil?
|
163
|
+
return gem_name.gsub('-', '_').upcase
|
164
|
+
end
|
165
|
+
|
140
166
|
def download(url, update=false)
|
141
167
|
loader = RemoteFileLoader.new
|
142
168
|
loader.get_remote_file(url, update, md5)
|
@@ -144,6 +170,7 @@ module Sprout
|
|
144
170
|
|
145
171
|
def install(from, to, force, archive_type=nil)
|
146
172
|
unpacker = ArchiveUnpacker.new
|
173
|
+
#puts "Unpacking from: #{from} to: #{to} force: #{force} type: #{archive_type}"
|
147
174
|
unpacker.unpack_archive(from, to, force, archive_type)
|
148
175
|
end
|
149
176
|
|
data/lib/sprout/version.rb
CHANGED
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.
|
4
|
+
version: 0.7.233
|
5
5
|
platform: mswin32
|
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-
|
12
|
+
date: 2010-03-03 00:00:00 -08:00
|
13
13
|
default_executable: sprout
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -95,7 +95,6 @@ extra_rdoc_files: []
|
|
95
95
|
files:
|
96
96
|
- MIT-LICENSE
|
97
97
|
- rakefile.rb
|
98
|
-
- TODO
|
99
98
|
- samples/gem_wrap/rakefile.rb
|
100
99
|
- bin/sprout
|
101
100
|
- lib/platform.rb
|
data/TODO
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
|
2
|
-
---------------------------------
|
3
|
-
In the interest of being a better member of our growing community,
|
4
|
-
I have extracted the contents of this file to the googlecode site at:
|
5
|
-
|
6
|
-
http://code.google.com/p/projectsprouts/issues/list?q=label:Beta1.0&can=2
|
7
|
-
|
8
|
-
Please feel free to check over the available issues and see if any look appealing!
|
9
|
-
|
10
|
-
If you're considering a contribution, please check in on our mailing list first just to be sure.
|
11
|
-
(projectsprouts@googlegroups.com)
|
12
|
-
|