upload_cache 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +64 -39
- data/lib/upload_cache.rb +8 -4
- data/upload_cache.gemspec +6 -6
- metadata +6 -17
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
This.rubyforge_project = 'codeforpeople'
|
2
2
|
This.author = "Ara T. Howard"
|
3
3
|
This.email = "ara.t.howard@gmail.com"
|
4
|
-
This.homepage = "
|
4
|
+
This.homepage = "https://github.com/ahoward/#{ This.lib }"
|
5
5
|
|
6
6
|
|
7
7
|
task :default do
|
@@ -26,11 +26,10 @@ def run_tests!(which = nil)
|
|
26
26
|
|
27
27
|
div = ('=' * 119)
|
28
28
|
line = ('-' * 119)
|
29
|
-
helper = "-r ./test/helper.rb" if test(?e, "./test/helper.rb")
|
30
29
|
|
31
30
|
test_rbs.each_with_index do |test_rb, index|
|
32
31
|
testno = index + 1
|
33
|
-
command = "#{ This.ruby } -I ./lib -I ./test/lib #{
|
32
|
+
command = "#{ This.ruby } -I ./lib -I ./test/lib #{ test_rb }"
|
34
33
|
|
35
34
|
puts
|
36
35
|
say(div, :color => :cyan, :bold => true)
|
@@ -59,9 +58,9 @@ end
|
|
59
58
|
|
60
59
|
|
61
60
|
task :gemspec do
|
62
|
-
ignore_extensions = 'git', 'svn', 'tmp', /sw./, 'bak', 'gem'
|
63
|
-
ignore_directories =
|
64
|
-
ignore_files =
|
61
|
+
ignore_extensions = ['git', 'svn', 'tmp', /sw./, 'bak', 'gem']
|
62
|
+
ignore_directories = ['pkg']
|
63
|
+
ignore_files = ['test/log', 'a.rb'] + Dir['db/*'] + %w'db'
|
65
64
|
|
66
65
|
shiteless =
|
67
66
|
lambda do |list|
|
@@ -87,8 +86,8 @@ task :gemspec do
|
|
87
86
|
version = This.version
|
88
87
|
files = shiteless[Dir::glob("**/**")]
|
89
88
|
executables = shiteless[Dir::glob("bin/*")].map{|exe| File.basename(exe)}
|
90
|
-
has_rdoc = true #File.exist?('doc')
|
91
|
-
test_files = "test/#{ lib }.rb"
|
89
|
+
#has_rdoc = true #File.exist?('doc')
|
90
|
+
test_files = test(?e, "test/#{ lib }.rb") ? "test/#{ lib }.rb" : nil
|
92
91
|
summary = object.respond_to?(:summary) ? object.summary : "summary: #{ lib } kicks the ass"
|
93
92
|
description = object.respond_to?(:description) ? object.description : "description: #{ lib } kicks the ass"
|
94
93
|
|
@@ -101,47 +100,60 @@ task :gemspec do
|
|
101
100
|
end
|
102
101
|
extensions = [extensions].flatten.compact
|
103
102
|
|
103
|
+
# TODO
|
104
|
+
if This.dependencies.nil?
|
105
|
+
dependencies = []
|
106
|
+
else
|
107
|
+
case This.dependencies
|
108
|
+
when Hash
|
109
|
+
dependencies = This.dependencies.values
|
110
|
+
when Array
|
111
|
+
dependencies = This.dependencies
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
104
115
|
template =
|
105
116
|
if test(?e, 'gemspec.erb')
|
106
117
|
Template{ IO.read('gemspec.erb') }
|
107
118
|
else
|
108
119
|
Template {
|
109
120
|
<<-__
|
110
|
-
##
|
121
|
+
## <%= lib %>.gemspec
|
111
122
|
#
|
112
123
|
|
113
124
|
Gem::Specification::new do |spec|
|
114
|
-
spec.name =
|
115
|
-
spec.version =
|
125
|
+
spec.name = <%= lib.inspect %>
|
126
|
+
spec.version = <%= version.inspect %>
|
116
127
|
spec.platform = Gem::Platform::RUBY
|
117
|
-
spec.summary =
|
118
|
-
spec.description =
|
128
|
+
spec.summary = <%= lib.inspect %>
|
129
|
+
spec.description = <%= description.inspect %>
|
119
130
|
|
120
|
-
spec.files
|
121
|
-
spec.executables =
|
131
|
+
spec.files =\n<%= files.sort.pretty_inspect %>
|
132
|
+
spec.executables = <%= executables.inspect %>
|
122
133
|
|
123
134
|
spec.require_path = "lib"
|
124
135
|
|
125
|
-
spec.
|
126
|
-
spec.test_files = #{ test_files.inspect }
|
136
|
+
spec.test_files = <%= test_files.inspect %>
|
127
137
|
|
128
|
-
|
129
|
-
|
138
|
+
<% dependencies.each do |lib_version| %>
|
139
|
+
spec.add_dependency(*<%= Array(lib_version).flatten.inspect %>)
|
140
|
+
<% end %>
|
130
141
|
|
131
|
-
spec.extensions.push(
|
142
|
+
spec.extensions.push(*<%= extensions.inspect %>)
|
132
143
|
|
133
|
-
spec.rubyforge_project =
|
134
|
-
spec.author =
|
135
|
-
spec.email =
|
136
|
-
spec.homepage =
|
144
|
+
spec.rubyforge_project = <%= This.rubyforge_project.inspect %>
|
145
|
+
spec.author = <%= This.author.inspect %>
|
146
|
+
spec.email = <%= This.email.inspect %>
|
147
|
+
spec.homepage = <%= This.homepage.inspect %>
|
137
148
|
end
|
138
149
|
__
|
139
150
|
}
|
140
151
|
end
|
141
152
|
|
142
153
|
Fu.mkdir_p(This.pkgdir)
|
143
|
-
|
144
|
-
open(
|
154
|
+
gemspec = "#{ lib }.gemspec"
|
155
|
+
open(gemspec, "w"){|fd| fd.puts(template)}
|
156
|
+
This.gemspec = gemspec
|
145
157
|
end
|
146
158
|
|
147
159
|
task :gem => [:clean, :gemspec] do
|
@@ -151,8 +163,8 @@ task :gem => [:clean, :gemspec] do
|
|
151
163
|
`#{ cmd }`
|
152
164
|
after = Dir['*.gem']
|
153
165
|
gem = ((after - before).first || after.first) or abort('no gem!')
|
154
|
-
Fu.mv
|
155
|
-
This.gem = File.basename(gem)
|
166
|
+
Fu.mv(gem, This.pkgdir)
|
167
|
+
This.gem = File.join(This.pkgdir, File.basename(gem))
|
156
168
|
end
|
157
169
|
|
158
170
|
task :readme do
|
@@ -208,12 +220,18 @@ task :release => [:clean, :gemspec, :gem] do
|
|
208
220
|
gems = Dir[File.join(This.pkgdir, '*.gem')].flatten
|
209
221
|
raise "which one? : #{ gems.inspect }" if gems.size > 1
|
210
222
|
raise "no gems?" if gems.size < 1
|
211
|
-
|
223
|
+
|
224
|
+
cmd = "gem push #{ This.gem }"
|
212
225
|
puts cmd
|
213
|
-
|
214
|
-
cmd
|
226
|
+
puts
|
227
|
+
system(cmd)
|
228
|
+
abort("cmd(#{ cmd }) failed with (#{ $?.inspect })") unless $?.exitstatus.zero?
|
229
|
+
|
230
|
+
cmd = "rubyforge login && rubyforge add_release #{ This.rubyforge_project } #{ This.lib } #{ This.version } #{ This.gem }"
|
215
231
|
puts cmd
|
216
|
-
|
232
|
+
puts
|
233
|
+
system(cmd)
|
234
|
+
abort("cmd(#{ cmd }) failed with (#{ $?.inspect })") unless $?.exitstatus.zero?
|
217
235
|
end
|
218
236
|
|
219
237
|
|
@@ -229,6 +247,7 @@ BEGIN {
|
|
229
247
|
require 'erb'
|
230
248
|
require 'fileutils'
|
231
249
|
require 'rbconfig'
|
250
|
+
require 'pp'
|
232
251
|
|
233
252
|
# fu shortcut
|
234
253
|
#
|
@@ -261,6 +280,12 @@ BEGIN {
|
|
261
280
|
end
|
262
281
|
This.version = version
|
263
282
|
|
283
|
+
# see if dependencies are export by the module
|
284
|
+
#
|
285
|
+
if This.object.respond_to?(:dependencies)
|
286
|
+
This.dependencies = This.object.dependencies
|
287
|
+
end
|
288
|
+
|
264
289
|
# we need to know the name of the lib an it's version
|
265
290
|
#
|
266
291
|
abort('no lib') unless This.lib
|
@@ -268,7 +293,7 @@ BEGIN {
|
|
268
293
|
|
269
294
|
# discover full path to this ruby executable
|
270
295
|
#
|
271
|
-
c =
|
296
|
+
c = RbConfig::CONFIG
|
272
297
|
bindir = c["bindir"] || c['BINDIR']
|
273
298
|
ruby_install_name = c['ruby_install_name'] || c['RUBY_INSTALL_NAME'] || 'ruby'
|
274
299
|
ruby_ext = c['EXEEXT'] || ''
|
@@ -287,11 +312,11 @@ BEGIN {
|
|
287
312
|
def unindent(s)
|
288
313
|
indent = nil
|
289
314
|
s.each_line do |line|
|
290
|
-
|
291
|
-
|
292
|
-
end
|
293
|
-
indent ? s.gsub(%r/^#{ indent }/, "") : s
|
315
|
+
next if line =~ %r/^\s*$/
|
316
|
+
indent = line[%r/^\s*/] and break
|
294
317
|
end
|
318
|
+
indent ? s.gsub(%r/^#{ indent }/, "") : s
|
319
|
+
end
|
295
320
|
extend self
|
296
321
|
end
|
297
322
|
|
@@ -299,11 +324,11 @@ BEGIN {
|
|
299
324
|
#
|
300
325
|
class Template
|
301
326
|
def initialize(&block)
|
302
|
-
@block = block
|
327
|
+
@block = block
|
303
328
|
@template = block.call.to_s
|
304
329
|
end
|
305
330
|
def expand(b=nil)
|
306
|
-
ERB.new(Util.unindent(@template)).result(b||@block)
|
331
|
+
ERB.new(Util.unindent(@template)).result((b||@block).binding)
|
307
332
|
end
|
308
333
|
alias_method 'to_s', 'expand'
|
309
334
|
end
|
data/lib/upload_cache.rb
CHANGED
@@ -5,7 +5,7 @@ require 'tmpdir'
|
|
5
5
|
require 'map'
|
6
6
|
|
7
7
|
class UploadCache
|
8
|
-
Version = '1.
|
8
|
+
Version = '1.3.0'
|
9
9
|
|
10
10
|
Readme = <<-__
|
11
11
|
NAME
|
@@ -277,12 +277,16 @@ class UploadCache
|
|
277
277
|
end
|
278
278
|
end
|
279
279
|
|
280
|
+
def to_s
|
281
|
+
url
|
282
|
+
end
|
283
|
+
|
280
284
|
def hidden
|
281
|
-
raw("<input type='hidden' name='#{ @name }' value='#{ @value }' class='upload_cache' />") if @value
|
285
|
+
raw("<input type='hidden' name='#{ @name }' value='#{ @value }' class='upload_cache hidden' />") if @value
|
282
286
|
end
|
283
287
|
|
284
|
-
def
|
285
|
-
|
288
|
+
def input
|
289
|
+
raw("<input type='file' name='#{ @name }' class='upload_cache input' />")
|
286
290
|
end
|
287
291
|
|
288
292
|
module HtmlSafe
|
data/upload_cache.gemspec
CHANGED
@@ -3,26 +3,26 @@
|
|
3
3
|
|
4
4
|
Gem::Specification::new do |spec|
|
5
5
|
spec.name = "upload_cache"
|
6
|
-
spec.version = "1.
|
6
|
+
spec.version = "1.3.0"
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.summary = "upload_cache"
|
9
9
|
spec.description = "description: upload_cache kicks the ass"
|
10
10
|
|
11
|
-
spec.files =
|
11
|
+
spec.files =
|
12
|
+
["README", "Rakefile", "lib", "lib/upload_cache.rb", "upload_cache.gemspec"]
|
13
|
+
|
12
14
|
spec.executables = []
|
13
15
|
|
14
16
|
spec.require_path = "lib"
|
15
17
|
|
16
|
-
spec.has_rdoc = true
|
17
18
|
spec.test_files = nil
|
18
19
|
|
19
|
-
|
20
|
-
spec.add_dependency 'uuidtools'
|
20
|
+
|
21
21
|
|
22
22
|
spec.extensions.push(*[])
|
23
23
|
|
24
24
|
spec.rubyforge_project = "codeforpeople"
|
25
25
|
spec.author = "Ara T. Howard"
|
26
26
|
spec.email = "ara.t.howard@gmail.com"
|
27
|
-
spec.homepage = "
|
27
|
+
spec.homepage = "https://github.com/ahoward/upload_cache"
|
28
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: upload_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,30 +9,19 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
13
|
-
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: uuidtools
|
16
|
-
requirement: &70325209538240 !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: *70325209538240
|
12
|
+
date: 2011-12-04 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
25
14
|
description: ! 'description: upload_cache kicks the ass'
|
26
15
|
email: ara.t.howard@gmail.com
|
27
16
|
executables: []
|
28
17
|
extensions: []
|
29
18
|
extra_rdoc_files: []
|
30
19
|
files:
|
31
|
-
- lib/upload_cache.rb
|
32
|
-
- Rakefile
|
33
20
|
- README
|
21
|
+
- Rakefile
|
22
|
+
- lib/upload_cache.rb
|
34
23
|
- upload_cache.gemspec
|
35
|
-
homepage:
|
24
|
+
homepage: https://github.com/ahoward/upload_cache
|
36
25
|
licenses: []
|
37
26
|
post_install_message:
|
38
27
|
rdoc_options: []
|