rango 0.1.1.2.10 → 0.1.1.2.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/CHANGELOG +7 -0
  2. data/README.textile +2 -0
  3. data/bin/rango +5 -2
  4. data/lib/rango.rb +47 -78
  5. data/lib/rango/core_ext.rb +21 -0
  6. data/lib/rango/gv/router.rb +42 -0
  7. data/lib/rango/gv/scaffolding.rb +53 -0
  8. data/lib/rango/gv/static.rb +4 -5
  9. data/lib/rango/interactive.rb +18 -0
  10. data/lib/rango/logger.rb +14 -0
  11. data/lib/rango/mini.rb +0 -6
  12. data/lib/rango/mini_render.rb +16 -0
  13. data/lib/rango/mixins/logger.rb +19 -0
  14. data/lib/rango/mixins/message.rb +3 -3
  15. data/lib/rango/mixins/render.rb +5 -5
  16. data/lib/rango/mixins/rendering.rb +13 -13
  17. data/lib/rango/orm/README.textile +24 -0
  18. data/lib/rango/orm/tasks/datamapper.rake +40 -14
  19. data/lib/rango/orm/tasks/sequel.rake +21 -1
  20. data/lib/rango/path.rb +13 -0
  21. data/lib/rango/rack/request.rb +8 -4
  22. data/lib/rango/templates/helpers.rb +84 -86
  23. data/lib/rango/templates/template.rb +50 -53
  24. data/lib/rango/version.rb +1 -1
  25. data/spec/rango/controller_spec.rb +1 -0
  26. data/spec/rango/mixins/message_spec.rb +4 -4
  27. data/spec/rango/mixins/render_spec.rb +4 -4
  28. data/spec/rango/project_spec.rb +2 -0
  29. data/spec/rango/templates/template_spec.rb +18 -18
  30. data/stubs/{project → stack}/content/Gemfile.rbt +0 -0
  31. data/stubs/{project → stack}/content/Rakefile.rbt +0 -0
  32. data/stubs/{project → stack}/content/TODO.txt +0 -0
  33. data/stubs/{project → stack}/content/config.ru.rbt +0 -0
  34. data/stubs/{project → stack}/content/init.rb.rbt +4 -7
  35. data/stubs/{app → stack}/content/models.rb.rbt +0 -0
  36. data/stubs/stack/content/settings_local.rb.rbt +20 -0
  37. data/stubs/{project → stack}/content/spec/%name%/init_spec.rb.rbt +0 -0
  38. data/stubs/{project → stack}/content/spec/%name%/models_spec.rb.rbt +0 -0
  39. data/stubs/{project → stack}/content/spec/%name%/views_spec.rb.rbt +0 -0
  40. data/stubs/{project → stack}/content/spec/spec.opts +0 -0
  41. data/stubs/{project → stack}/content/spec/spec_helper.rb +0 -0
  42. data/stubs/{project → stack}/content/templates/base.html.haml.rbt +0 -0
  43. data/stubs/stack/content/templates/errors/404.html.haml +1 -0
  44. data/stubs/stack/content/templates/errors/500.html.haml +1 -0
  45. data/stubs/{project → stack}/content/templates/index.html.haml +0 -0
  46. data/stubs/{app → stack}/content/views.rb.rbt +13 -0
  47. data/stubs/{app → stack}/metadata.yml +0 -0
  48. data/stubs/{project → stack}/postprocess.rb +0 -0
  49. data/stubs/{project → stack}/setup.rb +0 -0
  50. metadata +82 -43
  51. data/lib/rango/orm/adapter.rb +0 -46
  52. data/lib/rango/orm/adapters/datamapper.rb +0 -26
  53. data/lib/rango/orm/adapters/sequel.rb +0 -18
  54. data/lib/rango/orm/orm.txt +0 -11
  55. data/lib/rango/orm/support/datamapper/support.rb +0 -17
  56. data/stubs/app/content/init.rb.rbt +0 -10
  57. data/stubs/app/setup.rb +0 -13
  58. data/stubs/bigapp/content/init.rb +0 -0
  59. data/stubs/bigapp/content/models/%model%.rb.rbt +0 -6
  60. data/stubs/bigapp/content/views/%controller%.rb.rbt +0 -10
  61. data/stubs/bigapp/content/views/application.rb +0 -0
  62. data/stubs/bigapp/metadata.yml +0 -3
  63. data/stubs/bigapp/setup.rb +0 -12
  64. data/stubs/project/content/settings.rb +0 -13
  65. data/stubs/project/content/settings_local.rb.rbt +0 -6
  66. data/stubs/project/metadata.yml +0 -3
