tanuki 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +5 -4
- data/app/tanuki/controller/{link.thtml → controller.link.thtml} +0 -0
- data/app/tanuki/controller/controller.page.thtml +14 -0
- data/app/tanuki/controller/controller.rb +1 -2
- data/app/tanuki/controller/controller.title.ttxt +1 -0
- data/app/tanuki/controller/controller.view.thtml +3 -0
- data/app/tanuki/fetcher/sequel/sequel.rb +34 -0
- data/app/tanuki/manager/controller/controller.rb +1 -1
- data/app/tanuki/manager/page/page.rb +1 -1
- data/app/tanuki/meta_model/{manager.ttxt → meta_model.manager.ttxt} +0 -0
- data/app/tanuki/meta_model/{manager_base.ttxt → meta_model.manager_base.ttxt} +0 -0
- data/app/tanuki/meta_model/{model.ttxt → meta_model.model.ttxt} +0 -0
- data/app/tanuki/meta_model/{model_base.ttxt → meta_model.model_base.ttxt} +0 -0
- data/app/tanuki/meta_model/meta_model.rb +1 -2
- data/app/tanuki/model/controller/controller.rb +1 -1
- data/app/tanuki/model/page/page.rb +1 -1
- data/app/tanuki/page/missing/{default.thtml → missing.page.thtml} +1 -1
- data/app/tanuki/page/missing/missing.rb +3 -2
- data/app/user/page/home/home.rb +2 -0
- data/app/user/page/home/home.title.thtml +1 -0
- data/app/user/page/home/home.view.css +88 -0
- data/app/user/page/home/home.view.thtml +22 -0
- data/bin/tanuki +2 -1
- data/config/common.rb +1 -0
- data/config/common_application.rb +3 -6
- data/config/development_application.rb +0 -3
- data/lib/tanuki.rb +8 -7
- data/lib/tanuki/application.rb +108 -81
- data/lib/tanuki/argument.rb +10 -5
- data/lib/tanuki/argument/integer_range.rb +4 -2
- data/lib/tanuki/{behavior/object_behavior.rb → base_behavior.rb} +21 -4
- data/lib/tanuki/configurator.rb +20 -8
- data/lib/tanuki/const.rb +32 -0
- data/lib/tanuki/context.rb +18 -7
- data/lib/tanuki/controller.rb +517 -0
- data/lib/tanuki/css_compressor.rb +50 -0
- data/lib/tanuki/extensions/module.rb +21 -5
- data/lib/tanuki/extensions/rack/frozen_route.rb +35 -0
- data/lib/tanuki/extensions/rack/static_dir.rb +1 -1
- data/lib/tanuki/extensions/sequel/model.rb +7 -0
- data/lib/tanuki/i18n.rb +8 -6
- data/lib/tanuki/loader.rb +166 -33
- data/lib/tanuki/meta_model.rb +176 -0
- data/lib/tanuki/{behavior/model_behavior.rb → model_behavior.rb} +7 -3
- data/lib/tanuki/model_generator.rb +49 -29
- data/lib/tanuki/template_compiler.rb +72 -41
- data/lib/tanuki/utility.rb +11 -4
- data/lib/tanuki/utility/create.rb +52 -11
- data/lib/tanuki/utility/generate.rb +16 -10
- data/lib/tanuki/utility/version.rb +1 -1
- data/lib/tanuki/version.rb +7 -2
- metadata +50 -66
- data/app/tanuki/controller/default.thtml +0 -5
- data/app/tanuki/controller/index.thtml +0 -1
- data/app/user/page/index/default.thtml +0 -121
- data/app/user/page/index/index.rb +0 -2
- data/config/test_application.rb +0 -2
- data/lib/tanuki/behavior/controller_behavior.rb +0 -366
- data/lib/tanuki/behavior/meta_model_behavior.rb +0 -160
- data/lib/tanuki/extensions/rack/builder.rb +0 -26
- data/lib/tanuki/extensions/rack/server.rb +0 -18
- data/lib/tanuki/launcher.rb +0 -21
- data/lib/tanuki/utility/server.rb +0 -23
@@ -1,26 +0,0 @@
|
|
1
|
-
module Rack
|
2
|
-
class Builder
|
3
|
-
|
4
|
-
# Initializes application settings using configuration for environment +env+ and +rackup+ arguments.
|
5
|
-
# Application is configured for development, if no environment is specified.
|
6
|
-
# Returns Tanuki::Application::rack_app.
|
7
|
-
#
|
8
|
-
# This should be invoked from Rackup configuration files (e.g. +config.ru+):
|
9
|
-
#
|
10
|
-
# #\ -p 3000
|
11
|
-
# require 'tanuki'
|
12
|
-
# run tanuki
|
13
|
-
def tanuki(env=nil)
|
14
|
-
puts %{Calling for a Tanuki in "#{Dir.pwd}"}
|
15
|
-
at_exit { puts 'Tanuki ran away!' }
|
16
|
-
builder = self
|
17
|
-
Tanuki::Application.instance_eval do
|
18
|
-
configure(env = env ? env.to_sym : :development)
|
19
|
-
configure_middleware(builder)
|
20
|
-
puts "A racked #{env} Tanuki appears!"
|
21
|
-
rack_app
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
end #
|
26
|
-
end # Rack
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Rack
|
2
|
-
class Server
|
3
|
-
|
4
|
-
# Wraps around Rack::Server#options to update application configuration accordingly.
|
5
|
-
def options_with_tanuki(*args, &block)
|
6
|
-
rack_server = self
|
7
|
-
rackup_options = options_without_tanuki(*args, &block)
|
8
|
-
Tanuki::Application.instance_eval do
|
9
|
-
rackup_options.each_pair {|k, v| @context.send :"#{k.downcase}=", v }
|
10
|
-
@context.running_server = rack_server.server
|
11
|
-
end
|
12
|
-
rackup_options
|
13
|
-
end
|
14
|
-
|
15
|
-
alias_method_chain :options, :tanuki
|
16
|
-
|
17
|
-
end #
|
18
|
-
end # Rack
|
data/lib/tanuki/launcher.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
module Tanuki
|
2
|
-
|
3
|
-
# Tanuki::Launcher is called on every request.
|
4
|
-
# It is used to build output starting with the default view of the root controller.
|
5
|
-
# Rack iterates over an instance of this object on every request.
|
6
|
-
class Launcher
|
7
|
-
|
8
|
-
# Creates a new Tanuki::Launcher with root controller +ctrl+ in context +ctx+.
|
9
|
-
def initialize(ctrl, ctx)
|
10
|
-
@ctrl = ctrl
|
11
|
-
@ctx = ctx
|
12
|
-
end
|
13
|
-
|
14
|
-
# Passes a given +block+ to the requested page template tree.
|
15
|
-
def each(&block)
|
16
|
-
@ctrl.default_view.call(proc {|out| block.call(out.to_s) }, @ctx)
|
17
|
-
end
|
18
|
-
|
19
|
-
end # Launcher
|
20
|
-
|
21
|
-
end # Tanuki
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module Tanuki
|
2
|
-
|
3
|
-
module Utility
|
4
|
-
|
5
|
-
@help[:server] = 'run application'
|
6
|
-
|
7
|
-
# Runs the application in the current directory and environment +env+.
|
8
|
-
def self.server(env=nil)
|
9
|
-
env = env ? env.to_sym : :development
|
10
|
-
puts %{Calling for a Tanuki in "#{Dir.pwd}"}
|
11
|
-
version unless @in_repl
|
12
|
-
require 'tanuki'
|
13
|
-
begin
|
14
|
-
Application.run
|
15
|
-
puts 'Tanuki ran away!'
|
16
|
-
rescue SystemCallError
|
17
|
-
puts 'Tanuki ran away! Someone else is playing here.'
|
18
|
-
end if Application.configure(env)
|
19
|
-
end
|
20
|
-
|
21
|
-
end # Utility
|
22
|
-
|
23
|
-
end # Tanuki
|