rango 0.2 → 0.2.1.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. data/.gitignore +9 -0
  2. data/.gitmodules +3 -0
  3. data/CHANGELOG +5 -0
  4. data/CONTRIBUTORS +1 -0
  5. data/Gemfile +20 -0
  6. data/LICENSE +1 -1
  7. data/README.textile +5 -4
  8. data/benchmarks/ab.rb +6 -0
  9. data/benchmarks/bm/boot.rb +20 -0
  10. data/{spec/rango/version_spec.rb → benchmarks/bm/callbacks.rb} +0 -0
  11. data/benchmarks/bm/request.rb +4 -0
  12. data/benchmarks/bm/routers.rb +22 -0
  13. data/benchmarks/bm/stack.rb +19 -0
  14. data/{spec/stubs/acqs/dir/lib.rb → benchmarks/bm/templates.rb} +0 -0
  15. data/benchmarks/helper.rb +7 -0
  16. data/benchmarks/stubs/merb-app/.gitignore +21 -0
  17. data/benchmarks/stubs/merb-app/Rakefile +35 -0
  18. data/benchmarks/stubs/merb-app/app/controllers/application.rb +4 -0
  19. data/benchmarks/stubs/merb-app/app/controllers/exceptions.rb +15 -0
  20. data/benchmarks/stubs/merb-app/app/helpers/global_helpers.rb +7 -0
  21. data/benchmarks/stubs/merb-app/app/models/user.rb +19 -0
  22. data/benchmarks/stubs/merb-app/app/views/exceptions/not_acceptable.html.erb +63 -0
  23. data/benchmarks/stubs/merb-app/app/views/exceptions/not_found.html.erb +47 -0
  24. data/benchmarks/stubs/merb-app/app/views/layout/application.html.erb +12 -0
  25. data/benchmarks/stubs/merb-app/autotest/discover.rb +4 -0
  26. data/benchmarks/stubs/merb-app/autotest/merb.rb +154 -0
  27. data/benchmarks/stubs/merb-app/autotest/merb_rspec.rb +167 -0
  28. data/benchmarks/stubs/merb-app/config/database.yml +33 -0
  29. data/benchmarks/stubs/merb-app/config/dependencies.rb +36 -0
  30. data/benchmarks/stubs/merb-app/config/environments/development.rb +17 -0
  31. data/benchmarks/stubs/merb-app/config/environments/production.rb +12 -0
  32. data/benchmarks/stubs/merb-app/config/environments/rake.rb +13 -0
  33. data/benchmarks/stubs/merb-app/config/environments/staging.rb +12 -0
  34. data/benchmarks/stubs/merb-app/config/environments/test.rb +14 -0
  35. data/benchmarks/stubs/merb-app/config/init.rb +26 -0
  36. data/benchmarks/stubs/merb-app/config/rack.rb +13 -0
  37. data/benchmarks/stubs/merb-app/config/router.rb +46 -0
  38. data/benchmarks/stubs/merb-app/doc/rdoc/generators/merb_generator.rb +1364 -0
  39. data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/api_grease.js +640 -0
  40. data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/index.html.erb +37 -0
  41. data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/merb.css +252 -0
  42. data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/merb.rb +353 -0
  43. data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/merb_doc_styles.css +492 -0
  44. data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/prototype.js +2515 -0
  45. data/benchmarks/stubs/merb-app/merb/merb-auth/setup.rb +46 -0
  46. data/benchmarks/stubs/merb-app/merb/merb-auth/strategies.rb +13 -0
  47. data/benchmarks/stubs/merb-app/merb/session/session.rb +11 -0
  48. data/benchmarks/stubs/merb-app/public/.htaccess +17 -0
  49. data/benchmarks/stubs/merb-app/public/favicon.ico +0 -0
  50. data/benchmarks/stubs/merb-app/public/images/merb.jpg +0 -0
  51. data/benchmarks/stubs/merb-app/public/javascripts/application.js +1 -0
  52. data/benchmarks/stubs/merb-app/public/javascripts/jquery.js +19 -0
  53. data/benchmarks/stubs/merb-app/public/merb.fcgi +22 -0
  54. data/benchmarks/stubs/merb-app/public/robots.txt +5 -0
  55. data/benchmarks/stubs/merb-app/public/stylesheets/master.css +119 -0
  56. data/{spec/stubs/acqs/dir/lib_spec.rb → benchmarks/stubs/merb-app/spec/spec.opts} +0 -0
  57. data/benchmarks/stubs/merb-app/spec/spec_helper.rb +27 -0
  58. data/benchmarks/stubs/merb-app/tasks/doc.thor +151 -0
  59. data/benchmarks/stubs/merb-app/tasks/merb.thor/app_script.rb +33 -0
  60. data/benchmarks/stubs/merb-app/tasks/merb.thor/common.rb +70 -0
  61. data/benchmarks/stubs/merb-app/tasks/merb.thor/gem_ext.rb +127 -0
  62. data/benchmarks/stubs/merb-app/tasks/merb.thor/main.thor +152 -0
  63. data/benchmarks/stubs/merb-app/tasks/merb.thor/ops.rb +95 -0
  64. data/benchmarks/stubs/merb-app/tasks/merb.thor/utils.rb +42 -0
  65. data/benchmarks/stubs/merb-core/.gitignore +21 -0
  66. data/benchmarks/stubs/merb-core/Rakefile +35 -0
  67. data/benchmarks/stubs/merb-core/app/controllers/application.rb +4 -0
  68. data/benchmarks/stubs/merb-core/app/controllers/exceptions.rb +15 -0
  69. data/benchmarks/stubs/merb-core/app/helpers/global_helpers.rb +7 -0
  70. data/benchmarks/stubs/merb-core/app/views/exceptions/not_acceptable.html.erb +63 -0
  71. data/benchmarks/stubs/merb-core/app/views/exceptions/not_found.html.erb +47 -0
  72. data/benchmarks/stubs/merb-core/app/views/layout/application.html.erb +12 -0
  73. data/benchmarks/stubs/merb-core/autotest/discover.rb +1 -0
  74. data/benchmarks/stubs/merb-core/autotest/merb.rb +151 -0
  75. data/benchmarks/stubs/merb-core/autotest/merb_rspec.rb +167 -0
  76. data/benchmarks/stubs/merb-core/config/environments/development.rb +17 -0
  77. data/benchmarks/stubs/merb-core/config/environments/production.rb +12 -0
  78. data/benchmarks/stubs/merb-core/config/environments/rake.rb +13 -0
  79. data/benchmarks/stubs/merb-core/config/environments/staging.rb +12 -0
  80. data/benchmarks/stubs/merb-core/config/environments/test.rb +14 -0
  81. data/benchmarks/stubs/merb-core/config/init.rb +27 -0
  82. data/benchmarks/stubs/merb-core/config/rack.rb +13 -0
  83. data/benchmarks/stubs/merb-core/config/router.rb +43 -0
  84. data/benchmarks/stubs/merb-core/doc/rdoc/generators/merb_generator.rb +1364 -0
  85. data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/api_grease.js +640 -0
  86. data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/index.html.erb +37 -0
  87. data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/merb.css +252 -0
  88. data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/merb.rb +353 -0
  89. data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/merb_doc_styles.css +492 -0
  90. data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/prototype.js +2515 -0
  91. data/benchmarks/stubs/merb-core/public/.htaccess +17 -0
  92. data/benchmarks/stubs/merb-core/public/favicon.ico +0 -0
  93. data/benchmarks/stubs/merb-core/public/images/merb.jpg +0 -0
  94. data/benchmarks/stubs/merb-core/public/javascripts/application.js +1 -0
  95. data/benchmarks/stubs/merb-core/public/merb.fcgi +22 -0
  96. data/benchmarks/stubs/merb-core/public/robots.txt +5 -0
  97. data/benchmarks/stubs/merb-core/public/stylesheets/master.css +119 -0
  98. data/{spec/stubs/acqs/lib.rb → benchmarks/stubs/merb-core/spec/spec.opts} +0 -0
  99. data/benchmarks/stubs/merb-core/spec/spec_helper.rb +22 -0
  100. data/benchmarks/stubs/merb-core/tasks/merb.thor/app_script.rb +33 -0
  101. data/benchmarks/stubs/merb-core/tasks/merb.thor/common.rb +70 -0
  102. data/benchmarks/stubs/merb-core/tasks/merb.thor/gem_ext.rb +127 -0
  103. data/benchmarks/stubs/merb-core/tasks/merb.thor/main.thor +152 -0
  104. data/benchmarks/stubs/merb-core/tasks/merb.thor/ops.rb +95 -0
  105. data/benchmarks/stubs/merb-core/tasks/merb.thor/utils.rb +42 -0
  106. data/benchmarks/stubs/merb-flat/.gitignore +21 -0
  107. data/benchmarks/stubs/merb-flat/README.txt +10 -0
  108. data/benchmarks/stubs/merb-flat/Rakefile +35 -0
  109. data/benchmarks/stubs/merb-flat/application.rb +17 -0
  110. data/benchmarks/stubs/merb-flat/config/framework.rb +9 -0
  111. data/benchmarks/stubs/merb-flat/config/init.rb +42 -0
  112. data/benchmarks/stubs/merb-flat/spec/spec_helper.rb +26 -0
  113. data/benchmarks/stubs/merb-flat/tasks/merb.thor/app_script.rb +33 -0
  114. data/benchmarks/stubs/merb-flat/tasks/merb.thor/common.rb +70 -0
  115. data/benchmarks/stubs/merb-flat/tasks/merb.thor/gem_ext.rb +127 -0
  116. data/benchmarks/stubs/merb-flat/tasks/merb.thor/main.thor +152 -0
  117. data/benchmarks/stubs/merb-flat/tasks/merb.thor/ops.rb +95 -0
  118. data/benchmarks/stubs/merb-flat/tasks/merb.thor/utils.rb +42 -0
  119. data/benchmarks/stubs/merb-flat/views/foo.html.erb +3 -0
  120. data/benchmarks/stubs/merb-very-flat/.gitignore +21 -0
  121. data/benchmarks/stubs/merb-very-flat/Rakefile +35 -0
  122. data/benchmarks/stubs/merb-very-flat/merb-very-flat.rb +61 -0
  123. data/benchmarks/stubs/merb-very-flat/spec/spec_helper.rb +26 -0
  124. data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/app_script.rb +33 -0
  125. data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/common.rb +70 -0
  126. data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/gem_ext.rb +127 -0
  127. data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/main.thor +152 -0
  128. data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/ops.rb +95 -0
  129. data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/utils.rb +42 -0
  130. data/benchmarks/stubs/rails/README +243 -0
  131. data/benchmarks/stubs/rails/Rakefile +10 -0
  132. data/benchmarks/stubs/rails/app/controllers/application_controller.rb +12 -0
  133. data/benchmarks/stubs/rails/app/helpers/application_helper.rb +5 -0
  134. data/benchmarks/stubs/rails/config/boot.rb +112 -0
  135. data/benchmarks/stubs/rails/config/database.yml +22 -0
  136. data/benchmarks/stubs/rails/config/environment.rb +43 -0
  137. data/benchmarks/stubs/rails/config/environments/development.rb +19 -0
  138. data/benchmarks/stubs/rails/config/environments/production.rb +30 -0
  139. data/benchmarks/stubs/rails/config/environments/test.rb +30 -0
  140. data/benchmarks/stubs/rails/config/initializers/backtrace_silencers.rb +9 -0
  141. data/benchmarks/stubs/rails/config/initializers/inflections.rb +12 -0
  142. data/benchmarks/stubs/rails/config/initializers/mime_types.rb +7 -0
  143. data/benchmarks/stubs/rails/config/initializers/new_rails_defaults.rb +21 -0
  144. data/benchmarks/stubs/rails/config/initializers/session_store.rb +17 -0
  145. data/benchmarks/stubs/rails/config/locales/en.yml +5 -0
  146. data/benchmarks/stubs/rails/config/routes.rb +45 -0
  147. data/benchmarks/stubs/rails/doc/README_FOR_APP +2 -0
  148. data/{spec/stubs/acqs/tasks.thor → benchmarks/stubs/rails/log/development.log} +0 -0
  149. data/{stubs/stack/content/TODO.txt → benchmarks/stubs/rails/log/production.log} +0 -0
  150. data/benchmarks/stubs/rails/log/server.log +0 -0
  151. data/benchmarks/stubs/rails/log/test.log +0 -0
  152. data/benchmarks/stubs/rails/public/404.html +30 -0
  153. data/benchmarks/stubs/rails/public/422.html +30 -0
  154. data/benchmarks/stubs/rails/public/500.html +30 -0
  155. data/benchmarks/stubs/rails/public/favicon.ico +0 -0
  156. data/benchmarks/stubs/rails/public/images/rails.png +0 -0
  157. data/benchmarks/stubs/rails/public/index.html +275 -0
  158. data/benchmarks/stubs/rails/public/javascripts/application.js +2 -0
  159. data/benchmarks/stubs/rails/public/javascripts/controls.js +963 -0
  160. data/benchmarks/stubs/rails/public/javascripts/dragdrop.js +973 -0
  161. data/benchmarks/stubs/rails/public/javascripts/effects.js +1128 -0
  162. data/benchmarks/stubs/rails/public/javascripts/prototype.js +4320 -0
  163. data/benchmarks/stubs/rails/public/robots.txt +5 -0
  164. data/benchmarks/stubs/rails/script/about +4 -0
  165. data/benchmarks/stubs/rails/script/console +3 -0
  166. data/benchmarks/stubs/rails/script/dbconsole +3 -0
  167. data/benchmarks/stubs/rails/script/destroy +3 -0
  168. data/benchmarks/stubs/rails/script/generate +3 -0
  169. data/benchmarks/stubs/rails/script/performance/benchmarker +3 -0
  170. data/benchmarks/stubs/rails/script/performance/profiler +3 -0
  171. data/benchmarks/stubs/rails/script/plugin +3 -0
  172. data/benchmarks/stubs/rails/script/runner +3 -0
  173. data/benchmarks/stubs/rails/script/server +3 -0
  174. data/benchmarks/stubs/rails/test/performance/browsing_test.rb +11 -0
  175. data/benchmarks/stubs/rails/test/test_helper.rb +40 -0
  176. data/benchmarks/stubs/ramaze.rb +0 -0
  177. data/benchmarks/stubs/sinatra.rb +11 -0
  178. data/bin/rango +2 -2
  179. data/deps.rip +7 -0
  180. data/deps.rip.rbe +7 -0
  181. data/gems/cache/abstract-1.0.0.gem +0 -0
  182. data/gems/cache/code-cleaner-0.1.gem +0 -0
  183. data/gems/cache/code-cleaner-0.2.gem +0 -0
  184. data/gems/cache/code-cleaner-0.3.gem +0 -0
  185. data/gems/cache/code-cleaner-0.4.gem +0 -0
  186. data/gems/cache/code-cleaner-0.5.gem +0 -0
  187. data/gems/cache/code-cleaner-0.6.gem +0 -0
  188. data/gems/cache/code-cleaner-0.7.gem +0 -0
  189. data/gems/cache/code-cleaner-0.8.1.gem +0 -0
  190. data/gems/cache/code-cleaner-0.8.gem +0 -0
  191. data/gems/cache/erubis-2.6.5.gem +0 -0
  192. data/gems/cache/extlib-0.9.14.gem +0 -0
  193. data/gems/cache/haml-2.2.16.gem +0 -0
  194. data/gems/cache/haml-2.2.17.gem +0 -0
  195. data/gems/cache/nake-0.0.2.gem +0 -0
  196. data/gems/cache/nake-0.0.3.gem +0 -0
  197. data/gems/cache/nake-0.0.5.gem +0 -0
  198. data/gems/cache/nake-0.0.6.gem +0 -0
  199. data/gems/cache/nake-0.0.8.gem +0 -0
  200. data/gems/cache/rack-1.0.1.gem +0 -0
  201. data/gems/cache/rack-1.1.0.gem +0 -0
  202. data/gems/cache/rspec-1.2.9.gem +0 -0
  203. data/gems/cache/rspec-1.3.0.gem +0 -0
  204. data/gems/cache/term-ansicolor-1.0.4.gem +0 -0
  205. data/gems/cache/tilt-0.4.gem +0 -0
  206. data/gems/cache/tilt-0.5.gem +0 -0
  207. data/lib/rango.rb +28 -28
  208. data/lib/rango/cli.rb +34 -0
  209. data/lib/rango/contrib/pagination/adapters/datamapper.rb +21 -17
  210. data/lib/rango/controller.rb +36 -4
  211. data/lib/rango/environments.rb +1 -15
  212. data/lib/rango/exceptions.rb +144 -86
  213. data/lib/rango/helpers.rb +10 -2
  214. data/lib/rango/mailer.rb +48 -0
  215. data/lib/rango/mixins/action_args.rb +5 -7
  216. data/lib/rango/mixins/filters.rb +18 -14
  217. data/lib/rango/mixins/message.rb +30 -24
  218. data/lib/rango/mixins/rendering.rb +54 -0
  219. data/lib/rango/orm/tasks/datamapper.nake +81 -0
  220. data/lib/rango/orm/tasks/sequel.nake +43 -0
  221. data/lib/rango/router/adapters/usher.rb +2 -1
  222. data/lib/rango/stacks/controller.rb +12 -0
  223. data/lib/rango/tasks/spec.nake +9 -0
  224. data/lib/rango/templates/exts/haml.rb +1 -1
  225. data/lib/rango/templates/exts/tilt.rb +10 -0
  226. data/lib/rango/templates/helpers.rb +29 -25
  227. data/lib/rango/templates/template.rb +7 -6
  228. data/rango.gemspec +52 -0
  229. data/rango.pre.gemspec +8 -0
  230. data/spec/rango/environments_spec.rb +1 -1
  231. data/spec/rango/exceptions_spec.rb +8 -7
  232. data/spec/rango/mixins/render_spec.rb +1 -1
  233. data/spec/rango/templates/template_spec.rb +1 -1
  234. data/stubs/stack/content/%name%.gemspec.rbt +52 -0
  235. data/stubs/stack/content/%name%.pre.gemspec.rbt +8 -0
  236. data/stubs/stack/content/CHANGELOG +0 -0
  237. data/stubs/stack/content/Gemfile.rbt +22 -11
  238. data/stubs/stack/content/README.textile.rbt +7 -0
  239. data/stubs/stack/content/config.ru.rbt +33 -62
  240. data/stubs/stack/content/deps.rip +0 -0
  241. data/stubs/stack/content/init.rb.rbt +14 -39
  242. data/stubs/stack/content/lib/%name%.rb.rbt +8 -0
  243. data/stubs/stack/content/lib/%name%/config.rb.rbt +0 -0
  244. data/stubs/stack/content/{environments.rb.rbt → lib/%name%/environments/development.rb.rbt} +5 -0
  245. data/stubs/stack/content/lib/%name%/environments/production.rb.rbt +0 -0
  246. data/stubs/stack/content/lib/%name%/environments/stagging.rb.rbt +0 -0
  247. data/stubs/stack/content/lib/%name%/initializers/middlewares.rb.rbt +5 -0
  248. data/stubs/stack/content/lib/%name%/initializers/urls.rb.rbt +24 -0
  249. data/stubs/stack/content/{models.rb.rbt → lib/%name%/models.rb.rbt} +7 -0
  250. data/stubs/stack/content/{views.rb.rbt → lib/%name%/views.rb.rbt} +2 -8
  251. data/stubs/stack/content/rackup.rb.rbt +41 -0
  252. data/stubs/stack/content/tasks.rb.rbt +52 -0
  253. data/stubs/stack/setup.rb +7 -1
  254. data/support/hooks/pre-commit +12 -0
  255. data/tasks.rb +49 -0
  256. metadata +250 -54
  257. data/Rakefile +0 -33
  258. data/lib/rango/rack/middlewares/email_obfuscator.rb +0 -25
  259. data/lib/rango/version.rb +0 -7
  260. data/stubs/stack/content/.rvmrc.rbt +0 -2
  261. data/stubs/stack/content/Rakefile.rbt +0 -12