data/lib/rango/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  # NOTE: Do not edit this file manually, this
4
4
  # file is regenerated by task rake version:increase
5
5
  module Rango
6
- VERSION ||= "0.1.1.2.10"
6
+ VERSION ||= "0.1.1.2.11"
7
7
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative "../spec_helper"
4
4
 
5
+ require "rango/logger"
5
6
  require "rango/controller"
6
7
  require "rack/mock"
7
8
 
@@ -18,9 +18,9 @@ describe Rango::MessageMixin do
18
18
  end
19
19
 
20
20
  describe ".included" do
21
- it "should not do anything if method locals isn't defined" do
21
+ it "should not do anything if method context isn't defined" do
22
22
  pending "How to implement it?"
23
- @controller.should_not respond_to(:locals)
23
+ @controller.should_not respond_to(:context)
24
24
  end
25
25
 
26
26
  class ExplicitRenderingController < Rango::Controller
@@ -28,9 +28,9 @@ describe Rango::MessageMixin do
28
28
  include Rango::MessageMixin
29
29
  end
30
30
 
31
- it "should add message to locals if method locals is defined" do
31
+ it "should add message to context if method context is defined" do
32
32
  controller = ExplicitRenderingController.new(@env)
33
- controller.locals.should have_key(:message)
33
+ controller.context.should have_key(:message)
34
34
  end
35
35
  end
36
36
 
@@ -5,7 +5,7 @@ require_relative "../../spec_helper"
5
5
  require "rango/project"
6
6
  require "rango/mixins/render"
7
7
 
8
- Project.settings.template_dirs = [File.join(STUBS_ROOT, "templates")]
8
+ Rango::Template.template_paths = [File.join(STUBS_ROOT, "templates")]
9
9
 
10
10
  describe Rango::RenderMixin do
11
11
  it "should work standalone" do
@@ -24,20 +24,20 @@ describe Rango::RenderMixin do
24
24
  body.should be_kind_of(String)
25
25
  end
26
26
 
27
- it "should take a context as the second argument" do
27
+ it "should take a scope as the second argument" do
28
28
  context = Object.new
29
29
  body = render "context_id.html", context
30
30
  context_id = body.chomp.to_i
31
31
  context_id.should eql(context.object_id)
32
32
  end
33
33
 
34
- it "should take locals as the third argument" do
34
+ it "should take context as the third argument" do
35
35
  context = Object.new
36
36
  body = render "index.html", context, title: "Hi!"
37
37
  body.should match(/Hi\!/)
38
38
  end
39
39
 
40
- it "should take the second arguments as a locals if it's a hash and there is no third argument" do
40
+ it "should take the second arguments as a context if it's a hash and there is no third argument" do
41
41
  body = render "index.html", title: "Hi!"
42
42
  body.should match(/Hi\!/)
43
43
  end
@@ -1,6 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require_relative "../spec_helper"
4
+ require "media-path"
5
+ require "rango/project"
4
6
 
5
7
  describe Project do
6
8
  it "should have root" do
@@ -4,25 +4,25 @@ require_relative "../../spec_helper"
4
4
  require "rango/templates/template"
5
5
  require "rubyexts/string" # TODO: remove this after rubyexts update
6
6
 
7
- Project.settings.template_dirs = [File.join(STUBS_ROOT, "templates")]
7
+ Rango::Template.template_paths = [File.join(STUBS_ROOT, "templates")]
8
8
 
9
- describe Rango::Templates::Template do
9
+ describe Rango::Template do
10
10
  describe "#initialize" do
