hobix 0.4
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/bin/hobix +90 -0
- data/lib/hobix/api.rb +91 -0
- data/lib/hobix/article.rb +22 -0
- data/lib/hobix/base.rb +477 -0
- data/lib/hobix/bixwik.rb +200 -0
- data/lib/hobix/commandline.rb +661 -0
- data/lib/hobix/comments.rb +99 -0
- data/lib/hobix/config.rb +39 -0
- data/lib/hobix/datamarsh.rb +110 -0
- data/lib/hobix/entry.rb +83 -0
- data/lib/hobix/facets/comments.rb +74 -0
- data/lib/hobix/facets/publisher.rb +314 -0
- data/lib/hobix/facets/trackbacks.rb +80 -0
- data/lib/hobix/linklist.rb +76 -0
- data/lib/hobix/out/atom.rb +92 -0
- data/lib/hobix/out/erb.rb +64 -0
- data/lib/hobix/out/okaynews.rb +55 -0
- data/lib/hobix/out/quick.rb +312 -0
- data/lib/hobix/out/rdf.rb +97 -0
- data/lib/hobix/out/redrum.rb +26 -0
- data/lib/hobix/out/rss.rb +115 -0
- data/lib/hobix/plugin/bloglines.rb +73 -0
- data/lib/hobix/plugin/calendar.rb +220 -0
- data/lib/hobix/plugin/flickr.rb +110 -0
- data/lib/hobix/plugin/recent_comments.rb +82 -0
- data/lib/hobix/plugin/sections.rb +91 -0
- data/lib/hobix/plugin/tags.rb +60 -0
- data/lib/hobix/publish/ping.rb +53 -0
- data/lib/hobix/publish/replicate.rb +283 -0
- data/lib/hobix/publisher.rb +18 -0
- data/lib/hobix/search/dictionary.rb +141 -0
- data/lib/hobix/search/porter_stemmer.rb +203 -0
- data/lib/hobix/search/simple.rb +209 -0
- data/lib/hobix/search/vector.rb +100 -0
- data/lib/hobix/storage/filesys.rb +398 -0
- data/lib/hobix/trackbacks.rb +94 -0
- data/lib/hobix/util/objedit.rb +193 -0
- data/lib/hobix/util/patcher.rb +155 -0
- data/lib/hobix/webapp/cli.rb +195 -0
- data/lib/hobix/webapp/htmlform.rb +107 -0
- data/lib/hobix/webapp/message.rb +177 -0
- data/lib/hobix/webapp/urigen.rb +141 -0
- data/lib/hobix/webapp/webrick-servlet.rb +90 -0
- data/lib/hobix/webapp.rb +723 -0
- data/lib/hobix/weblog.rb +860 -0
- data/lib/hobix.rb +223 -0
- metadata +87 -0
data/lib/hobix.rb
ADDED
@@ -0,0 +1,223 @@
|
|
1
|
+
#
|
2
|
+
# = hobix.rb
|
3
|
+
#
|
4
|
+
# Hobix command-line weblog system.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2003-2004 why the lucky stiff
|
7
|
+
#
|
8
|
+
# Written & maintained by why the lucky stiff <why@ruby-lang.org>
|
9
|
+
#
|
10
|
+
# This program is free software, released under a BSD license.
|
11
|
+
# See COPYING for details.
|
12
|
+
#
|
13
|
+
#--
|
14
|
+
# $Id$
|
15
|
+
#++
|
16
|
+
require 'hobix/config'
|
17
|
+
require 'hobix/weblog'
|
18
|
+
|
19
|
+
# = Hobix
|
20
|
+
#
|
21
|
+
# Hobix is a complete blogging system, designed to be managed
|
22
|
+
# on the file system and accessed through a command-line application.
|
23
|
+
#
|
24
|
+
# The command-line application is powered by this Ruby library
|
25
|
+
# which is designed to be fully scriptable and extensible.
|
26
|
+
#
|
27
|
+
# = Module Map
|
28
|
+
#
|
29
|
+
# Here is a map of the core modules which are loaded when you
|
30
|
+
# require 'hobix' in your script.
|
31
|
+
#
|
32
|
+
# Hobix::Weblog:: Generally, this module is the starting point.
|
33
|
+
# Load a weblog's configuration into a Hobix::Weblog
|
34
|
+
# object, which can be used to query entries,
|
35
|
+
# generate pages, and edit any part of the site.
|
36
|
+
# (from 'hobix/weblog')
|
37
|
+
#
|
38
|
+
# Hobix::Page:: Whenever a template is generated into output,
|
39
|
+
# a Page object is passed in, describing the
|
40
|
+
# links to neighboring pages and update time.
|
41
|
+
# (from 'hobix/weblog')
|
42
|
+
#
|
43
|
+
# Hobix::Entry:: Using an entry's id (or shortName), you can
|
44
|
+
# load Entry objects, which contain all the
|
45
|
+
# content and rendering details for an entry.
|
46
|
+
# (from 'hobix/entry')
|
47
|
+
#
|
48
|
+
# Hobix::EntryEnum:: When Hobix supplies a template with a list of
|
49
|
+
# entry classes, this module is mixed in.
|
50
|
+
# (from 'hobix/entry')
|
51
|
+
#
|
52
|
+
# Hobix::LinkList:: An Entry subclass, used for storing links.
|
53
|
+
# (from 'hobix/linklist')
|
54
|
+
#
|
55
|
+
# Hobix::BasePlugin:: All Hobix plugins inherit from this class.
|
56
|
+
# The class uses Ruby's +inherited+ hook to
|
57
|
+
# identify plugins.
|
58
|
+
# (from 'hobix/base')
|
59
|
+
#
|
60
|
+
# Hobix::BaseStorage:: All storage plugins inherit from this class.
|
61
|
+
# Storage plugins exclusively store the weblog entries.
|
62
|
+
# (from 'hobix/base')
|
63
|
+
#
|
64
|
+
# Hobix::BaseOutput:: All output plugins inherit from this class.
|
65
|
+
# Output plugins are attached to specific template
|
66
|
+
# types and they feed entries into the template.
|
67
|
+
# (from 'hobix/base')
|
68
|
+
#
|
69
|
+
# Hobix::BasePublish:: All publisher plugins inherit from this class.
|
70
|
+
# Publisher plugins are notified when certain
|
71
|
+
# pages are updated. For example, the +ping+
|
72
|
+
# plugin will ping blog directories if the `index'
|
73
|
+
# pages are updated.
|
74
|
+
# (from 'hobix/base')
|
75
|
+
#
|
76
|
+
# Hobix::Config:: Users individually store their personal settings
|
77
|
+
# and weblog paths in .hobixrc. This class
|
78
|
+
# is used to load and manipulate the settings file.
|
79
|
+
# (from 'hobix/config')
|
80
|
+
#
|
81
|
+
# Hobix comes with a few plugins, for which documentation is also
|
82
|
+
# available.
|
83
|
+
#
|
84
|
+
# Hobix::Storage::Filesys:: This plugin stores entries in separate YAML
|
85
|
+
# files. Directories can be used to categorize
|
86
|
+
# and organize entries.
|
87
|
+
# (from 'hobix/storage/filesys')
|
88
|
+
#
|
89
|
+
# Hobix::Out::ERB:: This output plugin handles .erb templates.
|
90
|
+
# Page and entry data are passed in as variables.
|
91
|
+
# ERuby markup is used in the document to script
|
92
|
+
# against those variables.
|
93
|
+
# (from 'hobix/out/erb')
|
94
|
+
#
|
95
|
+
# Hobix::Out::RedRum:: This output plugin handles .redrum templates.
|
96
|
+
# These templates contain ERuby as well. The output
|
97
|
+
# generated by the page is passed through RedCloth,
|
98
|
+
# a Textile processor. This way, you can write
|
99
|
+
# your templates in Textile with ERuby scripting.
|
100
|
+
# (from 'hobix/out/redrum')
|
101
|
+
#
|
102
|
+
# Hobix::Out::RSS:: This output plugin handles .rss templates.
|
103
|
+
# These templates are empty and simply signify to
|
104
|
+
# the plugin that an RSS 2.0 feed should be generated
|
105
|
+
# for the entry data.
|
106
|
+
# (from 'hobix/out/rss')
|
107
|
+
#
|
108
|
+
# Hobix::Out::Atom:: This output plugin handles .atom templates.
|
109
|
+
# Just like the RSS plugin, but generates an Atom feed.
|
110
|
+
# (from 'hobix/out/atom')
|
111
|
+
#
|
112
|
+
# Hobix::Out::OkayNews:: This output plugin handles .okaynews templates.
|
113
|
+
# Just like the Atom and RSS plugins, but generates
|
114
|
+
# !okay/news, a YAML syndication feed.
|
115
|
+
# (from 'hobix/out/okaynews')
|
116
|
+
#
|
117
|
+
# Hobix::Publish::Ping:: This publisher plugin pings blog directories when the
|
118
|
+
# 'index' pages are published on a regen or upgen.
|
119
|
+
#
|
120
|
+
# = Examples
|
121
|
+
#
|
122
|
+
# Here are a few short examples to give you a feel for how Hobix can be
|
123
|
+
# scripted. Refer to individual module's documentation for more.
|
124
|
+
#
|
125
|
+
# == Example 1: Regenerating a weblog
|
126
|
+
#
|
127
|
+
# The first step is to load the Weblog object.
|
128
|
+
#
|
129
|
+
# require 'hobix'
|
130
|
+
# weblog = Hobix::Weblog.load( '/my/blahhg/hobix.yaml' )
|
131
|
+
#
|
132
|
+
# With the weblog loaded, we'll now want to load a template.
|
133
|
+
# Templates are stored in the weblog's +skel_path+ accessor.
|
134
|
+
#
|
135
|
+
# tpl_path = File.join( weblog.skel_path, 'index.html.erb' )
|
136
|
+
#
|
137
|
+
# We give the path to the editor. When we are done editing,
|
138
|
+
# the editor saves to the original path. We can then trigger
|
139
|
+
# a rebuild.
|
140
|
+
#
|
141
|
+
# weblog.regenerate :update
|
142
|
+
#
|
143
|
+
# The :update indicates that not every file will be regenerated,
|
144
|
+
# only those affected by the change.
|
145
|
+
#
|
146
|
+
# == Example 2: E-mail notify on publish
|
147
|
+
#
|
148
|
+
# Publisher plugins are used to perform actions when the site
|
149
|
+
# has an upgen or regen. Hobix plugins are absolutely the simplest
|
150
|
+
# Ruby coding ever. Watch.
|
151
|
+
#
|
152
|
+
# require 'net/smtp'
|
153
|
+
#
|
154
|
+
# module Hobix::Publish
|
155
|
+
# class Email < Hobix::BasePublish
|
156
|
+
# def initialize( weblog, emails ); end
|
157
|
+
# def watch; ['entry']; end
|
158
|
+
# def publish( page_name ); end
|
159
|
+
# end
|
160
|
+
# end
|
161
|
+
#
|
162
|
+
# This plugin doesn't do anything yet. But it won't throw any errors.
|
163
|
+
# This is our skeleton for a plugin that will e-mail us when there are
|
164
|
+
# updates to the site.
|
165
|
+
#
|
166
|
+
# The +watch+ method monitors certain page prefixes. The `entry' prefix
|
167
|
+
# indicates that this publish plugin looks for changes to any entry on
|
168
|
+
# the site.
|
169
|
+
#
|
170
|
+
# The +initialize+ method is important as well. It receives the
|
171
|
+
# +Hobix::Weblog+ object the publishing took place on. The _emails_
|
172
|
+
# parameter is supplied a list of e-mail address from the weblog's
|
173
|
+
# hobix.yaml configuration.
|
174
|
+
#
|
175
|
+
# When a plugin is initialized it is given the weblog object and
|
176
|
+
# any data which is supplied in the weblog configuration. Here is
|
177
|
+
# what the hobix.yaml looks like:
|
178
|
+
#
|
179
|
+
# requires:
|
180
|
+
# - hobix/storage/filesys
|
181
|
+
# - hobix/out/erb
|
182
|
+
# - hobix/publish/ping: [http://ping.blo.gs:80/]
|
183
|
+
#
|
184
|
+
# In the above configuration, an Array is passed to the Ping plugin.
|
185
|
+
# So that's what we'll receive here.
|
186
|
+
#
|
187
|
+
# To get our e-mail sending, let's fill in the +initialize+ and
|
188
|
+
# +publish+ methods.
|
189
|
+
#
|
190
|
+
# def initialize( weblog, emails )
|
191
|
+
# @weblog = weblog
|
192
|
+
# @emails = emails
|
193
|
+
# end
|
194
|
+
# def publish( page_name )
|
195
|
+
# Net::SMTP.start( 'localhost', 25 ) do |smtp|
|
196
|
+
# @emails.each do |email|
|
197
|
+
# smtp.send_message <<MSG, 'your@site.com', email
|
198
|
+
# From: your@site.com
|
199
|
+
# To: #{ email }
|
200
|
+
#
|
201
|
+
# The site has been updated.
|
202
|
+
# MSG
|
203
|
+
# end
|
204
|
+
# end
|
205
|
+
# end
|
206
|
+
#
|
207
|
+
module Hobix
|
208
|
+
## Version used to compare installations
|
209
|
+
VERSION = '0.4'
|
210
|
+
## CVS information
|
211
|
+
CVS_ID = "$Id$"
|
212
|
+
CVS_REV = "$Revision$"[11..-3]
|
213
|
+
## Share directory contains external data files
|
214
|
+
SHARE_PATH = "/usr/share/hobix/"
|
215
|
+
|
216
|
+
## Get a top-level constant from a string
|
217
|
+
def self.const_find( tclass )
|
218
|
+
obj_class = Object
|
219
|
+
tclass.split( "::" ).each { |c| obj_class = obj_class.const_get( c ) }
|
220
|
+
obj_class
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hobix
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.4'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Why the Lucky Stiff
|
8
|
+
autorequire: hobix
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-03-17 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email: why@ruby-lang.org
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- bin/hobix
|
20
|
+
- lib/hobix.rb
|
21
|
+
- lib/hobix/api.rb
|
22
|
+
- lib/hobix/article.rb
|
23
|
+
- lib/hobix/base.rb
|
24
|
+
- lib/hobix/bixwik.rb
|
25
|
+
- lib/hobix/commandline.rb
|
26
|
+
- lib/hobix/comments.rb
|
27
|
+
- lib/hobix/config.rb
|
28
|
+
- lib/hobix/datamarsh.rb
|
29
|
+
- lib/hobix/entry.rb
|
30
|
+
- lib/hobix/facets/comments.rb
|
31
|
+
- lib/hobix/facets/publisher.rb
|
32
|
+
- lib/hobix/facets/trackbacks.rb
|
33
|
+
- lib/hobix/linklist.rb
|
34
|
+
- lib/hobix/out/atom.rb
|
35
|
+
- lib/hobix/out/erb.rb
|
36
|
+
- lib/hobix/out/okaynews.rb
|
37
|
+
- lib/hobix/out/quick.rb
|
38
|
+
- lib/hobix/out/rdf.rb
|
39
|
+
- lib/hobix/out/redrum.rb
|
40
|
+
- lib/hobix/out/rss.rb
|
41
|
+
- lib/hobix/plugin/bloglines.rb
|
42
|
+
- lib/hobix/plugin/calendar.rb
|
43
|
+
- lib/hobix/plugin/flickr.rb
|
44
|
+
- lib/hobix/plugin/recent_comments.rb
|
45
|
+
- lib/hobix/plugin/sections.rb
|
46
|
+
- lib/hobix/plugin/tags.rb
|
47
|
+
- lib/hobix/publish/ping.rb
|
48
|
+
- lib/hobix/publish/replicate.rb
|
49
|
+
- lib/hobix/publisher.rb
|
50
|
+
- lib/hobix/search/dictionary.rb
|
51
|
+
- lib/hobix/search/porter_stemmer.rb
|
52
|
+
- lib/hobix/search/simple.rb
|
53
|
+
- lib/hobix/search/vector.rb
|
54
|
+
- lib/hobix/storage/filesys.rb
|
55
|
+
- lib/hobix/trackbacks.rb
|
56
|
+
- lib/hobix/util/objedit.rb
|
57
|
+
- lib/hobix/util/patcher.rb
|
58
|
+
- lib/hobix/webapp.rb
|
59
|
+
- lib/hobix/webapp/cli.rb
|
60
|
+
- lib/hobix/webapp/htmlform.rb
|
61
|
+
- lib/hobix/webapp/message.rb
|
62
|
+
- lib/hobix/webapp/urigen.rb
|
63
|
+
- lib/hobix/webapp/webrick-servlet.rb
|
64
|
+
- lib/hobix/weblog.rb
|
65
|
+
homepage: http://hobix.com/
|
66
|
+
licenses: []
|
67
|
+
metadata: {}
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubygems_version: 3.0.3.1
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: Hobix
|
87
|
+
test_files: []
|