data/rango.pre.gemspec ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env gem build
2
+ # encoding: utf-8
3
+
4
+ # You might think this is a terrible mess and guess what, you're
5
+ # right mate! However say thanks to authors of RubyGems, not me.
6
+ eval(File.read("rango.gemspec")).tap do |specification|
7
+ specification.version = "#{specification.version}.pre"
8
+ end
@@ -23,7 +23,7 @@ describe "Rango environments" do
23
23
  end
24
24
 
25
25
  describe ".production?" do
26
- %w{production stage}.each do |environment|
26
+ %w{production stagging}.each do |environment|
27
27
  it "should be true if Rango.environment is '#{environment}'" do
28
28
  Rango.environment = environment
29
29
  Rango.should be_production
@@ -1,19 +1,20 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require_relative "../spec_helper"
4
+ require "rango/exceptions"
4
5
 
5
- describe Rango::HttpError do
6
+ describe Rango::Exceptions do
6
7
  before(:each) do
7
- @error = Rango::NotFound.new("Post with given ID doesn't exist")
8
+ @error = Rango::Exceptions::NotFound.new("Post with given ID doesn't exist")
8
9
  end
9
10
 
10
11
  describe "constants" do
11
12
  it "should has CONTENT_TYPE" do
12
- Rango::HttpError.constants.should include(:CONTENT_TYPE)
13
+ Rango::Exceptions::HttpError.constants.should include(:CONTENT_TYPE)
13
14
  end