11
11
  it "should take path as a first argument" do
12
- template = Rango::Templates::Template.new("test.html")
12
+ template = Rango::Template.new("test.html")
13
13
  template.path.should eql("test.html")
14
14
  end
15
15
 
16
- it "should take context as an optional second argument" do
17
- context = Object.new
18
- template = Rango::Templates::Template.new("test.html", context)
19
- template.context.should eql(context)
16
+ it "should take scope as an optional second argument" do
17
+ scope = Object.new
18
+ template = Rango::Template.new("test.html", scope)
19
+ template.scope.should eql(scope)
20
20
  end
21
21
  end
22
22
 
23
23
  describe "#fullpath" do
24
24
  it "should find" do
25
- template = Rango::Templates::Template.new("test.html")
25
+ template = Rango::Template.new("test.html")
26
26
  fullpath = File.join(STUBS_ROOT, "templates", "test.html.haml")
27
27
  template.fullpath.should eql(fullpath)
28
28
  end
@@ -30,51 +30,51 @@ describe Rango::Templates::Template do
30
30
 
31
31
  describe "#render" do
32
32
  it "should raise TemplateNotFound if template can't be found" do
33
- template = Rango::Templates::Template.new("idonotexist.html")
33
+ template = Rango::Template.new("idonotexist.html")
34
34
  -> { template.render }.should raise_error(Rango::Errors::TemplateNotFound)
35
35
  end
36
36
 
37
37
  it "should render" do
38
- template = Rango::Templates::Template.new("test.html")
38
+ template = Rango::Template.new("test.html")
39
39
  template.render.should eql("<html></html>\n")
40
40
  end
41
41
 
42
42
  it "should have template inheritance" do
43
- template = Rango::Templates::Template.new("inheritance/basic/index.html")
43
+ template = Rango::Template.new("inheritance/basic/index.html")
44
44
  end
45
45
 
46
46
  it "should capture haml" do
47
- template = Rango::Templates::Template.new("inheritance/capture/haml/index.html")
47
+ template = Rango::Template.new("inheritance/capture/haml/index.html")
48
48
  template.render
49
49
  template.blocks[:content].should match("Hello!")
50
50
  end
51
51
 
52
52
  it "should capture erubis" do
53
- template = Rango::Templates::Template.new("inheritance/capture/erubis/index.html")
53
+ template = Rango::Template.new("inheritance/capture/erubis/index.html")
54
54
  template.render
55
55
  template.blocks[:content].should match("Hello!")
56
56
  end
57
57
 
58
58
  it "should capture erb" do
59
59
  pending "ERB or ERB adapter in Tilt seems to have problems with capturing"
60
- template = Rango::Templates::Template.new("inheritance/capture/erb/index.html")
60
+ template = Rango::Template.new("inheritance/capture/erb/index.html")
61
61
  template.render
62
62
  template.blocks[:content].should match("Hello!")
63
63
  end
64
64
  end
65
-
65
+
66
66
  describe "variables" do
67
67
  before(:each) do
68
- @template = Rango::Templates::Template.new("variables.html")
68
+ @template = Rango::Template.new("variables.html")
69
69
  end
70
70
 
71
71
  it "should capture erb" do
72
72
  @template.render(title: "Hi!").should match("Hi!")
73
73
  end
74
-
74
+
75
75
  it "should <%= &block %>" do
76
76
  pending "<%= &block %> should works for Erubis"
77
- template = Rango::Templates::Template.new("erubis.html")
77
+ template = Rango::Template.new("erubis.html")
78
78
  puts template.render
79
79
  end
80
80
  end
File without changes
File without changes
File without changes
File without changes
@@ -1,4 +1,8 @@
1
+ <% if defined?(JRUBY_VERSION) %>
2
+ <%= shebang rubypath, ["--1.9", "--disable-gems"] %>
3
+ <% else %>
1
4
  <%= shebang rubypath, ["--disable-gems"] %>
5
+ <% end %>
2
6
  # encoding: utf-8
3
7
 
4
8
  # This file should set Rango environment
