manveru-innate 2009.03.24 → 2009.04

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/CHANGELOG +354 -0
  2. data/MANIFEST +34 -22
  3. data/README.md +2 -10
  4. data/Rakefile +30 -247
  5. data/example/app/retro_games.rb +8 -8
  6. data/example/app/todo/layout/{default.erb → default.xhtml} +1 -1
  7. data/example/app/todo/view/{index.erb → index.xhtml} +11 -11
  8. data/example/app/whywiki_erb/start.rb +2 -1
  9. data/example/app/whywiki_erb/view/{edit.html.erb → edit.erb} +0 -0
  10. data/example/app/whywiki_erb/view/{index.html.erb → index.erb} +0 -0
  11. data/example/howto_spec.rb +1 -1
  12. data/example/provides.rb +9 -6
  13. data/example/session.rb +3 -3
  14. data/innate.gemspec +23 -127
  15. data/lib/innate/action.rb +24 -13
  16. data/lib/innate/adapter.rb +5 -27
  17. data/lib/innate/cache/file_based.rb +2 -0
  18. data/lib/innate/cache.rb +1 -1
  19. data/lib/innate/current.rb +5 -5
  20. data/lib/innate/dynamap.rb +5 -0
  21. data/lib/innate/helper/cgi.rb +32 -19
  22. data/lib/innate/helper/link.rb +2 -2
  23. data/lib/innate/helper/redirect.rb +1 -1
  24. data/lib/innate/helper/render.rb +87 -0
  25. data/lib/innate/helper/send_file.rb +9 -1
  26. data/lib/innate/helper.rb +20 -29
  27. data/lib/innate/log/hub.rb +1 -1
  28. data/lib/innate/middleware_compiler.rb +1 -15
  29. data/lib/innate/mock.rb +2 -3
  30. data/lib/innate/node.rb +85 -55
  31. data/lib/innate/options/dsl.rb +1 -1
  32. data/lib/innate/options.rb +1 -1
  33. data/lib/innate/request.rb +3 -76
  34. data/lib/innate/response.rb +1 -8
  35. data/lib/innate/session.rb +2 -3
  36. data/lib/innate/spec.rb +6 -50
  37. data/lib/innate/version.rb +1 -1
  38. data/lib/innate/view/erb.rb +1 -5
  39. data/lib/innate/view/etanni.rb +36 -0
  40. data/lib/innate/view/none.rb +1 -1
  41. data/lib/innate/view.rb +14 -16
  42. data/lib/innate.rb +27 -53
  43. data/spec/example/app/retro_games.rb +30 -0
  44. data/spec/example/provides.rb +16 -0
  45. data/spec/example/session.rb +8 -14
  46. data/spec/innate/action/layout/file_layout.xhtml +1 -0
  47. data/spec/innate/action/layout.rb +1 -1
  48. data/spec/innate/helper/aspect.rb +6 -6
  49. data/spec/innate/helper/flash.rb +28 -47
  50. data/spec/innate/helper/link.rb +8 -0
  51. data/spec/innate/helper/redirect.rb +58 -43
  52. data/spec/innate/helper/render.rb +133 -0
  53. data/spec/innate/helper/view/aspect_hello.xhtml +1 -0
  54. data/spec/innate/helper/view/locals.xhtml +1 -0
  55. data/spec/innate/helper/view/loop.xhtml +4 -0
  56. data/spec/innate/helper/view/num.xhtml +1 -0
  57. data/spec/innate/helper/view/partial.xhtml +1 -0
  58. data/spec/innate/helper/view/recursive.xhtml +7 -0
  59. data/spec/innate/node/node.rb +5 -13
  60. data/spec/innate/node/view/another_layout/{another_layout.erb → another_layout.xhtml} +1 -1
  61. data/spec/innate/node/view/{bar.erb → bar.xhtml} +0 -0
  62. data/spec/innate/node/view/foo.html.xhtml +1 -0
  63. data/spec/innate/node/view/{only_view.erb → only_view.xhtml} +0 -0
  64. data/spec/innate/node/view/with_layout.xhtml +1 -0
  65. data/spec/innate/provides/list.html.xhtml +1 -0
  66. data/spec/innate/provides/list.txt.xhtml +1 -0
  67. data/spec/innate/provides.rb +2 -2
  68. data/spec/innate/request.rb +0 -9
  69. data/spec/innate/session.rb +14 -15
  70. data/spec/innate/state/fiber.rb +8 -7
  71. data/tasks/bacon.rake +66 -0
  72. data/tasks/changelog.rake +18 -0
  73. data/tasks/gem.rake +22 -0
  74. data/tasks/gem_installer.rake +76 -0
  75. data/tasks/grancher.rake +12 -0
  76. data/tasks/install_dependencies.rake +4 -0
  77. data/tasks/manifest.rake +4 -0
  78. data/tasks/rcov.rake +19 -0
  79. data/tasks/release.rake +51 -0
  80. data/tasks/reversion.rake +8 -0
  81. data/tasks/setup.rake +28 -0
  82. metadata +41 -38
  83. data/lib/innate/core_compatibility/basic_object.rb +0 -10
  84. data/lib/innate/core_compatibility/string.rb +0 -3
  85. data/lib/innate/helper/partial.rb +0 -93
  86. data/spec/innate/action/layout/file_layout.erb +0 -1
  87. data/spec/innate/helper/partial.rb +0 -101
  88. data/spec/innate/helper/view/aspect_hello.erb +0 -1
  89. data/spec/innate/helper/view/locals.erb +0 -1
  90. data/spec/innate/helper/view/loop.erb +0 -4
  91. data/spec/innate/helper/view/num.erb +0 -1
  92. data/spec/innate/helper/view/partial.erb +0 -1
  93. data/spec/innate/helper/view/recursive.erb +0 -8
  94. data/spec/innate/node/view/foo.html.erb +0 -1
  95. data/spec/innate/node/view/with_layout.erb +0 -1
  96. data/spec/innate/provides/list.html.erb +0 -1
  97. data/spec/innate/provides/list.txt.erb +0 -1
