sprout 0.7.224-x86-linux → 0.7.226-x86-linux
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/platform.rb +4 -0
- data/lib/sprout.rb +3 -2
- data/lib/sprout/builder.rb +1 -1
- data/lib/sprout/tasks/gem_wrap_task.rb +13 -11
- data/lib/sprout/tasks/tool_task.rb +2 -1
- data/lib/sprout/version.rb +1 -1
- data/rakefile.rb +2 -2
- metadata +2 -3
- data/lib/sprout/template_resolver.rb +0 -207
data/lib/platform.rb
CHANGED
@@ -54,6 +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
|
58
|
+
os = :unix
|
59
|
+
impl = :solaris
|
57
60
|
elsif RUBY_PLATFORM =~ /vista/i
|
58
61
|
os = :win32
|
59
62
|
impl = :vista
|
@@ -84,6 +87,7 @@ module Platform #:nodoc:
|
|
84
87
|
end
|
85
88
|
|
86
89
|
# whither AIX, SOLARIS, and the other unixen?
|
90
|
+
# i386-solaris2.11
|
87
91
|
|
88
92
|
if RUBY_PLATFORM =~ /(i\d86)/i
|
89
93
|
arch = :x86
|
data/lib/sprout.rb
CHANGED
@@ -13,7 +13,7 @@ if(Gem::Version.new(Gem::RubyGemsVersion) != Gem::Version.new('1.0.1'))
|
|
13
13
|
require 'open-uri'
|
14
14
|
end
|
15
15
|
|
16
|
-
$:.
|
16
|
+
$:.unshift(File.dirname(__FILE__))
|
17
17
|
require 'sprout/dynamic_accessors'
|
18
18
|
require 'progress_bar'
|
19
19
|
require 'sprout/log'
|
@@ -157,7 +157,8 @@ module Sprout
|
|
157
157
|
command = "#{get_gem_preamble} uninstall -x -a -q #{sprout.name}"
|
158
158
|
|
159
159
|
if(!confirmation)
|
160
|
-
|
160
|
+
confirmation = remove_gems_confirmation
|
161
|
+
break unless confirmation
|
161
162
|
end
|
162
163
|
puts "executing #{command}"
|
163
164
|
raise ">> Exited with errors: #{$?}" unless system(command)
|
data/lib/sprout/builder.rb
CHANGED
@@ -30,7 +30,7 @@ module Sprout
|
|
30
30
|
return target
|
31
31
|
end
|
32
32
|
end
|
33
|
-
raise BuilderError.new("Sprout::Builder.build failed, unsupported platform or unexpected yaml")
|
33
|
+
raise BuilderError.new("Sprout::Builder.build failed, unsupported platform [#{platform}] or unexpected yaml")
|
34
34
|
end
|
35
35
|
|
36
36
|
private
|
@@ -55,9 +55,9 @@ module Sprout
|
|
55
55
|
# Homepage where users can learn more about this gem
|
56
56
|
attr_writer :homepage
|
57
57
|
# A string remote file specification usually something like:
|
58
|
-
#
|
58
|
+
#
|
59
59
|
# t.sprout_spec =<<EOF
|
60
|
-
# - !ruby/object:Sprout::RemoteFileTarget
|
60
|
+
# - !ruby/object:Sprout::RemoteFileTarget
|
61
61
|
# platform: universal
|
62
62
|
# url: http://as3flickrlib.googlecode.com/files/flickr-.87.zip
|
63
63
|
# archive_path: flickr-.87/src
|
@@ -83,7 +83,7 @@ module Sprout
|
|
83
83
|
@email = "projectsprouts@googlegroups.com"
|
84
84
|
@homepage = "http://www.projectsprouts.org"
|
85
85
|
end
|
86
|
-
|
86
|
+
|
87
87
|
def execute(*args) # :nodoc:
|
88
88
|
super
|
89
89
|
raise GemWrapError.new("A version must be provided to produce a Gem!") unless @version
|
@@ -94,7 +94,7 @@ module Sprout
|
|
94
94
|
# render_extensions(gem_package, extensions) if extensions.size
|
95
95
|
|
96
96
|
Dir.chdir(gem_package) do
|
97
|
-
|
97
|
+
|
98
98
|
spec = Gem::Specification.new do |s|
|
99
99
|
files = []
|
100
100
|
s.platform = Gem::Platform::RUBY
|
@@ -104,15 +104,17 @@ module Sprout
|
|
104
104
|
s.name = @gem_name
|
105
105
|
s.email = @email
|
106
106
|
s.homepage = @homepage
|
107
|
+
# added in order to avoid the lib not found error
|
108
|
+
s.require_path = "sprout.spec"
|
107
109
|
s.rubyforge_project = 'sprout'
|
108
110
|
gem_dependencies.each do |dep|
|
109
111
|
s.requirements << dep
|
110
112
|
end
|
111
|
-
|
113
|
+
|
112
114
|
sprout_requirement = s.requirements.collect do |req|
|
113
115
|
(req[0] == 'sprout')
|
114
116
|
end
|
115
|
-
|
117
|
+
|
116
118
|
if(!sprout_requirement)
|
117
119
|
s.add_dependency('sprout', '>= 0.7.209')
|
118
120
|
end
|
@@ -131,13 +133,13 @@ module Sprout
|
|
131
133
|
Gem::Builder.new(spec).build
|
132
134
|
end
|
133
135
|
|
134
|
-
FileUtils.mv("#{gem_package}/#{@gem_name}-#{@version}.gem", @package)
|
136
|
+
FileUtils.mv("#{gem_package}/#{@gem_name}-#{@version}.gem", @package)
|
135
137
|
FileUtils.rm_rf(gem_package)
|
136
138
|
end
|
137
|
-
|
139
|
+
|
138
140
|
# Add a gem dependency either with only the gem name
|
139
141
|
# or with a full name and version hash like:
|
140
|
-
#
|
142
|
+
#
|
141
143
|
# t.add_dependency('sprout-flashplayer-tool')
|
142
144
|
# or
|
143
145
|
# t.add_dependency('sprout-flashplayer-tool' => '9.115.0')
|
@@ -149,12 +151,12 @@ module Sprout
|
|
149
151
|
def gem_dependencies
|
150
152
|
return @gem_dependencies ||= []
|
151
153
|
end
|
152
|
-
|
154
|
+
|
153
155
|
# Add files to include in the gem/ext folder
|
154
156
|
def extensions
|
155
157
|
return @extensions ||= []
|
156
158
|
end
|
157
|
-
|
159
|
+
|
158
160
|
private
|
159
161
|
|
160
162
|
def gem_package
|
data/lib/sprout/version.rb
CHANGED
data/rakefile.rb
CHANGED
@@ -7,8 +7,8 @@ require 'rake/gempackagetask'
|
|
7
7
|
require 'rake/rdoctask'
|
8
8
|
require 'rake/contrib/rubyforgepublisher'
|
9
9
|
require 'fileutils'
|
10
|
-
require 'lib/sprout'
|
11
|
-
require 'lib/sprout/version'
|
10
|
+
require File.dirname(__FILE__) + '/lib/sprout'
|
11
|
+
require File.dirname(__FILE__) + '/lib/sprout/version'
|
12
12
|
|
13
13
|
PROJECT = "sprout"
|
14
14
|
NAME = "sprout"
|
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.226
|
5
5
|
platform: x86-linux
|
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-
|
12
|
+
date: 2010-02-23 00:00:00 -08:00
|
13
13
|
default_executable: sprout
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -122,7 +122,6 @@ files:
|
|
122
122
|
- lib/sprout/tasks/ssh_task.rb
|
123
123
|
- lib/sprout/tasks/tool_task.rb
|
124
124
|
- lib/sprout/tasks/zip_task.rb
|
125
|
-
- lib/sprout/template_resolver.rb
|
126
125
|
- lib/sprout/tool_task_model.rb
|
127
126
|
- lib/sprout/user.rb
|
128
127
|
- lib/sprout/version.rb
|
@@ -1,207 +0,0 @@
|
|
1
|
-
|
2
|
-
module Sprout
|
3
|
-
|
4
|
-
class TemplateResolver < Hash #:nodoc:
|
5
|
-
include Singleton
|
6
|
-
|
7
|
-
attr_accessor :replace_all,
|
8
|
-
:ignore_all
|
9
|
-
|
10
|
-
@@SPROUT_FILE_NAME = 'Sprout'
|
11
|
-
@@RENDER_IGNORE_FILES = ['asclass_config.rb', 'SWFMillTemplate.erb', 'Template.erb']
|
12
|
-
@@BINARY_EXTENSIONS = ['.jpg', '.png', '.gif', '.doc', '.xls', '.exe', '.swf', 'fla', '.psd']
|
13
|
-
@@LOG_PREFIX = ">> Created file: "
|
14
|
-
@@DELETE_PREFIX = ">> Deleted file: "
|
15
|
-
|
16
|
-
def initialize
|
17
|
-
super
|
18
|
-
@replace_all = false
|
19
|
-
@ignore_all = false
|
20
|
-
end
|
21
|
-
|
22
|
-
def copy_files(from, to, render=false)
|
23
|
-
created_files = Array.new
|
24
|
-
if(!File.exists? from)
|
25
|
-
raise UsageError.new('TemplateResolver attempted to copy files from (' + from + ') but it does not exist...')
|
26
|
-
end
|
27
|
-
if(File.directory? from)
|
28
|
-
Dir.open(from).each do |filename|
|
29
|
-
if(!Sprout.ignore_file? filename)
|
30
|
-
fullname = File.join(from, filename)
|
31
|
-
new_fullname = File.join(to, filename)
|
32
|
-
cleaned_filename = clean_file_name(filename)
|
33
|
-
cleaned_fullname = File.join(to, cleaned_filename)
|
34
|
-
if(File.directory? fullname)
|
35
|
-
Dir.mkdir(new_fullname) unless File.exists? new_fullname
|
36
|
-
puts new_fullname
|
37
|
-
copy_files(fullname, new_fullname, render)
|
38
|
-
else
|
39
|
-
file = copy_file(fullname, cleaned_fullname, render)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
else
|
44
|
-
raise UsageError.new("copy_files called with a file (" + from + ") instead of a directory!")
|
45
|
-
end
|
46
|
-
|
47
|
-
return created_files
|
48
|
-
end
|
49
|
-
|
50
|
-
def puts(file, is_delete=false)
|
51
|
-
prefix = (is_delete) ? @@DELETE_PREFIX : @@LOG_PREFIX
|
52
|
-
Log.puts(prefix + file.gsub(Dir.pwd + '/', ''))
|
53
|
-
end
|
54
|
-
|
55
|
-
def b(path)
|
56
|
-
(is_binary?(path)) ? 'b' : ''
|
57
|
-
end
|
58
|
-
|
59
|
-
def copy_file(from, to, render=false, delegate=nil)
|
60
|
-
if(write_file?(to))
|
61
|
-
content = nil
|
62
|
-
File.open(from, 'r' + b(from)) do |f|
|
63
|
-
content = f.read
|
64
|
-
end
|
65
|
-
if(render && should_render?(from))
|
66
|
-
begin
|
67
|
-
bind = (delegate.nil?) ? binding : delegate.get_binding
|
68
|
-
content = ERB.new(content, nil, '>').result(bind)
|
69
|
-
rescue NameError => e
|
70
|
-
Log.puts '>> Template ' + from + ' references a value that is not defined'
|
71
|
-
raise e
|
72
|
-
end
|
73
|
-
end
|
74
|
-
FileUtils.makedirs(File.dirname(to))
|
75
|
-
File.open(to, 'w' + b(to)) do |f|
|
76
|
-
f.write(content)
|
77
|
-
end
|
78
|
-
puts to
|
79
|
-
return to
|
80
|
-
end
|
81
|
-
return nil
|
82
|
-
end
|
83
|
-
|
84
|
-
def should_render?(file)
|
85
|
-
if(is_binary?(file) || @@RENDER_IGNORE_FILES.index(File.basename(file)))
|
86
|
-
return false
|
87
|
-
end
|
88
|
-
return true
|
89
|
-
end
|
90
|
-
|
91
|
-
def write_file?(file)
|
92
|
-
if(!File.exists?(file))
|
93
|
-
return true
|
94
|
-
elsif(@replace_all)
|
95
|
-
puts(file, true)
|
96
|
-
File.delete(file)
|
97
|
-
return true
|
98
|
-
elsif(@ignore_all)
|
99
|
-
return false
|
100
|
-
end
|
101
|
-
|
102
|
-
relative = file.gsub(Dir.pwd, '')
|
103
|
-
msg = <<EOF
|
104
|
-
|
105
|
-
[WARNING] Sprout Encountered an existing file at [#{relative}], what would you like to do?
|
106
|
-
(r)eplace, (i)gnore, (R)eplace all or (I)gnore all?
|
107
|
-
|
108
|
-
EOF
|
109
|
-
if(Log.debug)
|
110
|
-
return false
|
111
|
-
end
|
112
|
-
|
113
|
-
$stdout.puts msg
|
114
|
-
answer = $stdin.gets.chomp
|
115
|
-
if(answer == 'r')
|
116
|
-
return true
|
117
|
-
elsif(answer == 'i')
|
118
|
-
return false
|
119
|
-
elsif(answer == 'R')
|
120
|
-
msg = <<EOF
|
121
|
-
|
122
|
-
Are you sure you want to replace ALL duplicate files?
|
123
|
-
(y)es or (n)o
|
124
|
-
|
125
|
-
EOF
|
126
|
-
$stdout.puts msg
|
127
|
-
answer = $stdin.gets.chomp
|
128
|
-
if(answer == 'y')
|
129
|
-
@replace_all = true
|
130
|
-
else
|
131
|
-
write_file?(file)
|
132
|
-
end
|
133
|
-
elsif(answer == 'I')
|
134
|
-
@ignore_all = true
|
135
|
-
return false
|
136
|
-
else
|
137
|
-
$stdout.puts "I didn't understand that response... Please choose from the following choices:\n\n"
|
138
|
-
write_file?(file)
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
def render_file filename
|
143
|
-
file = File.open(filename, 'r')
|
144
|
-
resolved = ERB.new(file.read, nil, '>').result(binding)
|
145
|
-
file.close
|
146
|
-
file = File.open(filename, 'w')
|
147
|
-
file.write(resolved)
|
148
|
-
file.close
|
149
|
-
end
|
150
|
-
|
151
|
-
def clean_file_name name
|
152
|
-
return name.gsub(@@SPROUT_FILE_NAME, project_name)
|
153
|
-
end
|
154
|
-
|
155
|
-
def project_name
|
156
|
-
return Sprout.project_name
|
157
|
-
end
|
158
|
-
|
159
|
-
def instance_name
|
160
|
-
return project_name[0,1].downcase + project_name[1,project_name.size]
|
161
|
-
end
|
162
|
-
|
163
|
-
#TODO: Figure out if the file is plain text or not... Possible?
|
164
|
-
def is_binary? file
|
165
|
-
file_extension = File.extname(file).downcase
|
166
|
-
@@BINARY_EXTENSIONS.each do |ext|
|
167
|
-
if(file_extension == ext)
|
168
|
-
return true
|
169
|
-
end
|
170
|
-
end
|
171
|
-
return false
|
172
|
-
end
|
173
|
-
|
174
|
-
=begin
|
175
|
-
Found this code for binary inspection here:
|
176
|
-
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/44940
|
177
|
-
it's not 100%, but better than what I'm doing with extensions.
|
178
|
-
This should be tested and inserted above
|
179
|
-
if it works.
|
180
|
-
|
181
|
-
NON_ASCII_PRINTABLE = /[^\x20-\x7e\s]/
|
182
|
-
|
183
|
-
def nonbinary?(io, forbidden, size = 1024)
|
184
|
-
while buf = io.read(size)
|
185
|
-
return false if forbidden =~ buf
|
186
|
-
end
|
187
|
-
true
|
188
|
-
end
|
189
|
-
|
190
|
-
# usage: ruby this_script.rb filename ...
|
191
|
-
ARGV.each do |fn|
|
192
|
-
begin
|
193
|
-
open(fn) do |f|
|
194
|
-
if nonbinary?(f, NON_ASCII_PRINTABLE)
|
195
|
-
puts "#{fn}: ascii printable"
|
196
|
-
else
|
197
|
-
puts "#{fn}: binary"
|
198
|
-
end
|
199
|
-
end
|
200
|
-
rescue StandardError => e
|
201
|
-
puts "#$0: #$!"
|
202
|
-
end
|
203
|
-
end
|
204
|
-
=end
|
205
|
-
|
206
|
-
end
|
207
|
-
end
|