ramaze 0.1.0 → 0.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/Rakefile +4 -12
- data/bin/ramaze +95 -171
- data/doc/CHANGELOG +387 -4
- data/doc/README +81 -13
- data/doc/meta/announcement.txt +51 -8
- data/doc/meta/configuration.txt +17 -34
- data/doc/meta/internals.txt +34 -4
- data/doc/migrate/1110_to_1111.txt +131 -0
- data/doc/readme_chunks/features.txt +81 -12
- data/doc/readme_chunks/installing.txt +0 -1
- data/doc/tutorial/todolist.html +293 -65
- data/doc/tutorial/{todolist.txt → todolist.mkd} +251 -51
- data/examples/blog/main.rb +1 -1
- data/examples/blog/src/model.rb +0 -1
- data/examples/hello.rb +2 -5
- data/examples/templates/template/external.haml +5 -5
- data/examples/templates/template/external.liquid +1 -1
- data/examples/templates/template/external.mab +8 -8
- data/examples/templates/template/external.rem +30 -0
- data/examples/templates/template/external.rhtml +6 -7
- data/examples/templates/template/external.zmr +13 -9
- data/examples/templates/template_amrita2.rb +8 -8
- data/examples/templates/template_erubis.rb +11 -11
- data/examples/templates/template_ezamar.rb +9 -11
- data/examples/templates/template_haml.rb +13 -13
- data/examples/templates/template_liquid.rb +10 -10
- data/examples/templates/template_markaby.rb +13 -10
- data/examples/templates/template_remarkably.rb +59 -0
- data/examples/todolist/main.rb +1 -7
- data/examples/todolist/src/controller/main.rb +26 -13
- data/examples/todolist/src/element/page.rb +5 -0
- data/examples/whywiki/main.rb +1 -1
- data/lib/proto/main.rb +0 -8
- data/lib/proto/public/css/ramaze_error.css +12 -4
- data/lib/proto/public/error.zmr +6 -25
- data/lib/ramaze.rb +35 -245
- data/lib/ramaze/action.rb +21 -0
- data/lib/ramaze/adapter.rb +94 -29
- data/lib/ramaze/adapter/base.rb +57 -0
- data/lib/ramaze/adapter/mongrel.rb +12 -19
- data/lib/ramaze/adapter/webrick.rb +21 -20
- data/lib/ramaze/cache.rb +47 -3
- data/lib/ramaze/cache/memcached.rb +22 -0
- data/lib/ramaze/cache/yaml_store.rb +19 -0
- data/lib/ramaze/controller.rb +47 -271
- data/lib/ramaze/controller/error.rb +43 -0
- data/lib/ramaze/controller/render.rb +90 -0
- data/lib/ramaze/controller/resolve.rb +147 -0
- data/lib/ramaze/dispatcher.rb +41 -9
- data/lib/ramaze/dispatcher/file.rb +1 -1
- data/lib/ramaze/global.rb +73 -158
- data/lib/ramaze/global/dsl.rb +29 -0
- data/lib/ramaze/global/globalstruct.rb +90 -0
- data/lib/ramaze/helper.rb +1 -1
- data/lib/ramaze/helper/aspect.rb +39 -179
- data/lib/ramaze/helper/cache.rb +8 -9
- data/lib/ramaze/helper/cgi.rb +23 -0
- data/lib/ramaze/helper/file.rb +3 -0
- data/lib/ramaze/helper/inform.rb +3 -0
- data/lib/ramaze/helper/link.rb +56 -63
- data/lib/ramaze/helper/nitroform.rb +4 -0
- data/lib/ramaze/helper/redirect.rb +1 -1
- data/lib/ramaze/inform.rb +6 -2
- data/lib/ramaze/inform/analogger.rb +5 -1
- data/lib/ramaze/inform/hub.rb +1 -1
- data/lib/ramaze/inform/informing.rb +7 -0
- data/lib/ramaze/snippets/kernel/aquire.rb +2 -0
- data/lib/ramaze/snippets/kernel/constant.rb +2 -0
- data/lib/ramaze/snippets/kernel/pretty_inspect.rb +2 -0
- data/lib/ramaze/snippets/object/traits.rb +4 -0
- data/lib/ramaze/snippets/openstruct/temp.rb +3 -0
- data/lib/ramaze/snippets/string/DIVIDE.rb +2 -0
- data/lib/ramaze/snippets/string/camel_case.rb +2 -0
- data/lib/ramaze/snippets/string/color.rb +2 -0
- data/lib/ramaze/snippets/string/each.rb +2 -0
- data/lib/ramaze/snippets/string/snake_case.rb +3 -0
- data/lib/ramaze/snippets/struct/fill.rb +8 -2
- data/lib/ramaze/snippets/struct/values_at.rb +16 -0
- data/lib/ramaze/snippets/symbol/to_proc.rb +3 -0
- data/lib/ramaze/sourcereload.rb +89 -0
- data/lib/ramaze/template.rb +21 -12
- data/lib/ramaze/template/amrita2.rb +6 -6
- data/lib/ramaze/template/erubis.rb +4 -9
- data/lib/ramaze/template/ezamar.rb +13 -57
- data/lib/ramaze/template/ezamar/element.rb +10 -12
- data/lib/ramaze/template/ezamar/engine.rb +40 -101
- data/lib/ramaze/template/ezamar/morpher.rb +3 -3
- data/lib/ramaze/template/haml.rb +3 -6
- data/lib/ramaze/template/liquid.rb +4 -9
- data/lib/ramaze/template/markaby.rb +16 -22
- data/lib/ramaze/template/remarkably.rb +28 -0
- data/lib/ramaze/tool/mime.rb +2 -0
- data/lib/ramaze/tool/record.rb +6 -0
- data/lib/ramaze/trinity/request.rb +44 -54
- data/lib/ramaze/trinity/response.rb +1 -1
- data/lib/ramaze/trinity/session.rb +15 -37
- data/lib/ramaze/version.rb +1 -1
- data/rake_tasks/gem.rake +2 -2
- data/rake_tasks/maintaince.rake +42 -1
- data/rake_tasks/spec.rake +45 -0
- data/spec/examples/caching.rb +1 -1
- data/spec/examples/simple.rb +1 -1
- data/spec/examples/templates/template_amrita2.rb +1 -0
- data/spec/examples/templates/template_erubis.rb +2 -1
- data/spec/examples/templates/template_ezamar.rb +1 -1
- data/spec/examples/templates/template_haml.rb +2 -1
- data/spec/examples/templates/template_liquid.rb +2 -1
- data/spec/examples/templates/template_markaby.rb +2 -1
- data/spec/examples/templates/template_remarkably.rb +22 -0
- data/spec/examples/todolist.rb +125 -0
- data/spec/helper.rb +2 -23
- data/spec/helper/minimal.rb +20 -0
- data/spec/helper/mock_http.rb +24 -30
- data/spec/helper/simple_http.rb +2 -2
- data/spec/helper/wrap.rb +6 -9
- data/spec/ramaze/adapter.rb +1 -1
- data/spec/ramaze/adapter/record.rb +31 -0
- data/spec/ramaze/cache.rb +41 -54
- data/spec/ramaze/controller.rb +121 -137
- data/spec/ramaze/controller/template/list.xhtml +1 -0
- data/spec/ramaze/controller/template/other/greet/other.xhtml +1 -0
- data/spec/ramaze/controller/template_resolving.rb +27 -3
- data/spec/ramaze/element.rb +11 -7
- data/spec/ramaze/error.rb +1 -1
- data/spec/ramaze/gestalt.rb +2 -0
- data/spec/ramaze/helper/aspect.rb +30 -21
- data/spec/ramaze/helper/auth.rb +1 -1
- data/spec/ramaze/helper/cache.rb +2 -1
- data/spec/ramaze/helper/form.rb +14 -11
- data/spec/ramaze/helper/link.rb +18 -41
- data/spec/ramaze/localize.rb +29 -2
- data/spec/ramaze/morpher.rb +23 -12
- data/spec/ramaze/params.rb +46 -24
- data/spec/ramaze/request.rb +6 -2
- data/spec/ramaze/store/yaml.rb +5 -0
- data/spec/ramaze/template.rb +22 -27
- data/spec/ramaze/template/amrita2.rb +1 -2
- data/spec/ramaze/template/erubis.rb +1 -1
- data/spec/ramaze/template/ezamar.rb +1 -2
- data/spec/ramaze/template/haml.rb +2 -2
- data/spec/ramaze/template/haml/with_vars.haml +1 -1
- data/spec/ramaze/template/liquid.rb +1 -1
- data/spec/ramaze/template/markaby.rb +1 -1
- data/spec/ramaze/template/remarkably.rb +56 -0
- data/spec/ramaze/template/remarkably/external.rem +8 -0
- data/spec/ramaze/template/remarkably/sum.rem +1 -0
- metadata +38 -63
- data/doc/README.html +0 -637
- data/doc/allison/LICENSE +0 -184
- data/doc/allison/README +0 -37
- data/doc/allison/allison.css +0 -299
- data/doc/allison/allison.gif +0 -0
- data/doc/allison/allison.js +0 -307
- data/doc/allison/allison.rb +0 -287
- data/doc/allison/cache/BODY +0 -588
- data/doc/allison/cache/CLASS_INDEX +0 -4
- data/doc/allison/cache/CLASS_PAGE +0 -1
- data/doc/allison/cache/FILE_INDEX +0 -4
- data/doc/allison/cache/FILE_PAGE +0 -1
- data/doc/allison/cache/FONTS +0 -1
- data/doc/allison/cache/FR_INDEX_BODY +0 -1
- data/doc/allison/cache/IMGPATH +0 -1
- data/doc/allison/cache/INDEX +0 -1
- data/doc/allison/cache/JAVASCRIPT +0 -307
- data/doc/allison/cache/METHOD_INDEX +0 -4
- data/doc/allison/cache/METHOD_LIST +0 -1
- data/doc/allison/cache/SRC_PAGE +0 -1
- data/doc/allison/cache/STYLE +0 -321
- data/doc/allison/cache/URL +0 -1
- data/doc/changes.txt +0 -3375
- data/doc/changes.xml +0 -3378
- data/examples/todolist/conf/benchmark.yaml +0 -35
- data/examples/todolist/conf/debug.yaml +0 -34
- data/examples/todolist/conf/live.yaml +0 -33
- data/examples/todolist/conf/silent.yaml +0 -31
- data/examples/todolist/conf/stage.yaml +0 -33
- data/examples/todolist/public/css/coderay.css +0 -105
- data/examples/todolist/public/css/ramaze_error.css +0 -42
- data/lib/proto/conf/benchmark.yaml +0 -21
- data/lib/proto/conf/debug.yaml +0 -21
- data/lib/proto/conf/live.yaml +0 -21
- data/lib/proto/conf/silent.yaml +0 -21
- data/lib/proto/conf/stage.yaml +0 -21
- data/lib/proto/public/css/coderay.css +0 -105
- data/lib/ramaze/http_status.rb +0 -66
- data/lib/ramaze/snippets/hash/keys_to_sym.rb +0 -19
- data/lib/ramaze/snippets/kernel/method.rb +0 -26
- data/lib/ramaze/snippets/method/name.rb +0 -22
- data/lib/ramaze/snippets/ramaze/autoreload.rb +0 -135
- data/lib/ramaze/snippets/rdoc/usage_no_exit.rb +0 -65
- data/spec/all.rb +0 -32
- data/spec/ramaze/conf/locale_de.yaml +0 -6
- data/spec/ramaze/conf/locale_en.yaml +0 -6
- data/spec/ramaze/dependencies.rb +0 -16
- data/spec/ramaze/global.rb +0 -44
data/lib/ramaze/http_status.rb
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
|
-
|
|
4
|
-
module Ramaze
|
|
5
|
-
STATUS_CODE = {
|
|
6
|
-
# 1xx Informational (Request received, continuing process.)
|
|
7
|
-
|
|
8
|
-
:continue => 100,
|
|
9
|
-
:switching_protocols => 101,
|
|
10
|
-
|
|
11
|
-
# 2xx Success (The action was successfully received, understood, and accepted.)
|
|
12
|
-
|
|
13
|
-
:ok => 200,
|
|
14
|
-
:created => 201,
|
|
15
|
-
:accepted => 202,
|
|
16
|
-
:non_authorative_information => 203,
|
|
17
|
-
:no_content => 204,
|
|
18
|
-
:resent_content => 205,
|
|
19
|
-
:partial_content => 206,
|
|
20
|
-
:multi_status => 207,
|
|
21
|
-
|
|
22
|
-
# 3xx Redirection (The client must take additional action to complete the request.)
|
|
23
|
-
|
|
24
|
-
:multiple_choices => 300,
|
|
25
|
-
:moved_permamently => 301,
|
|
26
|
-
:moved_temporarily => 302,
|
|
27
|
-
:found => 302,
|
|
28
|
-
:see_other => 303,
|
|
29
|
-
:not_modified => 304,
|
|
30
|
-
:use_proxy => 305,
|
|
31
|
-
:switch_proxy => 306,
|
|
32
|
-
:temporary_redirect => 307,
|
|
33
|
-
|
|
34
|
-
# 4xx Client Error (The request contains bad syntax or cannot be fulfilled.)
|
|
35
|
-
|
|
36
|
-
:bad_request => 400,
|
|
37
|
-
:unauthorized => 401,
|
|
38
|
-
:payment_required => 402,
|
|
39
|
-
:forbidden => 403,
|
|
40
|
-
:not_found => 404,
|
|
41
|
-
:method_not_allowed => 405,
|
|
42
|
-
:not_aceptable => 406,
|
|
43
|
-
:proxy_authentication_required => 407,
|
|
44
|
-
:request_timeout => 408,
|
|
45
|
-
:conflict => 409,
|
|
46
|
-
:gone => 410,
|
|
47
|
-
:length_required => 411,
|
|
48
|
-
:precondition_failed => 412,
|
|
49
|
-
:request_entity_too_large => 413,
|
|
50
|
-
:request_uri_too_long => 414,
|
|
51
|
-
:unsupported_media_type => 415,
|
|
52
|
-
:requested_range_not_satisfiable => 416,
|
|
53
|
-
:expectation_failed => 417,
|
|
54
|
-
:retry_with => 449,
|
|
55
|
-
|
|
56
|
-
# 5xx Server Error (The server failed to fulfill an apparently valid request.)
|
|
57
|
-
|
|
58
|
-
:internal_server_error => 500,
|
|
59
|
-
:not_implemented => 501,
|
|
60
|
-
:bad_gateway => 502,
|
|
61
|
-
:service_unavailable => 503,
|
|
62
|
-
:gateway_timeout => 504,
|
|
63
|
-
:http_version_not_supported => 505,
|
|
64
|
-
:bandwidth_limit_exceeded => 509, # (not official)
|
|
65
|
-
}
|
|
66
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
|
-
|
|
4
|
-
class Hash
|
|
5
|
-
|
|
6
|
-
# convert all keys in the Hash to symbols.
|
|
7
|
-
|
|
8
|
-
def keys_to_sym!
|
|
9
|
-
each do |key, value|
|
|
10
|
-
self[key.to_sym] = delete(key)
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
# answer with a new Hash with all keys as symbols.
|
|
15
|
-
|
|
16
|
-
def keys_to_sym
|
|
17
|
-
dup.keys_to_sym!
|
|
18
|
-
end
|
|
19
|
-
end
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
|
-
|
|
4
|
-
# This chunk of code redefines the #method method of Kernel to act more
|
|
5
|
-
# dynamic.
|
|
6
|
-
|
|
7
|
-
module Kernel
|
|
8
|
-
alias_method :method_get, :method unless defined? method_get
|
|
9
|
-
|
|
10
|
-
# get the object of the method you are currently in or any
|
|
11
|
-
# other out of the backtrace, as long as it is in the same
|
|
12
|
-
# instance and retrievable via method_get (which is the old #method).
|
|
13
|
-
#
|
|
14
|
-
# class Foo
|
|
15
|
-
# def bar
|
|
16
|
-
# method
|
|
17
|
-
# end
|
|
18
|
-
# end
|
|
19
|
-
#
|
|
20
|
-
# Foo.new.bar #=> #<Method: Foo#bar>
|
|
21
|
-
|
|
22
|
-
def method(n = 0)
|
|
23
|
-
return method_get(n) unless n.is_a? Integer
|
|
24
|
-
method_get caller.to_s.scan(/`(.*?)'/)[n].first rescue nil
|
|
25
|
-
end
|
|
26
|
-
end
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
|
-
|
|
4
|
-
# Modification for upcoming functionality in 1.9
|
|
5
|
-
|
|
6
|
-
class Method
|
|
7
|
-
|
|
8
|
-
# name of the Method (example shows combination with the new Kernel#method)
|
|
9
|
-
#
|
|
10
|
-
# class Foo
|
|
11
|
-
# def bar
|
|
12
|
-
# method.name
|
|
13
|
-
# end
|
|
14
|
-
# end
|
|
15
|
-
#
|
|
16
|
-
# Foo.new.bar #=> 'bar'
|
|
17
|
-
|
|
18
|
-
def name
|
|
19
|
-
# parses things like <Method: A.d>
|
|
20
|
-
inspect.gsub(/#<Method: .*?[\.#](.*?)>/, '\1')
|
|
21
|
-
end
|
|
22
|
-
end
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
|
-
|
|
4
|
-
require 'set'
|
|
5
|
-
|
|
6
|
-
module Ramaze
|
|
7
|
-
|
|
8
|
-
RELOAD_ENV = {
|
|
9
|
-
:glob => /#{Dir.pwd}|ramaze/
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
class << self
|
|
13
|
-
def reload interval = 1
|
|
14
|
-
Inform.debug("initialize automatic file reload every #{interval} seconds")
|
|
15
|
-
|
|
16
|
-
Thread.new do
|
|
17
|
-
this = Thread.current
|
|
18
|
-
this[:task] = :autoreload
|
|
19
|
-
|
|
20
|
-
mtimes = {}
|
|
21
|
-
|
|
22
|
-
loop do
|
|
23
|
-
to_reload = all_reload_files.reject do |file|
|
|
24
|
-
mtime = File.mtime(file)
|
|
25
|
-
mtimes[file] ||= mtime
|
|
26
|
-
mtimes[file] == mtime
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
to_reload.each do |file|
|
|
30
|
-
sleep(interval / files.size.to_f)
|
|
31
|
-
Inform.debug("reload #{file}")
|
|
32
|
-
mtimes[file] = mtime if safe_load(file)
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def all_reload_files
|
|
39
|
-
env = RELOAD_ENV
|
|
40
|
-
|
|
41
|
-
files, paths = $LOADED_FEATURES, $LOAD_PATH
|
|
42
|
-
|
|
43
|
-
unless env[:files] == files and env[:paths] == paths
|
|
44
|
-
env[:files], env[:paths] = files.dup, paths.dup
|
|
45
|
-
env[:map] = files.map do |file|
|
|
46
|
-
possible = paths.map{|pa| File.join(pa.to_s, file.to_s) }
|
|
47
|
-
possible.find{|po| File.exists?(po) }
|
|
48
|
-
end
|
|
49
|
-
env[:map] = env[:map].compact.sort
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
env[:map].select{|f| f =~ env[:glob] }
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def safe_load(file)
|
|
56
|
-
load(file)
|
|
57
|
-
true
|
|
58
|
-
rescue Object => ex
|
|
59
|
-
Inform.error(ex)
|
|
60
|
-
false
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
# this method loops through all loaded/required files
|
|
65
|
-
# and re-loads them when they are updated.
|
|
66
|
-
# It takes one parameter, which is the interval in seconds
|
|
67
|
-
# with a default of 10.
|
|
68
|
-
# You can also safely kill all threads (except for the main)
|
|
69
|
-
# and it will just restart the autoreloader.
|
|
70
|
-
|
|
71
|
-
def self.autoreload interval = 10
|
|
72
|
-
Inform.debug("initialize autoreload with an interval of #{interval} seconds")
|
|
73
|
-
|
|
74
|
-
gatherer = Thread.new do
|
|
75
|
-
this = Thread.current
|
|
76
|
-
this[:task] = :autoreload
|
|
77
|
-
|
|
78
|
-
cache = {}
|
|
79
|
-
file_set = Set.new
|
|
80
|
-
|
|
81
|
-
loop do
|
|
82
|
-
files = file_set.dup
|
|
83
|
-
$LOADED_FEATURES.map do |file|
|
|
84
|
-
file = file.to_s
|
|
85
|
-
paths = $LOAD_PATH + ['']
|
|
86
|
-
correct_path = paths.find{|lp| File.exist?(File.join(lp.to_s, file))}
|
|
87
|
-
correct_file = File.expand_path(File.join(correct_path, file)) if correct_path
|
|
88
|
-
|
|
89
|
-
files << correct_file if correct_file
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
this[:files] = files
|
|
93
|
-
|
|
94
|
-
sleep_interval = this[:interval] ||= interval || 10
|
|
95
|
-
sleep sleep_interval
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
reloader = Thread.new do
|
|
100
|
-
this = Thread.current
|
|
101
|
-
this[:task] = :autoreload
|
|
102
|
-
|
|
103
|
-
cache = {}
|
|
104
|
-
this[:interval] = interval
|
|
105
|
-
sleep 0.1 until gatherer[:files] # wait for the gatherer
|
|
106
|
-
|
|
107
|
-
loop do
|
|
108
|
-
gatherer[:files].each do |file|
|
|
109
|
-
begin
|
|
110
|
-
current_time = File.mtime(file)
|
|
111
|
-
if last_time = cache[file]
|
|
112
|
-
unless last_time == current_time
|
|
113
|
-
Inform.info("autoreload #{file}")
|
|
114
|
-
load(file)
|
|
115
|
-
cache[file] = current_time
|
|
116
|
-
end
|
|
117
|
-
else
|
|
118
|
-
cache[file] = current_time
|
|
119
|
-
end
|
|
120
|
-
rescue Object => ex # catches errors when the load fails
|
|
121
|
-
# in case mtime fails
|
|
122
|
-
unless ex.message =~ /No such file or directory/
|
|
123
|
-
puts ex
|
|
124
|
-
puts ex.backtrace
|
|
125
|
-
end
|
|
126
|
-
# sleep a total of reloader[:interval],
|
|
127
|
-
# but spread it evenly on all files
|
|
128
|
-
end # begin
|
|
129
|
-
sleep_interval = this[:interval].to_f / gatherer[:files].size
|
|
130
|
-
sleep sleep_interval
|
|
131
|
-
end # each
|
|
132
|
-
end # loop
|
|
133
|
-
end # Thread.new
|
|
134
|
-
end # autoreload
|
|
135
|
-
end # Ramaze
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
|
-
|
|
4
|
-
require 'rdoc/ri/ri_paths'
|
|
5
|
-
require 'rdoc/usage'
|
|
6
|
-
|
|
7
|
-
# This is a little hack to enable RDoc to see through gems.
|
|
8
|
-
#
|
|
9
|
-
# Very evil, but until we get a better RDoc this will have to do.
|
|
10
|
-
|
|
11
|
-
module RDoc
|
|
12
|
-
class << self
|
|
13
|
-
|
|
14
|
-
# a patch for RDocs::usage calling our Rdoc::ramazes_usage_no_exit
|
|
15
|
-
|
|
16
|
-
def ramazes_usage(*args)
|
|
17
|
-
exit_code = 0
|
|
18
|
-
|
|
19
|
-
if args.size > 0
|
|
20
|
-
status = args[0]
|
|
21
|
-
if status.respond_to?(:to_int)
|
|
22
|
-
exit_code = status.to_int
|
|
23
|
-
args.shift
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
# display the usage and exit with the given code
|
|
28
|
-
ramazes_usage_no_exit(*args)
|
|
29
|
-
exit(exit_code)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# Only a modfication of RDoc::usage_no_exit for the lookup of main_program,
|
|
33
|
-
# this would be buggy if used by the binary of the gem since $0 is
|
|
34
|
-
# different.
|
|
35
|
-
#
|
|
36
|
-
# Using caller to lookup the actual bin.
|
|
37
|
-
|
|
38
|
-
def ramazes_usage_no_exit(*args)
|
|
39
|
-
main_program_file = caller[1].sub(/:\d+$/, '')
|
|
40
|
-
comment = File.open(main_program_file) do |file|
|
|
41
|
-
find_comment(file)
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
comment = comment.gsub(/^\s*#/, '')
|
|
45
|
-
|
|
46
|
-
markup = SM::SimpleMarkup.new
|
|
47
|
-
flow_convertor = SM::ToFlow.new
|
|
48
|
-
|
|
49
|
-
flow = markup.convert(comment, flow_convertor)
|
|
50
|
-
|
|
51
|
-
format = "plain"
|
|
52
|
-
|
|
53
|
-
unless args.empty?
|
|
54
|
-
flow = extract_sections(flow, args)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
options = RI::Options.instance
|
|
58
|
-
if args = ENV["RI"]
|
|
59
|
-
options.parse(args.split)
|
|
60
|
-
end
|
|
61
|
-
formatter = options.formatter.new(options, "")
|
|
62
|
-
formatter.display_flow(flow)
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
end
|
data/spec/all.rb
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
|
-
|
|
4
|
-
require 'spec/helper/layout'
|
|
5
|
-
|
|
6
|
-
layout = {
|
|
7
|
-
'ramaze' => {
|
|
8
|
-
'.' => '*',
|
|
9
|
-
'adapter' => '*',
|
|
10
|
-
'helper' => '*',
|
|
11
|
-
'inform' => '*',
|
|
12
|
-
'request' => '*',
|
|
13
|
-
'store' => '*',
|
|
14
|
-
'template' => '*',
|
|
15
|
-
'controller' => '*'
|
|
16
|
-
},
|
|
17
|
-
'examples' => {
|
|
18
|
-
'.' => '*',
|
|
19
|
-
'templates' => '*'
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
manually_add = %w[
|
|
24
|
-
ramaze/template ramaze/controller
|
|
25
|
-
]
|
|
26
|
-
manually_add.map!{|ma| File.expand_path("spec/#{ma}.rb") }
|
|
27
|
-
|
|
28
|
-
layout = SpecLayout.new(File.dirname(__FILE__), layout)
|
|
29
|
-
layout.gather
|
|
30
|
-
layout.clean
|
|
31
|
-
layout.files += manually_add
|
|
32
|
-
layout.run
|
data/spec/ramaze/dependencies.rb
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
|
-
|
|
4
|
-
require 'spec/helper'
|
|
5
|
-
|
|
6
|
-
testcase_requires 'rubygems'
|
|
7
|
-
|
|
8
|
-
describe "dependencies" do
|
|
9
|
-
it "no gems" do
|
|
10
|
-
# rspec, systemu and syntax (loaded by rspec since 0.9)
|
|
11
|
-
# are used for testing
|
|
12
|
-
regex = /rspec|rack|systemu|syntax/
|
|
13
|
-
gems = $:.grep(/gems/).reject{|g| g =~ regex}
|
|
14
|
-
gems.should == []
|
|
15
|
-
end
|
|
16
|
-
end
|
data/spec/ramaze/global.rb
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
|
-
|
|
4
|
-
require 'spec/helper'
|
|
5
|
-
|
|
6
|
-
describe "Ramaze::Global" do
|
|
7
|
-
it "just simple assignment and retrive" do
|
|
8
|
-
Ramaze::Global.some = :xxx
|
|
9
|
-
Ramaze::Global.some.should == :xxx
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it "setup" do
|
|
13
|
-
Ramaze::Global.setup :a => :b
|
|
14
|
-
Ramaze::Global.a.should == :b
|
|
15
|
-
Ramaze::Global.some.should == :xxx
|
|
16
|
-
Ramaze::Global.setup :a => :c
|
|
17
|
-
Ramaze::Global.a.should == :c
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it "more neat stuff" do
|
|
21
|
-
Ramaze::Global.update :a => :d, :foo => :bar
|
|
22
|
-
Ramaze::Global.a.should == :c
|
|
23
|
-
Ramaze::Global.foo.should == :bar
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it "values_at" do
|
|
27
|
-
Ramaze::Global.values_at(:a, :foo).should == [:c, :bar]
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it "getting thready" do
|
|
31
|
-
Ramaze::Global[:i] = 0
|
|
32
|
-
Thread.main[:i] = 0
|
|
33
|
-
|
|
34
|
-
(1..10).each do |i|
|
|
35
|
-
Thread.new do
|
|
36
|
-
Ramaze::Global[:i] += i
|
|
37
|
-
Thread.main[:i] += i
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
Ramaze::Global[:i].should == Thread.main[:i]
|
|
42
|
-
Ramaze::Global[:i].should == 55
|
|
43
|
-
end
|
|
44
|
-
end
|