@@ -0,0 +1,133 @@
1
+ require 'spec/helper'
2
+
3
+ class SpecHelperRenderFull
4
+ Innate.node '/render_full'
5
+
6
+ def foo
7
+ "foo: %p" % [request.params.sort]
8
+ end
9
+
10
+ def standard
11
+ render_full(r(:foo))
12
+ end
13
+
14
+ def with_query
15
+ render_full(r(:foo), 'a' => 'b')
16
+ end
17
+
18
+ def with_session
19
+ render_full(r(:get_session, :user))
20
+ end
21
+
22
+ def get_session(key)
23
+ session[key].inspect
24
+ end
25
+
26
+ def set_session(key, value)
27
+ session[key] = value
28
+ end
29
+ end
30
+
31
+ class SpecHelperRenderPartial
32
+ Innate.node '/render_partial'
33
+
34
+ layout :layout
35
+
36
+ def standard
37
+ 'hello'
38
+ end
39
+
40
+ def layout
41
+ '{ #{@content} }'
42
+ end
43
+
44
+ def without_layout
45
+ render_partial(:standard)
46
+ end
47
+ end
48
+
49
+ class SpecHelperRenderView
50
+ Innate.node '/render_view'
51
+ map_views '/'
52
+
53
+ layout :layout
54
+
55
+ def standard
56
+ 'hello'
57
+ end
58
+
59
+ def layout
60
+ '{ #{@content} }'
61
+ end
62
+
63
+ def without_method_or_layout
64
+ render_view(:num, :n => 42)
65
+ end
66
+ end
67
+
68
+ class SpecHelperRenderMisc
69
+ Innate.node '/misc'
70
+ map_views '/'
71
+
72
+ def recursive
73
+ @n ||= 1
74
+ end
75
+ end
76
+
77
+ describe Innate::Helper::Render do
78
+ describe '#render_full' do
79
+ behaves_like :mock
80
+
81
+ it 'renders a full action' do
82
+ get('/render_full/standard').body.should == 'foo: []'
83
+ end
84
+
85
+ it 'renders full action with query parameters' do
86
+ get('/render_full/with_query').body.should == 'foo: [["a", "b"]]'
87
+ end
88
+
89
+ # this is an edge-case, we don't have a full session running if this is the
90
+ # first request from the client as Innate creates sessions only on demand
91
+ # at the end of the request/response cycle.
92
+ #
93
+ # So we have to make some request first, in this case we simply set some
94
+ # value in the session that we can get afterwards.
95
+
96
+ it 'renders full action inside a session' do
97
+ get('/render_full/set_session/user/manveru')
98
+ get('/render_full/with_session').body.should == '"manveru"'
99
+ end
100
+ end
101
+
102
+ describe '#render_partial' do
103
+ behaves_like :mock
104
+
105
+ it 'renders action with layout' do
106
+ get('/render_partial/standard').body.should == '{ hello }'
107
+ end
108
+
109
+ it 'renders partial action without layout' do
110
+ get('/render_partial/without_layout').body.should == '{ hello }'
111
+ end
112
+ end
113
+
114
+ describe '#render_view' do
115
+ behaves_like :mock
116
+
117
+ it 'renders action without calling the method or applying layout' do
118
+ get('/render_view/without_method_or_layout').body.should == '{ 42 }'
119
+ end
120
+ end
121
+
122
+ describe 'misc functionality' do
123
+ behaves_like :mock
124
+
125
+ it 'can render_partial in a loop' do
126
+ get('/misc/loop').body.scan(/\d+/).should == %w[1 2 3 4 5]
127
+ end
128
+
129
+ it 'can recursively render_partial' do
130
+ get('/misc/recursive').body.scan(/\S/).join.should == '{1{2{3{44}3}2}1}'
131
+ end
132
+ end
133
+ end
@@ -0,0 +1 @@
1
+ #{@foo} #{@bar}!
@@ -0,0 +1 @@
1
+ #{say}, #{to}!
@@ -0,0 +1,4 @@
1
+ <?r (1..5).each do |n| ?>
2
+ <?r @n = n ?>
3
+ #{ render_partial('num') }
4
+ <?r end ?>
@@ -0,0 +1 @@
1
+ #{@n}
@@ -0,0 +1 @@
1
+ From Partial #{@here}
@@ -0,0 +1,7 @@
1
+ {
2
+ #{@n}
3
+ <?r if @n < 4 ?>
4
+ #{ render_partial(:recursive, :n => @n + 1) }
5
+ <?r end ?>
6
+ #{@n}
7
+ }
@@ -4,8 +4,6 @@ Innate.options.merge!(:views => 'view', :layouts => 'view')
4
4
 
