rango 0.2 → 0.2.1.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /*.gem
2
+
3
+ .DS_Store
4
+ .cache
5
+ .yardoc
6
+
7
+ script/*
8
+ gems/*
9
+ !gems/cache
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "examples"]
2
+ path = examples
3
+ url = git://github.com/botanicus/rango-examples.git
data/CHANGELOG CHANGED
@@ -60,3 +60,8 @@
60
60
  * rake hooks will install task for removing whitespace in pre-commit hook, contributors should use it!
61
61
  * Template helpers can work with paths relative to current template via ./path.html resp. ../path.html. All other paths are relative to the template paths.
62
62
  * Use simple-logger as a default logger or standar logger if the simple-logger isn't installed.
63
+
64
+ = Version 0.2.1
65
+ * More inteligent environments handling, just use Rango.environment and it will detect the proper one from ENV["RACK_ENV"], RACK_ENV constant or it will defaults to development. Rango.environment=(environment) will set all these variables so everything will stay consistent.
66
+ * MongoMapper supported in stack generator (rango create stack blog --orm=mongomapper)
67
+ * Added Rango::StackController which is more complete than just basic Rango::Controller
data/CONTRIBUTORS CHANGED
@@ -1,3 +1,4 @@
1
1
  Jakub Šťastný aka Botanicus (main author)
2
2
  Grant Michael Levkoff aka grantmichaels (wrote awesome http://www.rubyinside.com/rango-ruby-web-app-framework-2858.html)
3
3
  Martin Hrdlička
4
+ Tomasz Werbicki aka neaf
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+
3
+ # configuration
4
+ bundle_path "gems"
5
+ bin_path "script"
6
+ disable_rubygems
7
+
8
+ # gems
9
+ gem "nake"
10
+ gem "code-cleaner"
11
+
12
+ gem "tilt"
13
+ gem "rack"
14
+
15
+ gem "haml"
16
+ gem "erubis"
17
+
18
+ only(:test) do
19
+ gem "rspec"
20
+ end
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Jakub Šťastný aka Botanicus
1
+ Copyright (c) 2009 – 2010 Jakub Šťastný aka Botanicus
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.textile CHANGED
@@ -1,19 +1,20 @@
1
1
  h1. Installation via RubyGems
2
2
 
3
- * Daily builds: @gem install rango --pre@
4
- * Stable version: @gem install rango@
5
- * JRuby: @jruby --1.9 -S gem install rango@
3
+ * Daily builds: @gem install rango --pre@ and @gem install simple-templater@. RubyGems don't work with prerelease gems properly, so you can't just run @gem install simple-templater rango --pre@. The trouble is when you are installing with @--pre@, RubyGems are looking just for prerelease gems, but Erubis, which is dependency of simple-templater, doesn't have any prerelease gem.
4
+ * Stable version: @gem install simple-templater rango@
5
+ * JRuby: @jruby --1.9 -S gem install simple-templater rango@ is how you should install Rango for JRuby. Unfortunately I'm getting strange errors here. Don't forget the @--1.9@ argument, because Rango can be installed just on Ruby 1.9.
6
6
 
7
7
  _Rango itself doesn't define any runtime dependencies, since you may want to use just a subset of Rango, i. e. just template layer. If you are using stack generator, you get @Gemfile@ with usual dependencies, so @gem bundle@ will take care about it._
8
8
 
9
9
  h1. Installation via "Rip":http://hellorip.com
10
10
 
11
11
  * Install edge version: @rip install git://github.com/botanicus/rango.git@
12
- * Install tagged version: @rip install git://github.com/botanicus/rango.git 0.1@
12
+ * Install tagged version: @rip install git://github.com/botanicus/rango.git 0.2@
13
13
 
14
14
  h1. How to Contribute To Rango
15
15
 
16
16
  Contributions to Rango is easy, you don't have to create a ticket or something, the only thing you really have to do is write good code. Before you send a pull request, please ensure that you:
17
+ * Have no trailing whitespace in your code (if you run @rake hooks@, you get git pre-commit hook which take care about it)
17
18
  * Wrote YARD documentation
18
19
  * Wrote specs and run them under at least under Ruby 1.9.1, ideally under all the supported Ruby platforms:
19
20
 
data/benchmarks/ab.rb ADDED
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+
3
+ # start servers and run ab
4
+ # save results for each rango version
5
+
6
+ # agains all standard bm frameworks + Django
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative "../helper"
4
+
5
+ RBench.run(100) do
6
+ column :times
7
+ column :one, title: "Hot boot"
8
+ column :two, title: "Cold boot"
9
+
10
+ report "Standard boot" do
11
+ one do
12
+ quiet! { Rango.boot }
13
+ end
14
+
15
+ two do
16
+ load RANGO_LIBFILE
17
+ quiet! { Rango.boot }
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,4 @@
1
+ # encoding: utf-8
2
+
3
+ # controller
4
+ # callable
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative "../helper"
4
+
5
+ RBench.run(100) do
6
+ column :times
7
+ column :urlmap, title: "Rack::URLMap in Rango"
8
+ column :rack, title: "Rack router in Rango"
9
+ column :merb, title: "Merb router"
10
+ column :rails, title: "Rails router"
11
+ column :sinatra, title: "Sinatra routing"
12
+
13
+ group "A 1521 route set with routes nested evenly 2 levels deep" do
14
+ report "Homepage" do
15
+ end
16
+
17
+ report "Request with params" do
18
+ end
19
+ end
20
+
21
+ summary "foo"
22
+ end
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative "../helper"
4
+
5
+ Rango.boot
6
+
7
+ RBench.run(100) do
8
+ column :times
9
+ column :rango, title: "Rango"
10
+ column :ramaze, title: "Ramaze"
11
+ column :sinatra, title: "Sinatra"
12
+ column :merb, title: "Merb"
13
+ column :rails, title: "Rails"
14
+
15
+ report "Basic request/response processing" do
16
+ end
17
+
18
+ summary "All requests"
19
+ end
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+
3
+ require "rbench"
4
+ require_relative "../lib/rango"
5
+
6
+ PROJECT_ROOT = File.join(File.dirname(__FILE__), "..")
7
+ RANGO_LIBFILE = File.join(PROJECT_ROOT, "lib", "rango.rb")
@@ -0,0 +1,21 @@
1
+ .DS_Store
2
+ log/*
3
+ tmp/*
4
+ TAGS
5
+ *~
6
+ .#*
7
+ schema/schema.rb
8
+ schema/*_structure.sql
9
+ schema/*.sqlite3
10
+ schema/*.sqlite
11
+ schema/*.db
12
+ *.sqlite
13
+ *.sqlite3
14
+ *.db
15
+ src/*
16
+ .hgignore
17
+ .hg/*
18
+ .svn/*
19
+ gems/gems/*
20
+ gems/specifications/*
21
+ merb_profile_results
@@ -0,0 +1,35 @@
1
+ require 'rubygems'
2
+ require 'rake/rdoctask'
3
+
4
+ require 'merb-core'
5
+ require 'merb-core/tasks/merb'
6
+
7
+ include FileUtils
8
+
9
+ # Load the basic runtime dependencies; this will include
10
+ # any plugins and therefore plugin rake tasks.
11
+ init_env = ENV['MERB_ENV'] || 'rake'
12
+ Merb.load_dependencies(:environment => init_env)
13
+
14
+ # Get Merb plugins and dependencies
15
+ Merb::Plugins.rakefiles.each { |r| require r }
16
+
17
+ # Load any app level custom rakefile extensions from lib/tasks
18
+ tasks_path = File.join(File.dirname(__FILE__), "lib", "tasks")
19
+ rake_files = Dir["#{tasks_path}/*.rake"]
20
+ rake_files.each{|rake_file| load rake_file }
21
+
22
+ desc "Start runner environment"
23
+ task :merb_env do
24
+ Merb.start_environment(:environment => init_env, :adapter => 'runner')
25
+ end
26
+
27
+ require 'spec/rake/spectask'
28
+ require 'merb-core/test/tasks/spectasks'
29
+ desc 'Default: run spec examples'
30
+ task :default => 'spec'
31
+
32
+ ##############################################################################
33
+ # ADD YOUR CUSTOM TASKS IN /lib/tasks
34
+ # NAME YOUR RAKE FILES file_name.rake
35
+ ##############################################################################
@@ -0,0 +1,4 @@
1
+ # encoding: utf-8
2
+
3
+ class Application < Merb::Controller
4
+ end
@@ -0,0 +1,15 @@
1
+ # encoding: utf-8
2
+
3
+ class Exceptions < Merb::Controller
4
+
5
+ # handle NotFound exceptions (404)
6
+ def not_found
7
+ render :format => :html
8
+ end
9
+
10
+ # handle NotAcceptable exceptions (406)
11
+ def not_acceptable
12
+ render :format => :html
13
+ end
14
+
15
+ end
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+
3
+ module Merb
4
+ module GlobalHelpers
5
+ # helpers defined here available to all views.
6
+ end
7
+ end
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+
3
+ # This is a default user class used to activate merb-auth. Feel free to change from a User to
4
+ # Some other class, or to remove it altogether. If removed, merb-auth may not work by default.
5
+ #
6
+ # Don't forget that by default the salted_user mixin is used from merb-more
7
+ # You'll need to setup your db as per the salted_user mixin, and you'll need
8
+ # To use :password, and :password_confirmation when creating a user
9
+ #
10
+ # see merb/merb-auth/setup.rb to see how to disable the salted_user mixin
11
+ #
12
+ # You will need to setup your database and create a user.
13
+ class User
14
+ include DataMapper::Resource
15
+
16
+ property :id, Serial
17
+ property :login, String
18
+
19
+ end
@@ -0,0 +1,63 @@
1
+ <div id="container">
2
+ <div id="header-container">
3
+ <img src="/images/merb.jpg" />
4
+ <!-- <h1>Mongrel + Erb</h1> -->
5
+ <h2>pocket rocket web framework</h2>
6
+ <hr />
7
+ </div>
8
+
9
+ <div id="left-container">
10
+ <h3>Exception:</h3>
11
+ <p><%= request.exceptions.first.message %></p>
12
+ </div>
13
+
14
+ <div id="main-container">
15
+ <h3>Why am I seeing this page?</h3>
16
+ <p>Merb couldn't find an appropriate content_type to return,
17
+ based on what you said was available via provides() and
18
+ what the client requested.</p>
19
+
20
+ <h3>How to add a mime-type</h3>
21
+ <pre><code>
22
+ Merb.add_mime_type :pdf, :to_pdf, %w[application/pdf], &quot;Content-Encoding&quot; =&gt; &quot;gzip&quot;
23
+ </code></pre>
24
+ <h3>What this means is:</h3>
25
+ <ul>
26
+ <li>Add a mime-type for :pdf</li>
27
+ <li>Register the method for converting objects to PDF as <code>#to_pdf</code>.</li>
28
+ <li>Register the incoming mime-type "Accept" header as <code>application/pdf</code>.</li>
29
+ <li>Specify a new header for PDF types so it will set <code>Content-Encoding</code> to gzip.</li>
30
+ </ul>
31
+
32
+ <h3>You can then do:</h3>
33
+ <pre><code>
34
+ class Foo &lt; Application
35
+ provides :pdf
36
+ end
37
+ </code></pre>
38
+
39
+ <h3>Where can I find help?</h3>
40
+ <p>If you have any questions or if you can't figure something out, please take a
41
+ look at our <a href="http://merbivore.com/"> project page</a>,
42
+ feel free to come chat at irc.freenode.net, channel #merb,
43
+ or post to <a href="http://groups.google.com/group/merb">merb mailing list</a>
44
+ on Google Groups.</p>
45
+
46
+ <h3>What if I've found a bug?</h3>
47
+ <p>If you want to file a bug or make your own contribution to Merb,
48
+ feel free to register and create a ticket at our
49
+ <a href="http://merb.lighthouseapp.com/">project development page</a>
50
+ on Lighthouse.</p>
51
+
52
+ <h3>How do I edit this page?</h3>
53
+ <p>You can change what people see when this happens by editing <tt>app/views/exceptions/not_acceptable.html.erb</tt>.</p>
54
+
55
+ </div>
56
+
57
+ <div id="footer-container">
58
+ <hr />
59
+ <div class="left"></div>
60
+ <div class="right">&copy; 2008 the merb dev team</div>
61
+ <p>&nbsp;</p>
62
+ </div>
63
+ </div>
@@ -0,0 +1,47 @@
1
+ <div id="container">
2
+ <div id="header-container">
3
+ <img src="/images/merb.jpg" />
4
+ <!-- <h1>Mongrel + Erb</h1> -->
5
+ <h2>pocket rocket web framework</h2>
6
+ <hr />
7
+ </div>
8
+
9
+ <div id="left-container">
10
+ <h3>Exception:</h3>
11
+ <p><%= request.exceptions.first.message %></p>
12
+ </div>
13
+
14
+ <div id="main-container">
15
+ <h3>Welcome to Merb!</h3>
16
+ <p>Merb is a light-weight MVC framework written in Ruby. We hope you enjoy it.</p>
17
+
18
+ <h3>Where can I find help?</h3>
19
+ <p>If you have any questions or if you can't figure something out, please take a
20
+ look at our <a href="http://merbivore.com/"> project page</a>,
21
+ feel free to come chat at irc.freenode.net, channel #merb,
22
+ or post to <a href="http://groups.google.com/group/merb">merb mailing list</a>
23
+ on Google Groups.</p>
24
+
25
+ <h3>What if I've found a bug?</h3>
26
+ <p>If you want to file a bug or make your own contribution to Merb,
27
+ feel free to register and create a ticket at our
28
+ <a href="http://merb.lighthouseapp.com/">project development page</a>
29
+ on Lighthouse.</p>
30
+
31
+ <h3>How do I edit this page?</h3>
32
+ <p>You're seeing this page because you need to edit the following files:
33
+ <ul>
34
+ <li>config/router.rb <strong><em>(recommended)</em></strong></li>
35
+ <li>app/views/exceptions/not_found.html.erb <strong><em>(recommended)</em></strong></li>
36
+ <li>app/views/layout/application.html.erb <strong><em>(change this layout)</em></strong></li>
37
+ </ul>
38
+ </p>
39
+ </div>
40
+
41
+ <div id="footer-container">
42
+ <hr />
43
+ <div class="left"></div>
44
+ <div class="right">&copy; 2008 the merb dev team</div>
45
+ <p>&nbsp;</p>
46
+ </div>
47
+ </div>
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
3
+ <head>
4
+ <title>Fresh Merb App</title>
5
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
6
+ <link rel="stylesheet" href="/stylesheets/master.css" type="text/css" media="screen" charset="utf-8" />
7
+ </head>
8
+ <body>
9
+ <%#= message[:notice] %>
10
+ <%= catch_content :for_layout %>
11
+ </body>
12
+ </html>
@@ -0,0 +1,4 @@
1
+ # encoding: utf-8
2
+
3
+ Autotest.add_discovery { "merb" }
4
+ Autotest.add_discovery { "rspec" }
@@ -0,0 +1,154 @@
1
+ # encoding: utf-8
2
+
3
+ # Adapted from Autotest::Rails
4
+ require 'autotest'
5
+
6
+ class Autotest::Merb < Autotest
7
+
8
+ # +model_tests_dir+:: the directory to find model-centric tests
9
+ # +controller_tests_dir+:: the directory to find controller-centric tests
10
+ # +view_tests_dir+:: the directory to find view-centric tests
11
+ # +fixtures_dir+:: the directory to find fixtures in
12
+ attr_accessor :model_tests_dir, :controller_tests_dir, :view_tests_dir, :fixtures_dir
13
+
14
+ def initialize
15
+ super
16
+
17
+ initialize_test_layout
18
+
19
+ # Ignore any happenings in these directories
20
+ add_exception %r%^\./(?:doc|log|public|tmp|\.git|\.hg|\.svn|framework|gems|schema|\.DS_Store|autotest|bin|.*\.sqlite3)%
21
+ # Ignore SCM directories and custom Autotest mappings
22
+ %w[.svn .hg .git .autotest].each { |exception| add_exception(exception) }
23
+
24
+
25
+ # Ignore any mappings that Autotest may have already set up
26
+ clear_mappings
27
+
28
+ # Any changes to a file in the root of the 'lib' directory will run any
29
+ # model test with a corresponding name.
30
+ add_mapping %r%^lib\/.*\.rb% do |filename, _|
31
+ files_matching Regexp.new(["^#{model_test_for(filename)}$"])
32
+ end
33
+
34
+ # Any changes to a fixture will run corresponding view, controller and
35
+ # model tests
36
+ add_mapping %r%^#{fixtures_dir}/(.*)s.yml% do |_, m|
37
+ [
38
+ model_test_for(m[1]),
39
+ controller_test_for(m[1]),
40
+ view_test_for(m[1])
41
+ ]
42
+ end
43
+
44
+ # Any change to a test will cause it to be run
45
+ add_mapping %r%^test/(unit|models|integration|controllers|views|functional)/.*rb$% do |filename, _|
46
+ filename
47
+ end
48
+
49
+ # Any change to a model will cause it's corresponding test to be run
50
+ add_mapping %r%^app/models/(.*)\.rb$% do |_, m|
51
+ model_test_for(m[1])
52
+ end
53
+
54
+ # Any change to the global helper will result in all view and controller
55
+ # tests being run
56
+ add_mapping %r%^app/helpers/global_helpers.rb% do
57
+ files_matching %r%^test/(views|functional|controllers)/.*_test\.rb$%
58
+ end
59
+
60
+ # Any change to a helper will run it's corresponding view and controller
61
+ # tests, unless the helper is the global helper. Changes to the global
62
+ # helper run all view and controller tests.
63
+ add_mapping %r%^app/helpers/(.*)_helper(s)?.rb% do |_, m|
64
+ if m[1] == "global" then
65
+ files_matching %r%^test/(views|functional|controllers)/.*_test\.rb$%
66
+ else
67
+ [
68
+ view_test_for(m[1]),
69
+ controller_test_for(m[1])
70
+ ]
71
+ end
72
+ end
73
+
74
+ # Changes to views result in their corresponding view and controller test
75
+ # being run
76
+ add_mapping %r%^app/views/(.*)/% do |_, m|
77
+ [
78
+ view_test_for(m[1]),
79
+ controller_test_for(m[1])
80
+ ]
81
+ end
82
+
83
+ # Changes to a controller result in its corresponding test being run. If
84
+ # the controller is the exception or application controller, all
85
+ # controller tests are run.
86
+ add_mapping %r%^app/controllers/(.*)\.rb$% do |_, m|
87
+ if ["application", "exception"].include?(m[1])
88
+ files_matching %r%^test/(controllers|views|functional)/.*_test\.rb$%
89
+ else
90
+ controller_test_for(m[1])
91
+ end
92
+ end
93
+
94
+ # If a change is made to the router, run all controller and view tests
95
+ add_mapping %r%^config/router.rb$% do # FIX
96
+ files_matching %r%^test/(controllers|views|functional)/.*_test\.rb$%
97
+ end
98
+
99
+ # If any of the major files governing the environment are altered, run
100
+ # everything
101
+ add_mapping %r%^test/test_helper.rb|config/(init|rack|environments/test.rb|database.yml)% do # FIX
102
+ files_matching %r%^test/(unit|models|controllers|views|functional)/.*_test\.rb$%
103
+ end
104
+ end
105
+
106
+ private
107
+
108
+ # Determines the paths we can expect tests or specs to reside, as well as
109
+ # corresponding fixtures.
110
+ def initialize_test_layout
111
+ self.model_tests_dir = "test/unit"
112
+ self.controller_tests_dir = "test/functional"
113
+ self.view_tests_dir = "test/views"
114
+ self.fixtures_dir = "test/fixtures"
115
+ end
116
+
117
+ # Given a filename and the test type, this method will return the
118
+ # corresponding test's or spec's name.
119
+ #
120
+ # ==== Arguments
121
+ # +filename+<String>:: the file name of the model, view, or controller
122
+ # +kind_of_test+<Symbol>:: the type of test we that we should run
123
+ #
124
+ # ==== Returns
125
+ # String:: the name of the corresponding test or spec
126
+ #
127
+ # ==== Example
128
+ #
129
+ # > test_for("user", :model)
130
+ # => "user_test.rb"
131
+ # > test_for("login", :controller)
132
+ # => "login_controller_test.rb"
133
+ # > test_for("form", :view)
134
+ # => "form_view_spec.rb" # If you're running a RSpec-like suite
135
+ def test_for(filename, kind_of_test)
136
+ name = [filename]
137
+ name << kind_of_test.to_s if kind_of_test == :view
138
+ name << "test"
139
+ return name.join("_") + ".rb"
140
+ end
141
+
142
+ def model_test_for(filename)
143
+ [model_tests_dir, test_for(filename, :model)].join("/")
144
+ end
145
+
146
+ def controller_test_for(filename)
147
+ [controller_tests_dir, test_for(filename, :controller)].join("/")
148
+ end
149
+
150
+ def view_test_for(filename)
151
+ [view_tests_dir, test_for(filename, :view)].join("/")
152
+ end
153
+
154
+ end