14
-
15
+
15
16
  it "should xxxxxxxxx" do
16
- @class = Class.new(Rango::HttpError)
17
+ @class = Class.new(Rango::Exceptions::HttpError)
17
18
  -> { @class::STATUS }.should raise_error(NameError, /has to have defined constant STATUS/)
18
19
  end
19
20
  end
@@ -51,8 +52,8 @@ describe Rango::HttpError do
51
52
  @error.to_snakecase.should eql("not_found")
52
53
  end
53
54
  end
54
-
55
- describe "#to_reponse" do
55
+
56
+ describe "#to_response" do
56
57
  before(:each) do
57
58
  @status, @headers, @body = @error.to_response
58
59
  end
@@ -42,7 +42,7 @@ describe Rango::RenderMixin do
42
42
  end
43
43
 
44
44
  it "should raise TemplateNotFound if template wasn't found" do
45
- -> { render "idonotexist.html" }.should raise_error(Rango::Errors::TemplateNotFound)
45
+ -> { render "idonotexist.html" }.should raise_error(Rango::Exceptions::TemplateNotFound)
46
46
  end
47
47
  end
48
48
  end
@@ -30,7 +30,7 @@ describe Rango::Template do
30
30
  describe "#render" do
31
31
  it "should raise TemplateNotFound if template can't be found" do
