rango 0.1.1.2.11 → 0.1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -1
- data/README.textile +2 -2
- data/bin/rango +1 -0
- data/lib/rango.rb +34 -6
- data/lib/rango/contrib/pagination.rb +1 -4
- data/lib/rango/contrib/pagination/adapters/datamapper.rb +2 -0
- data/lib/rango/controller.rb +1 -0
- data/lib/rango/gv/scaffolding.rb +0 -1
- data/lib/rango/helpers/assets.rb +4 -3
- data/lib/rango/logger.rb +6 -1
- data/lib/rango/orm/README.textile +1 -1
- data/lib/rango/rack/middlewares/basic.rb +16 -7
- data/lib/rango/rack/middlewares/static.rb +2 -2
- data/lib/rango/rack/request.rb +1 -1
- data/lib/rango/router.rb +9 -0
- data/lib/rango/router/adapters/rack_mount.rb +1 -1
- data/lib/rango/router/adapters/usher.rb +2 -2
- data/lib/rango/stacks/controller.rb +7 -0
- data/lib/rango/stacks/mini.rb +5 -0
- data/lib/rango/templates/template.rb +2 -1
- data/lib/rango/version.rb +1 -1
- data/spec/rango/mixins/render_spec.rb +0 -1
- data/stubs/flat/content/flat.ru.rbt +3 -10
- data/stubs/stack/content/Gemfile.rbt +4 -0
- data/stubs/stack/content/config.ru.rbt +3 -3
- data/stubs/stack/content/init.rb.rbt +6 -7
- data/stubs/stack/content/spec/spec_helper.rb +1 -1
- metadata +8 -14
- data/lib/rango/interactive.rb +0 -18
- data/lib/rango/mixins/configurable.rb +0 -20
- data/lib/rango/project.rb +0 -27
- data/lib/rango/settings.rb +0 -98
- data/lib/rango/settings/erubis.rb +0 -15
- data/lib/rango/settings/framework.rb +0 -42
- data/lib/rango/settings/haml.rb +0 -47
- data/lib/rango/settings/template.rb +0 -19
- data/spec/rango/mixins/configurable_spec.rb +0 -0
- data/spec/rango/project_spec.rb +0 -45
- data/spec/rango/settings_spec.rb +0 -27
- data/stubs/flat/content/flat.ru +0 -21
data/CHANGELOG
CHANGED
@@ -34,9 +34,13 @@
|
|
34
34
|
* ImplicitRendering and ExplicitRendering mixins for using locals
|
35
35
|
vs. rendering in context of current controller instance
|
36
36
|
|
37
|
-
= Version 0.1.2,
|
37
|
+
= Version 0.1.2, 13/12/2009, 22651050ea20e2997a9e5d07c8a409eb8e5de4fe
|
38
38
|
* Sequel support
|
39
39
|
* Project generator renamed to stack generator
|
40
40
|
* Removed app and bigapp generators
|
41
41
|
* Added migration task for DataMapper
|
42
42
|
* Removed layer of ORM adapters
|
43
|
+
* Removed Project constant and settings
|
44
|
+
* Much more modular design
|
45
|
+
* Removed dependencies, since you can use whichever subset of Rango
|
46
|
+
* There is Rango::Router.app instead of Project.router
|
data/README.textile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
h1. Installation via RubyGems
|
2
2
|
|
3
|
-
* Daily builds: @gem install rango --pre@
|
3
|
+
* Daily builds: @gem install rango --pre@
|
4
4
|
* Stable version: @gem install rango@
|
5
5
|
* JRuby: @jruby --1.9 -S gem install rango@
|
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
|
|
data/bin/rango
CHANGED
data/lib/rango.rb
CHANGED
@@ -5,7 +5,6 @@ if RUBY_VERSION < "1.9.1"
|
|
5
5
|
end
|
6
6
|
|
7
7
|
require "rango/core_ext"
|
8
|
-
require "rubyexts/attribute"
|
9
8
|
|
10
9
|
rango_lib = File.dirname(__FILE__)
|
11
10
|
unless $:.include?(rango_lib) || $:.include?(File.expand_path(rango_lib))
|
@@ -21,12 +20,20 @@ module Rango
|
|
21
20
|
# Rango::Helpers.send(:include, Pupu::Helpers)
|
22
21
|
Helpers ||= Module.new
|
23
22
|
|
23
|
+
def self.root=(root)
|
24
|
+
@@root = root
|
25
|
+
end
|
26
|
+
|
24
27
|
def self.root
|
25
|
-
|
28
|
+
@@root ||= Dir.pwd
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.media_root=(media_root)
|
32
|
+
@@media_root = media_root
|
26
33
|
end
|
27
34
|
|
28
|
-
def self.
|
29
|
-
File.join(self.root, "
|
35
|
+
def self.media_root
|
36
|
+
@@media_root ||= File.join(self.root, "media")
|
30
37
|
end
|
31
38
|
|
32
39
|
def self.logger
|
@@ -50,7 +57,7 @@ module Rango
|
|
50
57
|
self.environment = options[:environment] if options[:environment]
|
51
58
|
block.call if block_given?
|
52
59
|
self.bootloaders.each do |name, bootloader|
|
53
|
-
logger.debug "Calling bootloader #{name}"
|
60
|
+
# logger.debug "Calling bootloader #{name}"
|
54
61
|
bootloader.call
|
55
62
|
end
|
56
63
|
end
|
@@ -60,7 +67,12 @@ module Rango
|
|
60
67
|
self.boot(options.merge(force: true))
|
61
68
|
end
|
62
69
|
|
63
|
-
|
70
|
+
def self.bootloaders
|
71
|
+
@@bootloaders
|
72
|
+
end
|
73
|
+
|
74
|
+
@@bootloaders = Hash.new
|
75
|
+
|
64
76
|
def self.after_boot(name, &block)
|
65
77
|
self.bootloaders[name] = block
|
66
78
|
end
|
@@ -70,4 +82,20 @@ module Rango
|
|
70
82
|
full_path = File.expand_path(File.join(File.dirname(__FILE__), relative_path))
|
71
83
|
$LOADED_FEATURES.any? { |file| file == full_path }
|
72
84
|
end
|
85
|
+
|
86
|
+
# Start IRB interactive session
|
87
|
+
# @since 0.0.1
|
88
|
+
def self.interactive
|
89
|
+
require "irb"
|
90
|
+
require "rango/utils"
|
91
|
+
|
92
|
+
ARGV.delete("-i") # otherwise irb will read it
|
93
|
+
ENV["RACK_ENV"] = Rango.environment # for racksh
|
94
|
+
unless try_require("racksh/boot")
|
95
|
+
Rango.logger.info("For more goodies install racksh gem")
|
96
|
+
try_require "irb/completion" # some people can have ruby compliled without readline
|
97
|
+
Rango::Utils.load_rackup # so you can use Rango::Router.app etc
|
98
|
+
end
|
99
|
+
IRB.start
|
100
|
+
end
|
73
101
|
end
|
@@ -1,13 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
# http://wiki.github.com/botanicus/rango/pagination
|
4
|
-
|
5
|
-
require "dm-aggregates"
|
6
|
-
|
4
|
+
# Don't forget to load your ORM adapter!
|
7
5
|
require "rango/contrib/pagination/page"
|
8
6
|
require "rango/contrib/pagination/strategies"
|
9
7
|
require "rango/contrib/pagination/helpers"
|
10
|
-
require "rango/contrib/pagination/adapters/#{Project.settings.orm || "datamapper"}"
|
11
8
|
|
12
9
|
Rango::Helpers.send(:include, Rango::Pagination::PaginationMixin)
|
13
10
|
# require code that must be loaded before the application
|
data/lib/rango/controller.rb
CHANGED
data/lib/rango/gv/scaffolding.rb
CHANGED
data/lib/rango/helpers/assets.rb
CHANGED
@@ -4,25 +4,26 @@
|
|
4
4
|
# ... but what if I need full path? It should be tested if file exist, of course
|
5
5
|
# javascript Path.new("design/whatever.js")
|
6
6
|
require "rango/helpers"
|
7
|
+
require "media-path"
|
7
8
|
|
8
9
|
module Rango
|
9
10
|
module Helpers
|
10
11
|
# stolen from pupu (but it's OK, it's my code)
|
11
12
|
# @since 0.0.2
|
12
13
|
def javascript(basename)
|
13
|
-
path = MediaPath.new(File.join(
|
14
|
+
path = MediaPath.new(File.join(Rango.media_root, "javascripts", "#{basename}.js"))
|
14
15
|
tag :script, src: path.url, type: "text/javascript"
|
15
16
|
end
|
16
17
|
|
17
18
|
# @since 0.0.2
|
18
19
|
def stylesheet(basename, attrs = Hash.new)
|
19
|
-
path = MediaPath.new(File.join(
|
20
|
+
path = MediaPath.new(File.join(Rango.media_root, "stylesheets", basename))
|
20
21
|
default = {href: path.url, media: 'screen', rel: 'stylesheet', type: 'text/css'}
|
21
22
|
single_tag :link, default.merge(attrs)
|
22
23
|
end
|
23
24
|
|
24
25
|
def image(basename, attrs = Hash.new)
|
25
|
-
path = MediaPath.new(File.join(
|
26
|
+
path = MediaPath.new(File.join(Rango.media_root, "images", basename))
|
26
27
|
default = {src: path.url, alt: path.basename}
|
27
28
|
single_tag :img, default.merge(attrs)
|
28
29
|
end
|
data/lib/rango/logger.rb
CHANGED
@@ -13,7 +13,7 @@ h1. Why not ...
|
|
13
13
|
|
14
14
|
h2. Save Used ORM in Project.orm or somewhere?
|
15
15
|
|
16
|
-
Because if you need have aditional support for each ORM, it's part of setup to put @load "myplugin/tasks.rake"@ to user's Rakefile etc, so there is no need for this.
|
16
|
+
Because if you need have aditional support for each ORM, it's part of setup to put @load "myplugin/tasks/datamapper.rake"@ to user's Rakefile etc, so there is no need for this.
|
17
17
|
|
18
18
|
h2. Support @config/database.yml@
|
19
19
|
|
@@ -13,27 +13,36 @@ module Rango
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
16
|
module Rango
|
18
17
|
module Middlewares
|
19
18
|
class Basic
|
19
|
+
def self.media_prefix
|
20
|
+
@@media_prefix
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.media_prefix=(media_prefix)
|
24
|
+
@@media_prefix = media_prefix
|
25
|
+
end
|
26
|
+
|
27
|
+
@@media_prefix = ""
|
28
|
+
|
20
29
|
attr_accessor :before, :after
|
21
30
|
def initialize(app, &block)
|
22
31
|
@@called = false unless defined?(@@called) # I'm not entirely sure why we have to do this
|
23
|
-
@app = app
|
32
|
+
@app = app#.extend(Rango::RackDebug)
|
24
33
|
|
25
34
|
#, key: 'rack.session', domain: 'foo.com', path: '/', expire_after: 2592000, secret: 'change_me'
|
26
35
|
self.before = [Rango::Middlewares::Encoding, Rack::MethodOverride, [Rack::Session::Cookie, path: '/']]
|
27
36
|
self.after = [Rack::ContentType, Rack::ContentLength, Rack::Head]
|
28
37
|
|
29
38
|
self.static_files_serving
|
30
|
-
|
39
|
+
|
31
40
|
block.call(self) if block_given?
|
32
41
|
# use Rango::Middlewares::Basic do |middleware|
|
33
42
|
# middleware.before.push MyMiddleware
|
34
43
|
# end
|
35
44
|
end
|
36
|
-
|
45
|
+
|
37
46
|
def call(env)
|
38
47
|
# Matryoshka principle
|
39
48
|
# MethodOverride.new(Encoding.new(@app))
|
@@ -56,7 +65,7 @@ module Rango
|
|
56
65
|
end
|
57
66
|
|
58
67
|
def static_files_serving
|
59
|
-
if
|
68
|
+
if self.class.media_prefix.empty?
|
60
69
|
Rango.logger.info("Media files are routed directly to the /")
|
61
70
|
require "rango/rack/middlewares/static"
|
62
71
|
self.before.unshift Rango::Middlewares::Static
|
@@ -68,8 +77,8 @@ module Rango
|
|
68
77
|
# use Rack::Static, :urls => ["/css", "/images"], :root => "public"
|
69
78
|
# will serve all requests beginning with /css or /images from the folder
|
70
79
|
# "public" in the current directory (ie public/css/* and public/images/*)
|
71
|
-
Rango.logger.info("Media files are available on #{
|
72
|
-
options = {urls: [
|
80
|
+
Rango.logger.info("Media files are available on #{self.class.media_prefix}")
|
81
|
+
options = {urls: [self.class.media_prefix]}
|
73
82
|
self.before.unshift [Rack::Static, options]
|
74
83
|
end
|
75
84
|
end
|
@@ -11,7 +11,7 @@ module Rango
|
|
11
11
|
# @since 0.0.2
|
12
12
|
def initialize(app)
|
13
13
|
@app = app
|
14
|
-
@file_server = ::Rack::File.new(
|
14
|
+
@file_server = ::Rack::File.new(Rango.media_root)
|
15
15
|
end
|
16
16
|
|
17
17
|
# @since 0.0.2
|
@@ -19,7 +19,7 @@ module Rango
|
|
19
19
|
path = env['PATH_INFO'].chomp('/')
|
20
20
|
method = env['REQUEST_METHOD']
|
21
21
|
|
22
|
-
prefix =
|
22
|
+
prefix = Rango::Middlewares::Basic.media_prefix.chomp("/")
|
23
23
|
prefix_regexp = Regexp.new(%r[^#{prefix}/])
|
24
24
|
if path.match(prefix_regexp) && FILE_METHODS.include?(method)
|
25
25
|
if file_exist?(path)
|
data/lib/rango/rack/request.rb
CHANGED
data/lib/rango/router.rb
CHANGED
@@ -14,6 +14,15 @@ module Rango
|
|
14
14
|
|
15
15
|
class Router
|
16
16
|
@@routers ||= Hash.new
|
17
|
+
def self.app
|
18
|
+
@@app
|
19
|
+
rescue
|
20
|
+
raise "You have to assign your router application to Rango::Router.app\nFor example Rango::Router.app = Usher::Interface.for(:rack, &block)"
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.app=(app)
|
24
|
+
@@app = app
|
25
|
+
end
|
17
26
|
|
18
27
|
def self.router
|
19
28
|
@@router
|
@@ -10,8 +10,8 @@ module Rango
|
|
10
10
|
module UrlHelper
|
11
11
|
# url(:login)
|
12
12
|
def url(*args)
|
13
|
-
raise "You have to asign your routes to
|
14
|
-
|
13
|
+
raise "You have to asign your routes to Rango::Router.app, for example Rango::Router.app = Usher::Interface.for(:rack) { get('/') }" if Rango::Router.app.nil?
|
14
|
+
Rango::Router.app.router.generator.generate(*args)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -14,6 +14,7 @@ module Rango
|
|
14
14
|
|
15
15
|
class Template
|
16
16
|
cattr_accessor :template_paths
|
17
|
+
self.template_paths = [File.join(Rango.root, "templates")]
|
17
18
|
|
18
19
|
# template -> supertemplate is the same relationship as class -> superclass
|
19
20
|
# @since 0.0.2
|
@@ -69,7 +70,7 @@ module Rango
|
|
69
70
|
|
70
71
|
protected
|
71
72
|
def find_in_template_paths
|
72
|
-
self.template_paths.each do |directory|
|
73
|
+
self.class.template_paths.each do |directory|
|
73
74
|
path = File.join(directory, self.path)
|
74
75
|
return Dir[path, "#{path}.*"].first
|
75
76
|
end
|
data/lib/rango/version.rb
CHANGED
@@ -2,20 +2,13 @@
|
|
2
2
|
# encoding: utf-8
|
3
3
|
|
4
4
|
# rackup -p 4000 -s thin flat.ru
|
5
|
-
require "rango"
|
6
|
-
require "rango/
|
5
|
+
require "rango/stacks/mini"
|
6
|
+
require "rango/router/adapters/basic"
|
7
7
|
|
8
8
|
Rango.boot
|
9
9
|
|
10
10
|
use Rango::Basic
|
11
11
|
|
12
|
-
Project.configure do
|
13
|
-
# TODO
|
14
|
-
end
|
15
|
-
|
16
|
-
# router
|
17
|
-
require "rango/router/adapters/basic"
|
18
|
-
|
19
12
|
map("/") do
|
20
|
-
run app { "<h1>Rango is just Awesome!</h1>" }
|
13
|
+
run Rango::Mini.app { "<h1>Rango is just Awesome!</h1>" }
|
21
14
|
end
|
@@ -11,8 +11,12 @@
|
|
11
11
|
# === Shared Gems === #
|
12
12
|
# Specify a dependency on rango. When the bundler downloads gems,
|
13
13
|
# it will download rango as well as all of rango' dependencies
|
14
|
+
|
15
|
+
# rango stack
|
14
16
|
gem "rango"#, git: "git://github.com/botanicus/rango.git"
|
15
17
|
gem "rack"#, git: "git://github.com/rack/rack.git"
|
18
|
+
gem "tilt"#, git: "git://github.com/rtomayko/tilt.git"
|
19
|
+
gem "rubyexts"#, git: "git://github.com/botanicus/rubyexts.git"
|
16
20
|
|
17
21
|
# router
|
18
22
|
<% case @router %>
|
@@ -44,12 +44,12 @@ Rango::Router.use(:<%= @router.to_sym %>)
|
|
44
44
|
<% case @router %>
|
45
45
|
<% when "usher" %>
|
46
46
|
# http://github.com/joshbuddy/usher
|
47
|
-
|
47
|
+
Rango::Router.app = Usher::Interface.for(:rack) do
|
48
48
|
get("/").to(<%= @name.camel_case %>::ShowCase.dispatcher(:index)).name(:showcase)
|
49
49
|
end
|
50
50
|
<% when "rack-mount" %>
|
51
51
|
# http://github.com/josh/rack-mount
|
52
|
-
|
52
|
+
Rango::Router.app = Rack::Mount::RouteSet.new do |set|
|
53
53
|
# add_route takes a rack application and conditions to match with
|
54
54
|
# conditions may be strings or regexps
|
55
55
|
# See Rack::Mount::RouteSet#add_route for more options.
|
@@ -62,4 +62,4 @@ end
|
|
62
62
|
<% end %>
|
63
63
|
|
64
64
|
use Rango::Middlewares::Basic
|
65
|
-
run
|
65
|
+
run Rango::Router.app
|
@@ -16,12 +16,7 @@ rescue LoadError => exception
|
|
16
16
|
abort "LoadError during loading gems/environment: #{exception.message}\nRun gem bundle to fix it."
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
require_relative "settings_local"
|
21
|
-
|
22
|
-
require "rango"
|
23
|
-
require "rango/helpers"
|
24
|
-
require "rango/environments"
|
19
|
+
require "rango/stacks/controller"
|
25
20
|
|
26
21
|
# http://wiki.github.com/botanicus/rango/environments-support
|
27
22
|
require "rango/environments"
|
@@ -38,8 +33,12 @@ Bundler.require_env(environment)
|
|
38
33
|
|
39
34
|
Rango.boot(environment: environment)
|
40
35
|
|
36
|
+
# settings
|
37
|
+
require_relative "settings_local"
|
38
|
+
|
41
39
|
# register applications
|
42
|
-
require_relative "
|
40
|
+
require_relative "views.rb"
|
41
|
+
require_relative "models.rb"
|
43
42
|
|
44
43
|
# if you will run this script with -i argument, interactive session will begin
|
45
44
|
Rango.interactive if ARGV.delete("-i")
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Jakub \xC5\xA0\xC5\xA5astn\xC3\xBD aka Botanicus"
|
@@ -103,13 +103,11 @@ files:
|
|
103
103
|
- lib/rango/helpers/general.rb
|
104
104
|
- lib/rango/helpers/syntax.rb
|
105
105
|
- lib/rango/helpers.rb
|
106
|
-
- lib/rango/interactive.rb
|
107
106
|
- lib/rango/logger.rb
|
108
107
|
- lib/rango/loggers/fireruby.rb
|
109
108
|
- lib/rango/mini.rb
|
110
109
|
- lib/rango/mini_render.rb
|
111
110
|
- lib/rango/mixins/application.rb
|
112
|
-
- lib/rango/mixins/configurable.rb
|
113
111
|
- lib/rango/mixins/filters.rb
|
114
112
|
- lib/rango/mixins/http_caching.rb
|
115
113
|
- lib/rango/mixins/logger.rb
|
@@ -121,7 +119,6 @@ files:
|
|
121
119
|
- lib/rango/orm/tasks/datamapper.rake
|
122
120
|
- lib/rango/orm/tasks/sequel.rake
|
123
121
|
- lib/rango/path.rb
|
124
|
-
- lib/rango/project.rb
|
125
122
|
- lib/rango/rack/middlewares/basic.rb
|
126
123
|
- lib/rango/rack/middlewares/email_obfuscator.rb
|
127
124
|
- lib/rango/rack/middlewares/encoding.rb
|
@@ -132,11 +129,8 @@ files:
|
|
132
129
|
- lib/rango/router/adapters/urlmap.rb
|
133
130
|
- lib/rango/router/adapters/usher.rb
|
134
131
|
- lib/rango/router.rb
|
135
|
-
- lib/rango/
|
136
|
-
- lib/rango/
|
137
|
-
- lib/rango/settings/haml.rb
|
138
|
-
- lib/rango/settings/template.rb
|
139
|
-
- lib/rango/settings.rb
|
132
|
+
- lib/rango/stacks/controller.rb
|
133
|
+
- lib/rango/stacks/mini.rb
|
140
134
|
- lib/rango/support/cucumber/steps/given_steps.rb
|
141
135
|
- lib/rango/support/cucumber/steps/then_steps.rb
|
142
136
|
- lib/rango/support/cucumber/steps/when_steps.rb
|
@@ -168,7 +162,6 @@ files:
|
|
168
162
|
- spec/rango/loggers/fireruby_spec.rb
|
169
163
|
- spec/rango/mini_spec.rb
|
170
164
|
- spec/rango/mixins/application_spec.rb
|
171
|
-
- spec/rango/mixins/configurable_spec.rb
|
172
165
|
- spec/rango/mixins/filters_spec.rb
|
173
166
|
- spec/rango/mixins/http_caching_spec.rb
|
174
167
|
- spec/rango/mixins/message_spec.rb
|
@@ -179,7 +172,6 @@ files:
|
|
179
172
|
- spec/rango/orm/adapters/sequel_spec.rb
|
180
173
|
- spec/rango/orm/support/datamapper/fields_spec.rb
|
181
174
|
- spec/rango/orm/support/datamapper/support_spec.rb
|
182
|
-
- spec/rango/project_spec.rb
|
183
175
|
- spec/rango/rack/middlewares/basic_spec.rb
|
184
176
|
- spec/rango/rack/middlewares/email_obfuscator_spec.rb
|
185
177
|
- spec/rango/rack/middlewares/encoding_spec.rb
|
@@ -194,7 +186,6 @@ files:
|
|
194
186
|
- spec/rango/settings/framework_spec.rb
|
195
187
|
- spec/rango/settings/haml_spec.rb
|
196
188
|
- spec/rango/settings/template_spec.rb
|
197
|
-
- spec/rango/settings_spec.rb
|
198
189
|
- spec/rango/support/cucumber/steps/given_steps_spec.rb
|
199
190
|
- spec/rango/support/cucumber/steps/then_steps_spec.rb
|
200
191
|
- spec/rango/support/cucumber/steps/when_steps_spec.rb
|
@@ -232,7 +223,6 @@ files:
|
|
232
223
|
- spec/stubs/templates/variables.html.haml
|
233
224
|
- stubs/features/content/env.rb
|
234
225
|
- stubs/features/metadata.yml
|
235
|
-
- stubs/flat/content/flat.ru
|
236
226
|
- stubs/flat/content/flat.ru.rbt
|
237
227
|
- stubs/flat/metadata.yml
|
238
228
|
- stubs/flat/postprocess.rb
|
@@ -304,12 +294,16 @@ post_install_message: |
|
|
304
294
|
* ImplicitRendering and ExplicitRendering mixins for using locals
|
305
295
|
vs. rendering in context of current controller instance
|
306
296
|
|
307
|
-
= Version 0.1.2,
|
297
|
+
= Version 0.1.2, 13/12/2009, 22651050ea20e2997a9e5d07c8a409eb8e5de4fe
|
308
298
|
* Sequel support
|
309
299
|
* Project generator renamed to stack generator
|
310
300
|
* Removed app and bigapp generators
|
311
301
|
* Added migration task for DataMapper
|
312
302
|
* Removed layer of ORM adapters
|
303
|
+
* Removed Project constant and settings
|
304
|
+
* Much more modular design
|
305
|
+
* Removed dependencies, since you can use whichever subset of Rango
|
306
|
+
* There is Rango::Router.app instead of Project.router
|
313
307
|
|
314
308
|
rdoc_options: []
|
315
309
|
|
data/lib/rango/interactive.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require "irb"
|
4
|
-
require "rango/utils"
|
5
|
-
require "rubyexts"
|
6
|
-
|
7
|
-
# Start IRB interactive session
|
8
|
-
# @since 0.0.1
|
9
|
-
def Rango.interactive
|
10
|
-
ARGV.delete("-i") # otherwise irb will read it
|
11
|
-
ENV["RACK_ENV"] = Rango.environment # for racksh
|
12
|
-
unless try_require("racksh/boot")
|
13
|
-
Rango.logger.info("For more goodies install racksh gem")
|
14
|
-
try_require "irb/completion" # some people can have ruby compliled without readline
|
15
|
-
Rango::Utils.load_rackup # so you can use Project.router etc
|
16
|
-
end
|
17
|
-
IRB.start
|
18
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
# TODO: move into separate gem with settings
|
4
|
-
module Rango
|
5
|
-
module Configurable
|
6
|
-
# @since 0.0.1
|
7
|
-
# @example
|
8
|
-
# Project.configure do
|
9
|
-
# self.property = "value"
|
10
|
-
# end
|
11
|
-
# @yield [block] Block which will be evaluated in Project.setttings object.
|
12
|
-
# @return [Rango::Settings::Framework] Returns project settings.
|
13
|
-
def configure(&block)
|
14
|
-
unless self.respond_to?(:settings)
|
15
|
-
raise "#{self.inspect} has to respond to settings"
|
16
|
-
end
|
17
|
-
self.settings.instance_eval(&block)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/lib/rango/project.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require "rango/settings"
|
4
|
-
require "rango/mixins/application"
|
5
|
-
require "rango/mixins/configurable"
|
6
|
-
require "rubyexts/mixins/import"
|
7
|
-
|
8
|
-
class Project
|
9
|
-
class << self
|
10
|
-
include RubyExts::ImportMixin
|
11
|
-
include Rango::ApplicationMixin
|
12
|
-
include Rango::Configurable
|
13
|
-
# @since 0.0.1
|
14
|
-
# @return [String] String reprezentation of project root directory.
|
15
|
-
root = attribute :root, Dir.pwd
|
16
|
-
|
17
|
-
# @since 0.0.1
|
18
|
-
# @return [Rango::Settings::Framework] Project settings.
|
19
|
-
attribute :settings, Rango::Settings::Framework.new
|
20
|
-
|
21
|
-
# @since 0.0.5
|
22
|
-
# @return [Rango::ORM::Adapter, NilClass] Used ORM
|
23
|
-
attribute :orm
|
24
|
-
|
25
|
-
attribute :router
|
26
|
-
end
|
27
|
-
end
|
data/lib/rango/settings.rb
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require "rubyexts/attribute"
|
4
|
-
|
5
|
-
module Rango
|
6
|
-
module Settings
|
7
|
-
ConfigurationError = Class.new(StandardError)
|
8
|
-
|
9
|
-
class Settings
|
10
|
-
def initialize(params = Hash.new)
|
11
|
-
params.each do |key, value|
|
12
|
-
self.send("#{key}=", value)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
# @since 0.0.1
|
17
|
-
# @example
|
18
|
-
# Project.settings.merge(MyPlugin.settings)
|
19
|
-
# @param [Rango::Settings] another Settings which will be merged into self. It doesn't change self.
|
20
|
-
# @return [Hash] Hash of settings attributes.
|
21
|
-
# TODO: maybe it should returns Rango::Settings?
|
22
|
-
def merge(another)
|
23
|
-
hattributes = another.is_a?(Hash) ? another : another.hattributes
|
24
|
-
self.hattributes.merge(hattributes)
|
25
|
-
end
|
26
|
-
|
27
|
-
# @since 0.0.1
|
28
|
-
# @example
|
29
|
-
# Project.settings.merge!(MyPlugin.settings)
|
30
|
-
# @param [Rango::Settings] another Settings which will be merged into self. It change self.
|
31
|
-
# @return [Hash] Hash of settings attributes.
|
32
|
-
# TODO: maybe it should returns Rango::Settings?
|
33
|
-
def merge!(another)
|
34
|
-
self.hattributes.merge!(another.hattributes)
|
35
|
-
end
|
36
|
-
|
37
|
-
# @since 0.0.1
|
38
|
-
# @example
|
39
|
-
# @return [String] All settings attributes in inspect format.
|
40
|
-
def inspect
|
41
|
-
self.hattributes.inspect
|
42
|
-
end
|
43
|
-
|
44
|
-
# @since 0.0.1
|
45
|
-
def to_hash
|
46
|
-
self.hattributes.reject { |key, value| value.nil? }
|
47
|
-
end
|
48
|
-
|
49
|
-
# @since 0.0.2
|
50
|
-
def settings_module(name)
|
51
|
-
if self.hattributes[name]
|
52
|
-
return self.hattributes[name]
|
53
|
-
else
|
54
|
-
require "rango/settings/#{name}"
|
55
|
-
const_name = name.to_s.camel_case
|
56
|
-
constant = Rango::Settings.const_get(const_name)
|
57
|
-
instance = constant.new
|
58
|
-
self.hattributes[name] = instance
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
# @since 0.0.1
|
63
|
-
# @example
|
64
|
-
# Project.configure do
|
65
|
-
# self.foobar = "something"
|
66
|
-
# end
|
67
|
-
# # => Logger will warn you that property foobar doesn't exist.
|
68
|
-
# @param [type] name explanation
|
69
|
-
def method_missing(name, *args, &block)
|
70
|
-
if name.to_s.match(/^([\w\d]+)=$/) && args.length.eql?(1)# && not block_given?
|
71
|
-
raise ConfigurationError, "Unknown #{self.class} item: #$1"
|
72
|
-
else
|
73
|
-
super(name, *args, &block)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
class Anonymous < Settings
|
79
|
-
# @since 0.0.2
|
80
|
-
# @example
|
81
|
-
# Project.configure do
|
82
|
-
# self.foobar = "something"
|
83
|
-
# end
|
84
|
-
# # => Set the property without warning
|
85
|
-
# @param [type] name explanation
|
86
|
-
def method_missing(name, *args, &block)
|
87
|
-
if name.to_s.match(/^([\w\d]+)=$/) && args.length.eql?(1)# && not block_given?
|
88
|
-
self.class.hattribute $1.to_sym
|
89
|
-
self.send(name, *args, &block)
|
90
|
-
else
|
91
|
-
super(name, *args, &block)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
require "rango/settings/framework"
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require "rango/settings"
|
4
|
-
|
5
|
-
module Rango
|
6
|
-
module Settings
|
7
|
-
class Erubis < Settings
|
8
|
-
# @since 0.0.2
|
9
|
-
hattribute :pattern, "<% %>" # can be string or regexp
|
10
|
-
|
11
|
-
# @since 0.0.2
|
12
|
-
hattribute :custom_class # use your own class instead of Erubis::Eruby. Don't forget that you must include (TODO: what) for autoescaping
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require "rango/settings"
|
4
|
-
|
5
|
-
module Rango
|
6
|
-
module Settings
|
7
|
-
class Framework < Settings
|
8
|
-
# @since 0.0.1
|
9
|
-
# @return [String] Path to your +media+ directory.
|
10
|
-
hattribute :media_root, lambda { File.join(Project.root, "media") }
|
11
|
-
|
12
|
-
# @since 0.0.2
|
13
|
-
# @return [String] rango-project.org/media/javascripts/mootools-core.js
|
14
|
-
hattribute :media_prefix, String.new#"/media"
|
15
|
-
|
16
|
-
# @since 0.0.1
|
17
|
-
# @return [Array[String]] Array with paths where Rango will trying to find templates.
|
18
|
-
hattribute :template_dirs, ["templates"]
|
19
|
-
|
20
|
-
# @since 0.0.2
|
21
|
-
hattribute :mime_formats, Array.new
|
22
|
-
|
23
|
-
# @since 0.0.2
|
24
|
-
# Just informative for plugins, it doesn't really do anything
|
25
|
-
hattribute :orm
|
26
|
-
|
27
|
-
# @since 0.0.2
|
28
|
-
# Project.settings.erubis.pattern
|
29
|
-
# hattribute :erubis, lambda { self.settings_module(:erubis) }
|
30
|
-
def erubis
|
31
|
-
self.settings_module(:erubis)
|
32
|
-
end
|
33
|
-
|
34
|
-
# @since 0.0.2
|
35
|
-
# Project.settings.haml.format
|
36
|
-
# hattribute :haml, lambda { self.settings_module(:haml) }
|
37
|
-
def haml
|
38
|
-
self.settings_module(:haml)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
data/lib/rango/settings/haml.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require "rango" # Rango.loaded?
|
4
|
-
require "rango/settings"
|
5
|
-
|
6
|
-
module Rango
|
7
|
-
module Settings
|
8
|
-
class Haml < Settings
|
9
|
-
# @since 0.0.2
|
10
|
-
# Determines the output format. The default is :xhtml. Other options are :html4 and :html5, which are identical to :xhtml except there are no self-closing tags, XML prolog is ignored and correct DOCTYPEs are generated.
|
11
|
-
hattribute :format, :xhtml # TODO: take from Project.settings.template.format
|
12
|
-
|
13
|
-
# @since 0.0.2
|
14
|
-
# Sets whether or not to escape HTML-sensitive characters in script. If this is true, = behaves like &=; otherwise, it behaves like !=. Note that if this is set, != should be used for yielding to subtemplates and rendering partials. Defaults to false.
|
15
|
-
hattribute :escape_html, false
|
16
|
-
|
17
|
-
# @since 0.0.2
|
18
|
-
# Whether or not attribute hashes and Ruby scripts designated by = or ~ should be evaluated. If this is true, said scripts are rendered as empty strings. Defaults to false.
|
19
|
-
hattribute :suppress_eval, false
|
20
|
-
|
21
|
-
# @since 0.0.2
|
22
|
-
# The character that should wrap element attributes. This defaults to ' (an apostrophe). Characters of this type within the attributes will be escaped (e.g. by replacing them with ') if the character is an apostrophe or a quotation mark.
|
23
|
-
hattribute :attr_wrapper, '"'
|
24
|
-
|
25
|
-
# @since 0.0.2
|
26
|
-
# A list of tag names that should be automatically self-closed if they have no content. Defaults to ['meta', 'img', 'link', 'br', 'hr', 'input', 'area', 'param', 'col', 'base'].
|
27
|
-
hattribute :autoclose, %w[meta img link br hr input area param col base]
|
28
|
-
|
29
|
-
# @since 0.0.2
|
30
|
-
# A list of tag names that should automatically have their newlines preserved using the Haml::Helpers#preserve helper. This means that any content given on the same line as the tag will be preserved. For example
|
31
|
-
# %textarea= "Foo\nBar"
|
32
|
-
# compiles to:
|
33
|
-
# <textarea>Foo&
Bar</textarea>
|
34
|
-
# Defaults to ['textarea', 'pre'].
|
35
|
-
hattribute :preserve, %w[textarea pre]
|
36
|
-
|
37
|
-
# @since 0.0.7
|
38
|
-
# 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
|
39
|
-
hattribute :ugly, lambda { Rango.loaded?("environments.rb") ? !Rango.development? : false }
|
40
|
-
|
41
|
-
# @since 0.1.1
|
42
|
-
# You don't have to explicitly specify attributes which are same for all the tags of same
|
43
|
-
# kind in your markup over and over if you just specify them as an options for the engine
|
44
|
-
hattribute :default_attributes, {script: {type: "text/javascript"}, form: {method: "POST"}}
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require "rango/settings"
|
4
|
-
|
5
|
-
module Rango
|
6
|
-
module Settings
|
7
|
-
class Template < Settings
|
8
|
-
# @since 0.0.3
|
9
|
-
hattribute :caching, Rango.development?
|
10
|
-
|
11
|
-
# @since 0.0.3
|
12
|
-
# useful for helpers
|
13
|
-
hattribute :format, :html
|
14
|
-
|
15
|
-
# @since 0.0.3
|
16
|
-
hattribute :format_version, 5
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
File without changes
|
data/spec/rango/project_spec.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require_relative "../spec_helper"
|
4
|
-
require "media-path"
|
5
|
-
require "rango/project"
|
6
|
-
|
7
|
-
describe Project do
|
8
|
-
it "should have root" do
|
9
|
-
Project.should respond_to(:root)
|
10
|
-
Project.root.should be_kind_of(String)
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should have path which is similar as root, but it is MediaPath, not String" do
|
14
|
-
Project.should respond_to(:path)
|
15
|
-
Project.path.should be_kind_of(MediaPath)
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should respond to name" do
|
19
|
-
Project.should respond_to(:name)
|
20
|
-
Project.name.should eql("rango") # it's derived from Dir.pwd
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should have settings" do
|
24
|
-
pending
|
25
|
-
Project.should respond_to(:settings)
|
26
|
-
Project.setttings.should be_kind_of(Rango::Settings::Framework)
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should have logger" do
|
30
|
-
Project.should respond_to(:logger)
|
31
|
-
Project.logger.should be_kind_of(RubyExts::Logger)
|
32
|
-
end
|
33
|
-
|
34
|
-
describe ".import" do
|
35
|
-
# TODO
|
36
|
-
end
|
37
|
-
|
38
|
-
describe ".import!" do
|
39
|
-
# TODO
|
40
|
-
end
|
41
|
-
|
42
|
-
describe ".configure" do
|
43
|
-
# TODO
|
44
|
-
end
|
45
|
-
end
|
data/spec/rango/settings_spec.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require_relative "../spec_helper"
|
4
|
-
|
5
|
-
describe Rango::Settings do
|
6
|
-
before(:each) do
|
7
|
-
@settings = Rango::Settings::Framework.new
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should can merge one settings with another" do
|
11
|
-
p @settings
|
12
|
-
# TODO
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should can merge! one settings with another" do
|
16
|
-
# TODO
|
17
|
-
end
|
18
|
-
|
19
|
-
it "should log message if anyone tries to write nonexisting property" do
|
20
|
-
# TODO
|
21
|
-
#@settings.foobar = "something"
|
22
|
-
end
|
23
|
-
|
24
|
-
describe Rango::Settings::Framework do
|
25
|
-
# TODO
|
26
|
-
end
|
27
|
-
end
|
data/stubs/flat/content/flat.ru
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
#!/usr/bin/env rackup -s thin -p 4000
|
2
|
-
# encoding: utf-8
|
3
|
-
|
4
|
-
# rackup -p 4000 -s thin flat.ru
|
5
|
-
require "rango"
|
6
|
-
require "rango/mixins/mini"
|
7
|
-
|
8
|
-
Rango.boot
|
9
|
-
|
10
|
-
use Rango::Basic
|
11
|
-
|
12
|
-
Project.configure do
|
13
|
-
# TODO
|
14
|
-
end
|
15
|
-
|
16
|
-
# router
|
17
|
-
require "rango/router/adapters/basic"
|
18
|
-
|
19
|
-
map("/") do
|
20
|
-
run app { "<h1>Rango is just Awesome!</h1>" }
|
21
|
-
end
|