ramaze 2011.01.30 → 2011.07.25
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/.mailmap +2 -0
- data/.rvmrc +1 -0
- data/README.md +119 -197
- data/Rakefile +14 -97
- data/bin/ramaze +6 -14
- data/doc/AUTHORS +8 -4
- data/doc/CHANGELOG +3784 -3339
- data/examples/app/chat/start.rb +2 -2
- data/lib/proto/app.rb +2 -3
- data/lib/proto/config.ru +4 -5
- data/lib/proto/controller/init.rb +11 -4
- data/lib/proto/controller/main.rb +12 -7
- data/lib/proto/layout/default.xhtml +56 -23
- data/lib/proto/model/init.rb +3 -1
- data/lib/proto/public/css/grid.css +107 -0
- data/lib/proto/public/css/layout.css +81 -0
- data/lib/proto/public/css/reset.css +123 -0
- data/lib/proto/public/css/text.css +109 -0
- data/lib/proto/public/images/bg.png +0 -0
- data/lib/proto/spec/main.rb +2 -2
- data/lib/proto/start.rb +11 -1
- data/lib/proto/view/index.xhtml +27 -23
- data/lib/ramaze.rb +0 -1
- data/lib/ramaze/app.rb +85 -12
- data/lib/ramaze/app_graph.rb +107 -0
- data/lib/ramaze/bin/console.rb +87 -0
- data/lib/ramaze/bin/create.rb +94 -0
- data/lib/ramaze/bin/helper.rb +107 -0
- data/lib/ramaze/bin/restart.rb +95 -0
- data/lib/ramaze/bin/runner.rb +141 -0
- data/lib/ramaze/bin/start.rb +206 -0
- data/lib/ramaze/bin/status.rb +152 -0
- data/lib/ramaze/bin/stop.rb +112 -0
- data/lib/ramaze/cache.rb +9 -4
- data/lib/ramaze/cache/localmemcache.rb +10 -13
- data/lib/ramaze/cache/lru.rb +49 -7
- data/lib/ramaze/cache/memcache.rb +170 -92
- data/lib/ramaze/cache/sequel.rb +301 -118
- data/lib/ramaze/controller.rb +108 -9
- data/lib/ramaze/controller/default.rb +15 -2
- data/lib/ramaze/current.rb +14 -2
- data/lib/ramaze/dependencies.rb +46 -0
- data/lib/ramaze/files.rb +38 -3
- data/lib/ramaze/gestalt.rb +12 -12
- data/lib/ramaze/helper.rb +0 -2
- data/lib/ramaze/helper/auth.rb +30 -23
- data/lib/ramaze/helper/blue_form.rb +175 -126
- data/lib/ramaze/helper/csrf.rb +76 -91
- data/lib/ramaze/helper/email.rb +105 -0
- data/lib/ramaze/helper/erector.rb +16 -15
- data/lib/ramaze/helper/gestalt.rb +2 -2
- data/lib/ramaze/helper/layout.rb +89 -73
- data/lib/ramaze/helper/link.rb +7 -6
- data/lib/ramaze/helper/localize.rb +6 -5
- data/lib/ramaze/helper/markaby.rb +25 -23
- data/lib/ramaze/helper/maruku.rb +3 -3
- data/lib/ramaze/helper/paginate.rb +19 -27
- data/lib/ramaze/helper/remarkably.rb +3 -3
- data/lib/ramaze/helper/request_accessor.rb +3 -3
- data/lib/ramaze/helper/send_file.rb +12 -8
- data/lib/ramaze/helper/simple_captcha.rb +5 -6
- data/lib/ramaze/helper/stack.rb +7 -4
- data/lib/ramaze/helper/tagz.rb +10 -11
- data/lib/ramaze/helper/thread.rb +19 -16
- data/lib/ramaze/helper/ultraviolet.rb +7 -4
- data/lib/ramaze/helper/user.rb +40 -21
- data/lib/ramaze/helper/xhtml.rb +29 -20
- data/lib/ramaze/log.rb +3 -11
- data/lib/ramaze/log/analogger.rb +5 -4
- data/lib/ramaze/log/growl.rb +9 -7
- data/lib/ramaze/log/hub.rb +3 -5
- data/lib/ramaze/log/informer.rb +15 -12
- data/lib/ramaze/log/knotify.rb +3 -5
- data/lib/ramaze/log/logger.rb +3 -5
- data/lib/ramaze/log/logging.rb +6 -8
- data/lib/ramaze/log/rotatinginformer.rb +27 -17
- data/lib/ramaze/log/syslog.rb +7 -7
- data/lib/ramaze/log/xosd.rb +3 -5
- data/lib/ramaze/middleware_compiler.rb +27 -4
- data/lib/ramaze/reloader.rb +50 -12
- data/lib/ramaze/reloader/watch_inotify.rb +4 -5
- data/lib/ramaze/reloader/watch_stat.rb +3 -3
- data/lib/ramaze/request.rb +18 -8
- data/lib/ramaze/response.rb +38 -7
- data/lib/ramaze/rest.rb +36 -0
- data/lib/ramaze/setup.rb +101 -31
- data/lib/ramaze/spec.rb +1 -1
- data/lib/ramaze/spec/bacon.rb +6 -3
- data/lib/ramaze/spec/helper/bacon.rb +0 -1
- data/lib/ramaze/version.rb +1 -1
- data/lib/ramaze/view.rb +2 -11
- data/lib/ramaze/view/erector.rb +46 -31
- data/lib/ramaze/view/erubis.rb +7 -3
- data/lib/ramaze/view/ezamar.rb +7 -3
- data/lib/ramaze/view/gestalt.rb +9 -3
- data/lib/ramaze/view/haml.rb +7 -3
- data/lib/ramaze/view/liquid.rb +3 -3
- data/lib/ramaze/view/lokar.rb +7 -3
- data/lib/ramaze/view/mustache.rb +11 -5
- data/lib/ramaze/view/nagoro.rb +3 -3
- data/lib/ramaze/view/sass.rb +1 -1
- data/lib/ramaze/view/slippers.rb +40 -13
- data/lib/ramaze/view/tagz.rb +9 -5
- data/ramaze.gemspec +23 -128
- data/spec/helper.rb +5 -0
- data/spec/ramaze/bin/app/config.ru +11 -0
- data/spec/ramaze/bin/create.rb +28 -0
- data/spec/ramaze/bin/runner.rb +30 -0
- data/spec/ramaze/bin/start.rb +38 -0
- data/spec/ramaze/cache/memcache.rb +10 -3
- data/spec/ramaze/cache/sequel.rb +7 -0
- data/spec/ramaze/controller/provide_inheritance.rb +0 -10
- data/spec/ramaze/dispatcher/file.rb +19 -15
- data/spec/ramaze/helper/auth.rb +10 -9
- data/spec/ramaze/helper/blue_form.rb +121 -68
- data/spec/ramaze/helper/email.rb +69 -0
- data/spec/ramaze/helper/layout.rb +12 -15
- data/spec/ramaze/helper/layout/alternative.xhtml +5 -0
- data/spec/ramaze/helper/user.rb +2 -0
- data/spec/ramaze/log/growl.rb +14 -1
- data/spec/{contrib → ramaze}/rest.rb +1 -1
- data/spec/ramaze/session/memcache.rb +2 -2
- data/spec/ramaze/view/sass.rb +1 -1
- data/tasks/bacon.rake +3 -3
- data/tasks/gem.rake +17 -18
- data/tasks/rcov.rake +2 -3
- data/tasks/release.rake +8 -65
- data/tasks/setup.rake +10 -8
- data/tasks/todo.rake +9 -5
- data/tasks/yard.rake +3 -2
- metadata +105 -397
- data/MANIFEST +0 -532
- data/TODO.md +0 -19
- data/benchmark/bench_templates/bench.rb +0 -67
- data/benchmark/bench_templates/view/large.erb +0 -79
- data/benchmark/bench_templates/view/large.haml +0 -41
- data/benchmark/bench_templates/view/large.lok +0 -79
- data/benchmark/bench_templates/view/large.xhtml +0 -79
- data/benchmark/bench_templates/view/small.erb +0 -21
- data/benchmark/bench_templates/view/small.haml +0 -12
- data/benchmark/bench_templates/view/small.lok +0 -21
- data/benchmark/bench_templates/view/small.xhtml +0 -21
- data/benchmark/results.txt +0 -131
- data/benchmark/run.rb +0 -355
- data/benchmark/suite/minimal.rb +0 -11
- data/benchmark/suite/no_informer.rb +0 -7
- data/benchmark/suite/no_sessions.rb +0 -9
- data/benchmark/suite/no_template.rb +0 -7
- data/benchmark/suite/simple.rb +0 -5
- data/benchmark/suite/template_erubis.rb +0 -8
- data/benchmark/suite/template_etanni.rb +0 -8
- data/benchmark/suite/template_ezamar.rb +0 -8
- data/benchmark/suite/template_haml.rb +0 -13
- data/benchmark/suite/template_liquid.rb +0 -11
- data/benchmark/suite/template_markaby.rb +0 -9
- data/benchmark/suite/template_nagoro.rb +0 -8
- data/benchmark/suite/template_redcloth.rb +0 -13
- data/benchmark/suite/template_tenjin.rb +0 -8
- data/benchmark/test.rb +0 -35
- data/doc/FAQ +0 -92
- data/doc/INSTALL +0 -92
- data/doc/TODO +0 -29
- data/doc/meta/announcement.txt +0 -119
- data/doc/meta/configuration.txt +0 -163
- data/doc/meta/internals.txt +0 -278
- data/doc/meta/users.kml +0 -64
- data/doc/tutorial/todolist.html +0 -1512
- data/doc/tutorial/todolist.txt +0 -920
- data/examples/app/sourceview/public/coderay.css +0 -104
- data/examples/app/sourceview/public/images/file.gif +0 -0
- data/examples/app/sourceview/public/images/folder.gif +0 -0
- data/examples/app/sourceview/public/images/tv-collapsable-last.gif +0 -0
- data/examples/app/sourceview/public/images/tv-collapsable.gif +0 -0
- data/examples/app/sourceview/public/images/tv-expandable-last.gif +0 -0
- data/examples/app/sourceview/public/images/tv-expandable.gif +0 -0
- data/examples/app/sourceview/public/images/tv-item-last.gif +0 -0
- data/examples/app/sourceview/public/images/tv-item.gif +0 -0
- data/examples/app/sourceview/public/jquery.js +0 -11
- data/examples/app/sourceview/public/jquery.treeview.css +0 -48
- data/examples/app/sourceview/public/jquery.treeview.js +0 -223
- data/examples/app/sourceview/public/sourceview.js +0 -52
- data/examples/app/sourceview/start.rb +0 -79
- data/examples/app/sourceview/view/index.haml +0 -59
- data/examples/helpers/httpdigest.rb +0 -107
- data/lib/proto/public/css/screen.css +0 -30
- data/lib/proto/public/js/jquery.js +0 -7179
- data/lib/ramaze/contrib/addressable_route.rb +0 -56
- data/lib/ramaze/contrib/app_graph.rb +0 -64
- data/lib/ramaze/contrib/email.rb +0 -88
- data/lib/ramaze/contrib/facebook.rb +0 -23
- data/lib/ramaze/contrib/facebook/facebook.rb +0 -171
- data/lib/ramaze/contrib/gettext.rb +0 -113
- data/lib/ramaze/contrib/gettext/mo.rb +0 -155
- data/lib/ramaze/contrib/gettext/parser.rb +0 -46
- data/lib/ramaze/contrib/gettext/po.rb +0 -109
- data/lib/ramaze/contrib/gzip_filter.rb +0 -1
- data/lib/ramaze/contrib/maruku_uv.rb +0 -59
- data/lib/ramaze/contrib/profiling.rb +0 -36
- data/lib/ramaze/contrib/rest.rb +0 -23
- data/lib/ramaze/contrib/sequel/create_join.rb +0 -26
- data/lib/ramaze/contrib/sequel/form_field.rb +0 -129
- data/lib/ramaze/contrib/sequel/image.rb +0 -196
- data/lib/ramaze/contrib/sequel/relation.rb +0 -98
- data/lib/ramaze/helper/httpdigest.rb +0 -96
- data/lib/ramaze/tool/bin.rb +0 -340
- data/lib/ramaze/tool/create.rb +0 -48
- data/lib/ramaze/tool/project_creator.rb +0 -120
- data/lib/ramaze/view/less.rb +0 -12
- data/lib/ramaze/view/maruku.rb +0 -15
- data/lib/ramaze/view/redcloth.rb +0 -21
- data/spec/contrib/addressable_route.rb +0 -30
- data/spec/examples/helpers/httpdigest.rb +0 -64
- data/spec/examples/templates/template_redcloth.rb +0 -13
- data/spec/ramaze/bin/ramaze.rb +0 -96
- data/spec/ramaze/helper/httpdigest.rb +0 -176
- data/spec/ramaze/view/less.rb +0 -60
- data/spec/ramaze/view/less/file.css.less +0 -8
- data/spec/ramaze/view/redcloth.rb +0 -66
- data/spec/ramaze/view/redcloth/external.redcloth +0 -8
- data/tasks/copyright.rake +0 -21
- data/tasks/gem_setup.rake +0 -112
- data/tasks/git.rake +0 -46
- data/tasks/grancher.rake +0 -12
- data/tasks/jquery.rake +0 -15
- data/tasks/manifest.rake +0 -4
- data/tasks/metric_changes.rake +0 -24
- data/tasks/reversion.rake +0 -8
- data/tasks/traits.rake +0 -21
@@ -1,155 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
mo.rb - A simple class for operating GNU MO file.
|
3
|
-
|
4
|
-
Copyright (C) 2003-2006 Masao Mutoh
|
5
|
-
Copyright (C) 2002 Masahiro Sakai, Masao Mutoh
|
6
|
-
Copyright (C) 2001 Masahiro Sakai
|
7
|
-
|
8
|
-
Masahiro Sakai <s01397ms@sfc.keio.ac.jp>
|
9
|
-
Masao Mutoh <mutoh@highway.ne.jp>
|
10
|
-
|
11
|
-
You can redistribute this file and/or modify it under the same term
|
12
|
-
of Ruby. License of Ruby is included with Ruby distribution in
|
13
|
-
the file "README".
|
14
|
-
|
15
|
-
$Id: mo.rb,v 1.7 2006/06/11 15:36:20 mutoh Exp $
|
16
|
-
=end
|
17
|
-
|
18
|
-
require 'iconv'
|
19
|
-
|
20
|
-
class MOFile < Hash
|
21
|
-
class InvalidFormat < RuntimeError; end;
|
22
|
-
|
23
|
-
attr_reader :filename
|
24
|
-
|
25
|
-
Header = Struct.new(:magic,
|
26
|
-
:revision,
|
27
|
-
:nstrings,
|
28
|
-
:orig_table_offset,
|
29
|
-
:translated_table_offset,
|
30
|
-
:hash_table_size,
|
31
|
-
:hash_table_offset)
|
32
|
-
|
33
|
-
MAGIC_BIG_ENDIAN = "\x95\x04\x12\xde"
|
34
|
-
MAGIC_LITTLE_ENDIAN = "\xde\x12\x04\x95"
|
35
|
-
|
36
|
-
def self.open(arg = nil, output_charset = nil)
|
37
|
-
result = self.new(output_charset)
|
38
|
-
result.load(arg)
|
39
|
-
end
|
40
|
-
|
41
|
-
def initialize(output_charset = nil)
|
42
|
-
@filename = nil
|
43
|
-
@last_modified = nil
|
44
|
-
@little_endian = true
|
45
|
-
@output_charset = output_charset
|
46
|
-
super
|
47
|
-
end
|
48
|
-
|
49
|
-
def update!
|
50
|
-
if FileTest.exist?(@filename)
|
51
|
-
st = File.stat(@filename)
|
52
|
-
load(@filename) unless (@last_modified == [st.ctime, st.mtime])
|
53
|
-
else
|
54
|
-
puts "#{@filename} was lost." if $DEBUG
|
55
|
-
clear
|
56
|
-
end
|
57
|
-
self
|
58
|
-
end
|
59
|
-
|
60
|
-
def load(arg)
|
61
|
-
case arg
|
62
|
-
when String
|
63
|
-
begin
|
64
|
-
st = File.stat(arg)
|
65
|
-
@last_modified = [st.ctime, st.mtime]
|
66
|
-
rescue Exception
|
67
|
-
end
|
68
|
-
load_from_file(arg)
|
69
|
-
when IO
|
70
|
-
load_from_stream(arg)
|
71
|
-
end
|
72
|
-
@filename = arg
|
73
|
-
self
|
74
|
-
end
|
75
|
-
|
76
|
-
def load_from_stream(io)
|
77
|
-
magic = io.read(4)
|
78
|
-
case magic
|
79
|
-
when MAGIC_BIG_ENDIAN
|
80
|
-
@little_endian = false
|
81
|
-
when MAGIC_LITTLE_ENDIAN
|
82
|
-
@little_endian = true
|
83
|
-
else
|
84
|
-
raise InvalidFormat.new("Unknown signature %s" % magic.dump)
|
85
|
-
end
|
86
|
-
|
87
|
-
header = Header.new(magic, *(io.read(4 * 6).unpack(@little_endian ? 'V6' : 'N6')))
|
88
|
-
raise InvalidFormat.new(sprintf("file format revision %d isn't supported", header.revision)) if header.revision > 0
|
89
|
-
|
90
|
-
io.pos = header.orig_table_offset
|
91
|
-
orig_table_data = io.read((4 * 2) * header.nstrings).unpack(@little_endian ? 'V*' : 'N*')
|
92
|
-
|
93
|
-
io.pos = header.translated_table_offset
|
94
|
-
trans_table_data = io.read((4 * 2) * header.nstrings).unpack(@little_endian ? 'V*' : 'N*')
|
95
|
-
|
96
|
-
original_strings = Array.new(header.nstrings)
|
97
|
-
for i in 0...header.nstrings
|
98
|
-
io.pos = orig_table_data[i * 2 + 1]
|
99
|
-
original_strings[i] = io.read(orig_table_data[i * 2 + 0])
|
100
|
-
end
|
101
|
-
|
102
|
-
clear
|
103
|
-
for i in 0...header.nstrings
|
104
|
-
io.pos = trans_table_data[i * 2 + 1]
|
105
|
-
str = io.read(trans_table_data[i * 2 + 0])
|
106
|
-
|
107
|
-
if original_strings[i] == ""
|
108
|
-
if str
|
109
|
-
@charset = nil
|
110
|
-
@nplurals = nil
|
111
|
-
@plural = nil
|
112
|
-
str.each_line{|line|
|
113
|
-
if /^Content-Type:/i =~ line and /charset=((?:\w|-)+)/i =~ line
|
114
|
-
@charset = $1
|
115
|
-
elsif /^Plural-Forms:\s*nplurals\s*\=\s*(\d*);\s*plural\s*\=\s*([^;]*)\n?/ =~ line
|
116
|
-
@nplurals = $1
|
117
|
-
@plural = $2
|
118
|
-
end
|
119
|
-
break if @charset and @nplurals
|
120
|
-
}
|
121
|
-
@nplurals = "1" unless @nplurals
|
122
|
-
@plural = "0" unless @plural
|
123
|
-
end
|
124
|
-
else
|
125
|
-
if @output_charset
|
126
|
-
begin
|
127
|
-
str = Iconv.iconv(@output_charset, @charset, str).join if @charset
|
128
|
-
rescue Iconv::Failure
|
129
|
-
if $DEBUG
|
130
|
-
$stderr.print "@charset = ", @charset, "\n"
|
131
|
-
$stderr.print "@output_charset = ", @output_charset, "\n"
|
132
|
-
$stderr.print "msgid = ", original_strings[i], "\n"
|
133
|
-
$stderr.print "msgstr = ", str, "\n"
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
|
-
self[original_strings[i]] = str
|
139
|
-
end
|
140
|
-
self
|
141
|
-
end
|
142
|
-
|
143
|
-
def load_from_file(filename)
|
144
|
-
@filename = filename
|
145
|
-
File.open(filename, 'rb'){|f| load_from_stream(f)}
|
146
|
-
end
|
147
|
-
|
148
|
-
def set_comment(msgid_or_sym, comment)
|
149
|
-
#Do nothing
|
150
|
-
end
|
151
|
-
|
152
|
-
|
153
|
-
attr_accessor :little_endian, :path, :last_modified
|
154
|
-
attr_reader :charset, :nplurals, :plural
|
155
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# suppress load warning message
|
2
|
-
verbose = $VERBOSE
|
3
|
-
$VERBOSE = nil
|
4
|
-
require 'gettext/rgettext'
|
5
|
-
$VERBOSE = verbose
|
6
|
-
|
7
|
-
module Ramaze::Tool::Gettext::Parser
|
8
|
-
module_function
|
9
|
-
|
10
|
-
TARGETS = Ramaze::Template::ENGINES.values.inject([]) do |exts, list|
|
11
|
-
list += exts
|
12
|
-
end
|
13
|
-
|
14
|
-
def target?(file)
|
15
|
-
TARGETS.include?(File.extname(file)[1..-1])
|
16
|
-
end
|
17
|
-
|
18
|
-
def parse(file, ary)
|
19
|
-
regex = Ramaze::Tool::Gettext.trait[:regex]
|
20
|
-
body = File.read(file)
|
21
|
-
body.gsub!(regex) do
|
22
|
-
msg = $1
|
23
|
-
unless msg.to_s.empty?
|
24
|
-
line_number = body[0..(body.index(msg))].split("\n").size
|
25
|
-
add_message(ary, msg, file, line_number)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
return ary
|
29
|
-
end
|
30
|
-
|
31
|
-
def add_message(ary, msg, file, line_number)
|
32
|
-
loc = message_location(file, line_number)
|
33
|
-
if value = ary.assoc(msg)
|
34
|
-
value << loc
|
35
|
-
else
|
36
|
-
ary << [msg, loc]
|
37
|
-
end
|
38
|
-
return ary
|
39
|
-
end
|
40
|
-
|
41
|
-
def message_location(file, line_number)
|
42
|
-
file + ":line" + line_number.to_s
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
GetText::RGetText.add_parser(Ramaze::Tool::Gettext::Parser)
|
@@ -1,109 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
=begin
|
3
|
-
rgettext.rb - Generate a .pot file.
|
4
|
-
|
5
|
-
Copyright (C) 2003-2006 Masao Mutoh
|
6
|
-
Copyright (C) 2001,2002 Yasushi Shoji, Masao Mutoh
|
7
|
-
|
8
|
-
Yasushi Shoji <yashi at atmark-techno.com>
|
9
|
-
Masao Mutoh <mutoh at highway.ne.jp>
|
10
|
-
|
11
|
-
You may redistribute it and/or modify it under the same
|
12
|
-
license terms as Ruby.
|
13
|
-
=end
|
14
|
-
|
15
|
-
|
16
|
-
module GetText
|
17
|
-
|
18
|
-
module RGetText #:nodoc:
|
19
|
-
extend GetText
|
20
|
-
|
21
|
-
MAX_LINE_LEN = 70 unless defined?(MAX_LINE_LEN)
|
22
|
-
|
23
|
-
module_function
|
24
|
-
|
25
|
-
def generate_pot_header # :nodoc:
|
26
|
-
time = Time.now.strftime("%Y-%m-%d %H:%M")
|
27
|
-
off = Time.now.utc_offset
|
28
|
-
sign = off <= 0 ? '-' : '+'
|
29
|
-
time += sprintf('%s%02d%02d', sign, *(off.abs / 60).divmod(60))
|
30
|
-
|
31
|
-
<<EOS
|
32
|
-
# SOME DESCRIPTIVE TITLE.
|
33
|
-
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
34
|
-
# This file is distributed under the same license as the PACKAGE package.
|
35
|
-
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
36
|
-
#
|
37
|
-
#, fuzzy
|
38
|
-
msgid ""
|
39
|
-
msgstr ""
|
40
|
-
"Project-Id-Version: PACKAGE VERSION\\n"
|
41
|
-
"POT-Creation-Date: #{time}\\n"
|
42
|
-
"PO-Revision-Date: #{time}\\n"
|
43
|
-
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n"
|
44
|
-
"Language-Team: LANGUAGE <LL@li.org>\\n"
|
45
|
-
"MIME-Version: 1.0\\n"
|
46
|
-
"Content-Type: text/plain; charset=UTF-8\\n"
|
47
|
-
"Content-Transfer-Encoding: 8bit\\n"
|
48
|
-
EOS
|
49
|
-
end
|
50
|
-
|
51
|
-
def generate_pot(ary) # :nodoc:
|
52
|
-
str = ""
|
53
|
-
result = Array.new
|
54
|
-
ary.each do |key|
|
55
|
-
msgid = key.shift.dup
|
56
|
-
curr_pos = MAX_LINE_LEN
|
57
|
-
key.each do |e|
|
58
|
-
if curr_pos + e.size > MAX_LINE_LEN
|
59
|
-
str << "\n#:"
|
60
|
-
curr_pos = 3
|
61
|
-
else
|
62
|
-
curr_pos += (e.size + 1)
|
63
|
-
end
|
64
|
-
str << " " << e
|
65
|
-
end
|
66
|
-
msgid.gsub!(/"/, '\"')
|
67
|
-
msgid.gsub!(/\r/, '')
|
68
|
-
|
69
|
-
str << "\nmsgid \"" << msgid << "\"\n"
|
70
|
-
str << "msgstr \"\"\n"
|
71
|
-
end
|
72
|
-
str
|
73
|
-
end
|
74
|
-
|
75
|
-
def generate_translated_po(hash)
|
76
|
-
str = generate_pot_header
|
77
|
-
result = Array.new
|
78
|
-
|
79
|
-
hash.keys.sort.each do |msgid|
|
80
|
-
msgid = msgid.dup
|
81
|
-
msgstr = hash[msgid]
|
82
|
-
|
83
|
-
msgid.gsub!(/"/, '\"')
|
84
|
-
msgid.gsub!(/\r/, '')
|
85
|
-
|
86
|
-
if msgstr
|
87
|
-
msgstr.gsub!(/"/, '\"')
|
88
|
-
msgstr.gsub!(/\r/, '')
|
89
|
-
end
|
90
|
-
|
91
|
-
str << "\nmsgid \"" << msgid << "\"\n"
|
92
|
-
str << "msgstr \"" << msgstr << "\"\n"
|
93
|
-
end
|
94
|
-
|
95
|
-
str
|
96
|
-
end
|
97
|
-
|
98
|
-
def generate(array) # :nodoc:
|
99
|
-
str = ''
|
100
|
-
str << generate_pot_header
|
101
|
-
str << generate_pot(array)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
if $0 == __FILE__
|
107
|
-
require 'yaml'
|
108
|
-
puts GetText::RGetText.generate_translated_po(YAML.load_file(ARGV[0]))
|
109
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
Ramaze.deprecated('contrib/gzip_filter.rb', 'Rack::Deflater')
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# A hack to make MaRuKu use UltraViolet for highlighting
|
2
|
-
# To specify the style to use use for example:
|
3
|
-
# uv_style: amy
|
4
|
-
# html_use_syntax: true
|
5
|
-
# code_lang: ruby
|
6
|
-
# In the document header area.
|
7
|
-
|
8
|
-
require 'maruku'
|
9
|
-
|
10
|
-
module MaRuKu
|
11
|
-
module Out
|
12
|
-
module HTML
|
13
|
-
def uv_highlight(source, lang, style)
|
14
|
-
require 'uv'
|
15
|
-
|
16
|
-
html = Uv.parse(source, 'xhtml', lang, lines = false, style)
|
17
|
-
|
18
|
-
# Prepare <code> containing <pre>
|
19
|
-
code = Document.new(html, :respect_whitespace => :all).root
|
20
|
-
code.name = 'code'
|
21
|
-
code.attributes['class'] = lang
|
22
|
-
code.attributes['lang'] = lang
|
23
|
-
|
24
|
-
# Prepare <pre>
|
25
|
-
pre = Element.new('pre')
|
26
|
-
pre << code
|
27
|
-
pre.attributes['class'] = style
|
28
|
-
pre
|
29
|
-
rescue => ex
|
30
|
-
puts ex
|
31
|
-
to_html_code_using_pre(source)
|
32
|
-
end
|
33
|
-
|
34
|
-
def to_html_code
|
35
|
-
source = self.raw_code
|
36
|
-
use_syntax = get_setting(:html_use_syntax)
|
37
|
-
uv_style = get_setting(:uv_style)
|
38
|
-
|
39
|
-
lang = self.attributes[:lang] || @doc.attributes[:code_lang]
|
40
|
-
lang ||= 'ruby' if attributes[:ruby]
|
41
|
-
|
42
|
-
# we always use syntax highlighting, this is a doc wiki
|
43
|
-
if lang and use_syntax
|
44
|
-
element = uv_highlight(source, lang, uv_style)
|
45
|
-
else
|
46
|
-
element = to_html_code_using_pre(source)
|
47
|
-
end
|
48
|
-
|
49
|
-
color = get_setting(:code_background_color)
|
50
|
-
|
51
|
-
if color != Globals[:code_background_color]
|
52
|
-
element.attributes['style'] = "background-color: #{color};"
|
53
|
-
end
|
54
|
-
|
55
|
-
add_ws element
|
56
|
-
end
|
57
|
-
end # HTML
|
58
|
-
end # Out
|
59
|
-
end # MaRuKu
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require "ruby-prof"
|
2
|
-
|
3
|
-
module Ramaze
|
4
|
-
class Dispatcher
|
5
|
-
class ActionProfiler < Action
|
6
|
-
def self.call(path)
|
7
|
-
if RubyProf.running?
|
8
|
-
super
|
9
|
-
else
|
10
|
-
result = RubyProf.profile { super }
|
11
|
-
output = StringIO.new
|
12
|
-
printer = RubyProf::FlatPrinter.new(result)
|
13
|
-
options = {
|
14
|
-
:min_percent => Contrib::Profiling.trait[:min_percent],
|
15
|
-
:print_file => false
|
16
|
-
}
|
17
|
-
printer.print(output, options)
|
18
|
-
output.string.split("\n").each do |line|
|
19
|
-
Log.info(line)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
module Contrib
|
27
|
-
class Profiling
|
28
|
-
trait :min_percent => 1
|
29
|
-
|
30
|
-
def self.startup
|
31
|
-
Dispatcher::FILTER.delete(Dispatcher::Action)
|
32
|
-
Dispatcher::FILTER << Dispatcher::ActionProfiler
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
data/lib/ramaze/contrib/rest.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# Use this together with the Rack::MethodOverride middleware for best
|
2
|
-
# behaviour.
|
3
|
-
#
|
4
|
-
# See spec/contrib/rest.rb for usage.
|
5
|
-
|
6
|
-
module Ramaze
|
7
|
-
# Don't use one option per method, we don't want to turn request_method into
|
8
|
-
# a symbol, together with MethodOverride this could lead to a memory leak.
|
9
|
-
options.o "REST rewrite mapping",
|
10
|
-
:rest_rewrite, { 'GET' => 'show',
|
11
|
-
'POST' => 'create',
|
12
|
-
'PUT' => 'update',
|
13
|
-
'DELETE' => 'destroy'}
|
14
|
-
|
15
|
-
Rewrite['REST dispatch'] = lambda{|path, request|
|
16
|
-
if suffix = Ramaze.options[:rest_rewrite][request.request_method]
|
17
|
-
"#{path}/#{suffix}".squeeze('/')
|
18
|
-
else
|
19
|
-
path
|
20
|
-
end
|
21
|
-
# return '/'
|
22
|
-
}
|
23
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'sequel'
|
2
|
-
require 'sequel/extensions/inflector'
|
3
|
-
|
4
|
-
module Sequel
|
5
|
-
class Model
|
6
|
-
# Force join table generation
|
7
|
-
#
|
8
|
-
# Usage:
|
9
|
-
# User.create_join(Article, 'articles_users')
|
10
|
-
# # or let the method figure out the correct join table using sequel
|
11
|
-
# # conventions.
|
12
|
-
# User.create_join(Article)
|
13
|
-
def self.create_join(to, name = nil)
|
14
|
-
from = self
|
15
|
-
name ||= [table_name.to_s, to.table_name.to_s].sort.join('_')
|
16
|
-
from_key = "#{from.table_name.to_s.singularize}_id"
|
17
|
-
to_key = "#{to.table_name.to_s.singularize}_id"
|
18
|
-
|
19
|
-
db.create_table! name do
|
20
|
-
primary_key :id
|
21
|
-
foreign_key from_key, :class => from
|
22
|
-
foreign_key to_key, :class => to
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|