5
5
  class SpecNode
6
6
  Innate.node('/')
7
- provide(:html, :ERB)
8
- provide(:erb, :None)
9
7
 
10
8
  def foo; end
11
9
  def bar; end
@@ -18,24 +16,18 @@ end
18
16
  class SpecNodeProvide
19
17
  Innate.node('/provide')
20
18
 
21
- provide(:html, :ERB)
22
- provide(:erb, :None)
23
-
24
19
  def foo
25
- '<%= 21 * 2 %>'
20
+ '#{21 * 2}'
26
21
  end
27
22
 
28
23
  def bar
29
- '<%= 84 / 2 %>'
24
+ '#{84 / 2}'
30
25
  end
31
26
  end
32
27
 
33
28
  class SpecNodeProvideTemplate
34
29
  Innate.node('/provide_template')
35
30
 
36
- provide :html, :ERB
37
- provide :erb, :None
38
-
39
31
  map_views '/'
40
32
  end
41
33
 
@@ -64,7 +56,7 @@ class SpecNodeWithLayoutMethod < SpecNodeProvide
64
56
  layout 'layout_method'
65
57
 
66
58
  def layout_method
67
- '<div class="content"><%= @content %></div>'
59
+ '<div class="content">#{@content}</div>'
68
60
  end
69
61
  end
70
62
 
@@ -96,14 +88,14 @@ describe 'Innate::Node' do
96
88
  should 'wrap with layout' do
97
89
  got = Innate::Mock.get('/layout/bar')
98
90
  got.status.should == 200
