rango 0.1.1 → 0.1.1.1
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.
- data/CHANGELOG +6 -2
- data/Rakefile +5 -72
- data/lib/rango.rb +1 -1
- data/lib/rango/controller.rb +33 -133
- data/lib/rango/mixins/filters.rb +70 -0
- data/lib/rango/mixins/message.rb +26 -0
- data/lib/rango/mixins/rendering.rb +41 -0
- data/lib/rango/settings/haml.rb +5 -0
- data/lib/rango/templates/exts/erubis.rb +1 -1
- data/lib/rango/templates/exts/haml.rb +34 -0
- data/lib/rango/templates/exts/tilt.rb +12 -2
- data/spec/rango/{bundling/dependency_spec.rb → gv/static_spec.rb} +0 -0
- data/spec/rango/{bundling/strategies/copy_spec.rb → mixins/filters_spec.rb} +0 -0
- data/spec/rango/{bundling/strategies/gem_spec.rb → mixins/message_spec.rb} +0 -0
- data/spec/rango/{bundling/strategies/git_spec.rb → mixins/rendering_spec.rb} +0 -0
- data/spec/rango/{bundling/strategies/hg_spec.rb → router/adapters/rack_mount_spec.rb} +0 -0
- data/spec/rango/{bundling/strategy_spec.rb → templates/exts/erubis_spec.rb} +0 -0
- data/spec/rango/{loggers/logger_spec.rb → templates/exts/haml_spec.rb} +0 -0
- data/spec/rango/templates/exts/tilt_spec.rb +0 -0
- data/spec/rango/templates/helpers_spec.rb +0 -0
- data/stubs/app/content/views.rb.rbt +6 -1
- data/stubs/project/content/Gemfile.rbt +2 -3
- data/stubs/project/content/config.ru.rbt +1 -1
- data/stubs/project/content/init.rb.rbt +2 -1
- metadata +16 -10
data/CHANGELOG
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
* [FEATURE] Hooks for Rendering
|
19
19
|
* [SPECS] Integration with RunCodeRun.com
|
20
20
|
* [SPECS] All specs passing
|
21
|
-
|
21
|
+
* SimpleTemplater, RubyExts & CLI
|
22
22
|
* [FEATURE] Bundler Support
|
23
23
|
* [FEATURE] Generic view
|
24
24
|
* [FEATURE] Project generator
|
@@ -27,5 +27,9 @@
|
|
27
27
|
= Version 0.1.1
|
28
28
|
* Tilt support
|
29
29
|
* Removed old merb-helpers
|
30
|
-
* Templates are rendered in separate namespace
|
31
30
|
* Reworked generic views
|
31
|
+
* Default attributes for Haml
|
32
|
+
* MessagesMixin and FiltersMixin were divided from Rango::Controller
|
33
|
+
* Shebang is just ruby rather than ruby1.9, so it plays well with rvm
|
34
|
+
* ImplicitRendering and ExplicitRendering mixins for using locals
|
35
|
+
vs. rendering in context of current controller instance
|
data/Rakefile
CHANGED
@@ -1,79 +1,12 @@
|
|
1
|
-
#!/usr/bin/env rake1.9
|
2
1
|
# encoding: utf-8
|
3
2
|
|
4
3
|
# http://support.runcoderun.com/faqs/builds/how-do-i-run-rake-with-trace-enabled
|
5
4
|
Rake.application.options.trace = true
|
6
5
|
|
7
|
-
task
|
6
|
+
# default task for RunCodeRun.com
|
7
|
+
task :default => ["submodules:init", :spec]
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
sh "git submodule init"
|
13
|
-
end
|
14
|
-
|
15
|
-
desc "Update submodules"
|
16
|
-
task :update do
|
17
|
-
Dir["vendor/*"].each do |path|
|
18
|
-
if File.directory?(path) && File.directory?(File.join(path, ".git"))
|
19
|
-
Dir.chdir(path) do
|
20
|
-
puts "=> #{path}"
|
21
|
-
puts %x[git reset --hard]
|
22
|
-
puts %x[git fetch]
|
23
|
-
puts %x[git reset origin/master --hard]
|
24
|
-
puts
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
task :gem do
|
32
|
-
sh "gem build rango.gemspec"
|
33
|
-
end
|
34
|
-
|
35
|
-
namespace :gem do
|
36
|
-
task :prerelease do
|
37
|
-
require_relative "lib/rango"
|
38
|
-
gemspec = Dir["*.gemspec"].first
|
39
|
-
content = File.read(gemspec)
|
40
|
-
prename = "#{gemspec.split(".").first}.pre.gemspec"
|
41
|
-
version = Rango::VERSION.sub(/^(\d+)\.(\d+)\.\d+$/) { "#$1.#{$1.to_i + 1}" }
|
42
|
-
File.open(prename, "w") do |file|
|
43
|
-
file.puts(content.gsub(/(\w+::VERSION)/, "'#{version}.pre'"))
|
44
|
-
end
|
45
|
-
sh "gem build #{prename}"
|
46
|
-
rm prename
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
desc "Release new version of rango"
|
51
|
-
task release: ["release:tag", "release:gemcutter"]
|
52
|
-
|
53
|
-
namespace :release do
|
54
|
-
desc "Create Git tag"
|
55
|
-
task :tag do
|
56
|
-
require_relative "lib/rango"
|
57
|
-
puts "Creating new git tag #{Rango::VERSION} and pushing it online ..."
|
58
|
-
sh "git tag -a -m 'Version #{Rango::VERSION}' #{Rango::VERSION}"
|
59
|
-
sh "git push --tags"
|
60
|
-
puts "Tag #{Rango::VERSION} was created and pushed to GitHub."
|
61
|
-
end
|
62
|
-
|
63
|
-
desc "Push gem to Gemcutter"
|
64
|
-
task :gemcutter do
|
65
|
-
puts "Pushing to Gemcutter ..."
|
66
|
-
sh "gem push #{Dir["*.gem"].last}"
|
67
|
-
end
|
68
|
-
|
69
|
-
desc "Create and push prerelease gem"
|
70
|
-
task :pre => ["gem:prerelease", :gemcutter]
|
71
|
-
end
|
72
|
-
|
73
|
-
desc "Run specs"
|
74
|
-
task :default => :setup do
|
75
|
-
rubylib = (ENV["RUBYLIB"] || String.new).split(":")
|
76
|
-
libdirs = Dir["vendor/*/lib"]
|
77
|
-
ENV["RUBYLIB"] = (libdirs + rubylib).join(":")
|
78
|
-
exec "./script/spec --options spec/spec.opts spec"
|
9
|
+
# load tasks
|
10
|
+
Dir["tasks/*.rake"].each do |taskfile|
|
11
|
+
load taskfile
|
79
12
|
end
|
data/lib/rango.rb
CHANGED
data/lib/rango/controller.rb
CHANGED
@@ -2,113 +2,54 @@
|
|
2
2
|
|
3
3
|
# http://wiki.github.com/botanicus/rango/controllers
|
4
4
|
|
5
|
-
require "rango/
|
5
|
+
require "rango/router"
|
6
6
|
require "rango/exceptions"
|
7
|
-
require "rango/project"
|
8
7
|
require "rango/rack/request"
|
9
|
-
require "rango/router"
|
10
|
-
require "rango/templates/template"
|
11
8
|
|
12
9
|
module Rango
|
13
10
|
class Controller
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
inherit_filters(subclass, :before)
|
26
|
-
inherit_filters(subclass, :after)
|
27
|
-
inherit_filters(subclass, :before_render)
|
28
|
-
inherit_filters(subclass, :after_render)
|
29
|
-
inherit_filters(subclass, :before_display)
|
30
|
-
inherit_filters(subclass, :after_display)
|
31
|
-
end
|
32
|
-
|
33
|
-
def inherit_filters(subclass, name)
|
34
|
-
subclass.send("#{name}_filters=", self.send("#{name}_filters").dup)
|
35
|
-
end
|
36
|
-
|
37
|
-
# before :login
|
38
|
-
# before :login, actions: [:send]
|
39
|
-
# @since 0.0.2
|
40
|
-
def before(action = nil, options = Hash.new, &block)
|
41
|
-
self.before_filters[action || block] = options
|
42
|
-
end
|
43
|
-
|
44
|
-
# @since 0.0.2
|
45
|
-
def after(action = nil, options = Hash.new, &block)
|
46
|
-
self.after_filters[action || block] = options
|
47
|
-
end
|
48
|
-
|
49
|
-
attribute :before_render_filters, Array.new
|
50
|
-
attribute :after_render_filters, Array.new
|
51
|
-
|
52
|
-
attribute :before_display_filters, Array.new
|
53
|
-
attribute :after_display_filters, Array.new
|
54
|
-
|
55
|
-
# [master] Change Merb::Controller to respond to #call and return a Rack Array. (wycats)http://rubyurl.com/BhoY
|
56
|
-
# @since 0.0.2
|
57
|
-
def call(env)
|
58
|
-
Rango::Router.set_rack_env(env) # See rango/router/adapters/*
|
59
|
-
request = Rango::Request.new(env)
|
60
|
-
options = env["rango.router.params"] || raise("rango.router.params property has to be setup at least to empty hash")
|
61
|
-
method = env["rango.controller.action"].to_sym
|
62
|
-
controller = self.new(env, options.merge(request.params))
|
63
|
-
begin
|
64
|
-
unless controller.respond_to?(method) # TODO: what about method_missing?
|
65
|
-
raise NotFound, "Controller #{self.name} doesn't have method #{method}"
|
66
|
-
end
|
67
|
-
controller.run_filters(:before, method.to_sym)
|
68
|
-
# If you don't care about arguments or if you prefer usage of params.
|
69
|
-
if controller.method(method).arity.eql?(0)
|
70
|
-
Rango.logger.debug("Calling method #{self.name}##{method} without arguments")
|
71
|
-
controller.response.body = controller.method(method).call
|
72
|
-
else
|
73
|
-
args = controller.params.values
|
74
|
-
Rango.logger.debug("Calling method #{self.name}##{method} with arguments #{args.inspect}")
|
75
|
-
controller.response.body = controller.method(method).call(*args)
|
76
|
-
end
|
77
|
-
controller.run_filters(:after, method)
|
78
|
-
return controller.response.finish
|
79
|
-
rescue HttpError => exception
|
80
|
-
controller.rescue_http_error(exception)
|
11
|
+
# [master] Change Merb::Controller to respond to #call and return a Rack Array. (wycats)http://rubyurl.com/BhoY
|
12
|
+
# @since 0.0.2
|
13
|
+
def self.call(env)
|
14
|
+
Rango::Router.set_rack_env(env)
|
15
|
+
request = Rango::Request.new(env)
|
16
|
+
options = env["rango.router.params"] || raise("rango.router.params property has to be setup at least to empty hash")
|
17
|
+
method = env["rango.controller.action"].to_sym
|
18
|
+
controller = self.new(env, options.merge(request.params))
|
19
|
+
begin
|
20
|
+
unless controller.respond_to?(method) # TODO: what about method_missing?
|
21
|
+
raise NotFound, "Controller #{self.name} doesn't have method #{method}"
|
81
22
|
end
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
end
|
92
|
-
|
93
|
-
# for routers
|
94
|
-
def dispatcher(action)
|
95
|
-
lambda do |env|
|
96
|
-
Rango.logger.info("Dispatching to #{self}##{action} [#{env["REQUEST_METHOD"]} #{env["PATH_INFO"]}]")
|
97
|
-
env["rango.controller.action"] = action
|
98
|
-
return self.call(env)
|
23
|
+
controller.run_filters(:before, method.to_sym)
|
24
|
+
# If you don't care about arguments or if you prefer usage of params.
|
25
|
+
if controller.method(method).arity.eql?(0)
|
26
|
+
Rango.logger.debug("Calling method #{self.name}##{method} without arguments")
|
27
|
+
controller.response.body = controller.method(method).call
|
28
|
+
else
|
29
|
+
args = controller.params.values
|
30
|
+
Rango.logger.debug("Calling method #{self.name}##{method} with arguments #{args.inspect}")
|
31
|
+
controller.response.body = controller.method(method).call(*args)
|
99
32
|
end
|
33
|
+
controller.run_filters(:after, method)
|
34
|
+
return controller.response.finish
|
35
|
+
rescue HttpError => exception
|
36
|
+
controller.rescue_http_error(exception)
|
100
37
|
end
|
38
|
+
end
|
101
39
|
|
102
|
-
|
103
|
-
|
104
|
-
|
40
|
+
# for routers
|
41
|
+
def self.dispatcher(action)
|
42
|
+
lambda do |env|
|
43
|
+
Rango.logger.info("Dispatching to #{self}##{action} [#{env["REQUEST_METHOD"]} #{env["PATH_INFO"]}]")
|
44
|
+
env["rango.controller.action"] = action
|
45
|
+
return self.call(env)
|
105
46
|
end
|
106
47
|
end
|
107
48
|
|
108
49
|
# @since 0.0.1
|
109
50
|
# @return [RubyExts::Logger] Logger for logging project related stuff.
|
110
51
|
# @see RubyExts::Logger
|
111
|
-
attribute :logger,
|
52
|
+
attribute :logger, Rango.logger
|
112
53
|
attribute :status
|
113
54
|
attribute :headers, Hash.new
|
114
55
|
|
@@ -120,27 +61,9 @@ module Rango
|
|
120
61
|
# @return [Hash] Hash with params from request. For example <code>{messages: {success: "You're logged in"}, post: {id: 2}}</code>
|
121
62
|
attr_accessor :params
|
122
63
|
|
123
|
-
# The rails-style flash messages
|
124
|
-
# @since 0.0.2
|
125
|
-
def message
|
126
|
-
@message ||= (request.GET[:msg] || Hash.new)
|
127
|
-
end
|
128
|
-
|
129
|
-
def render(template, locals = Hash.new)
|
130
|
-
super template, self.locals.merge!(locals)
|
131
|
-
end
|
132
|
-
|
133
64
|
# @since 0.0.2
|
134
65
|
def redirect(url, options = Hash.new)
|
135
66
|
self.status = 302
|
136
|
-
|
137
|
-
# for example ?msg[error]=foo
|
138
|
-
[:error, :success, :notice].each do |type|
|
139
|
-
if msg = (options[type] || message[type])
|
140
|
-
url.concat("?msg[#{type}]=#{msg}")
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
67
|
self.headers["Location"] = URI.escape(url)
|
145
68
|
return String.new
|
146
69
|
end
|
@@ -155,10 +78,6 @@ module Rango
|
|
155
78
|
end
|
156
79
|
attr_reader :session
|
157
80
|
|
158
|
-
def route_to(action, params = Hash.new)
|
159
|
-
self.class.route_to(request.env, action, params)
|
160
|
-
end
|
161
|
-
|
162
81
|
# redefine this method for your controller if you want to provide custom error pages
|
163
82
|
# returns response array for rack
|
164
83
|
# if you need to change just body of error message, define render_http_error method
|
@@ -171,24 +90,5 @@ module Rango
|
|
171
90
|
[status, headers, body]
|
172
91
|
end
|
173
92
|
end
|
174
|
-
|
175
|
-
# @since 0.0.2
|
176
|
-
def run_filters(name, method)
|
177
|
-
# Rango.logger.debug(self.class.instance_variables)
|
178
|
-
# Rango.logger.inspect(name: name, method: method)
|
179
|
-
self.class.get_filters(name).each do |filter_method, options|
|
180
|
-
unless options[:except] && options[:except].include?(method)
|
181
|
-
if filter_method.is_a?(Symbol) && self.respond_to?(filter_method)
|
182
|
-
Rango.logger.info("Calling filter #{filter_method} for controller #{self}")
|
183
|
-
self.send(filter_method)
|
184
|
-
elsif filter_method.respond_to?(:call)
|
185
|
-
Rango.logger.info("Calling filter #{filter_method.inspect} for controller #{self}")
|
186
|
-
self.instance_eval(&filter_method)
|
187
|
-
else
|
188
|
-
Rango.logger.error("Filter #{filter_method} doesn't exists!")
|
189
|
-
end
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
193
93
|
end
|
194
94
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Rango
|
4
|
+
module FiltersMixin
|
5
|
+
def self.included(controller)
|
6
|
+
controller.extend(ClassMethods)
|
7
|
+
end
|
8
|
+
|
9
|
+
# @since 0.0.2
|
10
|
+
def run_filters(name, method)
|
11
|
+
# Rango.logger.debug(self.class.instance_variables)
|
12
|
+
# Rango.logger.inspect(name: name, method: method)
|
13
|
+
self.class.get_filters(name).each do |filter_method, options|
|
14
|
+
unless options[:except] && options[:except].include?(method)
|
15
|
+
if filter_method.is_a?(Symbol) && self.respond_to?(filter_method)
|
16
|
+
Rango.logger.info("Calling filter #{filter_method} for controller #{self}")
|
17
|
+
self.send(filter_method)
|
18
|
+
elsif filter_method.respond_to?(:call)
|
19
|
+
Rango.logger.info("Calling filter #{filter_method.inspect} for controller #{self}")
|
20
|
+
self.instance_eval(&filter_method)
|
21
|
+
else
|
22
|
+
Rango.logger.error("Filter #{filter_method} doesn't exists!")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
module ClassMethods
|
29
|
+
def inherited(subclass)
|
30
|
+
inherit_filters(subclass, :before)
|
31
|
+
inherit_filters(subclass, :after)
|
32
|
+
inherit_filters(subclass, :before_render)
|
33
|
+
inherit_filters(subclass, :after_render)
|
34
|
+
inherit_filters(subclass, :before_display)
|
35
|
+
inherit_filters(subclass, :after_display)
|
36
|
+
end
|
37
|
+
|
38
|
+
def inherit_filters(subclass, name)
|
39
|
+
subclass.send("#{name}_filters=", self.send("#{name}_filters").dup)
|
40
|
+
end
|
41
|
+
|
42
|
+
# before :login
|
43
|
+
# before :login, actions: [:send]
|
44
|
+
# @since 0.0.2
|
45
|
+
def before(action = nil, options = Hash.new, &block)
|
46
|
+
self.before_filters[action || block] = options
|
47
|
+
end
|
48
|
+
|
49
|
+
# @since 0.0.2
|
50
|
+
def after(action = nil, options = Hash.new, &block)
|
51
|
+
self.after_filters[action || block] = options
|
52
|
+
end
|
53
|
+
|
54
|
+
# @since 0.0.2
|
55
|
+
def get_filters(type)
|
56
|
+
self.send("#{type}_filters")
|
57
|
+
end
|
58
|
+
|
59
|
+
# @since 0.0.2
|
60
|
+
attribute :before_filters, Hash.new
|
61
|
+
attribute :after_filters, Hash.new
|
62
|
+
|
63
|
+
attribute :before_render_filters, Array.new
|
64
|
+
attribute :after_render_filters, Array.new
|
65
|
+
|
66
|
+
attribute :before_display_filters, Array.new
|
67
|
+
attribute :after_display_filters, Array.new
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Rango
|
4
|
+
module MessageMixin
|
5
|
+
# The rails-style flash messages
|
6
|
+
# @since 0.0.2
|
7
|
+
def message
|
8
|
+
@message ||= (request.GET[:msg] || Hash.new)
|
9
|
+
end
|
10
|
+
|
11
|
+
# @since 0.0.2
|
12
|
+
def redirect(url, options = Hash.new)
|
13
|
+
self.status = 302
|
14
|
+
|
15
|
+
# for example ?msg[error]=foo
|
16
|
+
[:error, :success, :notice].each do |type|
|
17
|
+
if msg = (options[type] || message[type])
|
18
|
+
url.concat("?msg[#{type}]=#{msg}")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
self.headers["Location"] = URI.escape(url)
|
23
|
+
return String.new
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Rango
|
4
|
+
module ExplicitRendering
|
5
|
+
def render(template, locals = Hash.new)
|
6
|
+
super(template, self.locals.merge!(locals))
|
7
|
+
end
|
8
|
+
|
9
|
+
# def show
|
10
|
+
# # you can't use @explicit
|
11
|
+
# post = Post.get(params[:id])
|
12
|
+
# render "post.html", post: post
|
13
|
+
# end
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# Context for rendering templates
|
17
|
+
# This context will be extended by same crucial methods from template mixin
|
18
|
+
# We are in context of current controller by default
|
19
|
+
def context
|
20
|
+
Object.new.extend(Rango::Helpers)
|
21
|
+
end
|
22
|
+
|
23
|
+
# def show
|
24
|
+
# locals[:post] = Post.get(params[:id])
|
25
|
+
# render "show.html", locals
|
26
|
+
# end
|
27
|
+
def locals
|
28
|
+
@locals ||= {message: self.message}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
module ImplicitRendering
|
33
|
+
def context
|
34
|
+
self
|
35
|
+
end
|
36
|
+
|
37
|
+
def render(template)
|
38
|
+
super template
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/rango/settings/haml.rb
CHANGED
@@ -36,6 +36,11 @@ module Rango
|
|
36
36
|
# @since 0.0.7
|
37
37
|
# Haml now has an :ugly option, thanks to Wincent Colaiuta. This option forgoes pretty output formatting in favor of speed increases, which show up in particular when rendering deeply nested partials
|
38
38
|
hattribute :ugly, lambda { not Rango.development? }
|
39
|
+
|
40
|
+
# @since 0.1.1
|
41
|
+
# You don't have to explicitly specify attributes which are same for all the tags of same
|
42
|
+
# kind in your markup over and over if you just specify them as an options for the engine
|
43
|
+
hattribute :default_attributes, {script: {type: "text/javascript"}, form: {method: "POST"}}
|
39
44
|
end
|
40
45
|
end
|
41
46
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# Option default_attributes
|
4
|
+
#
|
5
|
+
# A hash of default attributes for tags (`{tag => {attribute => default_value}}`).
|
6
|
+
# Attributes of each tag will reverse merged with his default attributes, so you
|
7
|
+
# don't have to write over and over that script tag has attribute `type` with value
|
8
|
+
# `text/javascript`. For example, `%script` compiles to `<script type="text/javascript"></script>`.
|
9
|
+
# Defaults to `{:script => {:type => "text/javascript"}, :form => {:method => "POST"}}`
|
10
|
+
|
11
|
+
module Haml
|
12
|
+
class Engine
|
13
|
+
alias_method :__initialize__, :initialize
|
14
|
+
def initialize(template, options = Hash.new)
|
15
|
+
__initialize__(template, options)
|
16
|
+
@options[:default_attributes] = Hash.new
|
17
|
+
# symbolize keys
|
18
|
+
@options[:default_attributes] = @options[:default_attributes].inject(Hash.new) do |options, pair|
|
19
|
+
options.merge(pair.first.to_sym => pair.last)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module Precompiler
|
25
|
+
alias_method :__prerender_tag__, :prerender_tag
|
26
|
+
def prerender_tag(name, self_close, attributes)
|
27
|
+
# merge given attributes with default attributes from options
|
28
|
+
if default_attributes = @options[:default_attributes][name.to_sym]
|
29
|
+
attributes = default_attributes.merge(attributes)
|
30
|
+
end
|
31
|
+
__prerender_tag__(name, self_close, attributes)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -9,8 +9,18 @@ module Tilt
|
|
9
9
|
chainable do
|
10
10
|
def initialize_engine
|
11
11
|
super
|
12
|
-
require "rango/templates/erubis"
|
12
|
+
require "rango/templates/exts/erubis"
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
|
+
HamlTemplate.class_eval do
|
18
|
+
extend RubyExts::Chainable
|
19
|
+
chainable do
|
20
|
+
def initialize_engine
|
21
|
+
super
|
22
|
+
require "rango/templates/exts/haml"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -3,10 +3,15 @@
|
|
3
3
|
# http://wiki.github.com/botanicus/rango/controllers
|
4
4
|
|
5
5
|
require "rango/controller"
|
6
|
+
require "rango/mixins/render"
|
7
|
+
require "rango/mixins/filters"
|
8
|
+
require "rango/mixins/message"
|
6
9
|
|
7
10
|
module <%= @name.camel_case %>
|
8
11
|
class Application < Rango::Controller
|
9
|
-
|
12
|
+
include Rango::FiltersMixin
|
13
|
+
include Rango::MessageMixin
|
14
|
+
include Rango::RenderMixin
|
10
15
|
end
|
11
16
|
|
12
17
|
class ShowCase < Application
|
@@ -43,9 +43,8 @@ gem "dm-aggregates"#, git: "git://github.com/datamapper/dm-more.git" # for count
|
|
43
43
|
gem "sequel"#, git: "git://github.com/jeremyevans/sequel.git"
|
44
44
|
|
45
45
|
<% end %>
|
46
|
-
|
47
|
-
#gem "
|
48
|
-
#gem "unicorn"#, git: "git://repo.or.cz/unicorn.git"
|
46
|
+
gem "thin", require_as: nil#, git: "git://github.com/macournoyer/thin.git" # there seems to be some problems with latest thin
|
47
|
+
#gem "unicorn", require_as: nil#, git: "git://repo.or.cz/unicorn.git"
|
49
48
|
gem "racksh", require_as: nil#, git: "git://github.com/sickill/racksh.git"
|
50
49
|
<% if @warden %>
|
51
50
|
gem "warden"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= shebang "
|
1
|
+
<%= shebang "ruby", ["--disable-gems"] %>
|
2
2
|
# encoding: utf-8
|
3
3
|
|
4
4
|
# This file should set Rango environment
|
@@ -17,6 +17,7 @@ require_relative "settings"
|
|
17
17
|
require_relative "settings_local"
|
18
18
|
|
19
19
|
require "rango"
|
20
|
+
require "rango/helpers"
|
20
21
|
require "rango/environments"
|
21
22
|
|
22
23
|
# http://wiki.github.com/botanicus/rango/environments-support
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rango
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.1
|
4
|
+
version: 0.1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Jakub \xC5\xA0\xC5\xA5astn\xC3\xBD aka Botanicus"
|
@@ -37,7 +37,7 @@ dependencies:
|
|
37
37
|
version_requirement:
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- - "
|
40
|
+
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 0.0.2.1
|
43
43
|
version:
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
version_requirement:
|
58
58
|
version_requirements: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - "
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: 0.0.1.2
|
63
63
|
version:
|
@@ -104,8 +104,11 @@ files:
|
|
104
104
|
- lib/rango/mini.rb
|
105
105
|
- lib/rango/mixins/application.rb
|
106
106
|
- lib/rango/mixins/configurable.rb
|
107
|
+
- lib/rango/mixins/filters.rb
|
107
108
|
- lib/rango/mixins/http_caching.rb
|
109
|
+
- lib/rango/mixins/message.rb
|
108
110
|
- lib/rango/mixins/render.rb
|
111
|
+
- lib/rango/mixins/rendering.rb
|
109
112
|
- lib/rango/orm/adapter.rb
|
110
113
|
- lib/rango/orm/adapters/datamapper.rb
|
111
114
|
- lib/rango/orm/adapters/sequel.rb
|
@@ -135,17 +138,12 @@ files:
|
|
135
138
|
- lib/rango/support/cucumber/steps/when_steps.rb
|
136
139
|
- lib/rango/tasks/spec.rake
|
137
140
|
- lib/rango/templates/exts/erubis.rb
|
141
|
+
- lib/rango/templates/exts/haml.rb
|
138
142
|
- lib/rango/templates/exts/tilt.rb
|
139
143
|
- lib/rango/templates/helpers.rb
|
140
144
|
- lib/rango/templates/template.rb
|
141
145
|
- lib/rango/utils.rb
|
142
146
|
- lib/rango.rb
|
143
|
-
- spec/rango/bundling/dependency_spec.rb
|
144
|
-
- spec/rango/bundling/strategies/copy_spec.rb
|
145
|
-
- spec/rango/bundling/strategies/gem_spec.rb
|
146
|
-
- spec/rango/bundling/strategies/git_spec.rb
|
147
|
-
- spec/rango/bundling/strategies/hg_spec.rb
|
148
|
-
- spec/rango/bundling/strategy_spec.rb
|
149
147
|
- spec/rango/contrib/pagination/adapters/datamapper_spec.rb
|
150
148
|
- spec/rango/contrib/pagination/helpers_spec.rb
|
151
149
|
- spec/rango/contrib/pagination/page_spec.rb
|
@@ -156,18 +154,21 @@ files:
|
|
156
154
|
- spec/rango/environments_spec.rb
|
157
155
|
- spec/rango/exceptions_spec.rb
|
158
156
|
- spec/rango/forms/form_spec.rb
|
157
|
+
- spec/rango/gv/static_spec.rb
|
159
158
|
- spec/rango/gv_spec.rb
|
160
159
|
- spec/rango/helpers/assets_spec.rb
|
161
160
|
- spec/rango/helpers/general_spec.rb
|
162
161
|
- spec/rango/helpers/syntax_spec.rb
|
163
162
|
- spec/rango/helpers_spec.rb
|
164
163
|
- spec/rango/loggers/fireruby_spec.rb
|
165
|
-
- spec/rango/loggers/logger_spec.rb
|
166
164
|
- spec/rango/mini_spec.rb
|
167
165
|
- spec/rango/mixins/application_spec.rb
|
168
166
|
- spec/rango/mixins/configurable_spec.rb
|
167
|
+
- spec/rango/mixins/filters_spec.rb
|
169
168
|
- spec/rango/mixins/http_caching_spec.rb
|
169
|
+
- spec/rango/mixins/message_spec.rb
|
170
170
|
- spec/rango/mixins/render_spec.rb
|
171
|
+
- spec/rango/mixins/rendering_spec.rb
|
171
172
|
- spec/rango/orm/adapter_spec.rb
|
172
173
|
- spec/rango/orm/adapters/datamapper_spec.rb
|
173
174
|
- spec/rango/orm/adapters/sequel_spec.rb
|
@@ -179,6 +180,7 @@ files:
|
|
179
180
|
- spec/rango/rack/middlewares/encoding_spec.rb
|
180
181
|
- spec/rango/rack/middlewares/static_spec.rb
|
181
182
|
- spec/rango/rack/request_spec.rb
|
183
|
+
- spec/rango/router/adapters/rack_mount_spec.rb
|
182
184
|
- spec/rango/router/adapters/rack_router_spec.rb
|
183
185
|
- spec/rango/router/adapters/urlmap_spec.rb
|
184
186
|
- spec/rango/router/adapters/usher_spec.rb
|
@@ -191,6 +193,10 @@ files:
|
|
191
193
|
- spec/rango/support/cucumber/steps/given_steps_spec.rb
|
192
194
|
- spec/rango/support/cucumber/steps/then_steps_spec.rb
|
193
195
|
- spec/rango/support/cucumber/steps/when_steps_spec.rb
|
196
|
+
- spec/rango/templates/exts/erubis_spec.rb
|
197
|
+
- spec/rango/templates/exts/haml_spec.rb
|
198
|
+
- spec/rango/templates/exts/tilt_spec.rb
|
199
|
+
- spec/rango/templates/helpers_spec.rb
|
194
200
|
- spec/rango/templates/template_spec.rb
|
195
201
|
- spec/rango/utils_spec.rb
|
196
202
|
- spec/rango_spec.rb
|