32
32
  template = Rango::Template.new("idonotexist.html")
33
- -> { template.render }.should raise_error(Rango::Errors::TemplateNotFound)
33
+ -> { template.render }.should raise_error(Rango::Exceptions::TemplateNotFound)
34
34
  end
35
35
 
36
36
  it "should render" do
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env gem build
2
+ # encoding: utf-8
3
+
4
+ require "base64"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "<%= @name %>"
8
+ spec.version = "0.0.1"
9
+ spec.authors = ["<%= @full_name %>"]
10
+ spec.homepage = "http://github.com/<%= @gh_user %>/<%= @name %>"
11
+ spec.summary = ""
12
+ spec.description = "" # TODO: long description
13
+ spec.cert_chain = nil
14
+ spec.email = "TODO"
15
+ spec.has_rdoc = true
16
+
17
+ # files
18
+ spec.files = `git ls-files`.split("\n")
19
+ spec.require_paths = ["lib"]
20
+
21
+ # Ruby version
22
+ # NOTE: if you are using JRuby, you have to run jruby --1.9 -S gem install <%= @name %>
23
+ spec.required_ruby_version = ::Gem::Requirement.new("~> 1.9")
24
+
25
+ # dependencies
26
+ spec.add_dependency "rango", ">= 0.3"
27
+ spec.add_dependency "pancake"
28
+ spec.add_dependency "usher"
29
+ spec.add_dependency "tilt"
30
+ spec.add_dependency "haml"
31
+
32
+ # RubyGems has runtime dependencies (add_dependency) and
33
+ # development dependencies (add_development_dependency)
34
+ # Rango isn't a monolithic framework, so you might want
35
+ # to use just one specific part of it, so it has no sense
36
+ # to specify dependencies for the whole gem. If you want
37
+ # to install everything what you need for start with Rango,
38
+ # just run gem install rango --development
39
+
40
+ spec.add_development_dependency "bundler"
41
+
42
+ begin
43
+ require "changelog"
44
+ rescue LoadError
45
+ warn "You have to have changelog gem installed for post install message"
46
+ else
47
+ spec.post_install_message = CHANGELOG.new.version_changes
48
+ end
49
+
50
+ # RubyForge
51
+ spec.rubyforge_project = "<%= @name %>"
52
+ end
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env gem build
2
+ # encoding: utf-8
3
+
4
+ # You might think this is a terrible mess and guess what, you're
5
+ # right mate! However say thanks to authors of RubyGems, not me.
6
+ eval(File.read("<%= @name %>.gemspec")).tap do |specification|
7
+ specification.version = "#{specification.version}.pre"
8
+ end
File without changes
@@ -16,12 +16,19 @@
16
16
  gem "rango"#, git: "git://github.com/botanicus/rango.git"