99
- got.body.should == %(<div class="content">42</div>\n)
91
+ got.body.should == %(<div class="content">42</div>)
100
92
  got['Content-Type'].should == 'text/html'
101
93
  end
102
94
 
103
95
  should 'find layout with view_root' do
104
96
  got = Innate::Mock.get('/another_layout/bar')
105
97
  got.status.should == 200
106
- got.body.should == %(<div class="content">\n 42\n</div>\n)
98
+ got.body.should == %(<div class="content">\n 42\n</div>)
107
99
  got['Content-Type'].should == 'text/html'
108
100
  end
109
101
 
@@ -1,3 +1,3 @@
1
1
  <div class="content">
2
- <%= @content %>
2
+ #{@content}
3
3
  </div>
File without changes
@@ -0,0 +1 @@
1
+ <?r 10.times do |n| ?>#{n}<?r end ?>
@@ -0,0 +1 @@
1
+ <div class="content">#{@content}</div>
@@ -0,0 +1 @@
1
+ <ul><?r @users.each do |user| ?><li>#{user}</li><?r end ?></ul>
@@ -0,0 +1 @@
1
+ <?r @users.each do |user| ?>#{"#{user}\n"}<?r end ?>
@@ -12,7 +12,7 @@ Innate.options.merge!(:views => 'provides', :layouts => 'provides')
12
12
  class SpecNodeProvides
13
13
  Innate.node '/'
14
14
 
15
- provide(:html, :None)
15
+ provide(:html, :engine => :None)
16
16
  provide(:yaml, :type => 'text/yaml'){|a,s| s.to_yaml }
17
17
  provide(:json, :type => 'application/json'){|a,s| s.to_json }
18
18
 
@@ -31,7 +31,7 @@ class SpecNodeProvidesTemplates
31
31
 
32
32
  provide(:yaml, :type => 'text/yaml'){|a,s| s.to_yaml }
33
33
  provide(:json, :type => 'application/json'){|a,s| s.to_json }
34
- provide(:txt, :engine => :ERB, :type => 'text/plain')
34
+ provide(:txt, :engine => :Etanni, :type => 'text/plain')
35
35
 
36
36
  def list
37
37
  @users = %w[starbucks apollo athena]
@@ -74,13 +74,4 @@ describe Innate::Request do
74
74
  request('rack.url_scheme' => 'https').domain('/foo', :keep_query => true).
75
75
  should == URI('https://localhost:7000/foo?a=b')
76
76
  end
77
-
78
- should 'provide #accept_language' do
79
- request(@env).accept_language.should == %w[en-us en de-at de]
80
- end
81
-
82
- should 'provide #http_variables' do
83
- r = request(@env).http_variables
84
- r.should.not.be.empty
85
- end
86
77
  end
@@ -29,27 +29,26 @@ class SpecSession
29
29
  end
30
30
 
31
31
  describe Innate::Session do
32
- behaves_like :session
32
+ behaves_like :mock
33
33
 
34
34
  should 'initiate session as needed' do
35
- session do |mock|
36
- response = mock.get('/')
37
- response.body.should == 'No session here'
38
- response['Set-Cookie'].should == nil
35
+ get '/'
36
+ last_response.body.should == 'No session here'
37
+ last_response['Set-Cookie'].should == nil
39
38
 
40
- mock.get('/init').body.should == '0'
39
+ get('/init')
40
+ last_response.body.should == '0'
41
41
 
42
- 1.upto(10) do |n|
43
- mock.get('/increment').body.should == n.to_s
44
- end
42
+ 1.upto(10) do |n|
43
+ get('/increment').body.should == n.to_s
44
+ end
45
45
 
46
- mock.get('/reset')
47
- mock.get('/view').body.should == ''
48
- mock.get('/init').body.should == '0'
46
+ get('/reset')
47
+ get('/view').body.should == ''
48
+ get('/init').body.should == '0'
49
49
 
50
- -1.downto(-10) do |n|
51
- mock.get('/decrement').body.should == n.to_s
52
- end
50
+ -1.downto(-10) do |n|
51
+ get('/decrement').body.should == n.to_s
53
52
  end
54
53
  end
