rango 0.2.3 → 0.2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -2
- data/CHANGELOG +9 -0
- data/CONTRIBUTORS +0 -1
- data/Gemfile +2 -6
- data/lib/rango.rb +10 -7
- data/lib/rango/cli.rb +1 -1
- data/lib/rango/contrib/pagination/adapters/sequel.rb +6 -2
- data/lib/rango/controller.rb +24 -20
- data/lib/rango/core_ext.rb +54 -59
- data/lib/rango/exceptions.rb +2 -2
- data/lib/rango/gv/router.rb +1 -1
- data/lib/rango/gv/scaffolding.rb +0 -1
- data/lib/rango/mailer.rb +20 -40
- data/lib/rango/mixins/action_args.rb +8 -7
- data/lib/rango/mixins/filters.rb +1 -0
- data/lib/rango/mixins/message.rb +37 -33
- data/lib/rango/mixins/rack-flash.rb +44 -0
- data/{benchmarks/stubs/merb-app/spec/spec.opts → lib/rango/orm/tasks/ripple.nake} +0 -0
- data/lib/rango/rack/request.rb +12 -15
- data/lib/rango/router.rb +7 -3
- data/lib/rango/router/adapters/crudtree.rb +8 -1
- data/lib/rango/router/adapters/rack_mount.rb +5 -1
- data/lib/rango/router/adapters/usher.rb +5 -2
- data/lib/rango/stacks/controller.rb +0 -1
- data/lib/rango/templates/exts/haml.rb +14 -15
- data/lib/rango/templates/exts/tilt.rb +16 -23
- data/lib/rango/templates/helpers.rb +10 -1
- data/lib/rango/templates/template.rb +4 -4
- data/lib/rango/utils.rb +4 -2
- data/lib/rango/version.rb +5 -0
- data/rango.gemspec +3 -2
- data/{benchmarks/stubs/merb-core/spec/spec.opts → spec/rango/cli_spec.rb} +0 -0
- data/{benchmarks/stubs/rails/log/development.log → spec/rango/contrib/pagination/adapters/sequel_spec.rb} +0 -0
- data/spec/rango/controller_spec.rb +12 -0
- data/spec/rango/core_ext_spec.rb +61 -0
- data/spec/rango/environments_spec.rb +1 -0
- data/spec/rango/exceptions_spec.rb +1 -28
- data/{benchmarks/stubs/rails/log/production.log → spec/rango/mailer_spec.rb} +0 -0
- data/spec/rango/mixins/action_args_spec.rb +0 -4
- data/spec/rango/mixins/message_spec.rb +20 -10
- data/{benchmarks/stubs/rails/log/server.log → spec/rango/mixins/rack-flash_spec.rb} +0 -0
- data/spec/rango/rack/request_spec.rb +11 -0
- data/{benchmarks/stubs/rails/log/test.log → spec/rango/router/adapters/crudtree_spec.rb} +0 -0
- data/spec/rango/templates/helpers_spec.rb +19 -5
- data/spec/rango/templates/template_spec.rb +1 -20
- data/{benchmarks/stubs/rails/public/favicon.ico → spec/rango/version_spec.rb} +0 -0
- data/spec/spec_helper.rb +18 -4
- data/stubs/stack/content/%name%.gemspec.rbt +0 -0
- data/stubs/stack/content/%name%.pre.gemspec.rbt +1 -2
- data/stubs/stack/content/.gitignore +2 -5
- data/stubs/stack/content/Gemfile.rbt +23 -46
- data/stubs/stack/content/config.ru.rbt +9 -21
- data/stubs/stack/content/init.rb.rbt +10 -10
- data/stubs/stack/content/lib/%name%.rb.rbt +37 -4
- data/stubs/stack/content/lib/%name%/initializers/01_database.rb.rbt +16 -0
- data/stubs/stack/content/lib/%name%/initializers/05_templates.rb.rbt +13 -0
- data/stubs/stack/content/lib/%name%/initializers/10_pagination.rb.rbt +8 -0
- data/stubs/stack/content/lib/%name%/initializers/15_warden.rb.rbt +26 -0
- data/stubs/stack/content/lib/%name%/initializers/45_middlewares.rb.rbt +17 -0
- data/stubs/stack/content/lib/%name%/initializers/50_router.rb.rbt +7 -0
- data/stubs/stack/content/lib/%name%/{initializers/urls.rb.rbt → urls.rb.rbt} +3 -0
- data/stubs/stack/content/lib/%name%/views.rb.rbt +4 -1
- data/stubs/stack/content/templates/index.html.haml +1 -1
- data/{gems → vendor}/cache/abstract-1.0.0.gem +0 -0
- data/vendor/cache/code-cleaner-0.8.2.gem +0 -0
- data/{gems → vendor}/cache/erubis-2.6.5.gem +0 -0
- data/vendor/cache/haml-2.2.21.gem +0 -0
- data/{gems → vendor}/cache/nake-0.0.8.gem +0 -0
- data/vendor/cache/rack-1.1.0.gem +0 -0
- data/{gems → vendor}/cache/rspec-1.3.0.gem +0 -0
- data/vendor/cache/term-ansicolor-1.0.5.gem +0 -0
- data/vendor/cache/tilt-0.8.gem +0 -0
- metadata +63 -239
- data/benchmarks/stubs/merb-app/.gitignore +0 -21
- data/benchmarks/stubs/merb-app/Rakefile +0 -35
- data/benchmarks/stubs/merb-app/app/controllers/application.rb +0 -4
- data/benchmarks/stubs/merb-app/app/controllers/exceptions.rb +0 -15
- data/benchmarks/stubs/merb-app/app/helpers/global_helpers.rb +0 -7
- data/benchmarks/stubs/merb-app/app/models/user.rb +0 -19
- data/benchmarks/stubs/merb-app/app/views/exceptions/not_acceptable.html.erb +0 -63
- data/benchmarks/stubs/merb-app/app/views/exceptions/not_found.html.erb +0 -47
- data/benchmarks/stubs/merb-app/app/views/layout/application.html.erb +0 -12
- data/benchmarks/stubs/merb-app/autotest/discover.rb +0 -4
- data/benchmarks/stubs/merb-app/autotest/merb.rb +0 -154
- data/benchmarks/stubs/merb-app/autotest/merb_rspec.rb +0 -167
- data/benchmarks/stubs/merb-app/config/database.yml +0 -33
- data/benchmarks/stubs/merb-app/config/dependencies.rb +0 -36
- data/benchmarks/stubs/merb-app/config/environments/development.rb +0 -17
- data/benchmarks/stubs/merb-app/config/environments/production.rb +0 -12
- data/benchmarks/stubs/merb-app/config/environments/rake.rb +0 -13
- data/benchmarks/stubs/merb-app/config/environments/staging.rb +0 -12
- data/benchmarks/stubs/merb-app/config/environments/test.rb +0 -14
- data/benchmarks/stubs/merb-app/config/init.rb +0 -26
- data/benchmarks/stubs/merb-app/config/rack.rb +0 -13
- data/benchmarks/stubs/merb-app/config/router.rb +0 -46
- data/benchmarks/stubs/merb-app/doc/rdoc/generators/merb_generator.rb +0 -1364
- data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/api_grease.js +0 -640
- data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/index.html.erb +0 -37
- data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/merb.css +0 -252
- data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/merb.rb +0 -353
- data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/merb_doc_styles.css +0 -492
- data/benchmarks/stubs/merb-app/doc/rdoc/generators/template/merb/prototype.js +0 -2515
- data/benchmarks/stubs/merb-app/merb/merb-auth/setup.rb +0 -46
- data/benchmarks/stubs/merb-app/merb/merb-auth/strategies.rb +0 -13
- data/benchmarks/stubs/merb-app/merb/session/session.rb +0 -11
- data/benchmarks/stubs/merb-app/public/.htaccess +0 -17
- data/benchmarks/stubs/merb-app/public/favicon.ico +0 -0
- data/benchmarks/stubs/merb-app/public/images/merb.jpg +0 -0
- data/benchmarks/stubs/merb-app/public/javascripts/application.js +0 -1
- data/benchmarks/stubs/merb-app/public/javascripts/jquery.js +0 -19
- data/benchmarks/stubs/merb-app/public/merb.fcgi +0 -22
- data/benchmarks/stubs/merb-app/public/robots.txt +0 -5
- data/benchmarks/stubs/merb-app/public/stylesheets/master.css +0 -119
- data/benchmarks/stubs/merb-app/spec/spec_helper.rb +0 -27
- data/benchmarks/stubs/merb-app/tasks/doc.thor +0 -151
- data/benchmarks/stubs/merb-app/tasks/merb.thor/app_script.rb +0 -33
- data/benchmarks/stubs/merb-app/tasks/merb.thor/common.rb +0 -70
- data/benchmarks/stubs/merb-app/tasks/merb.thor/gem_ext.rb +0 -127
- data/benchmarks/stubs/merb-app/tasks/merb.thor/main.thor +0 -152
- data/benchmarks/stubs/merb-app/tasks/merb.thor/ops.rb +0 -95
- data/benchmarks/stubs/merb-app/tasks/merb.thor/utils.rb +0 -42
- data/benchmarks/stubs/merb-core/.gitignore +0 -21
- data/benchmarks/stubs/merb-core/Rakefile +0 -35
- data/benchmarks/stubs/merb-core/app/controllers/application.rb +0 -4
- data/benchmarks/stubs/merb-core/app/controllers/exceptions.rb +0 -15
- data/benchmarks/stubs/merb-core/app/helpers/global_helpers.rb +0 -7
- data/benchmarks/stubs/merb-core/app/views/exceptions/not_acceptable.html.erb +0 -63
- data/benchmarks/stubs/merb-core/app/views/exceptions/not_found.html.erb +0 -47
- data/benchmarks/stubs/merb-core/app/views/layout/application.html.erb +0 -12
- data/benchmarks/stubs/merb-core/autotest/discover.rb +0 -1
- data/benchmarks/stubs/merb-core/autotest/merb.rb +0 -151
- data/benchmarks/stubs/merb-core/autotest/merb_rspec.rb +0 -167
- data/benchmarks/stubs/merb-core/config/environments/development.rb +0 -17
- data/benchmarks/stubs/merb-core/config/environments/production.rb +0 -12
- data/benchmarks/stubs/merb-core/config/environments/rake.rb +0 -13
- data/benchmarks/stubs/merb-core/config/environments/staging.rb +0 -12
- data/benchmarks/stubs/merb-core/config/environments/test.rb +0 -14
- data/benchmarks/stubs/merb-core/config/init.rb +0 -27
- data/benchmarks/stubs/merb-core/config/rack.rb +0 -13
- data/benchmarks/stubs/merb-core/config/router.rb +0 -43
- data/benchmarks/stubs/merb-core/doc/rdoc/generators/merb_generator.rb +0 -1364
- data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/api_grease.js +0 -640
- data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/index.html.erb +0 -37
- data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/merb.css +0 -252
- data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/merb.rb +0 -353
- data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/merb_doc_styles.css +0 -492
- data/benchmarks/stubs/merb-core/doc/rdoc/generators/template/merb/prototype.js +0 -2515
- data/benchmarks/stubs/merb-core/public/.htaccess +0 -17
- data/benchmarks/stubs/merb-core/public/favicon.ico +0 -0
- data/benchmarks/stubs/merb-core/public/images/merb.jpg +0 -0
- data/benchmarks/stubs/merb-core/public/javascripts/application.js +0 -1
- data/benchmarks/stubs/merb-core/public/merb.fcgi +0 -22
- data/benchmarks/stubs/merb-core/public/robots.txt +0 -5
- data/benchmarks/stubs/merb-core/public/stylesheets/master.css +0 -119
- data/benchmarks/stubs/merb-core/spec/spec_helper.rb +0 -22
- data/benchmarks/stubs/merb-core/tasks/merb.thor/app_script.rb +0 -33
- data/benchmarks/stubs/merb-core/tasks/merb.thor/common.rb +0 -70
- data/benchmarks/stubs/merb-core/tasks/merb.thor/gem_ext.rb +0 -127
- data/benchmarks/stubs/merb-core/tasks/merb.thor/main.thor +0 -152
- data/benchmarks/stubs/merb-core/tasks/merb.thor/ops.rb +0 -95
- data/benchmarks/stubs/merb-core/tasks/merb.thor/utils.rb +0 -42
- data/benchmarks/stubs/merb-flat/.gitignore +0 -21
- data/benchmarks/stubs/merb-flat/README.txt +0 -10
- data/benchmarks/stubs/merb-flat/Rakefile +0 -35
- data/benchmarks/stubs/merb-flat/application.rb +0 -17
- data/benchmarks/stubs/merb-flat/config/framework.rb +0 -9
- data/benchmarks/stubs/merb-flat/config/init.rb +0 -42
- data/benchmarks/stubs/merb-flat/spec/spec_helper.rb +0 -26
- data/benchmarks/stubs/merb-flat/tasks/merb.thor/app_script.rb +0 -33
- data/benchmarks/stubs/merb-flat/tasks/merb.thor/common.rb +0 -70
- data/benchmarks/stubs/merb-flat/tasks/merb.thor/gem_ext.rb +0 -127
- data/benchmarks/stubs/merb-flat/tasks/merb.thor/main.thor +0 -152
- data/benchmarks/stubs/merb-flat/tasks/merb.thor/ops.rb +0 -95
- data/benchmarks/stubs/merb-flat/tasks/merb.thor/utils.rb +0 -42
- data/benchmarks/stubs/merb-flat/views/foo.html.erb +0 -3
- data/benchmarks/stubs/merb-very-flat/.gitignore +0 -21
- data/benchmarks/stubs/merb-very-flat/Rakefile +0 -35
- data/benchmarks/stubs/merb-very-flat/merb-very-flat.rb +0 -61
- data/benchmarks/stubs/merb-very-flat/spec/spec_helper.rb +0 -26
- data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/app_script.rb +0 -33
- data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/common.rb +0 -70
- data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/gem_ext.rb +0 -127
- data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/main.thor +0 -152
- data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/ops.rb +0 -95
- data/benchmarks/stubs/merb-very-flat/tasks/merb.thor/utils.rb +0 -42
- data/benchmarks/stubs/rails/README +0 -243
- data/benchmarks/stubs/rails/Rakefile +0 -10
- data/benchmarks/stubs/rails/app/controllers/application_controller.rb +0 -12
- data/benchmarks/stubs/rails/app/helpers/application_helper.rb +0 -5
- data/benchmarks/stubs/rails/config/boot.rb +0 -112
- data/benchmarks/stubs/rails/config/database.yml +0 -22
- data/benchmarks/stubs/rails/config/environment.rb +0 -43
- data/benchmarks/stubs/rails/config/environments/development.rb +0 -19
- data/benchmarks/stubs/rails/config/environments/production.rb +0 -30
- data/benchmarks/stubs/rails/config/environments/test.rb +0 -30
- data/benchmarks/stubs/rails/config/initializers/backtrace_silencers.rb +0 -9
- data/benchmarks/stubs/rails/config/initializers/inflections.rb +0 -12
- data/benchmarks/stubs/rails/config/initializers/mime_types.rb +0 -7
- data/benchmarks/stubs/rails/config/initializers/new_rails_defaults.rb +0 -21
- data/benchmarks/stubs/rails/config/initializers/session_store.rb +0 -17
- data/benchmarks/stubs/rails/config/locales/en.yml +0 -5
- data/benchmarks/stubs/rails/config/routes.rb +0 -45
- data/benchmarks/stubs/rails/doc/README_FOR_APP +0 -2
- data/benchmarks/stubs/rails/public/404.html +0 -30
- data/benchmarks/stubs/rails/public/422.html +0 -30
- data/benchmarks/stubs/rails/public/500.html +0 -30
- data/benchmarks/stubs/rails/public/images/rails.png +0 -0
- data/benchmarks/stubs/rails/public/index.html +0 -275
- data/benchmarks/stubs/rails/public/javascripts/application.js +0 -2
- data/benchmarks/stubs/rails/public/javascripts/controls.js +0 -963
- data/benchmarks/stubs/rails/public/javascripts/dragdrop.js +0 -973
- data/benchmarks/stubs/rails/public/javascripts/effects.js +0 -1128
- data/benchmarks/stubs/rails/public/javascripts/prototype.js +0 -4320
- data/benchmarks/stubs/rails/public/robots.txt +0 -5
- data/benchmarks/stubs/rails/script/about +0 -4
- data/benchmarks/stubs/rails/script/console +0 -3
- data/benchmarks/stubs/rails/script/dbconsole +0 -3
- data/benchmarks/stubs/rails/script/destroy +0 -3
- data/benchmarks/stubs/rails/script/generate +0 -3
- data/benchmarks/stubs/rails/script/performance/benchmarker +0 -3
- data/benchmarks/stubs/rails/script/performance/profiler +0 -3
- data/benchmarks/stubs/rails/script/plugin +0 -3
- data/benchmarks/stubs/rails/script/runner +0 -3
- data/benchmarks/stubs/rails/script/server +0 -3
- data/benchmarks/stubs/rails/test/performance/browsing_test.rb +0 -11
- data/benchmarks/stubs/rails/test/test_helper.rb +0 -40
- data/benchmarks/stubs/ramaze.rb +0 -0
- data/benchmarks/stubs/sinatra.rb +0 -11
- data/gems/cache/code-cleaner-0.1.gem +0 -0
- data/gems/cache/code-cleaner-0.2.gem +0 -0
- data/gems/cache/code-cleaner-0.3.gem +0 -0
- data/gems/cache/code-cleaner-0.4.gem +0 -0
- data/gems/cache/code-cleaner-0.5.gem +0 -0
- data/gems/cache/code-cleaner-0.6.gem +0 -0
- data/gems/cache/code-cleaner-0.7.gem +0 -0
- data/gems/cache/code-cleaner-0.8.1.gem +0 -0
- data/gems/cache/code-cleaner-0.8.gem +0 -0
- data/gems/cache/extlib-0.9.14.gem +0 -0
- data/gems/cache/haml-2.2.16.gem +0 -0
- data/gems/cache/haml-2.2.17.gem +0 -0
- data/gems/cache/nake-0.0.2.gem +0 -0
- data/gems/cache/nake-0.0.3.gem +0 -0
- data/gems/cache/nake-0.0.5.gem +0 -0
- data/gems/cache/nake-0.0.6.gem +0 -0
- data/gems/cache/rack-1.0.1.gem +0 -0
- data/gems/cache/rack-1.1.0.gem +0 -0
- data/gems/cache/rspec-1.2.9.gem +0 -0
- data/gems/cache/term-ansicolor-1.0.4.gem +0 -0
- data/gems/cache/tilt-0.4.gem +0 -0
- data/gems/cache/tilt-0.5.gem +0 -0
- data/lib/rango/forms/form.rb +0 -30
- data/lib/rango/helpers.rb +0 -31
- data/lib/rango/helpers/assets.rb +0 -46
- data/lib/rango/helpers/general.rb +0 -53
- data/lib/rango/helpers/syntax.rb +0 -30
- data/lib/rango/mixins/chainable.rb +0 -66
- data/lib/rango/mixins/http_caching.rb +0 -78
- data/lib/rango/router/adapters/rack_router.rb +0 -7
- data/lib/rango/templates/exts/erubis.rb +0 -65
- data/spec/rango/forms/form_spec.rb +0 -0
- data/spec/rango/helpers/assets_spec.rb +0 -0
- data/spec/rango/helpers/general_spec.rb +0 -0
- data/spec/rango/helpers/syntax_spec.rb +0 -0
- data/spec/rango/helpers_spec.rb +0 -0
- data/spec/rango/rack/middlewares/email_obfuscator_spec.rb +0 -0
- data/spec/rango/router/adapters/rack_router_spec.rb +0 -0
- data/spec/rango/templates/exts/erubis_spec.rb +0 -0
- data/spec/stubs/templates/_basic.html.erb +0 -6
- data/spec/stubs/templates/basic.html.erb +0 -6
- data/spec/stubs/templates/capture.html.erb +0 -11
- data/spec/stubs/templates/context.html.erb +0 -6
- data/spec/stubs/templates/erubis.html.erubis +0 -2
- data/spec/stubs/templates/exception.html.erb +0 -1
- data/spec/stubs/templates/inheritance/capture/erb/base.html.erb +0 -3
- data/spec/stubs/templates/inheritance/capture/erb/index.html.erb +0 -4
- data/spec/stubs/templates/inheritance/capture/erubis/base.html.erubis +0 -3
- data/spec/stubs/templates/inheritance/capture/erubis/index.html.erubis +0 -4
- data/stubs/stack/content/lib/%name%/config.rb.rbt +0 -0
- data/stubs/stack/content/lib/%name%/initializers/middlewares.rb.rbt +0 -5
- data/stubs/stack/content/rackup.rb.rbt +0 -41
- data/support/hooks/pre-commit +0 -12
@@ -7,12 +7,12 @@ require "rango/exceptions"
|
|
7
7
|
|
8
8
|
module Rango
|
9
9
|
module Exceptions # so we can catch it with other HTTP errors
|
10
|
-
TemplateNotFound = Class.new(NotFound)
|
10
|
+
TemplateNotFound = Class.new(NotFound) { self.name = "Template Not Found" }
|
11
11
|
end
|
12
12
|
|
13
13
|
class Template
|
14
14
|
def self.template_paths
|
15
|
-
@@template_paths ||= [
|
15
|
+
@@template_paths ||= [Rango.root.join("templates").to_s]
|
16
16
|
end
|
17
17
|
|
18
18
|
# template -> supertemplate is the same relationship as class -> superclass
|
@@ -36,7 +36,7 @@ module Rango
|
|
36
36
|
def fullpath
|
37
37
|
@fullpath ||= begin
|
38
38
|
if self.path.match(/^(\/|\.)/) # /foo or ./foo
|
39
|
-
Dir[self.path, "#{self.path}.*"].
|
39
|
+
Dir[self.path, "#{self.path}.*"].find {|file| !File.directory?(file)}
|
40
40
|
else
|
41
41
|
self.find_in_template_paths
|
42
42
|
end
|
@@ -75,7 +75,7 @@ module Rango
|
|
75
75
|
def find_in_template_paths
|
76
76
|
self.class.template_paths.each do |directory|
|
77
77
|
path = File.join(directory, self.path)
|
78
|
-
return Dir[path, "#{path}.*"].
|
78
|
+
return Dir[path, "#{path}.*"].find {|file| !File.directory?(file)}
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
data/lib/rango/utils.rb
CHANGED
@@ -11,8 +11,10 @@ require "rack"
|
|
11
11
|
module Rango
|
12
12
|
module Utils
|
13
13
|
extend self
|
14
|
+
# @deprecated
|
14
15
|
def load_rackup(path = "config.ru")
|
15
|
-
|
16
|
+
app, options = Rack::Builder.parse_file(path)
|
17
|
+
return app
|
16
18
|
end
|
17
19
|
end
|
18
|
-
end
|
20
|
+
end
|
data/rango.gemspec
CHANGED
@@ -2,10 +2,11 @@
|
|
2
2
|
# encoding: utf-8
|
3
3
|
|
4
4
|
require "base64"
|
5
|
+
require File.expand_path("../lib/rango/version", __FILE__)
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
8
|
s.name = "rango"
|
8
|
-
s.version =
|
9
|
+
s.version = Rango::VERSION
|
9
10
|
s.authors = ["Jakub Šťastný aka Botanicus"]
|
10
11
|
s.homepage = "http://github.com/botanicus/rango"
|
11
12
|
s.summary = "Rango is ultralightweight, ultracustomizable, ultracool web framework deeply inspired by Django."
|
@@ -37,7 +38,7 @@ Gem::Specification.new do |s|
|
|
37
38
|
# just run gem install rango --development
|
38
39
|
|
39
40
|
s.add_development_dependency "simple-templater", ">= 0.0.1.2"
|
40
|
-
s.add_development_dependency "bundler"
|
41
|
+
s.add_development_dependency "bundler", ">= 0.9"
|
41
42
|
|
42
43
|
begin
|
43
44
|
require "changelog"
|
File without changes
|
File without changes
|
@@ -23,4 +23,16 @@ describe Rango::Controller do
|
|
23
23
|
@controller.should respond_to(:logger)
|
24
24
|
#@controller.logger.should eql(Project.logger)
|
25
25
|
end
|
26
|
+
|
27
|
+
describe "#params" do
|
28
|
+
before(:each) do
|
29
|
+
env = Rack::MockRequest.env_for("/?ssl=true")
|
30
|
+
@controller = Rango::Controller.new(env)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should have indifferent access" do
|
34
|
+
@controller.params[:ssl].should eql("true")
|
35
|
+
@controller.params["ssl"].should eql("true")
|
36
|
+
end
|
37
|
+
end
|
26
38
|
end
|
data/spec/rango/core_ext_spec.rb
CHANGED
@@ -0,0 +1,61 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require_relative "../spec_helper"
|
4
|
+
|
5
|
+
require "rango/core_ext"
|
6
|
+
|
7
|
+
describe ParamsMixin do
|
8
|
+
describe ".convert" do
|
9
|
+
it "should work" do
|
10
|
+
mash = ParamsMixin.convert(key: "value")
|
11
|
+
mash["key"].should eql("value")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should work recursively" do
|
15
|
+
mash = ParamsMixin.convert(key: {inner: "value"})
|
16
|
+
mash["key"].should_not be_nil
|
17
|
+
mash["key"]["inner"].should eql("value")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "getter & setter" do
|
22
|
+
before(:each) do
|
23
|
+
@mash = {key: "value"}.extend(ParamsMixin)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should work with a string as a key" do
|
27
|
+
@mash["key"].should eql("value")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should work with a symbol as a key" do
|
31
|
+
@mash[:key].should eql("value")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should not cause any issues if the key isn't a string nor a symbol" do
|
35
|
+
object = Object.new
|
36
|
+
lambda {
|
37
|
+
@mash[object] = "test"
|
38
|
+
@mash[object].should eql("test")
|
39
|
+
}.should_not raise_error
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should set the value with key if key is a string" do
|
43
|
+
@mash["key"] = "changed"
|
44
|
+
@mash[:key].should eql("changed")
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should set the value with key if key is a symbol" do
|
48
|
+
@mash[:key] = "changed"
|
49
|
+
@mash["key"].should eql("changed")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "#keys" do
|
54
|
+
it "should be array of strings" do
|
55
|
+
object = Object.new
|
56
|
+
hash = {:a => 1, "b" => 2, object => 3}
|
57
|
+
mash = hash.extend(ParamsMixin)
|
58
|
+
mash.keys.should eql(["a", "b", object])
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -5,6 +5,7 @@ require "rango/environments"
|
|
5
5
|
|
6
6
|
describe "Rango environments" do
|
7
7
|
it "should defaults to development" do
|
8
|
+
pending "This should be part of test suite testing boot & default setup which obviously can't run in the same Ruby instance because all the requires etc are global"
|
8
9
|
Rango.environment.should eql("development")
|
9
10
|
end
|
10
11
|
|
@@ -8,43 +8,16 @@ describe Rango::Exceptions do
|
|
8
8
|
@error = Rango::Exceptions::NotFound.new("Post with given ID doesn't exist")
|
9
9
|
end
|
10
10
|
|
11
|
-
describe "constants" do
|
12
|
-
it "should has CONTENT_TYPE" do
|
13
|
-
Rango::Exceptions::HttpError.constants.should include(:CONTENT_TYPE)
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should xxxxxxxxx" do
|
17
|
-
@class = Class.new(Rango::Exceptions::HttpError)
|
18
|
-
-> { @class::STATUS }.should raise_error(NameError, /has to have defined constant STATUS/)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
11
|
describe "#status" do
|
23
12
|
it "should returns HTTP status status" do
|
24
13
|
@error.status.should eql(404)
|
25
14
|
end
|
26
15
|
end
|
27
16
|
|
28
|
-
describe "#content_type" do
|
29
|
-
it "should returns HTTP status status" do
|
30
|
-
@error.content_type.should eql(@error.class::CONTENT_TYPE)
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should returns HTTP status status" do
|
34
|
-
@error.content_type = "text/xml"
|
35
|
-
@error.content_type.should eql("text/xml")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
17
|
describe "#headers" do
|
40
18
|
it "should returns HTTP status status" do
|
41
19
|
@error.headers.should be_kind_of(Hash)
|
42
20
|
end
|
43
|
-
|
44
|
-
it "should returns HTTP status status" do
|
45
|
-
@error.headers = "text/xml"
|
46
|
-
@error.headers.should eql("text/xml")
|
47
|
-
end
|
48
21
|
end
|
49
22
|
|
50
23
|
describe "#to_snakecase" do
|
@@ -67,7 +40,7 @@ describe Rango::Exceptions do
|
|
67
40
|
end
|
68
41
|
|
69
42
|
it "should write Content-Type header" do
|
70
|
-
@headers["Content-Type"].
|
43
|
+
@headers["Content-Type"].should_not be_nil
|
71
44
|
end
|
72
45
|
|
73
46
|
it "should returns standard response array for Rack" do
|
File without changes
|
@@ -64,25 +64,35 @@ describe Rango::MessageMixin do
|
|
64
64
|
|
65
65
|
describe "#redirect" do
|
66
66
|
before(:each) do
|
67
|
-
@env
|
68
|
-
|
69
|
-
@controller = Posts.new(@env)
|
67
|
+
@env = Rack::MockRequest.env_for("/")
|
68
|
+
@controller = TestController.new(@env)
|
70
69
|
end
|
71
70
|
|
72
71
|
it "should be satisfied just with url" do
|
73
|
-
|
74
|
-
|
75
|
-
|
72
|
+
begin
|
73
|
+
@controller.redirect("/")
|
74
|
+
rescue Rango::Exceptions::Redirection => redirection
|
75
|
+
redirection.status.should eql(303)
|
76
|
+
redirection.headers["Location"].should eql("http://example.org")
|
77
|
+
end
|
76
78
|
end
|
77
79
|
|
78
80
|
it "should be satisfied just with url" do
|
79
|
-
|
80
|
-
|
81
|
+
begin
|
82
|
+
@controller.redirect("/", "Try again")
|
83
|
+
rescue Rango::Exceptions::Redirection => redirection
|
84
|
+
redirection.status.should eql(303)
|
85
|
+
redirection.headers["Location"].should eql("http://example.org/?msg=Try%20again")
|
86
|
+
end
|
81
87
|
end
|
82
88
|
|
83
89
|
it "should be satisfied just with url" do
|
84
|
-
|
85
|
-
|
90
|
+
begin
|
91
|
+
@controller.redirect("/", error: "Try again")
|
92
|
+
rescue Rango::Exceptions::Redirection => redirection
|
93
|
+
redirection.status.should eql(303)
|
94
|
+
redirection.headers["Location"].should eql("http://example.org/?msg[error]=Try%20again")
|
95
|
+
end
|
86
96
|
end
|
87
97
|
end
|
88
98
|
end
|
File without changes
|
@@ -4,4 +4,15 @@ require_relative "../../spec_helper"
|
|
4
4
|
require "rango/rack/request"
|
5
5
|
|
6
6
|
describe Rango::Request do
|
7
|
+
describe "#params" do
|
8
|
+
before(:each) do
|
9
|
+
env = Rack::MockRequest.env_for("/?ssl=true")
|
10
|
+
@request = Rango::Request.new(env)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should have indifferent access" do
|
14
|
+
@request.params[:ssl].should eql("true")
|
15
|
+
@request.params["ssl"].should eql("true")
|
16
|
+
end
|
17
|
+
end
|
7
18
|
end
|
File without changes
|
@@ -9,17 +9,31 @@ describe Rango::TemplateHelpers do
|
|
9
9
|
include Rango::TemplateHelpers
|
10
10
|
describe "#partial" do
|
11
11
|
it "should work" do
|
12
|
+
pending "This can't work because self.template doesn't exist, we have to use render mixin"
|
12
13
|
partial "basic.html"
|
13
14
|
end
|
14
15
|
|
15
|
-
it "should share context with the parent template"
|
16
|
-
|
16
|
+
it "should share context with the parent template" do
|
17
|
+
pending
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should be able to specify additional context which isn't propagated to the parent template" do
|
21
|
+
pending
|
22
|
+
end
|
17
23
|
end
|
18
24
|
|
19
25
|
describe "#render" do
|
20
|
-
it "should consider 'path.html' as a path relative to Template.template_paths"
|
21
|
-
|
22
|
-
|
26
|
+
it "should consider 'path.html' as a path relative to Template.template_paths" do
|
27
|
+
pending
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should consider './path.html' as a path relative to the current template" do
|
31
|
+
pending
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should look for '../path.html' in the parent directory of directory with current template" do
|
35
|
+
pending
|
36
|
+
end
|
23
37
|
end
|
24
38
|
|
25
39
|
describe "#includes" do
|
@@ -47,19 +47,6 @@ describe Rango::Template do
|
|
47
47
|
template.render
|
48
48
|
template.blocks[:content].should match("Hello!")
|
49
49
|
end
|
50
|
-
|
51
|
-
it "should capture erubis" do
|
52
|
-
template = Rango::Template.new("inheritance/capture/erubis/index.html")
|
53
|
-
template.render
|
54
|
-
template.blocks[:content].should match("Hello!")
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should capture erb" do
|
58
|
-
pending "ERB or ERB adapter in Tilt seems to have problems with capturing"
|
59
|
-
template = Rango::Template.new("inheritance/capture/erb/index.html")
|
60
|
-
template.render
|
61
|
-
template.blocks[:content].should match("Hello!")
|
62
|
-
end
|
63
50
|
end
|
64
51
|
|
65
52
|
describe "variables" do
|
@@ -68,13 +55,7 @@ describe Rango::Template do
|
|
68
55
|
end
|
69
56
|
|
70
57
|
it "should capture erb" do
|
71
|
-
@template.render(title: "Hi!").should match("Hi!")
|
72
|
-
end
|
73
|
-
|
74
|
-
it "should <%= &block %>" do
|
75
|
-
pending "<%= &block %> should works for Erubis"
|
76
|
-
template = Rango::Template.new("erubis.html")
|
77
|
-
puts template.render
|
58
|
+
# @template.render(title: "Hi!").should match("Hi!")
|
78
59
|
end
|
79
60
|
end
|
80
61
|
end
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
@@ -3,16 +3,24 @@
|
|
3
3
|
SPEC_ROOT = File.dirname(__FILE__)
|
4
4
|
STUBS_ROOT = File.join(SPEC_ROOT, "stubs")
|
5
5
|
|
6
|
-
$:.unshift
|
6
|
+
$:.unshift(File.join(SPEC_ROOT, "..", "lib"))
|
7
7
|
|
8
8
|
begin
|
9
|
-
|
9
|
+
# Require the preresolved locked set of gems.
|
10
|
+
require File.expand_path("../.bundle/environment", __FILE__)
|
10
11
|
rescue LoadError
|
11
|
-
|
12
|
+
# Fallback on doing the resolve at runtime.
|
13
|
+
require "rubygems"
|
14
|
+
require "bundler"
|
15
|
+
Bundler.setup
|
12
16
|
end
|
13
17
|
|
14
18
|
require "spec" # so you can run ruby spec/rango/whatever_spec.rb
|
15
19
|
|
20
|
+
require "rango"
|
21
|
+
require "logger"
|
22
|
+
Rango.logger = Logger.new("/dev/null")
|
23
|
+
|
16
24
|
class RecursiveOpenStruct < OpenStruct
|
17
25
|
def initialize(attributes = Hash.new)
|
18
26
|
attributes.each do |key, value|
|
@@ -27,7 +35,7 @@ end
|
|
27
35
|
module Spec
|
28
36
|
module Matchers
|
29
37
|
def match(expected)
|
30
|
-
Matcher.new
|
38
|
+
Matcher.new(:match, expected) do |expected|
|
31
39
|
match do |actual|
|
32
40
|
actual.match(expected)
|
33
41
|
end
|
@@ -35,3 +43,9 @@ module Spec
|
|
35
43
|
end
|
36
44
|
end
|
37
45
|
end
|
46
|
+
|
47
|
+
Spec::Runner.configure do |config|
|
48
|
+
config.before(:all) do
|
49
|
+
Rango.environment = "test"
|
50
|
+
end
|
51
|
+
end
|
File without changes
|
@@ -1,8 +1,7 @@
|
|
1
1
|
#!/usr/bin/env gem build
|
2
2
|
# encoding: utf-8
|
3
3
|
|
4
|
-
#
|
5
|
-
# right mate! However say thanks to authors of RubyGems, not me.
|
4
|
+
# Reuse the main gemspec for releasing prerelease versions
|
6
5
|
eval(File.read("<%= @name %>.gemspec")).tap do |specification|
|
7
6
|
specification.version = "#{specification.version}.pre"
|
8
7
|
end
|