17
17
  gem "rack"#, git: "git://github.com/rack/rack.git"
18
18
  gem "tilt"#, git: "git://github.com/rtomayko/tilt.git"
19
- <% if RUBY_VERSION < "1.9.2" %>
20
- # This is for Method#parameters which is used in action args mixin
21
- # However it doesn't work for me, I'm getting segmentation fault
22
- #gem "methopara"#, git: "git://github.com/genki/methopara.git"
19
+
20
+ gem "nake"#, git: "git://github.com/botanicus/nake.git"
21
+ <% if @code_cleaner %>
22
+ gem "code-cleaner"#, git: "git://github.com/botanicus/code-cleaner.git"
23
+ <% end %>
24
+ <% if @git_deployer %>
25
+ gem "git-deployer"#, git: "git://github.com/botanicus/git-deployer.git"
23
26
  <% end %>
24
27
 
28
+ gem "helpers"#, git: "git://github.com/botanicus/helpers.git"
29
+ # rack middlewares
30
+ gem "multigiri"#, git: "git://github.com/botanicus/multigiri.git"
31
+
25
32
  # router
26
33
  <% case @router %>
27
34
  <% when "usher" %>
@@ -50,10 +57,18 @@ gem "dm-aggregates"#, git: "git://github.com/datamapper/dm-more.git" # for count
50
57
  <% when "sequel" %>