55
54
  end
@@ -1,12 +1,13 @@
1
- begin
2
- require 'fiber'
3
- rescue LoadError
4
- exit
5
- end
6
-
7
1
  require 'spec/helper'
8
2
 
9
- describe Innate::State::Fiber do
3
+ describe 'Innate::State::Fiber' do
4
+ begin
5
+ require 'fiber'
6
+ rescue LoadError
7
+ it('needs fiber'){ should.flunk('needed fiber') }
8
+ exit
9
+ end
10
+
10
11
  F = Innate::State::Fiber
11
12
 
12
13
  it 'sets value in current thread with #[]=' do
data/tasks/bacon.rake ADDED
@@ -0,0 +1,66 @@
1
+ desc 'Run all bacon specs with pretty output'
2
+ task :bacon => :install_dependencies do
3
+ require 'open3'
4
+ require 'scanf'
5
+ require 'matrix'
6
+
7
+ specs = PROJECT_SPECS
8
+
9
+ some_failed = false
10
+ specs_size = specs.size
11
+ len = specs.map{|s| s.size }.sort.last
12
+ total_tests = total_assertions = total_failures = total_errors = 0
13
+ totals = Vector[0, 0, 0, 0]
14
+
15
+ red, yellow, green = "\e[31m%s\e[0m", "\e[33m%s\e[0m", "\e[32m%s\e[0m"
16
+ left_format = "%4d/%d: %-#{len + 11}s"
17
+ spec_format = "%d specifications (%d requirements), %d failures, %d errors"
18
+
19
+ specs.each_with_index do |spec, idx|
20
+ print(left_format % [idx + 1, specs_size, spec])
21
+
22
+ Open3.popen3(RUBY, spec) do |sin, sout, serr|
23
+ out = sout.read.strip
24
+ err = serr.read.strip
25
+
26
+ # this is conventional, see spec/innate/state/fiber.rb for usage
27
+ if out =~ /^Bacon::Error: (needed .*)/
28
+ puts(yellow % ("%6s %s" % ['', $1]))
29
+ else
30
+ total = nil
31
+
32
+ out.each_line do |line|
33
+ scanned = line.scanf(spec_format)
34
+
35
+ next unless scanned.size == 4
36
+
37
+ total = Vector[*scanned]
38
+ break
39
+ end
40
+
41
+ if total
42
+ totals += total
43
+ tests, assertions, failures, errors = total_array = total.to_a
44
+
45
+ if tests > 0 && failures + errors == 0
46
+ puts((green % "%6d passed") % tests)
47
+ else
48
+ some_failed = true
49
+ puts(red % " failed")
50
+ puts out unless out.empty?
51
+ puts err unless err.empty?
52
+ end
53
+ else
54
+ some_failed = true
55
+ puts(red % " failed")
56
+ puts out unless out.empty?
57
+ puts err unless err.empty?
58
+ end
59
+ end
60
+ end
61
+ end
62
+
63
+ total_color = some_failed ? red : green
64
+ puts(total_color % (spec_format % totals.to_a))
65
+ exit 1 if some_failed
66
+ end
@@ -0,0 +1,18 @@
1
+ desc 'update changelog'
2
+ task :changelog do
3
+ File.open('CHANGELOG', 'w+') do |changelog|
4
+ `git log -z --abbrev-commit`.split("\0").each do |commit|
5
+ next if commit =~ /^Merge: \d*/
6
+ ref, author, time, _, title, _, message = commit.split("\n", 7)
7
+ ref = ref[/commit ([0-9a-f]+)/, 1]
8
+ author = author[/Author: (.*)/, 1].strip
9
+ time = Time.parse(time[/Date: (.*)/, 1]).utc
10
+ title.strip!
11
+
12
+ changelog.puts "[#{ref} | #{time}] #{author}"
13
+ changelog.puts '', " * #{title}"
14
+ changelog.puts '', message.rstrip if message
15
+ changelog.puts
16
+ end
17
+ end
18
+ end
data/tasks/gem.rake ADDED
@@ -0,0 +1,22 @@
1
+ require 'rake/gempackagetask'
2
+
3
+ task :gemspec => [:manifest, :changelog] do
4
+ gemspec_file = "#{GEMSPEC.name}.gemspec"
5
+ File.open(gemspec_file, 'w+'){|gs| gs.puts(GEMSPEC.to_ruby) }
6
+ end
7
+
8
+ desc "package and install from gemspec"
9
+ task :install => [:gemspec] do
10
+ sh "gem build #{GEMSPEC.name}.gemspec"
11
+ sh "gem install #{GEMSPEC.name}-#{GEMSPEC.version}.gem"
12
+ end
13
+
14
+ desc "uninstall the gem"
15
+ task :uninstall => [:clean] do
16
+ sh %{gem uninstall -x #{GEMSPEC.name}}
17
+ end
18
+
19
+ Rake::GemPackageTask.new(GEMSPEC) do |p|
20
+ p.need_tar = true
21
+ p.need_zip = true
22
+ end
@@ -0,0 +1,76 @@
1
+ task :gem_installer do
2
+ class GemInstaller
3
+ def initialize(options = {}, &block)
4
+ @gems = []
5
+ @options = options
6
+
7
+ run(&block)
8
+ end
9
+
10
+ def run(&block)
11
+ instance_eval(&block) if block_given?
12
+ end
13
+
14
+ def gem(name, version = nil, options = {})
15
+ if version.respond_to?(:merge!)
16
+ options = version
17
+ else
18
+ options[:version] = version
19
+ end
20
+
21
+ @gems << [name, options]
22
+ end
23
+
24
+ def setup_gemspec(gemspec)
25
+ gemspec.dependencies.each do |dependency|
26
+ dependency.version_requirements.as_list.each do |version|
27
+ gem(dependency.name, version)
28
+ end
29
+ end
30
+
31
+ setup
32
+ end
33
+
34
+ def setup
35
+ require 'rubygems'
36
+ require 'rubygems/dependency_installer'
37
+
38
+ @gems.each do |name, options|
39
+ setup_gem(name, options)
40
+ end
41
+ end
42
+
43
+ def setup_gem(name, options, try_install = true)
44
+ print "activating #{name} ... "
45
+ Gem.activate(name, *[options[:version]].compact)
46
+ require(options[:lib] || name)
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)
52
+ end
53
+
54
+ def install_gem(name, options)
55
+ installer = Gem::DependencyInstaller.new(options)
56
+
57
+ temp_argv(options[:extconf]) do
58
+ print "Installing #{name} ... "
59
+ installer.install(name, options[:version])
60
+ puts "done."
61
+ end
62
+ end
63
+
64
+ def temp_argv(extconf)
65
+ if extconf ||= @options[:extconf]
66
+ old_argv = ARGV.clone
67
+ ARGV.replace(extconf.split(' '))
68
+ end
69
+
70
+ yield
71
+
72
+ ensure
73
+ ARGV.replace(old_argv) if extconf
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,12 @@
1
+ begin
2
+ require 'grancher/task'
3
+
4
+ Grancher::Task.new do |g|
5
+ g.branch = 'gh-pages'
6
+ g.push_to = 'origin'
7
+ g.message = 'Updated website'
8
+ g.directory 'ydoc', 'doc'
9
+ end
10
+ rescue LoadError
11
+ # oh well :)
12
+ end
@@ -0,0 +1,4 @@
1
+ desc 'install dependencies from gemspec'
2
+ task :install_dependencies => [:gem_installer] do
3
+ GemInstaller.new{ setup_gemspec(GEMSPEC) }
4
+ end
@@ -0,0 +1,4 @@
1
+ desc 'update manifest'
2
+ task :manifest do
3
+ File.open('MANIFEST', 'w+'){|io| io.puts(*GEMSPEC.files) }
4
+ end
data/tasks/rcov.rake ADDED
@@ -0,0 +1,19 @@
1
+ desc 'code coverage'
2
+ task :rcov => :clean do
3
+ specs = Dir['spec/innate/**/*.rb']
4
+ specs -= Dir['spec/innate/cache/common.rb']
5
+
6
+ # we ignore adapter as this has extensive specs in rack already.
7
+ ignore = %w[ gem rack bacon innate/adapter\.rb ]
8
+ ignore << 'fiber\.rb' if RUBY_VERSION < '1.9'
9
+
10
+ ignored = ignore.join(',')
11
+
12
+ cmd = "rcov --aggregate coverage.data --sort coverage -t --%s -x '#{ignored}' %s"
13
+
14
+ while spec = specs.shift
15
+ puts '', "Gather coverage for #{spec} ..."
16
+ html = specs.empty? ? 'html' : 'no-html'
17
+ sh(cmd % [html, spec])
18
+ end
19
+ end
@@ -0,0 +1,51 @@
1
+ namespace :release do
2
+ task :all => [:release_github, :release_rubyforge]
3
+
4
+ desc 'Display instructions to release on github'
5
+ task :github => [:reversion, :gemspec] do
6
+ name, version = GEMSPEC.name, GEMSPEC.version
7
+
8
+ puts <<INSTRUCTIONS
9
+ First add the relevant files:
10
+
11
+ git add MANIFEST CHANGELOG #{name}.gemspec lib/#{name}/version.rb
12
+
13
+ Then commit them, tag the commit, and push:
14
+
15
+ git commit -m 'Version #{version}'
16
+ git tag -a -m '#{version}' '#{version}'
17
+ git push
18
+
19
+ INSTRUCTIONS
20
+
21
+ end
22
+
23
+ # TODO: Not tested
24
+ desc 'Display instructions to release on rubyforge'
25
+ task :rubyforge => [:reversion, :gemspec, :package] do
26
+ name, version = GEMSPEC.name, GEMSPEC.version
27
+
28
+ puts <<INSTRUCTIONS
29
+ To publish to rubyforge do following:
30
+
31
+ rubyforge login
32
+ rubyforge add_release #{name} '#{version}' pkg/#{name}-#{version}.gem
33
+
34
+ After you have done these steps, see:
35
+
36
+ rake release:rubyforge_archives
37
+
38
+ INSTRUCTIONS
39
+ end
40
+
41
+ desc 'Display instructions to add archives after release:rubyforge'
42
+ task :rubyforge_archives do
43
+ puts "Adding archives for distro packagers is:", ""
44
+
45
+ Dir["pkg/#{name}-#{version}.{gz,zip}"].each do |file|
46
+ puts "rubyforge add_file #{name} #{name} '#{version}' '#{file}'"
47
+ end
48
+
49
+ puts
50
+ end
51
+ end
@@ -0,0 +1,8 @@
1
+ desc "update version.rb"
2
+ task :reversion do
3
+ File.open("lib/#{GEMSPEC.name}/version.rb", 'w+') do |file|
4
+ file.puts("module #{PROJECT_MODULE}")
5
+ file.puts(' VERSION = %p' % GEMSPEC.version.to_s)
6
+ file.puts('end')
7
+ end
8
+ end
data/tasks/setup.rake ADDED
@@ -0,0 +1,28 @@
1
+ # Currently, Innate is not usable without Rack from the master branch head.
2
+ # Also, our specs now depend on the latest rack-test.
3
+ #
4
+ # In order to make setup simpler for folks, I'll put up some gemspecs on github
5
+ # and use their automatic building to provide development versions of these
6
+ # libraries as gems for easier deployment.
7
+ #
8
+ # Once the libraries are officially released in a usable state I'll switch
9
+ # dependencies to the official ones again.
10
+ #
11
+ # Please note that this makes running in environments that enforce their own
12
+ # Rack (like jruby-rack) still quite difficult, but should allow for easier
13
+ # development.
14
+ #
15
+ # Please be patient.
16
+
17
+ desc 'install dependencies'
18
+ task :setup do
19
+ GemInstaller.new do
20
+ gem 'bacon', '>= 1.0'
21
+ gem 'json', '~> 1.1.3'
22
+
23
+ gem 'manveru-rack-test', '> 0.1.0', :lib => 'rack-test'
24
+ gem 'manveru-rack', '>= 0.9.9', :lib => 'rack'
25
+
26
+ setup
27
+ end
28
+ end