racknga 0.9.3 → 0.9.5
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.
- checksums.yaml +7 -0
- data/Gemfile +3 -12
- data/README.md +44 -0
- data/Rakefile +19 -272
- data/doc/text/{news.textile → news.md} +24 -7
- data/lib/racknga/access_log_parser.rb +1 -1
- data/lib/racknga/api-keys.rb +39 -0
- data/lib/racknga/cache_database.rb +2 -2
- data/lib/racknga/exception_mail_notifier.rb +18 -17
- data/lib/racknga/log_database.rb +1 -1
- data/lib/racknga/log_entry.rb +1 -1
- data/lib/racknga/middleware/auth/api-key.rb +95 -0
- data/lib/racknga/middleware/cache.rb +23 -11
- data/lib/racknga/middleware/deflater.rb +1 -1
- data/lib/racknga/middleware/exception_notifier.rb +1 -1
- data/lib/racknga/middleware/instance_name.rb +65 -12
- data/lib/racknga/middleware/jsonp.rb +26 -9
- data/lib/racknga/middleware/log.rb +1 -1
- data/lib/racknga/middleware/nginx_raw_uri.rb +1 -1
- data/lib/racknga/middleware/range.rb +4 -6
- data/lib/racknga/reverse_line_reader.rb +1 -1
- data/lib/racknga/utils.rb +1 -1
- data/lib/racknga/version.rb +3 -5
- data/lib/racknga.rb +2 -1
- data/munin/plugins/passenger_application_ +61 -47
- data/munin/plugins/passenger_status +64 -33
- data/test/racknga-test-utils.rb +2 -6
- data/test/run-test.rb +2 -5
- data/test/test-access-log-parser.rb +1 -1
- data/test/test-api-keys.rb +80 -0
- data/test/test-middleware-auth-api-key.rb +144 -0
- data/test/test-middleware-cache.rb +1 -1
- data/test/test-middleware-instance-name.rb +32 -10
- data/test/test-middleware-jsonp.rb +14 -2
- data/test/test-middleware-nginx-raw-uri.rb +1 -1
- data/test/test-middleware-range.rb +1 -1
- metadata +182 -157
- data/README.textile +0 -52
- data/lib/racknga/will_paginate.rb +0 -48
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a79351d478e9f65c4a538c46887772e03d50a40ec6184cd293a66c4fd3b17693
|
4
|
+
data.tar.gz: 6063c757219857417651798caa288da2467e891faadaf0ff1699b1ac0f171d0a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7b5143554b8e2ded028e10e37f74b6b01064c12a8bfc8fee957bbb0167748cbb043c9ebb0ccbc7e9949239bd095bb971f449dc85e4a4fb7688647b4536fce905
|
7
|
+
data.tar.gz: 902a9509717410a4f9221f7d12b7398485ab7a0ecb2996e80874ffd97f050d52446aca77e20d2a6c2f9365110742d97d55b3704481f6a3debf0070387f82ff50
|
data/Gemfile
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# -*- mode: ruby; coding: utf-8 -*-
|
2
2
|
#
|
3
3
|
# Copyright (C) 2011 Kouhei Sutou <kou@clear-code.com>
|
4
|
+
# Copyright (C) 2013 Haruka Yoshihara <yoshihara@clear-code.com>
|
4
5
|
#
|
5
6
|
# This library is free software; you can redistribute it and/or
|
6
7
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -13,18 +14,8 @@
|
|
13
14
|
#
|
14
15
|
# You should have received a copy of the GNU Lesser General Public
|
15
16
|
# License along with this library; if not, write to the Free Software
|
16
|
-
# Foundation, Inc.,
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
18
|
|
18
19
|
source "http://rubygems.org/"
|
19
20
|
|
20
|
-
|
21
|
-
gem "rack"
|
22
|
-
|
23
|
-
group :development, :test do
|
24
|
-
gem "test-unit"
|
25
|
-
gem "test-unit-notify"
|
26
|
-
gem "test-unit-capybara"
|
27
|
-
gem "rake"
|
28
|
-
gem "jeweler"
|
29
|
-
gem "yard"
|
30
|
-
end
|
21
|
+
gemspec
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# README
|
2
|
+
|
3
|
+
## Name
|
4
|
+
|
5
|
+
Racknga
|
6
|
+
|
7
|
+
## Description
|
8
|
+
|
9
|
+
Rack middlewares that use Rroonga features and
|
10
|
+
middlewares/utilities that don't use Rroonga features.
|
11
|
+
|
12
|
+
* [Rroonga](https://ranguba.org/)
|
13
|
+
* [Rack](https://rack.github.io/)
|
14
|
+
|
15
|
+
## Authors
|
16
|
+
|
17
|
+
* Sutou Kouhei `<kou@clear-code.com>`
|
18
|
+
|
19
|
+
## License
|
20
|
+
|
21
|
+
LGPL 2.1 or later. See license/lgpl-2.1.txt for details.
|
22
|
+
|
23
|
+
(Sutou Kouhei has a right to change the license
|
24
|
+
including contributed patches.)
|
25
|
+
|
26
|
+
## Dependencies
|
27
|
+
|
28
|
+
* Ruby >= 1.9.1
|
29
|
+
* Rroonga
|
30
|
+
* Rack
|
31
|
+
|
32
|
+
## Suggested libraries
|
33
|
+
|
34
|
+
* jpmobile
|
35
|
+
|
36
|
+
## Install
|
37
|
+
|
38
|
+
```console
|
39
|
+
$ sudo gem install racknga
|
40
|
+
```
|
41
|
+
|
42
|
+
## Documents
|
43
|
+
|
44
|
+
https://ranguba.org/racknga/en/
|
data/Rakefile
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
#
|
14
14
|
# You should have received a copy of the GNU Lesser General Public
|
15
15
|
# License along with this library; if not, write to the Free Software
|
16
|
-
# Foundation, Inc.,
|
16
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
|
18
18
|
require 'English'
|
19
19
|
|
@@ -21,289 +21,36 @@ require 'fileutils'
|
|
21
21
|
require 'pathname'
|
22
22
|
require 'erb'
|
23
23
|
require 'rubygems'
|
24
|
-
require '
|
25
|
-
require
|
26
|
-
require "
|
24
|
+
require 'rubygems/package_task'
|
25
|
+
require 'bundler/gem_helper'
|
26
|
+
require "packnga"
|
27
27
|
|
28
28
|
base_dir = Pathname.new(__FILE__).dirname
|
29
29
|
racknga_lib_dir = base_dir + 'lib'
|
30
30
|
$LOAD_PATH.unshift(racknga_lib_dir.to_s)
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
helper = Bundler::GemHelper.new(base_dir)
|
33
|
+
def helper.version_tag
|
34
|
+
version
|
35
35
|
end
|
36
|
+
helper.install
|
37
|
+
spec = helper.gemspec
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
project = nil
|
40
|
-
spec = nil
|
41
|
-
Jeweler::Tasks.new do |_spec|
|
42
|
-
spec = _spec
|
43
|
-
spec.name = 'racknga'
|
44
|
-
spec.version = version
|
45
|
-
spec.rubyforge_project = 'groonga'
|
46
|
-
spec.homepage = "http://groonga.rubyforge.org/"
|
47
|
-
authors_file = File.join(base_dir, "AUTHORS")
|
48
|
-
authors = []
|
49
|
-
emails = []
|
50
|
-
File.readlines(authors_file).each do |line|
|
51
|
-
if /\s*<([^<>]*)>$/ =~ line
|
52
|
-
authors << $PREMATCH
|
53
|
-
emails << $1
|
54
|
-
end
|
55
|
-
end
|
56
|
-
spec.authors = authors
|
57
|
-
spec.email = emails
|
58
|
-
spec.summary = "A Rack middleware collection for rroonga features."
|
59
|
-
spec.description = <<-EOD.gsub(/\n/, ' ').strip
|
60
|
-
Racknga is a Rack middlewares that uses rroonga features.
|
61
|
-
EOD
|
62
|
-
spec.license = "LGPLv2.1 or later"
|
63
|
-
spec.files = FileList["lib/**/*.rb",
|
64
|
-
"{license,munin,doc/text/}/**/*",
|
65
|
-
"example/*.rb",
|
66
|
-
"AUTHORS",
|
67
|
-
"Rakefile",
|
68
|
-
"Gemfile",
|
69
|
-
"README*"]
|
70
|
-
spec.test_files = FileList["test/**/*.rb"]
|
39
|
+
Gem::PackageTask.new(spec) do |pkg|
|
40
|
+
pkg.need_tar_gz = true
|
71
41
|
end
|
72
42
|
|
73
|
-
|
74
|
-
|
43
|
+
Packnga::DocumentTask.new(spec) do |task|
|
44
|
+
task.original_language = "en"
|
45
|
+
task.translate_languages = ["ja"]
|
75
46
|
end
|
76
47
|
|
77
|
-
|
78
|
-
doc_en_dir = reference_base_dir + "en"
|
79
|
-
html_base_dir = Pathname.new("doc/html")
|
80
|
-
html_reference_dir = html_base_dir + spec.name
|
81
|
-
YARD::Rake::YardocTask.new do |task|
|
82
|
-
task.options += ["--title", spec.name]
|
83
|
-
task.options += ["--readme", "README.textile"]
|
84
|
-
task.options += ["--files", "doc/text/**/*"]
|
85
|
-
task.options += ["--output-dir", doc_en_dir.to_s]
|
86
|
-
task.options += ["--charset", "utf-8"]
|
48
|
+
Packnga::ReleaseTask.new(spec) do
|
87
49
|
end
|
88
50
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
html = path.read
|
93
|
-
html = html.gsub(/<div id="footer">.+<\/div>/m,
|
94
|
-
"<div id=\"footer\"></div>")
|
95
|
-
path.open("w") do |html_file|
|
96
|
-
html_file.print(html)
|
97
|
-
end
|
98
|
-
end
|
51
|
+
desc "Run test"
|
52
|
+
task :test do
|
53
|
+
ruby("test/run-test.rb")
|
99
54
|
end
|
100
55
|
|
101
|
-
|
102
|
-
|
103
|
-
def apply_template(content, paths, templates, language)
|
104
|
-
content = content.sub(/lang="en"/, "lang=\"#{language}\"")
|
105
|
-
|
106
|
-
title = nil
|
107
|
-
content = content.sub(/<title>(.+?)<\/title>/m) do
|
108
|
-
title = $1
|
109
|
-
templates[:head].result(binding)
|
110
|
-
end
|
111
|
-
|
112
|
-
content = content.sub(/<body(?:.*?)>/) do |body_start|
|
113
|
-
"#{body_start}\n#{templates[:header].result(binding)}\n"
|
114
|
-
end
|
115
|
-
|
116
|
-
content = content.sub(/<\/body/) do |body_end|
|
117
|
-
"\n#{templates[:footer].result(binding)}\n#{body_end}"
|
118
|
-
end
|
119
|
-
|
120
|
-
content
|
121
|
-
end
|
122
|
-
|
123
|
-
def erb_template(name)
|
124
|
-
file = File.join("doc/templates", "#{name}.html.erb")
|
125
|
-
template = File.read(file)
|
126
|
-
erb = ERB.new(template, nil, "-")
|
127
|
-
erb.filename = file
|
128
|
-
erb
|
129
|
-
end
|
130
|
-
|
131
|
-
def rsync_to_rubyforge(spec, source, destination, options={})
|
132
|
-
config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
|
133
|
-
host = "#{config["username"]}@rubyforge.org"
|
134
|
-
|
135
|
-
rsync_args = "-av --exclude '*.erb' --chmod=ug+w"
|
136
|
-
rsync_args << " --delete" if options[:delete]
|
137
|
-
remote_dir = "/var/www/gforge-projects/#{spec.rubyforge_project}/"
|
138
|
-
sh("rsync #{rsync_args} #{source} #{host}:#{remote_dir}#{destination}")
|
139
|
-
end
|
140
|
-
|
141
|
-
def rake(*arguments)
|
142
|
-
ruby($0, *arguments)
|
143
|
-
end
|
144
|
-
|
145
|
-
namespace :reference do
|
146
|
-
translate_languages = [:ja]
|
147
|
-
supported_languages = [:en, *translate_languages]
|
148
|
-
html_files = FileList[doc_en_dir + "**/*.html"].to_a
|
149
|
-
|
150
|
-
directory reference_base_dir.to_s
|
151
|
-
CLOBBER.include(reference_base_dir.to_s)
|
152
|
-
|
153
|
-
po_dir = "doc/po"
|
154
|
-
pot_file = "#{po_dir}/#{spec.name}.pot"
|
155
|
-
namespace :pot do
|
156
|
-
directory po_dir
|
157
|
-
file pot_file => [po_dir, *html_files] do |t|
|
158
|
-
sh("xml2po", "--keep-entities", "--output", t.name, *html_files)
|
159
|
-
end
|
160
|
-
|
161
|
-
desc "Generates pot file."
|
162
|
-
task :generate => pot_file
|
163
|
-
end
|
164
|
-
|
165
|
-
namespace :po do
|
166
|
-
translate_languages.each do |language|
|
167
|
-
namespace language do
|
168
|
-
po_file = "#{po_dir}/#{language}.po"
|
169
|
-
|
170
|
-
if File.exist?(po_file)
|
171
|
-
file po_file => html_files do |t|
|
172
|
-
sh("xml2po", "--keep-entities", "--update", t.name, *html_files)
|
173
|
-
end
|
174
|
-
else
|
175
|
-
file po_file => pot_file do |t|
|
176
|
-
sh("msginit",
|
177
|
-
"--input=#{pot_file}",
|
178
|
-
"--output=#{t.name}",
|
179
|
-
"--locale=#{language}")
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
desc "Updates po file for #{language}."
|
184
|
-
task :update => po_file
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
desc "Updates po files."
|
189
|
-
task :update do
|
190
|
-
rake("clobber")
|
191
|
-
rake("yard")
|
192
|
-
translate_languages.each do |language|
|
193
|
-
rake("reference:po:#{language}:update")
|
194
|
-
end
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
namespace :translate do
|
199
|
-
translate_languages.each do |language|
|
200
|
-
po_file = "#{po_dir}/#{language}.po"
|
201
|
-
translate_doc_dir = "#{reference_base_dir}/#{language}"
|
202
|
-
|
203
|
-
desc "Translates documents to #{language}."
|
204
|
-
task language => [po_file, reference_base_dir, *html_files] do
|
205
|
-
doc_en_dir.find do |path|
|
206
|
-
base_path = path.relative_path_from(doc_en_dir)
|
207
|
-
translated_path = "#{translate_doc_dir}/#{base_path}"
|
208
|
-
if path.directory?
|
209
|
-
mkdir_p(translated_path)
|
210
|
-
next
|
211
|
-
end
|
212
|
-
case path.extname
|
213
|
-
when ".html"
|
214
|
-
sh("xml2po --keep-entities " +
|
215
|
-
"--po-file #{po_file} --language #{language} " +
|
216
|
-
"#{path} > #{translated_path}")
|
217
|
-
else
|
218
|
-
cp(path.to_s, translated_path, :preserve => true)
|
219
|
-
end
|
220
|
-
end
|
221
|
-
end
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
translate_task_names = translate_languages.collect do |language|
|
226
|
-
"reference:translate:#{language}"
|
227
|
-
end
|
228
|
-
desc "Translates references."
|
229
|
-
task :translate => translate_task_names
|
230
|
-
|
231
|
-
desc "Generates references."
|
232
|
-
task :generate => [:yard, :translate]
|
233
|
-
|
234
|
-
namespace :publication do
|
235
|
-
task :prepare do
|
236
|
-
supported_languages.each do |language|
|
237
|
-
raw_reference_dir = reference_base_dir + language.to_s
|
238
|
-
prepared_reference_dir = html_reference_dir + language.to_s
|
239
|
-
rm_rf(prepared_reference_dir.to_s)
|
240
|
-
head = erb_template("head.#{language}")
|
241
|
-
header = erb_template("header.#{language}")
|
242
|
-
footer = erb_template("footer.#{language}")
|
243
|
-
raw_reference_dir.find do |path|
|
244
|
-
relative_path = path.relative_path_from(raw_reference_dir)
|
245
|
-
prepared_path = prepared_reference_dir + relative_path
|
246
|
-
if path.directory?
|
247
|
-
mkdir_p(prepared_path.to_s)
|
248
|
-
else
|
249
|
-
case path.basename.to_s
|
250
|
-
when /(?:file|method|class)_list\.html\z/
|
251
|
-
cp(path.to_s, prepared_path.to_s)
|
252
|
-
when /\.html\z/
|
253
|
-
relative_dir_path = relative_path.dirname
|
254
|
-
current_path = relative_dir_path + path.basename
|
255
|
-
if current_path.basename.to_s == "index.html"
|
256
|
-
current_path = current_path.dirname
|
257
|
-
end
|
258
|
-
top_path = html_base_dir.relative_path_from(prepared_path.dirname)
|
259
|
-
package_path = top_path + spec.name
|
260
|
-
paths = {
|
261
|
-
:top => top_path,
|
262
|
-
:current => current_path,
|
263
|
-
:package => package_path,
|
264
|
-
}
|
265
|
-
templates = {
|
266
|
-
:head => head,
|
267
|
-
:header => header,
|
268
|
-
:footer => footer
|
269
|
-
}
|
270
|
-
content = apply_template(File.read(path.to_s),
|
271
|
-
paths,
|
272
|
-
templates,
|
273
|
-
language)
|
274
|
-
File.open(prepared_path.to_s, "w") do |file|
|
275
|
-
file.print(content)
|
276
|
-
end
|
277
|
-
else
|
278
|
-
cp(path.to_s, prepared_path.to_s)
|
279
|
-
end
|
280
|
-
end
|
281
|
-
end
|
282
|
-
end
|
283
|
-
File.open("#{html_reference_dir}/.htaccess", "w") do |file|
|
284
|
-
file.puts("RedirectMatch permanent ^/#{spec.name}/$ " +
|
285
|
-
"#{spec.homepage}#{spec.name}/en/")
|
286
|
-
end
|
287
|
-
end
|
288
|
-
end
|
289
|
-
|
290
|
-
desc "Upload document to rubyforge."
|
291
|
-
task :publish => [:generate, "reference:publication:prepare"] do
|
292
|
-
rsync_to_rubyforge(spec, "#{html_reference_dir}/", spec.name)
|
293
|
-
end
|
294
|
-
end
|
295
|
-
|
296
|
-
namespace :html do
|
297
|
-
desc "Publish HTML to Web site."
|
298
|
-
task :publish do
|
299
|
-
rsync_to_rubyforge(spec, "#{html_base_dir}/", "")
|
300
|
-
end
|
301
|
-
end
|
302
|
-
|
303
|
-
desc "Upload document to rubyforge."
|
304
|
-
task :publish => ["reference:publish"]
|
305
|
-
|
306
|
-
desc "Tag the current revision."
|
307
|
-
task :tag do
|
308
|
-
sh("git tag -a #{version} -m 'release #{version}!!!'")
|
309
|
-
end
|
56
|
+
task :default => :test
|
@@ -1,8 +1,25 @@
|
|
1
|
-
|
1
|
+
# NEWS
|
2
2
|
|
3
|
-
|
3
|
+
## 0.9.5: 2024-04-08
|
4
4
|
|
5
|
-
|
5
|
+
### Improvments
|
6
|
+
|
7
|
+
* Added `base64` dependency.
|
8
|
+
* Added `net-smtp` dependency.
|
9
|
+
* Removed `nkf` dependency.
|
10
|
+
* Stopped using deprecated APIs of Rack.
|
11
|
+
|
12
|
+
## 0.9.4: 2023-09-03
|
13
|
+
|
14
|
+
### Improvments
|
15
|
+
|
16
|
+
* [cache] Made Rroonga dependency optional. Users must add Rroonga
|
17
|
+
dependency explicitly.
|
18
|
+
* And more improvements...
|
19
|
+
|
20
|
+
## 0.9.3: 2011-11-12
|
21
|
+
|
22
|
+
### Improvments
|
6
23
|
|
7
24
|
* [access-log-parser] Supported Apache log.
|
8
25
|
* [cache] Fixed unknown name errors.
|
@@ -12,9 +29,9 @@ h3. Improvments
|
|
12
29
|
* [exception-mail-notifier] Used #message instead of #to_s.
|
13
30
|
* [logger] Logged also X-Runtime.
|
14
31
|
|
15
|
-
|
32
|
+
## 0.9.2: 2011-08-07
|
16
33
|
|
17
|
-
|
34
|
+
### Improvments
|
18
35
|
|
19
36
|
* [munin] Supported Passenger 3 support.
|
20
37
|
* [munin] Removed Passenger 2 support.
|
@@ -28,7 +45,7 @@ h3. Improvments
|
|
28
45
|
* Added NginixAccessLogParser.
|
29
46
|
* Documented middlewares.
|
30
47
|
|
31
|
-
|
48
|
+
## 0.9.1: 2010-11-11
|
32
49
|
|
33
50
|
* Improved cache validation.
|
34
51
|
* Supported caches per User-Agent.
|
@@ -39,6 +56,6 @@ h2. 0.9.1: 2010-11-11
|
|
39
56
|
* Changed license to LGPLv2.1 or later from LGPLv2.1.
|
40
57
|
* Supported will_paginate.
|
41
58
|
|
42
|
-
|
59
|
+
## 0.9.0: 2010-07-04
|
43
60
|
|
44
61
|
* Initial release!
|
@@ -15,7 +15,7 @@
|
|
15
15
|
#
|
16
16
|
# You should have received a copy of the GNU Lesser General Public
|
17
17
|
# License along with this library; if not, write to the Free Software
|
18
|
-
# Foundation, Inc.,
|
18
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
19
19
|
|
20
20
|
require "racknga/log_entry"
|
21
21
|
require "racknga/reverse_line_reader"
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Copyright (C) 2012 Haruka Yoshihara <yoshihara@clear-code.com>
|
2
|
+
# Copyright (C) 2024 Sutou Kouhei <kou@clear-code.com>
|
3
|
+
#
|
4
|
+
# This library is free software; you can redistribute it and/or
|
5
|
+
# modify it under the terms of the GNU Lesser General Public
|
6
|
+
# License as published by the Free Software Foundation; either
|
7
|
+
# version 2.1 of the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This library is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this library; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
+
|
18
|
+
module Racknga
|
19
|
+
# This is a store for API keys. It is used with
|
20
|
+
# Racknga::Middleware::Auth::APIKeys.
|
21
|
+
class APIKeys
|
22
|
+
# @param [String] query_parameter query parameter to specify an API key.
|
23
|
+
# @param [Array] api_keys stored API keys.
|
24
|
+
def initialize(query_parameter, api_keys)
|
25
|
+
@query_parameter = query_parameter
|
26
|
+
@api_keys = api_keys
|
27
|
+
end
|
28
|
+
|
29
|
+
# Checks whether stored API keys includes an API key in a request.
|
30
|
+
# @param [Hash] environment an environment for Rack.
|
31
|
+
# @return [Boolean] true if an API key is included, or false if not.
|
32
|
+
def include?(environment)
|
33
|
+
request = Rack::Request.new(environment)
|
34
|
+
key = request.params[@query_parameter]
|
35
|
+
|
36
|
+
@api_keys.include?(key)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -14,7 +14,7 @@
|
|
14
14
|
#
|
15
15
|
# You should have received a copy of the GNU Lesser General Public
|
16
16
|
# License along with this library; if not, write to the Free Software
|
17
|
-
# Foundation, Inc.,
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
18
|
|
19
19
|
require 'fileutils'
|
20
20
|
|
@@ -98,7 +98,7 @@ module Racknga
|
|
98
98
|
:key_type => "ShortText") do |table|
|
99
99
|
table.uint32("status")
|
100
100
|
table.short_text("headers")
|
101
|
-
table.text("body"
|
101
|
+
table.text("body")
|
102
102
|
table.short_text("checksum")
|
103
103
|
table.uint32("age")
|
104
104
|
table.time("created_at")
|
@@ -1,6 +1,4 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# Copyright (C) 2010-2011 Kouhei Sutou <kou@clear-code.com>
|
1
|
+
# Copyright (C) 2010-2024 Sutou Kouhei <kou@clear-code.com>
|
4
2
|
#
|
5
3
|
# This library is free software; you can redistribute it and/or
|
6
4
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -14,15 +12,15 @@
|
|
14
12
|
#
|
15
13
|
# You should have received a copy of the GNU Lesser General Public
|
16
14
|
# License along with this library; if not, write to the Free Software
|
17
|
-
# Foundation, Inc.,
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
16
|
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
23
|
-
require
|
17
|
+
require "base64"
|
18
|
+
require "etc"
|
19
|
+
require "net/smtp"
|
20
|
+
require "socket"
|
21
|
+
require "time"
|
24
22
|
|
25
|
-
require
|
23
|
+
require "racknga/utils"
|
26
24
|
|
27
25
|
module Racknga
|
28
26
|
# Ruby 1.9 only. 1.8 isn't supported.
|
@@ -132,10 +130,10 @@ EOE
|
|
132
130
|
end
|
133
131
|
|
134
132
|
def send_summaries
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
133
|
+
subject = "summaries of #{@summaries.size} notifications"
|
134
|
+
mail = create_mail(:subject => subject,
|
135
|
+
:body => report_body)
|
136
|
+
send(mail)
|
139
137
|
end
|
140
138
|
|
141
139
|
def report_body
|
@@ -198,10 +196,13 @@ EOB
|
|
198
196
|
def encode_subject(subject)
|
199
197
|
case charset
|
200
198
|
when /\Aiso-2022-jp\z/i
|
201
|
-
|
202
|
-
|
203
|
-
|
199
|
+
subject = subject.encode("ISO-2022-JP")
|
200
|
+
end
|
201
|
+
base64_subject = Base64.encode64(subject)
|
202
|
+
lines = base64_subject.lines.collect do |line|
|
203
|
+
"=?#{charset}?B?#{line.chomp}?="
|
204
204
|
end
|
205
|
+
lines.join("\r\n")
|
205
206
|
end
|
206
207
|
end
|
207
208
|
end
|
data/lib/racknga/log_database.rb
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
#
|
15
15
|
# You should have received a copy of the GNU Lesser General Public
|
16
16
|
# License along with this library; if not, write to the Free Software
|
17
|
-
# Foundation, Inc.,
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18
18
|
|
19
19
|
require 'fileutils'
|
20
20
|
|
data/lib/racknga/log_entry.rb
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
#
|
16
16
|
# You should have received a copy of the GNU Lesser General Public
|
17
17
|
# License along with this library; if not, write to the Free Software
|
18
|
-
# Foundation, Inc.,
|
18
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
19
19
|
|
20
20
|
module Racknga
|
21
21
|
class LogEntry
|