tanuki 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/README.rdoc +5 -4
  2. data/app/tanuki/controller/{link.thtml → controller.link.thtml} +0 -0
  3. data/app/tanuki/controller/controller.page.thtml +14 -0
  4. data/app/tanuki/controller/controller.rb +1 -2
  5. data/app/tanuki/controller/controller.title.ttxt +1 -0
  6. data/app/tanuki/controller/controller.view.thtml +3 -0
  7. data/app/tanuki/fetcher/sequel/sequel.rb +34 -0
  8. data/app/tanuki/manager/controller/controller.rb +1 -1
  9. data/app/tanuki/manager/page/page.rb +1 -1
  10. data/app/tanuki/meta_model/{manager.ttxt → meta_model.manager.ttxt} +0 -0
  11. data/app/tanuki/meta_model/{manager_base.ttxt → meta_model.manager_base.ttxt} +0 -0
  12. data/app/tanuki/meta_model/{model.ttxt → meta_model.model.ttxt} +0 -0
  13. data/app/tanuki/meta_model/{model_base.ttxt → meta_model.model_base.ttxt} +0 -0
  14. data/app/tanuki/meta_model/meta_model.rb +1 -2
  15. data/app/tanuki/model/controller/controller.rb +1 -1
  16. data/app/tanuki/model/page/page.rb +1 -1
  17. data/app/tanuki/page/missing/{default.thtml → missing.page.thtml} +1 -1
  18. data/app/tanuki/page/missing/missing.rb +3 -2
  19. data/app/user/page/home/home.rb +2 -0
  20. data/app/user/page/home/home.title.thtml +1 -0
  21. data/app/user/page/home/home.view.css +88 -0
  22. data/app/user/page/home/home.view.thtml +22 -0
  23. data/bin/tanuki +2 -1
  24. data/config/common.rb +1 -0
  25. data/config/common_application.rb +3 -6
  26. data/config/development_application.rb +0 -3
  27. data/lib/tanuki.rb +8 -7
  28. data/lib/tanuki/application.rb +108 -81
  29. data/lib/tanuki/argument.rb +10 -5
  30. data/lib/tanuki/argument/integer_range.rb +4 -2
  31. data/lib/tanuki/{behavior/object_behavior.rb → base_behavior.rb} +21 -4
  32. data/lib/tanuki/configurator.rb +20 -8
  33. data/lib/tanuki/const.rb +32 -0
  34. data/lib/tanuki/context.rb +18 -7
  35. data/lib/tanuki/controller.rb +517 -0
  36. data/lib/tanuki/css_compressor.rb +50 -0
  37. data/lib/tanuki/extensions/module.rb +21 -5
  38. data/lib/tanuki/extensions/rack/frozen_route.rb +35 -0
  39. data/lib/tanuki/extensions/rack/static_dir.rb +1 -1
  40. data/lib/tanuki/extensions/sequel/model.rb +7 -0
  41. data/lib/tanuki/i18n.rb +8 -6
  42. data/lib/tanuki/loader.rb +166 -33
  43. data/lib/tanuki/meta_model.rb +176 -0
  44. data/lib/tanuki/{behavior/model_behavior.rb → model_behavior.rb} +7 -3
  45. data/lib/tanuki/model_generator.rb +49 -29
  46. data/lib/tanuki/template_compiler.rb +72 -41
  47. data/lib/tanuki/utility.rb +11 -4
  48. data/lib/tanuki/utility/create.rb +52 -11
  49. data/lib/tanuki/utility/generate.rb +16 -10
  50. data/lib/tanuki/utility/version.rb +1 -1
  51. data/lib/tanuki/version.rb +7 -2
  52. metadata +50 -66
  53. data/app/tanuki/controller/default.thtml +0 -5
  54. data/app/tanuki/controller/index.thtml +0 -1
  55. data/app/user/page/index/default.thtml +0 -121
  56. data/app/user/page/index/index.rb +0 -2
  57. data/config/test_application.rb +0 -2
  58. data/lib/tanuki/behavior/controller_behavior.rb +0 -366
  59. data/lib/tanuki/behavior/meta_model_behavior.rb +0 -160
  60. data/lib/tanuki/extensions/rack/builder.rb +0 -26
  61. data/lib/tanuki/extensions/rack/server.rb +0 -18
  62. data/lib/tanuki/launcher.rb +0 -21
  63. 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
@@ -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