51
58
  gem "sequel"#, git: "git://github.com/jeremyevans/sequel.git"
52
59
 
60
+ <% when "mongomapper" %>
61
+ gem "mongo_mapper"#, git: "git://github.com/jnunemaker/mongomapper.git"
62
+
53
63
  <% end %>
54
- gem "thin", require_as: nil#, git: "git://github.com/macournoyer/thin.git" # there seems to be some problems with latest thin
55
- #gem "unicorn", require_as: nil#, git: "git://repo.or.cz/unicorn.git"
56
- gem "racksh", require_as: nil#, git: "git://github.com/sickill/racksh.git"
64
+ # NOTE: do not use require_as: nil because if you do so, bundler will require the library anyway
65
+ # Check last section of http://wiki.github.com/merb/merb/howto-using-the-bundler for more informations
66
+ only(:bundle) do
67
+ gem "thin"#, git: "git://github.com/macournoyer/thin.git" # there seems to be some problems with latest thin
68
+ #gem "unicorn"#, git: "git://repo.or.cz/unicorn.git"
69
+ gem "racksh"#, git: "git://github.com/sickill/racksh.git"
70
+ gem "shotgun"#, git: "git://github.com/rtomayko/shotgun.git"
71
+ end
57
72
  <% if @warden %>
58
73
  gem "warden"
59
74
  <% end %>
@@ -62,10 +77,6 @@ gem "simple-logger"#, git: "git://github.com/botanicus/simple-logger.git"
62
77
  gem "media-path"#, git: "git://github.com/botanicus/media-path.git" # for asset helpers
63
78
 
64
79
  # === Environment-Specific Setup === #
65
- only(:development) do
66
- gem "shotgun", require_as: nil#, git: "git://github.com/rtomayko/shotgun.git"
67
- end
68
-
69
80
  except(:stage, :production) do
70
81
  <% case @orm %>
71
82
  <% when "datamapper" %>
