ramaze 2008.06 → 2008.11
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/README.markdown +6 -6
- data/Rakefile +33 -3
- data/bin/ramaze +18 -0
- data/doc/CHANGELOG +960 -0
- data/doc/LEGAL +5 -1
- data/doc/meta/announcement.txt +20 -36
- data/doc/tutorial/todolist.html +421 -313
- data/doc/tutorial/todolist.mkd +33 -16
- data/examples/app/blog/spec/blog.rb +3 -3
- data/examples/app/rapaste/controller/paste.rb +8 -1
- data/examples/app/rapaste/model/paste.rb +3 -0
- data/examples/app/rapaste/spec/rapaste.rb +3 -1
- data/examples/app/rapaste/start.rb +3 -2
- data/examples/app/sourceview/public/sourceview.js +2 -2
- data/examples/app/todolist/spec/todolist.rb +6 -6
- data/examples/app/todolist/template/index.xhtml +1 -1
- data/examples/app/whywiki/spec/whywiki.rb +2 -2
- data/examples/app/wikore/spec/wikore.rb +2 -2
- data/examples/app/wikore/src/model.rb +4 -3
- data/examples/app/wiktacular/spec/wiktacular.rb +7 -7
- data/examples/basic/simple.rb +2 -2
- data/examples/helpers/paginate.rb +71 -0
- data/examples/misc/simple_auth.rb +20 -8
- data/lib/proto/controller/init.rb +10 -0
- data/lib/proto/controller/main.rb +1 -3
- data/lib/proto/model/init.rb +4 -0
- data/lib/proto/public/dispatch.fcgi +1 -1
- data/lib/proto/spec/main.rb +2 -1
- data/lib/proto/start.rb +3 -3
- data/lib/proto/start.ru +1 -1
- data/lib/proto/view/error.xhtml +4 -4
- data/lib/ramaze.rb +8 -3
- data/lib/ramaze/action.rb +6 -6
- data/lib/ramaze/adapter.rb +1 -6
- data/lib/ramaze/adapter/base.rb +30 -27
- data/lib/ramaze/adapter/cgi.rb +1 -0
- data/lib/ramaze/cache.rb +1 -3
- data/lib/ramaze/cache/memcached.rb +3 -5
- data/lib/ramaze/contrib/auto_params.rb +2 -2
- data/lib/ramaze/contrib/auto_params/get_args.rb +2 -1
- data/lib/ramaze/contrib/gems.rb +17 -18
- data/lib/ramaze/contrib/gzip_filter.rb +22 -9
- data/lib/ramaze/contrib/maruku_uv.rb +59 -0
- data/lib/ramaze/contrib/profiling.rb +1 -1
- data/lib/ramaze/contrib/rest.rb +16 -13
- data/lib/ramaze/contrib/sequel/create_join.rb +25 -0
- data/lib/ramaze/contrib/sequel/form_field.rb +129 -0
- data/lib/ramaze/contrib/sequel/image.rb +198 -0
- data/lib/ramaze/contrib/sequel/relation.rb +82 -0
- data/lib/ramaze/controller.rb +33 -34
- data/lib/ramaze/controller/resolve.rb +29 -9
- data/lib/ramaze/current.rb +60 -20
- data/lib/ramaze/current/request.rb +8 -7
- data/lib/ramaze/current/response.rb +15 -3
- data/lib/ramaze/current/session/flash.rb +8 -0
- data/lib/ramaze/dispatcher.rb +17 -9
- data/lib/ramaze/dispatcher/action.rb +4 -5
- data/lib/ramaze/dispatcher/directory.rb +1 -1
- data/lib/ramaze/dispatcher/error.rb +4 -4
- data/lib/ramaze/dispatcher/file.rb +4 -4
- data/lib/ramaze/gestalt.rb +15 -20
- data/lib/ramaze/helper/cgi.rb +7 -15
- data/lib/ramaze/helper/formatting.rb +41 -1
- data/lib/ramaze/helper/httpdigest.rb +20 -7
- data/lib/ramaze/helper/link.rb +4 -6
- data/lib/ramaze/helper/paginate.rb +233 -0
- data/lib/ramaze/helper/redirect.rb +1 -1
- data/lib/ramaze/helper/rest.rb +1 -1
- data/lib/ramaze/helper/thread.rb +17 -0
- data/lib/ramaze/helper/ultraviolet.rb +44 -0
- data/lib/ramaze/helper/user.rb +4 -9
- data/lib/ramaze/log.rb +2 -2
- data/lib/ramaze/log/analogger.rb +21 -23
- data/lib/ramaze/log/growl.rb +21 -23
- data/lib/ramaze/log/hub.rb +1 -1
- data/lib/ramaze/log/informer.rb +97 -99
- data/lib/ramaze/log/knotify.rb +14 -16
- data/lib/ramaze/log/logger.rb +11 -13
- data/lib/ramaze/log/logging.rb +61 -63
- data/lib/ramaze/log/rotatinginformer.rb +168 -0
- data/lib/ramaze/log/syslog.rb +41 -31
- data/lib/ramaze/log/xosd.rb +70 -72
- data/lib/ramaze/option.rb +9 -6
- data/lib/ramaze/option/holder.rb +5 -27
- data/lib/ramaze/reloader.rb +186 -0
- data/lib/ramaze/setup.rb +1 -1
- data/lib/ramaze/snippets.rb +13 -0
- data/lib/ramaze/snippets/array/put_within.rb +31 -24
- data/lib/ramaze/snippets/binding/locals.rb +23 -11
- data/lib/ramaze/snippets/dictionary.rb +2 -2
- data/lib/ramaze/snippets/fiber.rb +63 -0
- data/lib/ramaze/snippets/kernel/constant.rb +36 -21
- data/lib/ramaze/snippets/kernel/pretty_inspect.rb +12 -6
- data/lib/ramaze/snippets/numeric/filesize_format.rb +24 -17
- data/lib/ramaze/snippets/numeric/time.rb +63 -0
- data/lib/ramaze/snippets/object/__dir__.rb +29 -0
- data/lib/ramaze/snippets/object/acquire.rb +40 -0
- data/lib/ramaze/snippets/object/instance_variable_defined.rb +16 -5
- data/lib/ramaze/snippets/object/pretty.rb +14 -4
- data/lib/ramaze/snippets/object/scope.rb +14 -7
- data/lib/ramaze/snippets/ordered_set.rb +25 -14
- data/lib/ramaze/snippets/proc/locals.rb +17 -9
- data/lib/ramaze/snippets/ramaze/deprecated.rb +13 -0
- data/lib/ramaze/snippets/ramaze/fiber.rb +24 -0
- data/lib/ramaze/snippets/ramaze/state.rb +86 -0
- data/lib/ramaze/snippets/ramaze/struct.rb +45 -0
- data/lib/ramaze/snippets/string/camel_case.rb +13 -8
- data/lib/ramaze/snippets/string/color.rb +24 -20
- data/lib/ramaze/snippets/string/each.rb +14 -3
- data/lib/ramaze/snippets/string/end_with.rb +20 -0
- data/lib/ramaze/snippets/string/esc.rb +26 -21
- data/lib/ramaze/snippets/string/ord.rb +12 -6
- data/lib/ramaze/snippets/string/snake_case.rb +13 -7
- data/lib/ramaze/snippets/string/start_with.rb +16 -5
- data/lib/ramaze/snippets/string/unindent.rb +23 -15
- data/lib/ramaze/snippets/thread/into.rb +3 -3
- data/lib/ramaze/spec/helper/bacon.rb +5 -5
- data/lib/ramaze/spec/helper/mock_http.rb +1 -1
- data/lib/ramaze/spec/helper/pretty_output.rb +2 -2
- data/lib/ramaze/spec/helper/snippets.rb +8 -0
- data/lib/ramaze/template.rb +4 -1
- data/lib/ramaze/template/ezamar/textpow.syntax +34 -0
- data/lib/ramaze/template/maruku.rb +34 -0
- data/lib/ramaze/template/tagz.rb +2 -2
- data/lib/ramaze/template/xslt.rb +2 -2
- data/lib/ramaze/tool/create.rb +27 -53
- data/lib/ramaze/tool/localize.rb +8 -4
- data/lib/ramaze/tool/mime.rb +11 -1
- data/lib/ramaze/tool/project_creator.rb +110 -0
- data/lib/ramaze/trinity.rb +4 -1
- data/lib/ramaze/version.rb +1 -1
- data/lib/vendor/bacon.rb +323 -0
- data/rake_tasks/gem.rake +10 -1
- data/rake_tasks/maintenance.rake +40 -2
- data/rake_tasks/metric.rake +24 -0
- data/rake_tasks/release.rake +17 -4
- data/rake_tasks/spec.rake +1 -2
- data/ramaze.gemspec +549 -495
- data/spec/contrib/auto_params.rb +3 -3
- data/spec/contrib/profiling.rb +2 -2
- data/spec/examples/simple_auth.rb +2 -2
- data/spec/examples/templates/template_haml.rb +0 -2
- data/spec/ramaze/action/file_cache.rb +22 -0
- data/spec/ramaze/adapter.rb +2 -2
- data/spec/ramaze/controller/actionless_templates.rb +1 -1
- data/spec/ramaze/controller/subclass.rb +15 -0
- data/spec/ramaze/controller/template_resolving.rb +1 -1
- data/spec/ramaze/controller/view/bar.xhtml +1 -0
- data/spec/ramaze/controller/view/base/another.xhtml +1 -0
- data/spec/ramaze/current/session.rb +1 -1
- data/spec/ramaze/dispatcher/file.rb +2 -2
- data/spec/ramaze/helper/aspect.rb +26 -17
- data/spec/ramaze/helper/formatting.rb +13 -0
- data/spec/ramaze/log/informer.rb +10 -10
- data/spec/ramaze/log/syslog.rb +67 -4
- data/spec/ramaze/rewrite.rb +1 -1
- data/spec/ramaze/route.rb +1 -1
- data/spec/ramaze/struct.rb +47 -0
- data/spec/ramaze/template/markaby.rb +1 -1
- data/spec/ramaze/template/tagz.rb +1 -1
- data/spec/snippets/binding/locals.rb +9 -0
- data/spec/snippets/numeric/time.rb +12 -0
- data/spec/snippets/{kernel → object}/__dir__.rb +0 -0
- data/spec/snippets/{kernel → object}/acquire.rb +0 -0
- metadata +90 -81
- data/cache.yaml +0 -7
- data/examples/app/rammit/spec/rammit.rb +0 -31
- data/examples/app/rammit/src/controller/main.rb +0 -3
- data/examples/app/rammit/src/controller/page.rb +0 -16
- data/examples/app/rammit/src/model.rb +0 -33
- data/examples/app/rammit/start.rb +0 -8
- data/examples/app/rammit/template/index.xhtml +0 -14
- data/examples/app/rammit/template/page/view.xhtml +0 -4
- data/lib/ramaze/snippets/kernel/__dir__.rb +0 -23
- data/lib/ramaze/snippets/kernel/acquire.rb +0 -34
- data/lib/ramaze/snippets/object/thread_accessor.rb +0 -5
- data/lib/ramaze/snippets/ramaze/thread_accessor.rb +0 -58
- data/lib/ramaze/snippets/struct/fill.rb +0 -23
- data/lib/ramaze/snippets/struct/values_at.rb +0 -39
- data/lib/ramaze/snippets/symbol/to_proc.rb +0 -24
- data/lib/ramaze/sourcereload.rb +0 -176
- data/spec/snippets/struct/fill.rb +0 -26
- data/spec/snippets/struct/values_at.rb +0 -52
- data/spec/snippets/symbol/to_proc.rb +0 -13
data/lib/vendor/bacon.rb
ADDED
@@ -0,0 +1,323 @@
|
|
1
|
+
# Bacon -- small RSpec clone.
|
2
|
+
#
|
3
|
+
# "Truth will sooner come out from error than from confusion." ---Francis Bacon
|
4
|
+
|
5
|
+
# Copyright (C) 2007, 2008 Christian Neukirchen <purl.org/net/chneukirchen>
|
6
|
+
#
|
7
|
+
# Bacon is freely distributable under the terms of an MIT-style license.
|
8
|
+
# See COPYING or http://www.opensource.org/licenses/mit-license.php.
|
9
|
+
|
10
|
+
module Bacon
|
11
|
+
VERSION = "0.9"
|
12
|
+
|
13
|
+
Counter = Hash.new(0)
|
14
|
+
ErrorLog = ""
|
15
|
+
Shared = Hash.new { |_, name|
|
16
|
+
raise NameError, "no such context: #{name.inspect}"
|
17
|
+
}
|
18
|
+
|
19
|
+
RestrictName = // unless defined? RestrictName
|
20
|
+
RestrictContext = // unless defined? RestrictContext
|
21
|
+
|
22
|
+
def self.summary_on_exit
|
23
|
+
return if Counter[:installed_summary] > 0
|
24
|
+
at_exit {
|
25
|
+
handle_summary
|
26
|
+
if $!
|
27
|
+
raise $!
|
28
|
+
elsif Counter[:errors] + Counter[:failed] > 0
|
29
|
+
exit 1
|
30
|
+
end
|
31
|
+
}
|
32
|
+
Counter[:installed_summary] += 1
|
33
|
+
end
|
34
|
+
|
35
|
+
module SpecDoxOutput
|
36
|
+
def handle_specification(name)
|
37
|
+
puts name
|
38
|
+
yield
|
39
|
+
puts
|
40
|
+
end
|
41
|
+
|
42
|
+
def handle_requirement(description)
|
43
|
+
print "- #{description}"
|
44
|
+
error = yield
|
45
|
+
puts error.empty? ? "" : " [#{error}]"
|
46
|
+
end
|
47
|
+
|
48
|
+
def handle_summary
|
49
|
+
print ErrorLog
|
50
|
+
puts "%d specifications (%d requirements), %d failures, %d errors" %
|
51
|
+
Counter.values_at(:specifications, :requirements, :failed, :errors)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
module TestUnitOutput
|
56
|
+
def handle_specification(name) yield end
|
57
|
+
|
58
|
+
def handle_requirement(description)
|
59
|
+
error = yield
|
60
|
+
if error.empty?
|
61
|
+
print "."
|
62
|
+
else
|
63
|
+
print error[0..0]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def handle_summary
|
68
|
+
puts "", ErrorLog
|
69
|
+
puts "%d tests, %d assertions, %d failures, %d errors" %
|
70
|
+
Counter.values_at(:specifications, :requirements, :failed, :errors)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
module TapOutput
|
75
|
+
def handle_specification(name) yield end
|
76
|
+
|
77
|
+
def handle_requirement(description)
|
78
|
+
ErrorLog.replace ""
|
79
|
+
error = yield
|
80
|
+
if error.empty?
|
81
|
+
printf "ok %-3d - %s\n" % [Counter[:specifications], description]
|
82
|
+
else
|
83
|
+
printf "not ok %d - %s: %s\n" %
|
84
|
+
[Counter[:specifications], description, error]
|
85
|
+
puts ErrorLog.strip.gsub(/^/, '# ')
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def handle_summary
|
90
|
+
puts "1..#{Counter[:specifications]}"
|
91
|
+
puts "# %d tests, %d assertions, %d failures, %d errors" %
|
92
|
+
Counter.values_at(:specifications, :requirements, :failed, :errors)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
extend SpecDoxOutput # default
|
97
|
+
|
98
|
+
class Error < RuntimeError
|
99
|
+
attr_accessor :count_as
|
100
|
+
|
101
|
+
def initialize(count_as, message)
|
102
|
+
@count_as = count_as
|
103
|
+
super message
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
class Context
|
108
|
+
def initialize(name, &block)
|
109
|
+
@name = name
|
110
|
+
@before, @after = [], []
|
111
|
+
|
112
|
+
return unless name =~ RestrictContext
|
113
|
+
Bacon.handle_specification(name) { instance_eval(&block) }
|
114
|
+
end
|
115
|
+
|
116
|
+
def before(&block); @before << block; end
|
117
|
+
def after(&block); @after << block; end
|
118
|
+
|
119
|
+
def behaves_like(*names)
|
120
|
+
names.each { |name| instance_eval(&Shared[name]) }
|
121
|
+
end
|
122
|
+
|
123
|
+
def it(description, &block)
|
124
|
+
return unless description =~ RestrictName
|
125
|
+
block ||= lambda { should.flunk "not implemented" }
|
126
|
+
Counter[:specifications] += 1
|
127
|
+
run_requirement description, block
|
128
|
+
end
|
129
|
+
|
130
|
+
def should(*args, &block)
|
131
|
+
if Counter[:depth]==0
|
132
|
+
it('should '+args.first,&block)
|
133
|
+
else
|
134
|
+
super(*args,&block)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def run_requirement(description, spec)
|
139
|
+
Bacon.handle_requirement description do
|
140
|
+
begin
|
141
|
+
Counter[:depth] += 1
|
142
|
+
rescued = false
|
143
|
+
begin
|
144
|
+
@before.each { |block| instance_eval(&block) }
|
145
|
+
prev_req = Counter[:requirements]
|
146
|
+
instance_eval(&spec)
|
147
|
+
rescue Object => e
|
148
|
+
rescued = true
|
149
|
+
raise e
|
150
|
+
ensure
|
151
|
+
if Counter[:requirements] == prev_req and not rescued
|
152
|
+
raise Error.new(:missing,
|
153
|
+
"empty specification: #{@name} #{description}")
|
154
|
+
end
|
155
|
+
begin
|
156
|
+
@after.each { |block| instance_eval(&block) }
|
157
|
+
rescue Object => e
|
158
|
+
raise e unless rescued
|
159
|
+
end
|
160
|
+
end
|
161
|
+
rescue Object => e
|
162
|
+
ErrorLog << "#{e.class}: #{e.message}\n"
|
163
|
+
e.backtrace.find_all { |line| line !~ /bin\/bacon|\/bacon\.rb:\d+/ }.
|
164
|
+
each_with_index { |line, i|
|
165
|
+
ErrorLog << "\t#{line}#{i==0 ? ": #@name - #{description}" : ""}\n"
|
166
|
+
}
|
167
|
+
ErrorLog << "\n"
|
168
|
+
|
169
|
+
if e.kind_of? Error
|
170
|
+
Counter[e.count_as] += 1
|
171
|
+
e.count_as.to_s.upcase
|
172
|
+
else
|
173
|
+
Counter[:errors] += 1
|
174
|
+
"ERROR: #{e.class}"
|
175
|
+
end
|
176
|
+
else
|
177
|
+
""
|
178
|
+
ensure
|
179
|
+
Counter[:depth] -= 1
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
def raise?(*args, &block); block.raise?(*args); end
|
185
|
+
def throw?(*args, &block); block.throw?(*args); end
|
186
|
+
def change?(*args, &block); block.change?(*args); end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
|
191
|
+
class Object
|
192
|
+
def true?; false; end
|
193
|
+
def false?; false; end
|
194
|
+
end
|
195
|
+
|
196
|
+
class TrueClass
|
197
|
+
def true?; true; end
|
198
|
+
end
|
199
|
+
|
200
|
+
class FalseClass
|
201
|
+
def false?; true; end
|
202
|
+
end
|
203
|
+
|
204
|
+
class Proc
|
205
|
+
def raise?(*exceptions)
|
206
|
+
exceptions = [RuntimeError] if exceptions.empty?
|
207
|
+
call
|
208
|
+
|
209
|
+
# Only to work in 1.9.0, rescue with splat doesn't work there right now
|
210
|
+
rescue Object => e
|
211
|
+
case e
|
212
|
+
when *exceptions
|
213
|
+
e
|
214
|
+
else
|
215
|
+
raise e
|
216
|
+
end
|
217
|
+
else
|
218
|
+
false
|
219
|
+
end
|
220
|
+
|
221
|
+
def throw?(sym)
|
222
|
+
catch(sym) {
|
223
|
+
call
|
224
|
+
return false
|
225
|
+
}
|
226
|
+
return true
|
227
|
+
end
|
228
|
+
|
229
|
+
def change?
|
230
|
+
pre_result = yield
|
231
|
+
called = call
|
232
|
+
post_result = yield
|
233
|
+
pre_result != post_result
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
class Numeric
|
238
|
+
def close?(to, delta)
|
239
|
+
(to.to_f - self).abs <= delta.to_f rescue false
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
|
244
|
+
class Object
|
245
|
+
def should(*args, &block) Should.new(self).be(*args, &block) end
|
246
|
+
end
|
247
|
+
|
248
|
+
module Kernel
|
249
|
+
private
|
250
|
+
|
251
|
+
def describe(*args, &block) Bacon::Context.new(args.join(' '), &block) end
|
252
|
+
def shared(name, &block) Bacon::Shared[name] = block end
|
253
|
+
end
|
254
|
+
|
255
|
+
|
256
|
+
class Should
|
257
|
+
# Kills ==, ===, =~, eql?, equal?, frozen?, instance_of?, is_a?,
|
258
|
+
# kind_of?, nil?, respond_to?, tainted?
|
259
|
+
instance_methods.each { |method|
|
260
|
+
undef_method method if method =~ /\?|^\W+$/
|
261
|
+
}
|
262
|
+
|
263
|
+
def initialize(object)
|
264
|
+
@object = object
|
265
|
+
@negated = false
|
266
|
+
end
|
267
|
+
|
268
|
+
def not(*args, &block)
|
269
|
+
@negated = !@negated
|
270
|
+
|
271
|
+
if args.empty?
|
272
|
+
self
|
273
|
+
else
|
274
|
+
be(*args, &block)
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
def be(*args, &block)
|
279
|
+
if args.empty?
|
280
|
+
self
|
281
|
+
else
|
282
|
+
block = args.shift unless block_given?
|
283
|
+
satisfy(*args, &block)
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
alias a be
|
288
|
+
alias an be
|
289
|
+
|
290
|
+
def satisfy(*args, &block)
|
291
|
+
if args.size == 1 && String === args.first
|
292
|
+
description = args.shift
|
293
|
+
else
|
294
|
+
description = ""
|
295
|
+
end
|
296
|
+
|
297
|
+
r = yield(@object, *args)
|
298
|
+
if Bacon::Counter[:depth] > 0
|
299
|
+
Bacon::Counter[:requirements] += 1
|
300
|
+
raise Bacon::Error.new(:failed, description) unless @negated ^ r
|
301
|
+
end
|
302
|
+
@negated ^ r ? r : false
|
303
|
+
end
|
304
|
+
|
305
|
+
def method_missing(name, *args, &block)
|
306
|
+
name = "#{name}?" if name.to_s =~ /\w[^?]\z/
|
307
|
+
|
308
|
+
desc = @negated ? "not " : ""
|
309
|
+
desc << @object.inspect << "." << name.to_s
|
310
|
+
desc << "(" << args.map{|x|x.inspect}.join(", ") << ") failed"
|
311
|
+
|
312
|
+
satisfy(desc) { |x| x.__send__(name, *args, &block) }
|
313
|
+
end
|
314
|
+
|
315
|
+
def equal(value) self == value end
|
316
|
+
def match(value) self =~ value end
|
317
|
+
def identical_to(value) self.equal? value end
|
318
|
+
alias same_as identical_to
|
319
|
+
|
320
|
+
def flunk(reason="Flunked")
|
321
|
+
raise Bacon::Error.new(:failed, reason)
|
322
|
+
end
|
323
|
+
end
|
data/rake_tasks/gem.rake
CHANGED
@@ -16,8 +16,10 @@ def generate_gemspec(version)
|
|
16
16
|
s.executables = Dir["#{s.bindir}/*"].map{|f| File.basename(f) }
|
17
17
|
s.files = FileList.new('**/*'){|fl|
|
18
18
|
fl.exclude(/^pkg\//)
|
19
|
-
|
19
|
+
fl.exclude(/^tags$/)
|
20
|
+
}.sort
|
20
21
|
|
22
|
+
s.platform = Gem::Platform::RUBY
|
21
23
|
s.has_rdoc = true
|
22
24
|
s.post_install_message = POST_INSTALL_MESSAGE
|
23
25
|
|
@@ -33,6 +35,7 @@ Gem::Specification.new do |s|
|
|
33
35
|
|
34
36
|
s.summary = %summary%
|
35
37
|
s.description = %description%
|
38
|
+
s.platform = %platform%
|
36
39
|
s.has_rdoc = %has_rdoc%
|
37
40
|
s.author = %author%
|
38
41
|
s.email = %email%
|
@@ -63,3 +66,9 @@ end
|
|
63
66
|
|
64
67
|
File.open("ramaze.gemspec", 'w+'){|file| file.puts(gemspec) }
|
65
68
|
end
|
69
|
+
|
70
|
+
spec = generate_gemspec(version_today)
|
71
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
72
|
+
pkg.need_zip = true
|
73
|
+
pkg.need_tar = true
|
74
|
+
end
|
data/rake_tasks/maintenance.rake
CHANGED
@@ -114,6 +114,44 @@ namespace :maintenance do
|
|
114
114
|
File.open(basefile + '.html', 'w+'){|io| io << doc.to_s }
|
115
115
|
end
|
116
116
|
|
117
|
+
# This task is so full of hacks, it may break any second, but it just feels
|
118
|
+
# good to have proper highlighting for sh, ezamar and ruby generated from
|
119
|
+
# markdown without any external CSS to worry about.
|
120
|
+
desc 'Rebuild doc/tutorial/todolist.html using UltraViolet'
|
121
|
+
task 'tutorial-uv' do
|
122
|
+
require 'maruku'
|
123
|
+
require 'uv'
|
124
|
+
require 'hpricot'
|
125
|
+
require 'ramaze/contrib/maruku_uv'
|
126
|
+
|
127
|
+
# Inject ezamar syntax
|
128
|
+
Uv.init_syntaxes
|
129
|
+
ezamar = 'lib/ramaze/template/ezamar/textpow.syntax'
|
130
|
+
syntaxes = Uv.instance_variable_get('@syntaxes')
|
131
|
+
syntaxes['ezamar'] = Textpow::SyntaxNode.load(ezamar)
|
132
|
+
|
133
|
+
base = 'doc/tutorial/todolist'
|
134
|
+
original = File.read(base + '.mkd')
|
135
|
+
maruku = Maruku.new(original)
|
136
|
+
style = maruku.attributes[:uv_style]
|
137
|
+
|
138
|
+
html = maruku.to_html_document
|
139
|
+
|
140
|
+
uv_lib = Gem::latest_load_paths.grep(/ultraviolet/).first
|
141
|
+
uv_root = File.dirname(uv_lib)
|
142
|
+
css = Dir["#{uv_root}/**/#{style}.css"].first
|
143
|
+
|
144
|
+
doc = Hpricot(html)
|
145
|
+
css = %(<style type="text/css">
|
146
|
+
pre { margin: 1em; padding: 1em; }
|
147
|
+
#{File.read(css)}
|
148
|
+
</style>)
|
149
|
+
|
150
|
+
doc.at('title').after(css)
|
151
|
+
|
152
|
+
File.open(base + '.html', 'w+'){|io| io << doc.to_s }
|
153
|
+
end
|
154
|
+
|
117
155
|
def existing_authors
|
118
156
|
authors = {}
|
119
157
|
|
@@ -337,12 +375,12 @@ namespace :maintenance do
|
|
337
375
|
desc "list all undocumented methods"
|
338
376
|
task 'undocumented' do
|
339
377
|
$VERBOSE = false
|
340
|
-
Rake::Task['undocumented-module'].invoke
|
378
|
+
Rake::Task['maintenance:undocumented-module'].invoke
|
341
379
|
end
|
342
380
|
|
343
381
|
desc "list all undocumented methods verbosely"
|
344
382
|
task 'undocumented-verbose' do
|
345
383
|
$VERBOSE = true
|
346
|
-
Rake::Task['undocumented-module'].invoke
|
384
|
+
Rake::Task['maintenance:undocumented-module'].invoke
|
347
385
|
end
|
348
386
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
namespace :metric do
|
2
|
+
desc 'changes per file according to git'
|
3
|
+
task :churn do
|
4
|
+
$stdout.sync = true
|
5
|
+
out = lambda{|changes, rb| puts("%4d %s" % [changes, rb]) }
|
6
|
+
churn = {}
|
7
|
+
|
8
|
+
print 'churning '
|
9
|
+
|
10
|
+
Dir['lib/**/*.rb'].each do |rb|
|
11
|
+
changes = `git-log --pretty=oneline '#{rb}'`.count("\n")
|
12
|
+
print '.'
|
13
|
+
# out[changes, rb]
|
14
|
+
churn[rb] = changes
|
15
|
+
end
|
16
|
+
puts ' done.'
|
17
|
+
|
18
|
+
sorted = churn.sort_by{|r,c| c }.reverse
|
19
|
+
puts "Top 20:"
|
20
|
+
sorted.first(20).each{|(r,c)| out[c,r] }
|
21
|
+
puts "Bottom 20:"
|
22
|
+
sorted.last(20).each{|(r,c)| out[c,r] }
|
23
|
+
end
|
24
|
+
end
|
data/rake_tasks/release.rake
CHANGED
@@ -37,12 +37,12 @@ namespace :release do
|
|
37
37
|
task 'nightly' do
|
38
38
|
prepare_package(version_today)
|
39
39
|
|
40
|
-
location = '/
|
40
|
+
location = 'web/gems/'
|
41
41
|
|
42
|
-
sh "scp pkg/*.{gem,tgz,zip} ramaze.net:#{location}"
|
43
|
-
sh "ssh ramaze.net '
|
42
|
+
sh "scp pkg/*.{gem,tgz,zip} ramaze@ramaze.net:#{location}"
|
43
|
+
sh "ssh ramaze@ramaze.net '
|
44
44
|
source ~/.zsh/export.sh
|
45
|
-
cd #{location}
|
45
|
+
cd #{location}
|
46
46
|
gem generate_index'"
|
47
47
|
end
|
48
48
|
|
@@ -60,4 +60,17 @@ gem generate_index'"
|
|
60
60
|
sh "rubyforge add_file ramaze ramaze #{release_id} '#{file}'"
|
61
61
|
end
|
62
62
|
end
|
63
|
+
|
64
|
+
desc 'Prepare and push gemspec to github'
|
65
|
+
task 'gemspec' => 'gemspec-prepare' do
|
66
|
+
sh "git commit -m 'Update ramaze.gemspec' ramaze.gemspec"
|
67
|
+
sh 'git fetch'
|
68
|
+
sh 'git rebase origin/master'
|
69
|
+
sh 'git push'
|
70
|
+
end
|
71
|
+
|
72
|
+
desc 'Prepare gemspec for push to github'
|
73
|
+
task 'gemspec-prepare' do
|
74
|
+
update_gemspec(generate_gemspec(version_month))
|
75
|
+
end
|
63
76
|
end
|