Pistos-ramaze 2009.04.08 → 2009.06.12
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/MANIFEST +37 -22
- data/{README.markdown → README.md} +5 -24
- data/Rakefile +33 -26
- data/benchmark/bench_templates/bench.rb +67 -0
- data/benchmark/bench_templates/view/large.erb +79 -0
- data/benchmark/bench_templates/view/large.haml +41 -0
- data/benchmark/bench_templates/view/large.xhtml +79 -0
- data/benchmark/bench_templates/view/small.erb +21 -0
- data/benchmark/bench_templates/view/small.haml +12 -0
- data/benchmark/bench_templates/view/small.xhtml +21 -0
- data/benchmark/run.rb +14 -21
- data/benchmark/suite/minimal.rb +3 -5
- data/benchmark/suite/no_informer.rb +0 -2
- data/benchmark/suite/no_sessions.rb +3 -4
- data/benchmark/suite/no_template.rb +1 -3
- data/benchmark/suite/simple.rb +1 -3
- data/benchmark/suite/template_erubis.rb +0 -2
- data/benchmark/suite/template_etanni.rb +8 -0
- data/benchmark/suite/template_ezamar.rb +1 -3
- data/benchmark/suite/template_haml.rb +0 -2
- data/benchmark/suite/template_liquid.rb +0 -2
- data/benchmark/suite/template_markaby.rb +0 -2
- data/benchmark/suite/template_nagoro.rb +1 -3
- data/benchmark/suite/template_redcloth.rb +0 -2
- data/benchmark/suite/template_tenjin.rb +0 -2
- data/bin/ramaze +11 -163
- data/doc/AUTHORS +15 -8
- data/doc/CHANGELOG +10094 -12262
- data/doc/meta/announcement.txt +93 -46
- data/doc/tutorial/todolist.html +22 -58
- data/doc/tutorial/todolist.txt +20 -39
- data/examples/app/auth/layout/{auth.nag → auth.xhtml} +0 -0
- data/examples/app/auth/view/{index.nag → index.xhtml} +0 -0
- data/examples/app/auth/view/{login.nag → login.xhtml} +0 -0
- data/examples/app/auth/view/{secret.nag → secret.xhtml} +0 -0
- data/examples/app/blog/app.rb +1 -1
- data/examples/app/blog/controller/comment.rb +1 -1
- data/examples/app/blog/controller/entry.rb +12 -3
- data/examples/app/blog/model/init.rb +5 -0
- data/examples/app/blog/model/tag.rb +2 -2
- data/examples/app/blog/view/entry/index.nag +3 -3
- data/examples/app/blog/view/feed.atom.nag +1 -1
- data/examples/app/blog/view/feed.rss.nag +1 -1
- data/examples/app/blog/view/index.nag +1 -1
- data/examples/app/blog/view/tag/index.nag +1 -1
- data/examples/app/chat/layout/{default.nag → default.xhtml} +0 -0
- data/examples/app/chat/view/{chat.nag → chat.xhtml} +0 -0
- data/examples/app/chat/view/{index.nag → index.xhtml} +0 -0
- data/examples/app/localization/locale/de.yaml +5 -0
- data/examples/app/localization/locale/en.yaml +5 -0
- data/examples/app/localization/locale/ja.yaml +5 -0
- data/examples/app/localization/start.rb +33 -20
- data/examples/app/wikore/spec/wikore.rb +4 -6
- data/examples/app/wikore/src/controller.rb +9 -11
- data/examples/app/wikore/src/model.rb +7 -10
- data/examples/app/wikore/start.rb +1 -1
- data/examples/app/wikore/{template → view}/index.xhtml +0 -0
- data/examples/helpers/cache.rb +6 -4
- data/examples/misc/css.rb +6 -12
- data/examples/misc/rapp.rb +28 -17
- data/lib/proto/app.rb +14 -0
- data/lib/proto/config.ru +8 -5
- data/lib/proto/controller/init.rb +3 -3
- data/lib/proto/spec/main.rb +9 -11
- data/lib/proto/start.rb +6 -10
- data/lib/ramaze.rb +8 -9
- data/lib/ramaze/app.rb +4 -3
- data/lib/ramaze/cache/localmemcache.rb +2 -2
- data/lib/ramaze/cache/memcache.rb +26 -1
- data/lib/ramaze/cache/sequel.rb +24 -9
- data/lib/ramaze/contrib/addressable_route.rb +56 -0
- data/lib/ramaze/contrib/email.rb +2 -0
- data/lib/ramaze/contrib/facebook/facebook.rb +4 -4
- data/lib/ramaze/contrib/sequel/create_join.rb +1 -0
- data/lib/ramaze/contrib/sequel/form_field.rb +4 -4
- data/lib/ramaze/contrib/sequel/image.rb +9 -11
- data/lib/ramaze/contrib/sequel/relation.rb +17 -3
- data/lib/ramaze/controller.rb +26 -18
- data/lib/ramaze/gestalt.rb +4 -1
- data/lib/ramaze/helper.rb +1 -0
- data/lib/ramaze/helper/auth.rb +0 -5
- data/lib/ramaze/helper/cache.rb +65 -25
- data/lib/ramaze/helper/form.rb +14 -2
- data/lib/ramaze/helper/formatting.rb +3 -1
- data/lib/ramaze/helper/gestalt.rb +32 -0
- data/lib/ramaze/helper/identity.rb +3 -3
- data/lib/ramaze/helper/layout.rb +97 -0
- data/lib/ramaze/helper/link.rb +6 -25
- data/lib/ramaze/helper/localize.rb +13 -3
- data/lib/ramaze/helper/paginate.rb +4 -2
- data/lib/ramaze/helper/ultraviolet.rb +2 -0
- data/lib/ramaze/helper/user.rb +3 -3
- data/lib/ramaze/log/rotatinginformer.rb +10 -10
- data/lib/ramaze/request.rb +3 -5
- data/lib/ramaze/setup.rb +22 -9
- data/lib/ramaze/spec.rb +8 -12
- data/lib/ramaze/spec/bacon.rb +34 -0
- data/lib/ramaze/spec/helper/template_examples.rb +15 -22
- data/lib/ramaze/tool/bin.rb +340 -0
- data/lib/ramaze/tool/project_creator.rb +1 -1
- data/lib/ramaze/version.rb +1 -1
- data/lib/ramaze/view.rb +6 -11
- data/lib/ramaze/view/erubis.rb +2 -2
- data/lib/ramaze/view/ezamar.rb +2 -2
- data/lib/ramaze/view/gestalt.rb +14 -0
- data/lib/ramaze/view/haml.rb +2 -1
- data/lib/ramaze/view/liquid.rb +45 -11
- data/lib/ramaze/view/maruku.rb +2 -1
- data/lib/ramaze/view/nagoro/render_partial.rb +9 -9
- data/lib/ramaze/view/sass.rb +1 -1
- data/lib/ramaze/view/tenjin.rb +7 -4
- data/lib/vendor/etag.rb +4 -2
- data/lib/vendor/route_exceptions.rb +9 -15
- data/ramaze.gemspec +56 -9
- data/spec/contrib/addressable_route.rb +30 -0
- data/spec/contrib/rest.rb +2 -2
- data/spec/examples/caching.rb +5 -7
- data/spec/examples/css.rb +3 -3
- data/spec/examples/element.rb +4 -3
- data/spec/examples/hello.rb +3 -3
- data/spec/examples/helpers/httpdigest.rb +44 -69
- data/spec/examples/linking.rb +3 -3
- data/spec/examples/simple.rb +3 -3
- data/spec/examples/templates/template_erubis.rb +8 -4
- data/spec/examples/templates/template_ezamar.rb +9 -4
- data/spec/examples/templates/template_haml.rb +8 -4
- data/spec/examples/templates/template_liquid.rb +8 -4
- data/spec/examples/templates/template_markaby.rb +9 -5
- data/spec/examples/templates/template_nagoro.rb +9 -5
- data/spec/examples/templates/template_redcloth.rb +8 -4
- data/spec/examples/templates/template_remarkably.rb +8 -4
- data/spec/examples/templates/template_tenjin.rb +8 -4
- data/spec/helper.rb +1 -2
- data/spec/ramaze/action/render.rb +4 -1
- data/spec/ramaze/app.rb +5 -2
- data/spec/ramaze/bin/ramaze.rb +96 -0
- data/spec/ramaze/cache/localmemcache.rb +1 -1
- data/spec/ramaze/cache/memcache.rb +7 -1
- data/spec/ramaze/cache/sequel.rb +1 -1
- data/spec/ramaze/controller/actionless_templates.rb +2 -2
- data/spec/ramaze/controller/lonely_mapping.rb +18 -0
- data/spec/ramaze/controller/mapping.rb +4 -15
- data/spec/ramaze/controller/provide_inheritance.rb +5 -2
- data/spec/ramaze/controller/resolve.rb +2 -2
- data/spec/ramaze/controller/subclass.rb +2 -2
- data/spec/ramaze/controller/template_resolving.rb +2 -2
- data/spec/ramaze/dispatcher/directory.rb +5 -2
- data/spec/ramaze/dispatcher/file.rb +28 -26
- data/spec/ramaze/error.rb +3 -3
- data/spec/ramaze/files.rb +5 -2
- data/spec/ramaze/gestalt.rb +26 -17
- data/spec/ramaze/helper/auth.rb +30 -41
- data/spec/ramaze/helper/bench.rb +6 -2
- data/spec/ramaze/helper/cache.rb +45 -5
- data/spec/ramaze/helper/flash.rb +11 -15
- data/spec/ramaze/helper/form.rb +6 -3
- data/spec/ramaze/helper/formatting.rb +4 -1
- data/spec/ramaze/helper/gestalt.rb +4 -1
- data/spec/ramaze/helper/gravatar.rb +4 -1
- data/spec/ramaze/helper/httpdigest.rb +51 -66
- data/spec/ramaze/helper/layout.rb +79 -0
- data/spec/ramaze/helper/layout/default.xhtml +5 -0
- data/spec/ramaze/helper/link.rb +33 -12
- data/spec/ramaze/helper/localize.rb +9 -4
- data/spec/ramaze/helper/maruku.rb +5 -2
- data/spec/ramaze/helper/pager.rb +2 -2
- data/spec/ramaze/helper/paginate.rb +5 -2
- data/spec/ramaze/helper/request_accessor.rb +5 -2
- data/spec/ramaze/helper/sequel_form.rb +7 -2
- data/spec/ramaze/helper/simple_captcha.rb +10 -14
- data/spec/ramaze/helper/stack.rb +32 -40
- data/spec/ramaze/helper/user.rb +19 -14
- data/spec/ramaze/helper/xhtml.rb +4 -1
- data/spec/ramaze/log/informer.rb +1 -1
- data/spec/ramaze/log/logging.rb +4 -1
- data/spec/ramaze/log/syslog.rb +6 -6
- data/spec/ramaze/params.rb +5 -6
- data/spec/ramaze/request.rb +16 -1
- data/spec/ramaze/session/memcache.rb +66 -0
- data/spec/ramaze/struct.rb +4 -1
- data/spec/ramaze/view.rb +2 -2
- data/spec/ramaze/view/erubis.rb +2 -2
- data/spec/ramaze/view/ezamar.rb +2 -2
- data/spec/ramaze/view/gestalt.rb +94 -0
- data/spec/ramaze/view/gestalt/external.ges +8 -0
- data/spec/ramaze/view/haml.rb +2 -2
- data/spec/ramaze/view/liquid.rb +2 -2
- data/spec/ramaze/view/nagoro.rb +2 -2
- data/spec/ramaze/view/redcloth.rb +2 -2
- data/spec/ramaze/view/remarkably.rb +2 -2
- data/spec/ramaze/view/sass.rb +2 -2
- data/spec/ramaze/view/tagz.rb +2 -2
- data/spec/ramaze/view/tenjin.rb +2 -2
- data/spec/snippets/array/put_within.rb +30 -25
- data/spec/snippets/binding/locals.rb +4 -1
- data/spec/snippets/numeric/filesize_format.rb +4 -1
- data/spec/snippets/numeric/time.rb +5 -2
- data/spec/snippets/object/__dir__.rb +4 -1
- data/spec/snippets/ordered_set.rb +4 -1
- data/spec/snippets/ramaze/acquire.rb +4 -1
- data/spec/snippets/ramaze/dictionary.rb +4 -1
- data/spec/snippets/ramaze/struct.rb +4 -1
- data/spec/snippets/string/camel_case.rb +4 -1
- data/spec/snippets/string/color.rb +4 -1
- data/spec/snippets/string/snake_case.rb +4 -1
- data/spec/snippets/string/unindent.rb +4 -1
- data/spec/snippets/thread/into.rb +4 -1
- data/tasks/bacon.rake +5 -3
- data/tasks/changelog.rake +3 -1
- data/tasks/{gem_installer.rake → gem_setup.rake} +45 -22
- data/tasks/release.rake +12 -27
- data/tasks/setup.rake +6 -0
- data/tasks/todo.rake +2 -4
- metadata +205 -31
- data/CHANGELOG +0 -16546
- data/benchmark/suite/template_builder.rb +0 -12
- data/doc/tutorial/todolist.mkd +0 -787
- data/examples/helpers/provide.rb +0 -23
- data/lib/proto/view/page.xhtml +0 -27
- data/lib/ramaze/snippets/divide.rb +0 -22
- data/lib/ramaze/snippets/kernel/constant.rb +0 -41
- data/lib/ramaze/snippets/object/acquire.rb +0 -37
- data/lib/ramaze/snippets/string/each.rb +0 -19
- data/spec/ramaze/helper/partial.rb +0 -40
- data/spec/snippets/kernel/constant.rb +0 -23
- data/tasks/install_dependencies.rake +0 -6
@@ -1,33 +1,38 @@
|
|
1
|
-
|
1
|
+
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
require File.expand_path('../../../../lib/ramaze/spec/helper/snippets', __FILE__)
|
5
|
+
|
6
|
+
describe 'Array' do
|
7
|
+
describe '#put_within' do
|
8
|
+
it 'puts a given object at a well-described position' do
|
9
|
+
array = [:foo, :bar, :baz]
|
10
|
+
array.put_within(:foobar, :after => :bar, :before => :baz)
|
11
|
+
array.should == [:foo, :bar, :foobar, :baz]
|
12
|
+
end
|
9
13
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
it 'raises on uncertainity' do
|
15
|
+
array = [:foo, :bar, :baz]
|
16
|
+
lambda{
|
17
|
+
array.put_within(:foobar, :after => :foo, :before => :baz)
|
18
|
+
}.should.raise(ArgumentError).
|
19
|
+
message.should == "Too many elements within constrain"
|
20
|
+
end
|
16
21
|
end
|
17
|
-
end
|
18
22
|
|
19
|
-
describe '
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
describe '#put_after' do
|
24
|
+
it 'puts a given object at a well-described position' do
|
25
|
+
array = [:foo, :bar, :baz]
|
26
|
+
array.put_after(:bar, :foobar)
|
27
|
+
array.should == [:foo, :bar, :foobar, :baz]
|
28
|
+
end
|
24
29
|
end
|
25
|
-
end
|
26
30
|
|
27
|
-
describe '
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
31
|
+
describe '#put_within' do
|
32
|
+
it 'puts a given object at a well-described position' do
|
33
|
+
array = [:foo, :bar, :baz]
|
34
|
+
array.put_before(:bar, :foobar)
|
35
|
+
array.should == [:foo, :foobar, :bar, :baz]
|
36
|
+
end
|
32
37
|
end
|
33
38
|
end
|
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require File.expand_path('../../../../lib/ramaze/spec/helper/snippets', __FILE__)
|
2
5
|
|
3
6
|
describe 'locals' do
|
4
7
|
should 'find locals' do
|
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require File.expand_path('../../../../lib/ramaze/spec/helper/snippets', __FILE__)
|
2
5
|
|
3
6
|
describe "Numeric#filesize_format" do
|
4
7
|
it 'it should convert filesizes to human readable format' do
|
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require File.expand_path('../../../../lib/ramaze/spec/helper/snippets', __FILE__)
|
2
5
|
|
3
6
|
describe "Numeric time extensions" do
|
4
7
|
it 'should provide times in the past' do
|
@@ -9,4 +12,4 @@ describe "Numeric time extensions" do
|
|
9
12
|
it 'should provide times in the future' do
|
10
13
|
2.weeks.from_now.to_i.should == (Time.now + 2*7*24*60*60).to_i
|
11
14
|
end
|
12
|
-
end
|
15
|
+
end
|
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require File.expand_path('../../../../lib/ramaze/spec/helper/snippets', __FILE__)
|
2
5
|
|
3
6
|
describe '__DIR__' do
|
4
7
|
# this is hardly exhaustive, but better than nothing
|
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require File.expand_path('../../../lib/ramaze/spec/helper/snippets', __FILE__)
|
2
5
|
|
3
6
|
describe 'OrderedSet' do
|
4
7
|
os = OrderedSet.new(1,2,3,1)
|
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require File.expand_path('../../../../lib/ramaze/spec/helper/snippets', __FILE__)
|
2
5
|
require 'fileutils'
|
3
6
|
|
4
7
|
|
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require File.expand_path('../../../../lib/ramaze/spec/helper/snippets', __FILE__)
|
2
5
|
|
3
6
|
describe Ramaze::Dictionary do
|
4
7
|
Dictionary = Ramaze::Dictionary
|
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require File.expand_path('../../../../lib/ramaze/spec/helper/snippets', __FILE__)
|
2
5
|
|
3
6
|
describe Ramaze::Struct do
|
4
7
|
should 'provide #values_at' do
|
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require File.expand_path('../../../../lib/ramaze/spec/helper/snippets', __FILE__)
|
2
5
|
|
3
6
|
describe "String#camel_case" do
|
4
7
|
|
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require File.expand_path('../../../../lib/ramaze/spec/helper/snippets', __FILE__)
|
2
5
|
|
3
6
|
describe 'String#color' do
|
4
7
|
it 'should define methods to return ANSI strings' do
|
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require File.expand_path('../../../../lib/ramaze/spec/helper/snippets', __FILE__)
|
2
5
|
|
3
6
|
describe "String#snake_case" do
|
4
7
|
|
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require File.expand_path('../../../../lib/ramaze/spec/helper/snippets', __FILE__)
|
2
5
|
|
3
6
|
describe "String#unindent" do
|
4
7
|
it "should remove indentation" do
|
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require File.expand_path('../../../../lib/ramaze/spec/helper/snippets', __FILE__)
|
2
5
|
|
3
6
|
describe 'Thread.into' do
|
4
7
|
it 'should provide access to thread vars' do
|
data/tasks/bacon.rake
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
desc 'Run all bacon specs with pretty output'
|
2
|
-
task :bacon => :
|
2
|
+
task :bacon => :setup do
|
3
3
|
require 'open3'
|
4
4
|
require 'scanf'
|
5
5
|
require 'matrix'
|
@@ -16,14 +16,16 @@ task :bacon => :install_dependencies do
|
|
16
16
|
left_format = "%4d/%d: %-#{len + 11}s"
|
17
17
|
spec_format = "%d specifications (%d requirements), %d failures, %d errors"
|
18
18
|
|
19
|
+
load_path = File.expand_path('../../', __FILE__)
|
20
|
+
|
19
21
|
specs.each_with_index do |spec, idx|
|
20
22
|
print(left_format % [idx + 1, specs_size, spec])
|
21
23
|
|
22
|
-
Open3.popen3(RUBY, spec) do |sin, sout, serr|
|
24
|
+
Open3.popen3(RUBY, '-I', load_path, spec) do |sin, sout, serr|
|
23
25
|
out = sout.read.strip
|
24
26
|
err = serr.read.strip
|
25
27
|
|
26
|
-
# this is conventional
|
28
|
+
# this is conventional
|
27
29
|
if out =~ /^Bacon::Error: (needed .*)/
|
28
30
|
puts(yellow % ("%6s %s" % ['', $1]))
|
29
31
|
else
|
data/tasks/changelog.rake
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
desc 'update changelog'
|
2
2
|
task :changelog do
|
3
|
-
File.open('CHANGELOG', 'w+') do |changelog|
|
3
|
+
File.open('doc/CHANGELOG', 'w+') do |changelog|
|
4
4
|
`git log -z --abbrev-commit`.split("\0").each do |commit|
|
5
5
|
next if commit =~ /^Merge: \d*/
|
6
6
|
ref, author, time, _, title, _, message = commit.split("\n", 7)
|
7
7
|
ref = ref[/commit ([0-9a-f]+)/, 1]
|
8
8
|
author = author[/Author: (.*)/, 1].strip
|
9
9
|
time = Time.parse(time[/Date: (.*)/, 1]).utc
|
10
|
+
time = time.strftime('%a %b %d %H:%M:%S %Z %Y')
|
11
|
+
|
10
12
|
title.strip!
|
11
13
|
|
12
14
|
changelog.puts "[#{ref} | #{time}] #{author}"
|
@@ -1,14 +1,17 @@
|
|
1
|
-
task :
|
2
|
-
class
|
1
|
+
task :gem_setup do
|
2
|
+
class GemSetup
|
3
3
|
def initialize(options = {}, &block)
|
4
4
|
@gems = []
|
5
|
-
@options = options
|
5
|
+
@options = options.dup
|
6
|
+
@verbose = @options.delete(:verbose)
|
6
7
|
|
7
8
|
run(&block)
|
8
9
|
end
|
9
10
|
|
10
11
|
def run(&block)
|
11
|
-
|
12
|
+
return unless block_given?
|
13
|
+
instance_eval(&block)
|
14
|
+
setup
|
12
15
|
end
|
13
16
|
|
14
17
|
def gem(name, version = nil, options = {})
|
@@ -21,6 +24,16 @@ task :gem_installer do
|
|
21
24
|
@gems << [name, options]
|
22
25
|
end
|
23
26
|
|
27
|
+
# all gems defined, let's try to load/install them
|
28
|
+
def setup
|
29
|
+
require 'rubygems'
|
30
|
+
require 'rubygems/dependency_installer'
|
31
|
+
|
32
|
+
@gems.each do |name, options|
|
33
|
+
setup_gem(name, options)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
24
37
|
def setup_gemspec(gemspec)
|
25
38
|
gemspec.dependencies.each do |dependency|
|
26
39
|
dependency.version_requirements.as_list.each do |version|
|
@@ -31,36 +44,31 @@ task :gem_installer do
|
|
31
44
|
setup
|
32
45
|
end
|
33
46
|
|
34
|
-
|
35
|
-
|
36
|
-
|
47
|
+
# first try to activate, install and try to activate again if activation
|
48
|
+
# fails the first time
|
49
|
+
def setup_gem(name, options)
|
50
|
+
version = [options[:version]].compact
|
51
|
+
lib_name = options[:lib] || name
|
37
52
|
|
38
|
-
|
39
|
-
setup_gem(name, options)
|
40
|
-
end
|
41
|
-
end
|
53
|
+
log "activating #{name}"
|
42
54
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
puts "success."
|
48
|
-
rescue LoadError => error
|
49
|
-
puts error
|
50
|
-
install_gem(name, options) if try_install
|
51
|
-
setup_gem(name, options, try_install = false)
|
55
|
+
Gem.activate(name, *version)
|
56
|
+
rescue LoadError
|
57
|
+
install_gem(name, options)
|
58
|
+
Gem.activate(name, *version)
|
52
59
|
end
|
53
60
|
|
61
|
+
# tell rubygems to install a gem
|
54
62
|
def install_gem(name, options)
|
55
63
|
installer = Gem::DependencyInstaller.new(options)
|
56
64
|
|
57
65
|
temp_argv(options[:extconf]) do
|
58
|
-
|
66
|
+
log "Installing #{name}"
|
59
67
|
installer.install(name, options[:version])
|
60
|
-
puts "done."
|
61
68
|
end
|
62
69
|
end
|
63
70
|
|
71
|
+
# prepare ARGV for rubygems installer
|
64
72
|
def temp_argv(extconf)
|
65
73
|
if extconf ||= @options[:extconf]
|
66
74
|
old_argv = ARGV.clone
|
@@ -72,5 +80,20 @@ task :gem_installer do
|
|
72
80
|
ensure
|
73
81
|
ARGV.replace(old_argv) if extconf
|
74
82
|
end
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
def log(msg)
|
87
|
+
return unless @verbose
|
88
|
+
|
89
|
+
if defined?(Log)
|
90
|
+
Log.info(msg)
|
91
|
+
else
|
92
|
+
puts(msg)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def rubyforge; 'http://gems.rubyforge.org/' end
|
97
|
+
def github; 'http://gems.github.com/' end
|
75
98
|
end
|
76
99
|
end
|
data/tasks/release.rake
CHANGED
@@ -2,15 +2,17 @@ namespace :release do
|
|
2
2
|
task :all => [:release_github, :release_rubyforge]
|
3
3
|
|
4
4
|
desc 'Display instructions to release on github'
|
5
|
-
task :github => [:reversion, :gemspec] do
|
5
|
+
task :github => [:jquery, :reversion, :authors, :gemspec] do
|
6
6
|
name, version = GEMSPEC.name, GEMSPEC.version
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
sh('git', 'add',
|
9
|
+
'MANIFEST', 'doc/CHANGELOG', 'doc/AUTHORS',
|
10
|
+
"#{name}.gemspec",
|
11
|
+
"lib/#{name}/version.rb")
|
10
12
|
|
11
|
-
|
13
|
+
puts <<INSTRUCTIONS
|
12
14
|
|
13
|
-
|
15
|
+
I added the relevant files, you can commit them, tag the commit, and push:
|
14
16
|
|
15
17
|
git commit -m 'Version #{version}'
|
16
18
|
git tag -a -m '#{version}' '#{version}'
|
@@ -22,14 +24,14 @@ INSTRUCTIONS
|
|
22
24
|
|
23
25
|
# TODO: Not tested
|
24
26
|
desc 'Display instructions to release on rubyforge'
|
25
|
-
task :rubyforge => [:reversion, :gemspec, :package] do
|
27
|
+
task :rubyforge => [:jquery, :reversion, :authors, :gemspec, :package] do
|
26
28
|
name, version = GEMSPEC.name, GEMSPEC.version
|
27
29
|
|
28
30
|
puts <<INSTRUCTIONS
|
29
31
|
To publish to rubyforge do following:
|
30
32
|
|
31
33
|
rubyforge login
|
32
|
-
rubyforge add_release #{name} #{version} pkg/#{name}-#{version}.gem
|
34
|
+
rubyforge add_release #{name} #{name} '#{version}' pkg/#{name}-#{version}.gem
|
33
35
|
|
34
36
|
After you have done these steps, see:
|
35
37
|
|
@@ -40,30 +42,13 @@ INSTRUCTIONS
|
|
40
42
|
|
41
43
|
desc 'Display instructions to add archives after release:rubyforge'
|
42
44
|
task :rubyforge_archives do
|
43
|
-
|
44
|
-
|
45
|
+
name, version = GEMSPEC.name, GEMSPEC.version
|
45
46
|
puts "Adding archives for distro packagers is:", ""
|
46
47
|
|
47
|
-
Dir["pkg/#{name}-#{version}.{
|
48
|
-
puts "rubyforge add_file #{name} #{name} #{
|
48
|
+
Dir["pkg/#{name}-#{version}.{tgz,zip}"].each do |file|
|
49
|
+
puts "rubyforge add_file #{name} #{name} '#{version}' '#{file}'"
|
49
50
|
end
|
50
51
|
|
51
52
|
puts
|
52
53
|
end
|
53
54
|
end
|
54
|
-
|
55
|
-
# Use URI and proper XPATH, something along these lines:
|
56
|
-
#
|
57
|
-
# a = doc.at('a[@href=~"release_id"]')[:href]
|
58
|
-
# release_id = URI(a).query[/release_id=(\w+)/, 1]
|
59
|
-
def latest_release_id
|
60
|
-
require 'open-uri'
|
61
|
-
require 'hpricot'
|
62
|
-
|
63
|
-
url = "http://rubyforge.org/frs/?group_id=#{PROJECT_RUBYFORGE_GROUP_ID}"
|
64
|
-
doc = Hpricot(open(url))
|
65
|
-
a = (doc/:a).find{|a| a[:href] =~ /release_id/}
|
66
|
-
|
67
|
-
version = a.inner_html
|
68
|
-
release_id = Hash[*a[:href].split('?').last.split('=').flatten]['release_id']
|
69
|
-
end
|
data/tasks/setup.rake
ADDED
data/tasks/todo.rake
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
desc "show a todolist from all the TODO tags in the source"
|
2
2
|
task :todo do
|
3
|
-
|
4
|
-
|
5
|
-
files.each do |file|
|
3
|
+
Dir.glob('{lib,spec}/**/*.rb') do |file|
|
6
4
|
lastline = todo = comment = long_comment = false
|
7
5
|
|
8
6
|
File.readlines(file).each_with_index do |line, lineno|
|
@@ -10,7 +8,7 @@ task :todo do
|
|
10
8
|
comment = line =~ /^\s*?#.*?$/
|
11
9
|
long_comment = line =~ /^=begin/
|
12
10
|
long_comment = line =~ /^=end/
|
13
|
-
todo = true if line =~ /TODO/ and (long_comment or comment)
|
11
|
+
todo = true if line =~ /TODO|FIXME|THINK/ and (long_comment or comment)
|
14
12
|
todo = false if line.gsub('#', '').strip.empty?
|
15
13
|
todo = false unless comment or long_comment
|
16
14
|
if todo
|