@@ -0,0 +1,7 @@
1
+ h1. About
2
+
3
+ h1. Setup
4
+
5
+ h1. Links
6
+
7
+ * "Source Code":http://github.com/<%= @gh_user %>/<%= @name %>
@@ -1,65 +1,36 @@
1
- <%= shebang "./init.rb", %w[-p 4000 -s thin] %>
1
+ <%= shebang "./bin/shotgun", %w[-p 4000 -s thin] %>
2
2
  # encoding: utf-8
3
3
 
4
- require "rango/rack/middlewares/basic"
5
-
6
- # Load init.rb even if config.ru is just loaded
7
- # This comes handy in Passenger etc, but it's still
8
- # useful to have config.ru as an executable, because
9
- # it's easy to have default arguments for bin/rackup
10
- require_relative "init.rb" unless $0.eql?(__FILE__)
11
- <% if @warden %>
12
-
13
- # warden authentication
14
- # wiki.github.com/hassox/warden/setup
15
- require "warden"
16
-
17
- use Warden::Manager do |manager|
18
- manager.default_strategies :password
19
- # Rango::Controller has class method call which will call Rango::Controller.reroute(action),
20
- # for example Login.route_to(:login) which will set login action of Login controller as default
21
- # Internally it just rewrites env["rango.controller"] and env["rango.action"] to "Login", resp. "login"
22
- manager.failure_app = Login
4
+ # Shebang:
5
+ # - bin/shotgun
6
+ # - bin/rackup
7
+
8
+ # Try to keep this file as small as possible.
9
+ # You should put here rack-specific stuff which means mainly
10
+ # middleware initialization (Rack::Builder#use) and setting
11
+ # rack endpoint (Rack::Builder#run). Middleware setup should be placed into rackup.rb
12
+
13
+ # In fact
14
+ # - It's a stupid idea to evaluate the whole file in context of a Rack::Builder instance
15
+ # - You can't use __END__ in config.ru because of the eval
16
+ # - File vs. Rack::File
17
+
18
+ unless __FILE__.eql?("(eval)")
19
+ require "init.rb"
20
+ require "rackup.rb"
21
+ else
22
+ puts "~ Running config.ru #{self.inspect}"
23
+ use Rango::Middlewares::Basic
24
+
25
+ # <% if @warden %>
26
+ # use Warden::Manager do |manager|
27
+ # manager.default_strategies :password
28
+ # # Rango::Controller has class method call which will call Rango::Controller.reroute(action),
29
+ # # for example Login.route_to(:login) which will set login action of Login controller as default
30
+ # # Internally it just rewrites env["rango.controller"] and env["rango.action"] to "Login", resp. "login"
31
+ # manager.failure_app = Login
32
+ # end
33
+ #
34
+ # <% end %>
35
+ run lambda { |env| [200, Hash.new, ["hey"]] }
23
36
  end
24
-
25
- # See also wiki.github.com/hassox/warden/callbacks
26
- Warden::Manager.serialize_into_session { |user| user.id }
27
- Warden::Manager.serialize_from_session { |key| User.get(id) }
28
-
29
- # Go to login
30
- Warden::Manager.before_failure do |env, opts|
31
- Login.route_to env, "login"
32
- end
33
-
34
- Warden::Strategies.add(:password) do
35
- def authenticate!
36
- User.new # TODO
37
- end
38
- end
39
- <% end %>
40
-
41
- # http://wiki.github.com/botanicus/rango/routers
42
- Rango::Router.use(:<%= @router.to_sym %>)
43
-
44
- <% case @router %>
45
- <% when "usher" %>
46
- # http://github.com/joshbuddy/usher
47
- Rango::Router.app = Usher::Interface.for(:rack) do
48
- get("/").to(<%= @name.camel_case %>::ShowCase.dispatcher(:index)).name(:showcase)
49
- end
50
- <% when "rack-mount" %>
51
- # http://github.com/josh/rack-mount
52
- Rango::Router.app = Rack::Mount::RouteSet.new do |set|
53
- # add_route takes a rack application and conditions to match with
54
- # conditions may be strings or regexps
55
- # See Rack::Mount::RouteSet#add_route for more options.
56
- set.add_route <%= @name.camel_case %>::ShowCase.dispatcher(:index), method: "get", path: "/"
57
- end
58
- <% when "rack-router" %>
59
- # TODO: routes
60
- <% when "urlmap" %>
61
- # TODO: routes
62
- <% end %>
63
-
64
- use Rango::Middlewares::Basic
65
- run Rango::Router.app
File without changes
@@ -1,4 +1,4 @@
1
- <% if defined?(JRUBY_VERSION) %>
1
+ <% if RUBY_PLATFORM.eql?("java") %>
2
2
  <%= shebang rubypath, ["--1.9", "--disable-gems"] %>
3
3
  <% else %>
4
4
  <%= shebang rubypath, ["--disable-gems"] %>