@@ -13,7 +17,6 @@ rescue LoadError => exception
13
17
  end
14
18
 
15
19
  # settings
16
- require_relative "settings"
17
20
  require_relative "settings_local"
18
21
 
19
22
  require "rango"
@@ -38,12 +41,6 @@ Rango.boot(environment: environment)
38
41
  # register applications
39
42
  require_relative "<%= @name %>/init.rb"
40
43
 
41
- # database connection
42
- <% case @orm %>
43
- <% when "datamapper" %>
44
- DataMapper.setup(:default, "sqlite3:#{Rango.environment}.db")
45
- <% end %>
46
-
47
44
  # if you will run this script with -i argument, interactive session will begin
48
45
  Rango.interactive if ARGV.delete("-i")
49
46
 
File without changes
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+
3
+ # database connection
4
+ <% case @orm %>
5
+ <% when "sequel" %>
6
+ # http://sequel.rubyforge.org/rdoc/files/doc/opening_databases_rdoc.html
7
+ case Rango.environment
8
+ when "development", "production", "staging"
9
+ DB = Sequel.connect("sqlite://db/#{Rango.environment}.db")
10
+ when "test", "spec", "cucumber"
11
+ DB = Sequel.sqlite # in memory database
12
+ end
13
+ <% when "datamapper" %>
14
+ case Rango.environment
15
+ when "development", "production", "staging"
16
+ DataMapper.setup(:default, "sqlite3:db/#{Rango.environment}.db")
17
+ when "test", "spec", "cucumber"
18
+ DataMapper.setup(:default, "sqlite3::memory:")
19
+ end
20
+ <% end %>
File without changes
@@ -0,0 +1 @@
1
+ = h exception.inspect
@@ -13,6 +13,19 @@ module <%= @name.camel_case %>
13
13
  include Rango::FiltersMixin
14
14
  include Rango::MessageMixin
15
15
  include Rango::ExplicitRendering
16
+
17
+ # http://wiki.github.com/botanicus/rango/errors-handling
18
+ def render_http_error(exception)
19
+ if self.respond_to?(exception.to_snakecase)
20
+ self.send(exception.to_snakecase, exception)
21
+ else
22
+ begin
23
+ render "errors/#{exception.status}.html"
24
+ rescue TemplateNotFound
25
+ render "errors/500.html"
26
+ end
27
+ end
28
+ end
16
29
  end
17
30
 
18
31
  class ShowCase < Application
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rango
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.2.10
4
+ version: 0.1.1.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Jakub \xC5\xA0\xC5\xA5astn\xC3\xBD aka Botanicus"
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
- date: 2009-12-11 00:00:00 +00:00
11
+ date: 2009-12-13 00:00:00 +00:00
12
12
  default_executable: rango
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
16
- type: :runtime
16
+ type: :development
17
17
  version_requirement:
18
18
  version_requirements: !ruby/object:Gem::Requirement
19
19
  requirements:
@@ -23,7 +23,7 @@ dependencies:
23
23
  version:
24
24
  - !ruby/object:Gem::Dependency
25
25
  name: tilt
26
- type: :runtime
26
+ type: :development
27
27
  version_requirement:
28
28
  version_requirements: !ruby/object:Gem::Requirement
29
29
  requirements:
@@ -33,7 +33,7 @@ dependencies:
33
33
  version:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: rubyexts
36
- type: :runtime
36
+ type: :development
37
37
  version_requirement:
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
@@ -43,7 +43,7 @@ dependencies:
43
43
  version:
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: media-path
46
- type: :runtime
46
+ type: :development
47
47
  version_requirement:
48
48
  version_requirements: !ruby/object:Gem::Requirement
49
49
  requirements:
@@ -53,7 +53,7 @@ dependencies:
53
53
  version:
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: simple-templater
56
- type: :runtime
56
+ type: :development
57
57
  version_requirement:
58
58
  version_requirements: !ruby/object:Gem::Requirement
59
59
  requirements:
@@ -63,13 +63,13 @@ dependencies:
63
63
  version:
64
64
  - !ruby/object:Gem::Dependency
