rethoth 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +26 -0
- data/bin/thoth +233 -0
- data/lib/proto/config.ru +45 -0
- data/lib/proto/thoth.conf.sample +206 -0
- data/lib/thoth/cache.rb +53 -0
- data/lib/thoth/config.rb +158 -0
- data/lib/thoth/controller/admin.rb +75 -0
- data/lib/thoth/controller/api/comment.rb +73 -0
- data/lib/thoth/controller/api/page.rb +134 -0
- data/lib/thoth/controller/api/post.rb +122 -0
- data/lib/thoth/controller/api/tag.rb +59 -0
- data/lib/thoth/controller/archive.rb +50 -0
- data/lib/thoth/controller/comment.rb +173 -0
- data/lib/thoth/controller/main.rb +193 -0
- data/lib/thoth/controller/media.rb +172 -0
- data/lib/thoth/controller/page.rb +167 -0
- data/lib/thoth/controller/post.rb +310 -0
- data/lib/thoth/controller/search.rb +86 -0
- data/lib/thoth/controller/tag.rb +107 -0
- data/lib/thoth/controller.rb +48 -0
- data/lib/thoth/errors.rb +35 -0
- data/lib/thoth/helper/admin.rb +86 -0
- data/lib/thoth/helper/cookie.rb +45 -0
- data/lib/thoth/helper/error.rb +122 -0
- data/lib/thoth/helper/pagination.rb +131 -0
- data/lib/thoth/helper/wiki.rb +77 -0
- data/lib/thoth/helper/ysearch.rb +89 -0
- data/lib/thoth/importer/pants.rb +81 -0
- data/lib/thoth/importer/poseidon.rb +54 -0
- data/lib/thoth/importer/thoth.rb +103 -0
- data/lib/thoth/importer.rb +131 -0
- data/lib/thoth/layout/default.rhtml +47 -0
- data/lib/thoth/middleware/minify.rb +82 -0
- data/lib/thoth/migrate/001_create_schema.rb +108 -0
- data/lib/thoth/migrate/002_add_media_size.rb +37 -0
- data/lib/thoth/migrate/003_add_post_draft.rb +38 -0
- data/lib/thoth/migrate/004_add_comment_email.rb +37 -0
- data/lib/thoth/migrate/005_add_page_position.rb +37 -0
- data/lib/thoth/migrate/006_add_comment_close_delete.rb +43 -0
- data/lib/thoth/migrate/007_add_comment_summary.rb +37 -0
- data/lib/thoth/model/comment.rb +216 -0
- data/lib/thoth/model/media.rb +87 -0
- data/lib/thoth/model/page.rb +204 -0
- data/lib/thoth/model/post.rb +262 -0
- data/lib/thoth/model/tag.rb +80 -0
- data/lib/thoth/model/tags_posts_map.rb +34 -0
- data/lib/thoth/monkeypatch/sequel/model/errors.rb +37 -0
- data/lib/thoth/plugin/thoth_delicious.rb +105 -0
- data/lib/thoth/plugin/thoth_flickr.rb +86 -0
- data/lib/thoth/plugin/thoth_pinboard.rb +98 -0
- data/lib/thoth/plugin/thoth_tags.rb +68 -0
- data/lib/thoth/plugin/thoth_twitter.rb +175 -0
- data/lib/thoth/plugin.rb +59 -0
- data/lib/thoth/public/css/admin.css +223 -0
- data/lib/thoth/public/css/thoth.css +592 -0
- data/lib/thoth/public/images/admin-sprite.png +0 -0
- data/lib/thoth/public/images/thoth-sprite.png +0 -0
- data/lib/thoth/public/js/admin/comments.js +116 -0
- data/lib/thoth/public/js/admin/name.js +244 -0
- data/lib/thoth/public/js/admin/tagcomplete.js +332 -0
- data/lib/thoth/public/js/lazyload-min.js +4 -0
- data/lib/thoth/public/js/thoth.js +203 -0
- data/lib/thoth/public/robots.txt +5 -0
- data/lib/thoth/version.rb +37 -0
- data/lib/thoth/view/admin/index.rhtml +1 -0
- data/lib/thoth/view/admin/login.rhtml +23 -0
- data/lib/thoth/view/admin/toolbar.rhtml +117 -0
- data/lib/thoth/view/admin/welcome.rhtml +58 -0
- data/lib/thoth/view/archive/index.rhtml +24 -0
- data/lib/thoth/view/comment/comment.rhtml +47 -0
- data/lib/thoth/view/comment/delete.rhtml +15 -0
- data/lib/thoth/view/comment/form.rhtml +81 -0
- data/lib/thoth/view/comment/index.rhtml +68 -0
- data/lib/thoth/view/comment/list.rhtml +48 -0
- data/lib/thoth/view/media/delete.rhtml +15 -0
- data/lib/thoth/view/media/edit.rhtml +12 -0
- data/lib/thoth/view/media/form.rhtml +7 -0
- data/lib/thoth/view/media/list.rhtml +35 -0
- data/lib/thoth/view/media/media.rhtml +44 -0
- data/lib/thoth/view/media/new.rhtml +7 -0
- data/lib/thoth/view/page/delete.rhtml +15 -0
- data/lib/thoth/view/page/edit.rhtml +15 -0
- data/lib/thoth/view/page/form.rhtml +57 -0
- data/lib/thoth/view/page/index.rhtml +9 -0
- data/lib/thoth/view/page/list.rhtml +49 -0
- data/lib/thoth/view/page/new.rhtml +15 -0
- data/lib/thoth/view/post/comments.rhtml +12 -0
- data/lib/thoth/view/post/compact.rhtml +48 -0
- data/lib/thoth/view/post/delete.rhtml +15 -0
- data/lib/thoth/view/post/edit.rhtml +15 -0
- data/lib/thoth/view/post/form.rhtml +83 -0
- data/lib/thoth/view/post/index.rhtml +48 -0
- data/lib/thoth/view/post/list.rhtml +61 -0
- data/lib/thoth/view/post/new.rhtml +15 -0
- data/lib/thoth/view/post/tiny.rhtml +4 -0
- data/lib/thoth/view/search/index.rhtml +45 -0
- data/lib/thoth/view/tag/index.rhtml +34 -0
- data/lib/thoth/view/thoth/css.rhtml +9 -0
- data/lib/thoth/view/thoth/footer.rhtml +15 -0
- data/lib/thoth/view/thoth/header.rhtml +23 -0
- data/lib/thoth/view/thoth/index.rhtml +11 -0
- data/lib/thoth/view/thoth/js.rhtml +6 -0
- data/lib/thoth/view/thoth/sidebar.rhtml +38 -0
- data/lib/thoth/view/thoth/util/pager.rhtml +23 -0
- data/lib/thoth/view/thoth/util/simple_pager.rhtml +15 -0
- data/lib/thoth/view/thoth/util/table_sortheader.rhtml +20 -0
- data/lib/thoth.rb +394 -0
- metadata +409 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: af4011f591355af9450daa140d5acbd5ddb652e5
|
4
|
+
data.tar.gz: bd93c7e0e0088b3ede574b49496ae1a62ed75a93
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: aa181bcfb70927ce5f5022106e39c4e272c195affc53d6c2a6a97241bde483df705a5f023d795b046a9834a99d6311bcb7555fbcaa7d7d70677ea90d7a8be05b
|
7
|
+
data.tar.gz: 9f9f3e8f1b7d488150bd20f1d525b32d6113b424a15e0e5193b6e0faba6fa13c8b14e696e00f96ee069ab97fda1e82454c0360a22c9f6cb22480a7df26d11c83
|
data/LICENSE
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Copyright (c) 2017 John Pagonis <john@pagonis.org>
|
2
|
+
Copyright (c) 2009 - 2011 Ryan Grove <ryan@wonko.com>
|
3
|
+
All rights reserved.
|
4
|
+
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
7
|
+
|
8
|
+
* Redistributions of source code must retain the above copyright notice,
|
9
|
+
this list of conditions and the following disclaimer.
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
12
|
+
and/or other materials provided with the distribution.
|
13
|
+
* Neither the name of this project nor the names of its contributors may be
|
14
|
+
used to endorse or promote products derived from this software without
|
15
|
+
specific prior written permission.
|
16
|
+
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
18
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
19
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
20
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
21
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
22
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
23
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
24
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
25
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/bin/thoth
ADDED
@@ -0,0 +1,233 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#--
|
3
|
+
# Copyright (c) 2017 John Pagonis <john@pagonis.org>
|
4
|
+
# Copyright (c) 2009 Ryan Grove <ryan@wonko.com>
|
5
|
+
# All rights reserved.
|
6
|
+
#
|
7
|
+
# Redistribution and use in source and binary forms, with or without
|
8
|
+
# modification, are permitted provided that the following conditions are met:
|
9
|
+
#
|
10
|
+
# * Redistributions of source code must retain the above copyright notice,
|
11
|
+
# this list of conditions and the following disclaimer.
|
12
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
13
|
+
# this list of conditions and the following disclaimer in the documentation
|
14
|
+
# and/or other materials provided with the distribution.
|
15
|
+
# * Neither the name of this project nor the names of its contributors may be
|
16
|
+
# used to endorse or promote products derived from this software without
|
17
|
+
# specific prior written permission.
|
18
|
+
#
|
19
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
20
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
21
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
22
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
23
|
+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
24
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
25
|
+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
26
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
27
|
+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
#++
|
30
|
+
|
31
|
+
require 'optparse'
|
32
|
+
require 'ramaze'
|
33
|
+
|
34
|
+
module Thoth
|
35
|
+
include Innate::Traited
|
36
|
+
|
37
|
+
cli_action = :server # :import, :migrate, or :server
|
38
|
+
cli_values = {}
|
39
|
+
|
40
|
+
# Parse command-line options.
|
41
|
+
begin
|
42
|
+
OptionParser.new {|o|
|
43
|
+
o.summary_indent = ' '
|
44
|
+
o.summary_width = 24
|
45
|
+
o.banner = "Usage: thoth [options]\n" +
|
46
|
+
" thoth [info]"
|
47
|
+
|
48
|
+
o.separator ''
|
49
|
+
o.separator 'Options:'
|
50
|
+
|
51
|
+
o.on('-a', '--adapter <adapter>',
|
52
|
+
'Use the specified Ramaze server adapter.') do |adapter|
|
53
|
+
trait(:adapter => adapter)
|
54
|
+
end
|
55
|
+
|
56
|
+
o.on('-c', '--config <filename>',
|
57
|
+
'Use the specified configuration file.') do |filename|
|
58
|
+
trait(:config_file => File.expand_path(filename))
|
59
|
+
end
|
60
|
+
|
61
|
+
o.on('-d', '--daemon <command>', [:start, :stop, :restart],
|
62
|
+
'Issue the specified daemon command (start, stop, or',
|
63
|
+
'restart).') do |cmd|
|
64
|
+
trait(:daemon => cmd)
|
65
|
+
end
|
66
|
+
|
67
|
+
o.on('-H', '--home <path>',
|
68
|
+
'Use the specified home directory.') do |home|
|
69
|
+
unless File.directory?(home)
|
70
|
+
abort("Error: home directory not found or not a directory: #{home}")
|
71
|
+
end
|
72
|
+
|
73
|
+
HOME_DIR = File.expand_path(home)
|
74
|
+
end
|
75
|
+
|
76
|
+
o.on('-i', '--ip <address>',
|
77
|
+
'Listen for connections on the specified IP address.') do |address|
|
78
|
+
trait(:ip => address)
|
79
|
+
end
|
80
|
+
|
81
|
+
o.on('-p', '--port <number>',
|
82
|
+
'Listen for connections on the specified port number.') do |port|
|
83
|
+
trait(:port => port.to_i)
|
84
|
+
end
|
85
|
+
|
86
|
+
o.separator ''
|
87
|
+
|
88
|
+
o.on('--create <path>',
|
89
|
+
'Create a new Thoth home directory with a sample',
|
90
|
+
'config file.') do |path|
|
91
|
+
require 'thoth'
|
92
|
+
|
93
|
+
begin
|
94
|
+
create(path)
|
95
|
+
rescue => e
|
96
|
+
abort("Error: #{e}")
|
97
|
+
end
|
98
|
+
|
99
|
+
puts 'Your new Thoth home directory has been created at ' <<
|
100
|
+
File.expand_path(path)
|
101
|
+
|
102
|
+
exit
|
103
|
+
end
|
104
|
+
|
105
|
+
o.on('--devel',
|
106
|
+
'Run Thoth in development mode.') do
|
107
|
+
trait(:mode => :devel)
|
108
|
+
end
|
109
|
+
|
110
|
+
o.on('--import <module>',
|
111
|
+
'Import content from another blog engine using the',
|
112
|
+
'specified import module.') do |import_module|
|
113
|
+
cli_action = :import
|
114
|
+
cli_values[:importer] = import_module
|
115
|
+
end
|
116
|
+
|
117
|
+
o.on('--irb',
|
118
|
+
'Start Thoth within an IRB session.') do
|
119
|
+
trait(:irb => true)
|
120
|
+
end
|
121
|
+
|
122
|
+
o.on('--log-sql <filename>',
|
123
|
+
'Log all SQL queries to the specified file.') do |filename|
|
124
|
+
trait(:sql_log => File.expand_path(filename))
|
125
|
+
end
|
126
|
+
|
127
|
+
o.on '--migrate [version]',
|
128
|
+
'Migrate the database to the specified schema version,',
|
129
|
+
'or to the latest version if not specified.' do |version|
|
130
|
+
cli_action = :migrate
|
131
|
+
cli_values[:schema_version] = version
|
132
|
+
end
|
133
|
+
|
134
|
+
o.separator ''
|
135
|
+
o.separator 'Info:'
|
136
|
+
|
137
|
+
o.on_tail('-h', '--help',
|
138
|
+
'Display usage information (this message).') do
|
139
|
+
require 'thoth'
|
140
|
+
|
141
|
+
puts "#{APP_NAME} v#{APP_VERSION} <#{APP_URL}>"
|
142
|
+
puts "#{APP_COPYRIGHT}"
|
143
|
+
puts
|
144
|
+
puts o
|
145
|
+
puts
|
146
|
+
puts 'Default Directories:'
|
147
|
+
puts " public: #{PUBLIC_DIR}"
|
148
|
+
puts " view: #{VIEW_DIR}"
|
149
|
+
exit
|
150
|
+
end
|
151
|
+
|
152
|
+
o.on_tail('-v', '--version',
|
153
|
+
'Display version information.') do
|
154
|
+
require 'thoth'
|
155
|
+
|
156
|
+
puts "#{APP_NAME} v#{APP_VERSION} <#{APP_URL}>"
|
157
|
+
puts "#{APP_COPYRIGHT}"
|
158
|
+
puts
|
159
|
+
puts "#{APP_NAME} comes with ABSOLUTELY NO WARRANTY."
|
160
|
+
puts
|
161
|
+
puts "This program is open source software distributed under the BSD license. For"
|
162
|
+
puts "details, see the LICENSE file contained in the source distribution."
|
163
|
+
exit
|
164
|
+
end
|
165
|
+
}.parse!(ARGV)
|
166
|
+
rescue => e
|
167
|
+
abort("Error: #{e}")
|
168
|
+
end
|
169
|
+
|
170
|
+
require 'thoth'
|
171
|
+
|
172
|
+
Config.load(trait[:config_file])
|
173
|
+
|
174
|
+
if trait[:irb]
|
175
|
+
# Avoid passing args to IRB.
|
176
|
+
ARGV.clear
|
177
|
+
|
178
|
+
require 'irb'
|
179
|
+
require 'irb/completion'
|
180
|
+
|
181
|
+
ENV['IRBRC'] = '.irbrc' if File.exist?('.irbrc')
|
182
|
+
IRB.start
|
183
|
+
end
|
184
|
+
|
185
|
+
case cli_action
|
186
|
+
when :import
|
187
|
+
require 'thoth/importer'
|
188
|
+
|
189
|
+
begin
|
190
|
+
Importer.load_importer(cli_values[:importer]).run
|
191
|
+
rescue LoadError => e
|
192
|
+
abort("Error: #{e}")
|
193
|
+
end
|
194
|
+
|
195
|
+
when :migrate
|
196
|
+
schema_version = cli_values[:schema_version]
|
197
|
+
|
198
|
+
if !schema_version.nil? && schema_version.to_i == 0
|
199
|
+
puts 'WARNING: Migrating to schema version 0 will delete your Thoth database. This'
|
200
|
+
puts 'action cannot be undone. Are you sure you want to continue? (y/n)'
|
201
|
+
print '> '
|
202
|
+
|
203
|
+
exit unless STDIN.gets.strip =~ /^y(?:es)?/i
|
204
|
+
puts
|
205
|
+
end
|
206
|
+
|
207
|
+
begin
|
208
|
+
open_db
|
209
|
+
Sequel::Migrator.apply(@db, File.join(LIB_DIR, 'migrate'), schema_version.nil? ? nil :
|
210
|
+
schema_version.to_i)
|
211
|
+
rescue => e
|
212
|
+
abort("Error: #{e}")
|
213
|
+
else
|
214
|
+
puts "Migration complete."
|
215
|
+
end
|
216
|
+
|
217
|
+
when :server
|
218
|
+
trait(:pidfile => File.join(HOME_DIR, "thoth_#{trait[:ip]}_#{trait[:port]}.pid"))
|
219
|
+
|
220
|
+
trait[:adapter] ||= Config.server['adapter']
|
221
|
+
trait[:ip] ||= Config.server['address']
|
222
|
+
trait[:port] ||= Config.server['port']
|
223
|
+
|
224
|
+
begin
|
225
|
+
send(trait[:daemon] || :run)
|
226
|
+
rescue SchemaError => e
|
227
|
+
abort("Error: #{e}")
|
228
|
+
end
|
229
|
+
|
230
|
+
else
|
231
|
+
abort("Error: unknown action: #{cli_action}")
|
232
|
+
end
|
233
|
+
end
|
data/lib/proto/config.ru
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2017 John Pagonis <john@pagonis.org>
|
3
|
+
# Copyright (c) 2009 Ryan Grove <ryan@wonko.com>
|
4
|
+
# All rights reserved.
|
5
|
+
#
|
6
|
+
# Redistribution and use in source and binary forms, with or without
|
7
|
+
# modification, are permitted provided that the following conditions are met:
|
8
|
+
#
|
9
|
+
# * Redistributions of source code must retain the above copyright notice,
|
10
|
+
# this list of conditions and the following disclaimer.
|
11
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
12
|
+
# this list of conditions and the following disclaimer in the documentation
|
13
|
+
# and/or other materials provided with the distribution.
|
14
|
+
# * Neither the name of this project nor the names of its contributors may be
|
15
|
+
# used to endorse or promote products derived from this software without
|
16
|
+
# specific prior written permission.
|
17
|
+
#
|
18
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
19
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
20
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
22
|
+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
23
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
24
|
+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
25
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
26
|
+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
27
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
28
|
+
#++
|
29
|
+
|
30
|
+
# Rackup file for Thoth.
|
31
|
+
|
32
|
+
require 'thoth'
|
33
|
+
|
34
|
+
module Thoth
|
35
|
+
if ENV['RACK_ENV'] == 'development' || ENV['RAILS_ENV'] == 'development'
|
36
|
+
trait(:mode => :devel)
|
37
|
+
end
|
38
|
+
|
39
|
+
Config.load(trait[:config_file])
|
40
|
+
|
41
|
+
init_thoth
|
42
|
+
end
|
43
|
+
|
44
|
+
Ramaze.start(:file => __FILE__, :started => true)
|
45
|
+
run Ramaze
|
@@ -0,0 +1,206 @@
|
|
1
|
+
#
|
2
|
+
# thoth.conf - Thoth configuration file.
|
3
|
+
#
|
4
|
+
# Customize this file as desired. You must restart Thoth before configuration
|
5
|
+
# changes will take effect.
|
6
|
+
#
|
7
|
+
# This file is YAML, but you may also use Erubis expressions to insert variables
|
8
|
+
# or run Ruby code.
|
9
|
+
#
|
10
|
+
|
11
|
+
# Settings for live mode.
|
12
|
+
live:
|
13
|
+
|
14
|
+
# Connection URI for the database. Currently SQLite3 and MySQL are supported.
|
15
|
+
# PostgreSQL may work, but hasn't been tested.
|
16
|
+
#
|
17
|
+
# Sample SQLite3 config:
|
18
|
+
# db: sqlite:////absolute/path/to/database.db
|
19
|
+
#
|
20
|
+
# Sample MySQL config:
|
21
|
+
# db: mysql://user:pass@hostname/database
|
22
|
+
db: sqlite:///<%= Thoth::HOME_DIR %>/db/live.db
|
23
|
+
|
24
|
+
# General site settings.
|
25
|
+
site:
|
26
|
+
# Name of your blog. This will be displayed as the title of your blog's
|
27
|
+
# index page and in your blog's feeds.
|
28
|
+
name: New Thoth Blog
|
29
|
+
|
30
|
+
# A brief description or subtitle for your blog.
|
31
|
+
desc: Thoth is awesome.
|
32
|
+
|
33
|
+
# Base URL of your site. This is necessary in order for Thoth to know how
|
34
|
+
# to construct links. Be sure to set this correctly or links may not work.
|
35
|
+
url: http://localhost:7000/
|
36
|
+
|
37
|
+
# URLs of CSS files to load in addition to the default Thoth CSS. You can
|
38
|
+
# override Thoth's default styles by specifying your own CSS files here.
|
39
|
+
# These can be relative or absolute URLs.
|
40
|
+
#
|
41
|
+
# Example:
|
42
|
+
# css:
|
43
|
+
# - /css/foo.css
|
44
|
+
# - 'http://example.com/bar.css'
|
45
|
+
#
|
46
|
+
css: []
|
47
|
+
|
48
|
+
# URLs of JS files to load in addition to the default Thoth JS. You can
|
49
|
+
# extend or override Thoth's JS or add functionality by specifying your own
|
50
|
+
# JS files here. These can be relative or absolute URLs.
|
51
|
+
#
|
52
|
+
# Example:
|
53
|
+
# js:
|
54
|
+
# - /js/foo.js
|
55
|
+
# - 'http://example.com/bar.js'
|
56
|
+
#
|
57
|
+
js: []
|
58
|
+
|
59
|
+
# Whether or not to allow visitors to post comments in response to blog
|
60
|
+
# posts.
|
61
|
+
enable_comments: true
|
62
|
+
|
63
|
+
# Whether or not you want to expose a sitemap for your blog. A sitemap is
|
64
|
+
# an XML file that gives search engines information about all the URLs on
|
65
|
+
# your site so they can index them more easily.
|
66
|
+
#
|
67
|
+
# If enabled, you'll be able to see your sitemap at
|
68
|
+
# http://yourdomain.com/sitemap and you can submit this URL to search
|
69
|
+
# engines to improve the indexing of your site (and possibly your pagerank).
|
70
|
+
enable_sitemap: true
|
71
|
+
|
72
|
+
# Gravatar settings.
|
73
|
+
gravatar:
|
74
|
+
# Whether or not to enable Gravatar images on comments. Gravatar is a free
|
75
|
+
# service that allows people to associate profile images with an email
|
76
|
+
# address so that their postings on blogs and other websites are easily
|
77
|
+
# identifiable. Learn more at http://www.gravatar.com/.
|
78
|
+
enabled: true
|
79
|
+
|
80
|
+
# Default icon set to use for users who don't have custom Gravatars. See
|
81
|
+
# gravatar.com for the latest options. As of this writing, the available
|
82
|
+
# choices are "identicon" (geometric shapes), "monsterids" (cutesy little
|
83
|
+
# monsters), and "wavatars" (cutesy geometric shapes).
|
84
|
+
#
|
85
|
+
# Alternatively, you can specify the URL of your own custom image here and
|
86
|
+
# that image will be used instead.
|
87
|
+
default: identicon
|
88
|
+
|
89
|
+
# Maximum Gravatar rating to allow. Available ratings are "g", "pg", "r",
|
90
|
+
# and "x". Just like with movies, "r" and "x"-rated Gravatars may contain
|
91
|
+
# adult content.
|
92
|
+
rating: g
|
93
|
+
|
94
|
+
# Gravatar size in pixels. This sets both the width and the height.
|
95
|
+
size: 32
|
96
|
+
|
97
|
+
# Administrator settings.
|
98
|
+
admin:
|
99
|
+
# Your name. This will be displayed in the copyright notice at the bottom of
|
100
|
+
# the page, and will be used as the author name for your site's feeds.
|
101
|
+
name: John Doe
|
102
|
+
|
103
|
+
# Your email address. If you leave this blank or comment it out, it won't be
|
104
|
+
# displayed.
|
105
|
+
email: ''
|
106
|
+
|
107
|
+
# Administrator username. This is the name you'll use to log into Thoth.
|
108
|
+
user: thoth
|
109
|
+
|
110
|
+
# Administrator password. By default this is a random number, so you won't
|
111
|
+
# be able to log in until you change this!
|
112
|
+
pass: thoth
|
113
|
+
|
114
|
+
# String of random characters to add uniqueness to the admin auth cookie
|
115
|
+
# hash. Just fill this with some made-up nonsense.
|
116
|
+
seed: 6d552ac197a862b82b85868d6c245feb
|
117
|
+
|
118
|
+
# Plugins that should be loaded when Thoth starts. Usually it's not
|
119
|
+
# necessary to load a plugin until the first time it's used, but some plugins
|
120
|
+
# alter core functionality and thus must be loaded at start time.
|
121
|
+
#
|
122
|
+
# Example:
|
123
|
+
# plugins:
|
124
|
+
# - foo
|
125
|
+
# - bar
|
126
|
+
# - baz
|
127
|
+
#
|
128
|
+
plugins: []
|
129
|
+
|
130
|
+
# Absolute path to a directory where uploaded media files (images, videos,
|
131
|
+
# etc.) for your blog posts and pages should be stored. This directory needs
|
132
|
+
# to be readable and writeable by the user running the Thoth server.
|
133
|
+
media: <%= Thoth::HOME_DIR %>/media
|
134
|
+
|
135
|
+
# Server settings.
|
136
|
+
server:
|
137
|
+
# Server adapter to use. This can be any adapter Ramaze supports.
|
138
|
+
adapter: webrick
|
139
|
+
|
140
|
+
# IP address on which Thoth should listen for connections. Specify 0.0.0.0
|
141
|
+
# if you want Thoth to listen on all addresses.
|
142
|
+
address: 0.0.0.0
|
143
|
+
|
144
|
+
# Port on which the Thoth server should listen for connections.
|
145
|
+
port: 7000
|
146
|
+
|
147
|
+
# Whether or not to enable caching. Enabling caching will significantly
|
148
|
+
# improve Thoth's performance under heavy traffic.
|
149
|
+
enable_cache: true
|
150
|
+
|
151
|
+
# Whether or not to enable automatic, on the fly minification of your blog's
|
152
|
+
# external CSS and JavaScript files. Enabling minification will reduce
|
153
|
+
# page weight and is a great way to improve performance, but you'll need to
|
154
|
+
# restart Thoth in order for CSS and JS changes to take effect.
|
155
|
+
#
|
156
|
+
# Note: this setting will have no effect if you're running Thoth under
|
157
|
+
# Phusion Passenger or any other environment in which static file requests
|
158
|
+
# are handled by a frontend server without passing through Ramaze.
|
159
|
+
enable_minify: true
|
160
|
+
|
161
|
+
# Filename to which errors should be logged when running in production mode,
|
162
|
+
# or blank if you don't care about errors.
|
163
|
+
error_log: <%= Thoth::HOME_DIR %>/log/error.log
|
164
|
+
|
165
|
+
# Memcache settings.
|
166
|
+
memcache:
|
167
|
+
# Whether or not to enable memcache. When enabled along with the
|
168
|
+
# server.enable_cache setting above, Thoth will use memcache for all cache
|
169
|
+
# operations instead of the default per-process Hash-based cache.
|
170
|
+
#
|
171
|
+
# This may be beneficial if you have a very high-traffic blog and
|
172
|
+
# distribute load across multiple Ramaze processes or physical servers,
|
173
|
+
# but in most cases it's overkill.
|
174
|
+
#
|
175
|
+
# Note: This option requires that the memcache-client gem be installed.
|
176
|
+
enabled: false
|
177
|
+
|
178
|
+
# Memcache servers to use. Each entry in this list must contain at least
|
179
|
+
# a hostname, and optionally a port number and priority.
|
180
|
+
#
|
181
|
+
# Example:
|
182
|
+
# servers:
|
183
|
+
# - 'localhost:11211:1'
|
184
|
+
# - 'foo.example.com:11211:2'
|
185
|
+
#
|
186
|
+
servers:
|
187
|
+
- 'localhost:11211:1'
|
188
|
+
|
189
|
+
# Timestamp formats.
|
190
|
+
timestamp:
|
191
|
+
# Format for long timestamps. For details, see:
|
192
|
+
# http://www.ruby-doc.org/core/classes/Time.html#M000297
|
193
|
+
long: '%A %B %d, %Y @ %I:%M %p (%Z)'
|
194
|
+
|
195
|
+
# Format for short timestamps. For details, see:
|
196
|
+
# http://www.ruby-doc.org/core/classes/Time.html#M000297
|
197
|
+
short: '%Y-%m-%d %I:%M'
|
198
|
+
|
199
|
+
# Settings for dev mode. Any setting that you don't explicitly specify here will
|
200
|
+
# just inherit from live mode.
|
201
|
+
dev:
|
202
|
+
db: sqlite:///<%= Thoth::HOME_DIR %>/db/dev.db
|
203
|
+
|
204
|
+
server:
|
205
|
+
enable_cache: false
|
206
|
+
enable_minify: false
|
data/lib/thoth/cache.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009 Ryan Grove <ryan@wonko.com>
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without
|
6
|
+
# modification, are permitted provided that the following conditions are met:
|
7
|
+
#
|
8
|
+
# * Redistributions of source code must retain the above copyright notice,
|
9
|
+
# this list of conditions and the following disclaimer.
|
10
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
# this list of conditions and the following disclaimer in the documentation
|
12
|
+
# and/or other materials provided with the distribution.
|
13
|
+
# * Neither the name of this project nor the names of its contributors may be
|
14
|
+
# used to endorse or promote products derived from this software without
|
15
|
+
# specific prior written permission.
|
16
|
+
#
|
17
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
18
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
19
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
20
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
21
|
+
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
22
|
+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
23
|
+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
24
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
25
|
+
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
#++
|
28
|
+
|
29
|
+
module Thoth; class Cache
|
30
|
+
|
31
|
+
# This is a no-op cache API used when the cache is disabled in order to avoid
|
32
|
+
# having to make constant configuration checks.
|
33
|
+
class Noop
|
34
|
+
include Innate::Cache::API
|
35
|
+
|
36
|
+
def cache_clear; end
|
37
|
+
|
38
|
+
def cache_delete(key, *keys)
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
|
42
|
+
def cache_fetch(key, default = nil)
|
43
|
+
default
|
44
|
+
end
|
45
|
+
|
46
|
+
def cache_setup(hostname, username, appname, cachename); end
|
47
|
+
|
48
|
+
def cache_store(key, value, options = {})
|
49
|
+
value
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end; end
|