@@ -20,44 +20,19 @@ rescue LoadError => exception
20
20
  abort "LoadError during loading gems/environment: #{exception.message}\nRun gem bundle to fix it."
21
21
  end
22
22
 
23
- require "rango/stacks/controller"
23
+ require "rango"
24
24
 
25
- # http://wiki.github.com/botanicus/rango/environments-support
26
- require "rango/environments"
25
+ # we need to load dependencies before boot, so bootloaders will be called
26
+ Rango.logger.info("Loading dependencies for #{Rango.environment}")
27
+ Bundler.require_env(Rango.environment)
28
+ Rango.boot
27
29
 
28
- environment = (RACK_ENV if defined?(RACK_ENV)) || ENV["RACK_ENV"] || "development"
29
- ENV["RACK_ENV"] = (RACK_ENV ||= environment)
30
- unless %w[test development stage production].include?(environment)
31
- abort "Unknown environment: #{environment}"
32
- end
30
+ $LOAD_PATH.unshift(File.expand_path("../lib", __FILE__))
33
31
 
34
- # we need to load dependencies before boot, so bootloaders will be called
35
- Rango.logger.info("Loading dependencies for #{environment}")
36
- Bundler.require_env(environment)
37
-
38
- Rango.boot(environment: environment)
39
-
40
- # environment-specific settings
41
- require_relative "environments"
42
-
43
- # register applications
44
- require_relative "views.rb"
45
- require_relative "models.rb"
46
-
47
- # if you will run this script with -i argument, interactive session will begin
48
- Rango.interactive if ARGV.delete("-i")
49
-
50
- # so it can work as a runner
51
- # ./init.rb: start webserver
52
- if ARGV.length > 0 && $0.eql?(__FILE__)
53
- # config.ru
54
- if ARGV.last.split(".").last.eql?("ru")
55
- if Rango.development?
56
- load File.join(File.dirname(__FILE__), "bin", "shotgun")
57
- else
58
- load File.join(File.dirname(__FILE__), "bin", "rackup")
59
- end
60
- else
61
- load ARGV.shift
62
- end
63
- end
32
+ require "<%= name %>"
33
+
34
+ # Available arguments:
35
+ # ./init.rb -i
36
+ # ./init.rb -i file
37
+ # ./init.rb file
38
+ Rango.parse(ARGV)
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+
3
+ # initializers
4
+ require "<%= @name %>/initializers/url.rb"
5
+
6
+ # after environment is set
7
+ require "<%= @name %>/views.rb"
8
+ require "<%= @name %>/models.rb"
File without changes
@@ -1,5 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
+ # http://wiki.github.com/botanicus/rango/environments-support
4
+ require "rango/environments"
5
+
3
6
  # database connection
4
7
  <% case @orm %>
5
8
  <% when "sequel" %>
@@ -17,6 +20,8 @@ when "development", "production", "staging"
17
20
  when "test", "spec", "cucumber"
18
21
  DataMapper.setup(:default, "sqlite3::memory:")
19
22
  end
23
+ <% when "mongomapper" %>
24
+ MongoMapper.database = "#{Rango.environment}"
20
25
  <% end %>
21
26
 
22
27
  if Rango.development?
@@ -0,0 +1,5 @@
1
+ # nepridavat middlewares ktere uz jsou v @ins
2
+ # => global rack builder object
3
+ # joshbuddy mel neco na insertovani middlewares
4
+
5
+ # Rango.rackup.use
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+
3
+ # http://wiki.github.com/botanicus/rango/routers
4
+ Rango::Router.use(:<%= @router.to_sym %>)
5
+
6
+ <% case @router %>
7
+ <% when "usher" %>
8
+ # http://github.com/joshbuddy/usher
9
+ Rango::Router.app = Usher::Interface.for(:rack) do
10
+ get("/").to(<%= @name.camel_case %>::ShowCase.dispatcher(:index)).name(:showcase)
11
+ end
12
+ <% when "rack-mount" %>
13
+ # http://github.com/josh/rack-mount
14
+ Rango::Router.app = Rack::Mount::RouteSet.new do |set|
15
+ # add_route takes a rack application and conditions to match with
16
+ # conditions may be strings or regexps
17
+ # See Rack::Mount::RouteSet#add_route for more options.
18
+ set.add_route <%= @name.camel_case %>::ShowCase.dispatcher(:index), method: "get", path: "/"
19
+ end
20
+ <% when "rack-router" %>
21
+ # TODO: routes
22
+ <% when "urlmap" %>
23
+ # TODO: routes
24
+ <% end %>
@@ -15,6 +15,13 @@ module <%= @name.camel_case %>
15
15
  # TODO: implement <%= model %> model
16
16
  end
17
17
 
18
+ <% when "mongomapper" %>
19
+ class <%= model.camel_case %>
20
+ include MongoMapper::Document
21
+ key :title, String
22
+ key :slug, String, index: true
23
+ end
24
+
18
25
  <% end %>
19
26
  <% end %>
20
27
  end