65
65
  name: bundler
66
- type: :runtime
66
+ type: :development
67
67
  version_requirement:
68
68
  version_requirements: !ruby/object:Gem::Requirement
69
69
  requirements:
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
- version: "0.7"
72
+ version: "0"
73
73
  version:
74
74
  description: ""
75
75
  email: knava.bestvinensis@gmail.com
@@ -91,32 +91,36 @@ files:
91
91
  - lib/rango/contrib/pagination.rb
92
92
  - lib/rango/contrib/syndication.rb
93
93
  - lib/rango/controller.rb
94
+ - lib/rango/core_ext.rb
94
95
  - lib/rango/environments.rb
95
96
  - lib/rango/exceptions.rb
96
97
  - lib/rango/forms/form.rb
98
+ - lib/rango/gv/router.rb
99
+ - lib/rango/gv/scaffolding.rb
97
100
  - lib/rango/gv/static.rb
98
101
  - lib/rango/gv.rb
99
102
  - lib/rango/helpers/assets.rb
100
103
  - lib/rango/helpers/general.rb
101
104
  - lib/rango/helpers/syntax.rb
102
105
  - lib/rango/helpers.rb
106
+ - lib/rango/interactive.rb
107
+ - lib/rango/logger.rb
103
108
  - lib/rango/loggers/fireruby.rb
104
109
  - lib/rango/mini.rb
110
+ - lib/rango/mini_render.rb
105
111
  - lib/rango/mixins/application.rb
106
112
  - lib/rango/mixins/configurable.rb
107
113
  - lib/rango/mixins/filters.rb
108
114
  - lib/rango/mixins/http_caching.rb
115
+ - lib/rango/mixins/logger.rb
109
116
  - lib/rango/mixins/message.rb
110
117
  - lib/rango/mixins/render.rb
111
118
  - lib/rango/mixins/rendering.rb
112
- - lib/rango/orm/adapter.rb
113
- - lib/rango/orm/adapters/datamapper.rb
114
- - lib/rango/orm/adapters/sequel.rb
115
- - lib/rango/orm/orm.txt
119
+ - lib/rango/orm/README.textile
116
120
  - lib/rango/orm/support/datamapper/fields.rb
117
- - lib/rango/orm/support/datamapper/support.rb
118
121
  - lib/rango/orm/tasks/datamapper.rake
119
122
  - lib/rango/orm/tasks/sequel.rake
123
+ - lib/rango/path.rb
120
124
  - lib/rango/project.rb
121
125
  - lib/rango/rack/middlewares/basic.rb
122
126
  - lib/rango/rack/middlewares/email_obfuscator.rb
@@ -226,17 +230,6 @@ files:
226
230
  - spec/stubs/templates/inheritance/capture/haml/index.html.haml
227
231
  - spec/stubs/templates/test.html.haml
228
232
  - spec/stubs/templates/variables.html.haml
229
- - stubs/app/content/init.rb.rbt
230
- - stubs/app/content/models.rb.rbt
231
- - stubs/app/content/views.rb.rbt
232
- - stubs/app/metadata.yml
233
- - stubs/app/setup.rb
234
- - stubs/bigapp/content/init.rb
235
- - stubs/bigapp/content/models/%model%.rb.rbt
236
- - stubs/bigapp/content/views/%controller%.rb.rbt
237
- - stubs/bigapp/content/views/application.rb
238
- - stubs/bigapp/metadata.yml
239
- - stubs/bigapp/setup.rb
240
233
  - stubs/features/content/env.rb
241
234
  - stubs/features/metadata.yml
242
235
  - stubs/flat/content/flat.ru
@@ -244,23 +237,26 @@ files:
244
237
  - stubs/flat/metadata.yml
245
238
  - stubs/flat/postprocess.rb
246
239
  - stubs/flat/setup.rb
247
- - stubs/project/content/config.ru.rbt
248
- - stubs/project/content/Gemfile.rbt
249
- - stubs/project/content/init.rb.rbt
250
- - stubs/project/content/Rakefile.rbt
251
- - stubs/project/content/settings.rb
252
- - stubs/project/content/settings_local.rb.rbt
253
- - stubs/project/content/spec/%name%/init_spec.rb.rbt
254
- - stubs/project/content/spec/%name%/models_spec.rb.rbt
255
- - stubs/project/content/spec/%name%/views_spec.rb.rbt
256
- - stubs/project/content/spec/spec.opts
257
- - stubs/project/content/spec/spec_helper.rb
258
- - stubs/project/content/templates/base.html.haml.rbt
259
- - stubs/project/content/templates/index.html.haml
260
- - stubs/project/content/TODO.txt
261
- - stubs/project/metadata.yml
262
- - stubs/project/postprocess.rb
263
- - stubs/project/setup.rb
240
+ - stubs/stack/content/config.ru.rbt
241
+ - stubs/stack/content/Gemfile.rbt
242
+ - stubs/stack/content/init.rb.rbt
243
+ - stubs/stack/content/models.rb.rbt
244
+ - stubs/stack/content/Rakefile.rbt
245
+ - stubs/stack/content/settings_local.rb.rbt
246
+ - stubs/stack/content/spec/%name%/init_spec.rb.rbt
247
+ - stubs/stack/content/spec/%name%/models_spec.rb.rbt
248
+ - stubs/stack/content/spec/%name%/views_spec.rb.rbt
249
+ - stubs/stack/content/spec/spec.opts
250
+ - stubs/stack/content/spec/spec_helper.rb
251
+ - stubs/stack/content/templates/base.html.haml.rbt
252
+ - stubs/stack/content/templates/errors/404.html.haml
253
+ - stubs/stack/content/templates/errors/500.html.haml
254
+ - stubs/stack/content/templates/index.html.haml
255
+ - stubs/stack/content/TODO.txt
256
+ - stubs/stack/content/views.rb.rbt
257
+ - stubs/stack/metadata.yml
258
+ - stubs/stack/postprocess.rb
259
+ - stubs/stack/setup.rb
264
260
  - CHANGELOG
265
261
  - CONTRIBUTORS
266
262
  - LICENSE
@@ -271,7 +267,50 @@ has_rdoc: true
271
267
  homepage: http://github.com/botanicus/rango
272
268
  licenses: []
273
269
 
274
- post_install_message:
270
+ post_install_message: |
271
+ = Version 0.0.1 Miracle Born
272
+ * Just basics
273
+
274
+ = Version 0.0.2 MVC Princess
275
+ * static files middleware
276
+ * MVC layer
277
+ * sessions, cookies
278
+ * integrated merb-auth
279
+
280
+ = Version 0.0.3
281
+
282
+ = Version 0.0.4
283
+
284
+ = Version 0.1
285
+ * [FEATURE] environments support
286
+ * [FEATURE] installation without RubyGems
287
+ * [FEATURE] HTTP caching
288
+ * [FEATURE] Hooks for Rendering
289
+ * [SPECS] Integration with RunCodeRun.com
290
+ * [SPECS] All specs passing
291
+ * SimpleTemplater, RubyExts & CLI
292
+ * [FEATURE] Bundler Support
293
+ * [FEATURE] Generic view
294
+ * [FEATURE] Project generator
295
+ * [FEATURE] Rack-mount support
296
+
297
+ = Version 0.1.1
298
+ * Tilt support
299
+ * Removed old merb-helpers
300
+ * Reworked generic views
301
+ * Default attributes for Haml
302
+ * MessagesMixin and FiltersMixin were divided from Rango::Controller
303
+ * Shebang is just ruby rather than ruby1.9, so it plays well with rvm
304
+ * ImplicitRendering and ExplicitRendering mixins for using locals
305
+ vs. rendering in context of current controller instance
306
+
307
+ = Version 0.1.2, 10/12/2009, SHA1
308
+ * Sequel support
309
+ * Project generator renamed to stack generator
310
+ * Removed app and bigapp generators
311
+ * Added migration task for DataMapper
312
+ * Removed layer of ORM adapters
313
+
275
314
  rdoc_options: []
276
315
 
277
316
  require_paths: