hobix 0.4 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +18 -0
- data/README +18 -0
- data/Rakefile +96 -0
- data/bin/hobix +7 -3
- data/contrib/blosxom-to-hobix.rb +253 -0
- data/contrib/txp-to-hobix.rb +56 -0
- data/contrib/webrick-all-mine.rb +20 -0
- data/doc/CHANGELOG +285 -0
- data/doc/rdoc/classes/Hobix/API.html +382 -0
- data/doc/rdoc/classes/Hobix/Article.html +111 -0
- data/doc/rdoc/classes/Hobix/BaseContent.html +692 -0
- data/doc/rdoc/classes/Hobix/BaseEntry.html +218 -0
- data/doc/rdoc/classes/Hobix/BaseFacet.html +205 -0
- data/doc/rdoc/classes/Hobix/BaseOutput.html +122 -0
- data/doc/rdoc/classes/Hobix/BasePlugin.html +201 -0
- data/doc/rdoc/classes/Hobix/BaseProperties/ClassMethods.html +243 -0
- data/doc/rdoc/classes/Hobix/BaseProperties.html +218 -0
- data/doc/rdoc/classes/Hobix/BasePublish.html +157 -0
- data/doc/rdoc/classes/Hobix/BaseStorage.html +417 -0
- data/doc/rdoc/classes/Hobix/BixWik/Entry.html +196 -0
- data/doc/rdoc/classes/Hobix/BixWik/IndexEntry.html +170 -0
- data/doc/rdoc/classes/Hobix/BixWik/WikiRedCloth.html +111 -0
- data/doc/rdoc/classes/Hobix/BixWik.html +418 -0
- data/doc/rdoc/classes/Hobix/BixWikPlugin.html +158 -0
- data/doc/rdoc/classes/Hobix/CommandLine.html +1970 -0
- data/doc/rdoc/classes/Hobix/Comment.html +113 -0
- data/doc/rdoc/classes/Hobix/Config.html +212 -0
- data/doc/rdoc/classes/Hobix/DataMarsh.html +667 -0
- data/doc/rdoc/classes/Hobix/Entry.html +178 -0
- data/doc/rdoc/classes/Hobix/EntryEnum.html +162 -0
- data/doc/rdoc/classes/Hobix/Enumerable.html +170 -0
- data/doc/rdoc/classes/Hobix/Facets/WikiEdit.html +180 -0
- data/doc/rdoc/classes/Hobix/Facets.html +111 -0
- data/doc/rdoc/classes/Hobix/LinkList.html +182 -0
- data/doc/rdoc/classes/Hobix/Out/Quick.html +412 -0
- data/doc/rdoc/classes/Hobix/Out.html +119 -0
- data/doc/rdoc/classes/Hobix/Page.html +381 -0
- data/doc/rdoc/classes/Hobix/Trackback.html +113 -0
- data/doc/rdoc/classes/Hobix/UriStr.html +198 -0
- data/doc/rdoc/classes/Hobix/WebApp/QueryString.html +207 -0
- data/doc/rdoc/classes/Hobix/WebApp/QueryValidationFailure.html +111 -0
- data/doc/rdoc/classes/Hobix/WebApp.html +1383 -0
- data/doc/rdoc/classes/Hobix/Weblog/AuthorNotFound.html +111 -0
- data/doc/rdoc/classes/Hobix/Weblog.html +2082 -0
- data/doc/rdoc/classes/Hobix.html +399 -0
- data/doc/rdoc/classes/Kernel.html +139 -0
- data/doc/rdoc/classes/Regexp.html +154 -0
- data/doc/rdoc/classes/YAML/Omap.html +144 -0
- data/doc/rdoc/classes/YAML.html +111 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/COPYING.html +129 -0
- data/doc/rdoc/files/README.html +131 -0
- data/doc/rdoc/files/doc/CHANGELOG.html +101 -0
- data/doc/rdoc/files/lib/hobix/api_rb.html +119 -0
- data/doc/rdoc/files/lib/hobix/article_rb.html +126 -0
- data/doc/rdoc/files/lib/hobix/base_rb.html +128 -0
- data/doc/rdoc/files/lib/hobix/bixwik_rb.html +126 -0
- data/doc/rdoc/files/lib/hobix/commandline_rb.html +140 -0
- data/doc/rdoc/files/lib/hobix/comments_rb.html +126 -0
- data/doc/rdoc/files/lib/hobix/config_rb.html +125 -0
- data/doc/rdoc/files/lib/hobix/datamarsh_rb.html +108 -0
- data/doc/rdoc/files/lib/hobix/entry_rb.html +118 -0
- data/doc/rdoc/files/lib/hobix/linklist_rb.html +127 -0
- data/doc/rdoc/files/lib/hobix/publisher_rb.html +126 -0
- data/doc/rdoc/files/lib/hobix/trackbacks_rb.html +128 -0
- data/doc/rdoc/files/lib/hobix/webapp_rb.html +127 -0
- data/doc/rdoc/files/lib/hobix/weblog_rb.html +135 -0
- data/doc/rdoc/files/lib/hobix_rb.html +127 -0
- data/doc/rdoc/fr_class_index.html +67 -0
- data/doc/rdoc/fr_file_index.html +44 -0
- data/doc/rdoc/fr_method_index.html +307 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/git_hobix_update.php +13 -0
- data/lib/hobix/base.rb +6 -3
- data/lib/hobix/bixwik.rb +12 -12
- data/lib/hobix/commandline.rb +18 -2
- data/lib/hobix/comments.rb +4 -5
- data/lib/hobix/entry.rb +2 -1
- data/lib/hobix/facets/comments.rb +31 -6
- data/lib/hobix/linklist.rb +6 -1
- data/lib/hobix/out/atom.rb +29 -20
- data/lib/hobix/out/quick.rb +8 -6
- data/lib/hobix/out/rss.rb +16 -3
- data/lib/hobix/plugin/akismet.rb +196 -0
- data/lib/hobix/plugin/calendar.rb +6 -14
- data/lib/hobix/plugin/recent_comments.rb +4 -2
- data/lib/hobix/plugin/tags.rb +1 -1
- data/lib/hobix/storage/filesys.rb +41 -31
- data/lib/hobix/trackbacks.rb +1 -2
- data/lib/hobix/weblog.rb +73 -40
- data/lib/hobix.rb +9 -2
- data/share/default-blog/hobix.yaml +16 -0
- data/share/default-blog/htdocs/site.css +174 -0
- data/share/default-blog/skel/entry.html.quick +0 -0
- data/share/default-blog/skel/index.atom.atom +0 -0
- data/share/default-blog/skel/index.html.quick-summary +0 -0
- data/share/default-blog/skel/index.xml.rss +0 -0
- data/share/default-blog/skel/index.yaml.okaynews +0 -0
- data/share/default-blog/skel/monthly.html.quick-archive +0 -0
- data/share/default-blog/skel/section.html.quick-archive +0 -0
- data/share/default-blog/skel/yearly.html.quick-archive +0 -0
- data/share/default-blog-modes.yaml +7 -0
- data/share/default-blog.apache-cgi.patch +8 -0
- data/share/default-blog.apache-ssi.patch +38 -0
- data/share/default-blog.apache2-ssi.patch +3 -0
- data/share/default-blog.cgi.patch +8 -0
- data/share/default-blog.comments.patch +5 -0
- data/share/default-blog.prototype.patch +766 -0
- data/share/default-blog.publisher.patch +5 -0
- data/share/default-blog.wiki.patch +29 -0
- data/share/publisher/css/control.css +90 -0
- data/share/publisher/css/form.css +238 -0
- data/share/publisher/css/form.import.css +72 -0
- data/share/publisher/css/main-menu.css +134 -0
- data/share/publisher/i/hobix-emblazen-1.png +0 -0
- data/share/publisher/i/hobix-emblazen-2.png +0 -0
- data/share/publisher/i/hobix-emblazen-3.png +0 -0
- data/share/publisher/i/hobix-emblazen-4.png +0 -0
- data/share/publisher/i/hobix-emblazen-5.png +0 -0
- data/share/publisher/i/hobix-emblazen-6.png +0 -0
- data/share/publisher/i/hobix-emblazen-7.png +0 -0
- data/share/publisher/index.erb +66 -0
- data/share/publisher/js/controls.js +261 -0
- data/share/publisher/js/dragdrop.js +476 -0
- data/share/publisher/js/effects.js +570 -0
- data/share/publisher/js/prototype.js +1011 -0
- metadata +196 -53
- checksums.yaml +0 -7
@@ -0,0 +1,1970 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Hobix::CommandLine</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Hobix::CommandLine</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/hobix/commandline_rb.html">
|
59
|
+
lib/hobix/commandline.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000062">add_weblog</a>
|
84
|
+
<a href="#M000061">add_weblog_args</a>
|
85
|
+
<a href="#M000060">add_weblog_explain</a>
|
86
|
+
<a href="#M000091">aorta</a>
|
87
|
+
<a href="#M000055">blogs_weblog</a>
|
88
|
+
<a href="#M000054">blogs_weblog_args</a>
|
89
|
+
<a href="#M000053">blogs_weblog_explain</a>
|
90
|
+
<a href="#M000048">config</a>
|
91
|
+
<a href="#M000059">create_weblog</a>
|
92
|
+
<a href="#M000058">create_weblog_args</a>
|
93
|
+
<a href="#M000057">create_weblog_explain</a>
|
94
|
+
<a href="#M000075">del_weblog</a>
|
95
|
+
<a href="#M000074">del_weblog_args</a>
|
96
|
+
<a href="#M000073">del_weblog_explain</a>
|
97
|
+
<a href="#M000078">druby_weblog</a>
|
98
|
+
<a href="#M000077">druby_weblog_args</a>
|
99
|
+
<a href="#M000076">druby_weblog_explain</a>
|
100
|
+
<a href="#M000072">edit_action</a>
|
101
|
+
<a href="#M000071">edit_action_args</a>
|
102
|
+
<a href="#M000070">edit_action_explain</a>
|
103
|
+
<a href="#M000044">extended</a>
|
104
|
+
<a href="#M000045">gets</a>
|
105
|
+
<a href="#M000095">http</a>
|
106
|
+
<a href="#M000099">http_edit_remote</a>
|
107
|
+
<a href="#M000096">http_get</a>
|
108
|
+
<a href="#M000100">http_list_remote</a>
|
109
|
+
<a href="#M000102">http_patch_remote</a>
|
110
|
+
<a href="#M000097">http_post</a>
|
111
|
+
<a href="#M000098">http_post_remote</a>
|
112
|
+
<a href="#M000101">http_search_remote</a>
|
113
|
+
<a href="#M000063">join_as_author</a>
|
114
|
+
<a href="#M000084">list_action</a>
|
115
|
+
<a href="#M000083">list_action_args</a>
|
116
|
+
<a href="#M000082">list_action_explain</a>
|
117
|
+
<a href="#M000056">load_patchsets</a>
|
118
|
+
<a href="#M000047">login</a>
|
119
|
+
<a href="#M000081">patch_action</a>
|
120
|
+
<a href="#M000080">patch_action_args</a>
|
121
|
+
<a href="#M000079">patch_action_explain</a>
|
122
|
+
<a href="#M000087">post_action</a>
|
123
|
+
<a href="#M000086">post_action_args</a>
|
124
|
+
<a href="#M000085">post_action_explain</a>
|
125
|
+
<a href="#M000094">puts</a>
|
126
|
+
<a href="#M000046">puts</a>
|
127
|
+
<a href="#M000069">regen_action</a>
|
128
|
+
<a href="#M000068">regen_action_args</a>
|
129
|
+
<a href="#M000067">regen_action_explain</a>
|
130
|
+
<a href="#M000049">save_config</a>
|
131
|
+
<a href="#M000088">setup</a>
|
132
|
+
<a href="#M000090">setup_blogs</a>
|
133
|
+
<a href="#M000089">setup_personal</a>
|
134
|
+
<a href="#M000092">tabular</a>
|
135
|
+
<a href="#M000093">tabular_entries</a>
|
136
|
+
<a href="#M000066">upgen_action</a>
|
137
|
+
<a href="#M000065">upgen_action_args</a>
|
138
|
+
<a href="#M000064">upgen_action_explain</a>
|
139
|
+
<a href="#M000052">upgrade_app</a>
|
140
|
+
<a href="#M000051">upgrade_app_args</a>
|
141
|
+
<a href="#M000050">upgrade_app_explain</a>
|
142
|
+
</div>
|
143
|
+
</div>
|
144
|
+
|
145
|
+
</div>
|
146
|
+
|
147
|
+
|
148
|
+
<!-- if includes -->
|
149
|
+
|
150
|
+
<div id="section">
|
151
|
+
|
152
|
+
|
153
|
+
<div id="constants-list">
|
154
|
+
<h3 class="section-bar">Constants</h3>
|
155
|
+
|
156
|
+
<div class="name-list">
|
157
|
+
<table summary="Constants">
|
158
|
+
<tr class="top-aligned-row context-row">
|
159
|
+
<td class="context-item-name">HOME_DIR</td>
|
160
|
+
<td>=</td>
|
161
|
+
<td class="context-item-value">home_dir</td>
|
162
|
+
</tr>
|
163
|
+
<tr class="top-aligned-row context-row">
|
164
|
+
<td class="context-item-name">RC</td>
|
165
|
+
<td>=</td>
|
166
|
+
<td class="context-item-value">File.join( HOME_DIR, '.hobixrc' )</td>
|
167
|
+
</tr>
|
168
|
+
</table>
|
169
|
+
</div>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
<!-- if method_list -->
|
178
|
+
<div id="methods">
|
179
|
+
<h3 class="section-bar">Public Class methods</h3>
|
180
|
+
|
181
|
+
<div id="method-M000044" class="method-detail">
|
182
|
+
<a name="M000044"></a>
|
183
|
+
|
184
|
+
<div class="method-heading">
|
185
|
+
<a href="#M000044" class="method-signature">
|
186
|
+
<span class="method-name">extended</span><span class="method-args">( o )</span>
|
187
|
+
</a>
|
188
|
+
</div>
|
189
|
+
|
190
|
+
<div class="method-description">
|
191
|
+
<p><a class="source-toggle" href="#"
|
192
|
+
onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
|
193
|
+
<div class="method-source-code" id="M000044-source">
|
194
|
+
<pre>
|
195
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 39</span>
|
196
|
+
39: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">CommandLine</span>.<span class="ruby-identifier">extended</span>( <span class="ruby-identifier">o</span> )
|
197
|
+
40: <span class="ruby-comment cmt">#</span>
|
198
|
+
41: <span class="ruby-comment cmt"># When extended we should get all required plugin for the </span>
|
199
|
+
42: <span class="ruby-comment cmt"># whole Hobix stuff</span>
|
200
|
+
43: <span class="ruby-comment cmt">#</span>
|
201
|
+
44: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span> <span class="ruby-constant">RC</span>
|
202
|
+
45:
|
203
|
+
46: <span class="ruby-identifier">config</span> = <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">load</span>( <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>( <span class="ruby-constant">RC</span> ) )
|
204
|
+
47:
|
205
|
+
48: <span class="ruby-comment cmt">#</span>
|
206
|
+
49: <span class="ruby-comment cmt"># Add a new instance variable to o</span>
|
207
|
+
50: <span class="ruby-comment cmt">#</span>
|
208
|
+
51: <span class="ruby-identifier">o</span>.<span class="ruby-identifier">instance_variable_set</span>( <span class="ruby-identifier">:@config</span>, <span class="ruby-identifier">config</span> )
|
209
|
+
52:
|
210
|
+
53: <span class="ruby-comment cmt">#</span>
|
211
|
+
54: <span class="ruby-comment cmt"># Eventually add user specified path</span>
|
212
|
+
55: <span class="ruby-comment cmt">#</span>
|
213
|
+
56: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">config</span>[<span class="ruby-value str">'libs'</span>]
|
214
|
+
57: <span class="ruby-identifier">config</span>[<span class="ruby-value str">'libs'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
|
215
|
+
58: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>( <span class="ruby-identifier">p</span> ) <span class="ruby-operator">&&</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>( <span class="ruby-identifier">p</span> )
|
216
|
+
59: <span class="ruby-identifier">$LOAD_PATH</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">p</span>
|
217
|
+
60: <span class="ruby-keyword kw">else</span>
|
218
|
+
61: <span class="ruby-identifier">warn</span> <span class="ruby-node">"#{p} not loaded. Either inexistant or not a directory"</span>
|
219
|
+
62: <span class="ruby-keyword kw">end</span>
|
220
|
+
63: <span class="ruby-keyword kw">end</span>
|
221
|
+
64: <span class="ruby-keyword kw">end</span>
|
222
|
+
65:
|
223
|
+
66: <span class="ruby-comment cmt">#</span>
|
224
|
+
67: <span class="ruby-comment cmt"># And system wide path too</span>
|
225
|
+
68: <span class="ruby-comment cmt">#</span>
|
226
|
+
69: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>( <span class="ruby-constant">Hobix</span><span class="ruby-operator">::</span><span class="ruby-constant">SHARE_PATH</span> )
|
227
|
+
70: <span class="ruby-identifier">$LOAD_PATH</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">Hobix</span><span class="ruby-operator">::</span><span class="ruby-constant">SHARE_PATH</span>,<span class="ruby-value str">"lib"</span>)
|
228
|
+
71: <span class="ruby-keyword kw">end</span>
|
229
|
+
72:
|
230
|
+
73: <span class="ruby-comment cmt">#</span>
|
231
|
+
74: <span class="ruby-comment cmt"># Load plugins if necessary</span>
|
232
|
+
75: <span class="ruby-comment cmt">#</span>
|
233
|
+
76: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">config</span>[<span class="ruby-value str">'requires'</span>]
|
234
|
+
77: <span class="ruby-identifier">config</span>[<span class="ruby-value str">'requires'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">req</span><span class="ruby-operator">|</span>
|
235
|
+
78: <span class="ruby-constant">Hobix</span><span class="ruby-operator">::</span><span class="ruby-constant">BasePlugin</span><span class="ruby-operator">::</span><span class="ruby-identifier">start</span>( <span class="ruby-identifier">req</span>, <span class="ruby-keyword kw">self</span> )
|
236
|
+
79: <span class="ruby-keyword kw">end</span>
|
237
|
+
80: <span class="ruby-keyword kw">end</span>
|
238
|
+
81:
|
239
|
+
82: <span class="ruby-keyword kw">end</span>
|
240
|
+
</pre>
|
241
|
+
</div>
|
242
|
+
</div>
|
243
|
+
</div>
|
244
|
+
|
245
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
246
|
+
|
247
|
+
<div id="method-M000062" class="method-detail">
|
248
|
+
<a name="M000062"></a>
|
249
|
+
|
250
|
+
<div class="method-heading">
|
251
|
+
<a href="#M000062" class="method-signature">
|
252
|
+
<span class="method-name">add_weblog</span><span class="method-args">( name, path )</span>
|
253
|
+
</a>
|
254
|
+
</div>
|
255
|
+
|
256
|
+
<div class="method-description">
|
257
|
+
<p><a class="source-toggle" href="#"
|
258
|
+
onclick="toggleCode('M000062-source');return false;">[Source]</a></p>
|
259
|
+
<div class="method-source-code" id="M000062-source">
|
260
|
+
<pre>
|
261
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 221</span>
|
262
|
+
221: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_weblog</span>( <span class="ruby-identifier">name</span>, <span class="ruby-identifier">path</span> )
|
263
|
+
222: <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'weblogs'</span>] <span class="ruby-operator">||=</span> {}
|
264
|
+
223: <span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>( <span class="ruby-identifier">path</span> )
|
265
|
+
224: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"*** Checking for existence of blog."</span>
|
266
|
+
225: <span class="ruby-identifier">require</span> <span class="ruby-value str">'hobix/weblog'</span>
|
267
|
+
226: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span> <span class="ruby-identifier">path</span>
|
268
|
+
227: <span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>( <span class="ruby-identifier">path</span>, <span class="ruby-value str">'hobix.yaml'</span> )
|
269
|
+
228: <span class="ruby-identifier">puts</span> <span class="ruby-node">"*** Path is a directory, using `#{ path }'."</span>
|
270
|
+
229: <span class="ruby-keyword kw">end</span>
|
271
|
+
230: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span> <span class="ruby-identifier">path</span>
|
272
|
+
231: <span class="ruby-identifier">puts</span> <span class="ruby-node">"*** No file `#{ path }' found! Aborting."</span>
|
273
|
+
232: <span class="ruby-keyword kw">return</span>
|
274
|
+
233: <span class="ruby-keyword kw">end</span>
|
275
|
+
234: <span class="ruby-identifier">join_as_author</span>( <span class="ruby-identifier">name</span>, <span class="ruby-identifier">path</span> )
|
276
|
+
235: <span class="ruby-keyword kw">end</span>
|
277
|
+
</pre>
|
278
|
+
</div>
|
279
|
+
</div>
|
280
|
+
</div>
|
281
|
+
|
282
|
+
<div id="method-M000061" class="method-detail">
|
283
|
+
<a name="M000061"></a>
|
284
|
+
|
285
|
+
<div class="method-heading">
|
286
|
+
<a href="#M000061" class="method-signature">
|
287
|
+
<span class="method-name">add_weblog_args</span><span class="method-args">()</span>
|
288
|
+
</a>
|
289
|
+
</div>
|
290
|
+
|
291
|
+
<div class="method-description">
|
292
|
+
<p><a class="source-toggle" href="#"
|
293
|
+
onclick="toggleCode('M000061-source');return false;">[Source]</a></p>
|
294
|
+
<div class="method-source-code" id="M000061-source">
|
295
|
+
<pre>
|
296
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 220</span>
|
297
|
+
220: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_weblog_args</span>; [<span class="ruby-value str">'weblog-name'</span>, <span class="ruby-value str">'/path/to/hobix.yaml'</span>]; <span class="ruby-keyword kw">end</span>
|
298
|
+
</pre>
|
299
|
+
</div>
|
300
|
+
</div>
|
301
|
+
</div>
|
302
|
+
|
303
|
+
<div id="method-M000060" class="method-detail">
|
304
|
+
<a name="M000060"></a>
|
305
|
+
|
306
|
+
<div class="method-heading">
|
307
|
+
<a href="#M000060" class="method-signature">
|
308
|
+
<span class="method-name">add_weblog_explain</span><span class="method-args">()</span>
|
309
|
+
</a>
|
310
|
+
</div>
|
311
|
+
|
312
|
+
<div class="method-description">
|
313
|
+
<p>
|
314
|
+
Add a weblog to local <a href="CommandLine.html#M000048">config</a>
|
315
|
+
</p>
|
316
|
+
<p><a class="source-toggle" href="#"
|
317
|
+
onclick="toggleCode('M000060-source');return false;">[Source]</a></p>
|
318
|
+
<div class="method-source-code" id="M000060-source">
|
319
|
+
<pre>
|
320
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 219</span>
|
321
|
+
219: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_weblog_explain</span>; <span class="ruby-value str">"Adds a pre-existing hobix weblog to your list."</span>; <span class="ruby-keyword kw">end</span>
|
322
|
+
</pre>
|
323
|
+
</div>
|
324
|
+
</div>
|
325
|
+
</div>
|
326
|
+
|
327
|
+
<div id="method-M000091" class="method-detail">
|
328
|
+
<a name="M000091"></a>
|
329
|
+
|
330
|
+
<div class="method-heading">
|
331
|
+
<a href="#M000091" class="method-signature">
|
332
|
+
<span class="method-name">aorta</span><span class="method-args">( obj )</span>
|
333
|
+
</a>
|
334
|
+
</div>
|
335
|
+
|
336
|
+
<div class="method-description">
|
337
|
+
<p><a class="source-toggle" href="#"
|
338
|
+
onclick="toggleCode('M000091-source');return false;">[Source]</a></p>
|
339
|
+
<div class="method-source-code" id="M000091-source">
|
340
|
+
<pre>
|
341
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 524</span>
|
342
|
+
524: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">aorta</span>( <span class="ruby-identifier">obj</span> )
|
343
|
+
525: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'use editor'</span>]
|
344
|
+
526: <span class="ruby-comment cmt"># I am quite displeased that Tempfile.open eats its blocks result,</span>
|
345
|
+
527: <span class="ruby-comment cmt"># thereby necessitating this blecherous construct...</span>
|
346
|
+
528: <span class="ruby-identifier">tempfile</span> = <span class="ruby-keyword kw">nil</span>
|
347
|
+
529: <span class="ruby-constant">Tempfile</span>.<span class="ruby-identifier">open</span>(<span class="ruby-value str">"hobix.post"</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">tempfile</span><span class="ruby-operator">|</span> <span class="ruby-identifier">tempfile</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">to_yaml</span> }
|
348
|
+
530:
|
349
|
+
531: <span class="ruby-keyword kw">begin</span>
|
350
|
+
532: <span class="ruby-identifier">created</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">mtime</span>( <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">path</span> )
|
351
|
+
533: <span class="ruby-identifier">system</span>( <span class="ruby-node">"#{ ENV['EDITOR'] || 'vi' } #{ tempfile.path }"</span> )
|
352
|
+
534: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>( <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">path</span> )
|
353
|
+
535:
|
354
|
+
536: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">created</span> <span class="ruby-operator"><</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">mtime</span>( <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">path</span> )
|
355
|
+
537: <span class="ruby-identifier">obj</span> = <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">load</span>( <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">open</span> )
|
356
|
+
538: <span class="ruby-keyword kw">else</span>
|
357
|
+
539: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"** Edit aborted"</span>
|
358
|
+
540: <span class="ruby-identifier">obj</span> = <span class="ruby-keyword kw">nil</span>
|
359
|
+
541: <span class="ruby-keyword kw">end</span>
|
360
|
+
542: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
361
|
+
543: <span class="ruby-identifier">puts</span> <span class="ruby-node">"There was an error saving the entry: #{ e.class }: #{ e.message }"</span>
|
362
|
+
544: <span class="ruby-identifier">print</span> <span class="ruby-value str">"Re-edit [Yn]? "</span>
|
363
|
+
545: <span class="ruby-identifier">response</span> = <span class="ruby-identifier">gets</span>.<span class="ruby-identifier">strip</span>
|
364
|
+
546: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">response</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[Yy]/</span>
|
365
|
+
547: <span class="ruby-keyword kw">retry</span>
|
366
|
+
548: <span class="ruby-keyword kw">else</span>
|
367
|
+
549: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"** Edit aborted"</span>
|
368
|
+
550: <span class="ruby-identifier">obj</span> = <span class="ruby-keyword kw">nil</span>
|
369
|
+
551: <span class="ruby-keyword kw">end</span>
|
370
|
+
552: <span class="ruby-keyword kw">ensure</span>
|
371
|
+
553: <span class="ruby-comment cmt"># tempfile will get closed/unlinked when it's collected anyway;</span>
|
372
|
+
554: <span class="ruby-comment cmt"># may as well do it here to provide some determinism for the user</span>
|
373
|
+
555: <span class="ruby-keyword kw">begin</span>
|
374
|
+
556: <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">true</span>
|
375
|
+
557: <span class="ruby-keyword kw">rescue</span>
|
376
|
+
558: <span class="ruby-keyword kw">end</span>
|
377
|
+
559: <span class="ruby-keyword kw">end</span>
|
378
|
+
560: <span class="ruby-keyword kw">else</span>
|
379
|
+
561: <span class="ruby-identifier">require</span> <span class="ruby-value str">'hobix/util/objedit'</span>
|
380
|
+
562: <span class="ruby-identifier">obj</span> = <span class="ruby-constant">Hobix</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-constant">ObjEdit</span>( <span class="ruby-identifier">obj</span> )
|
381
|
+
563: <span class="ruby-keyword kw">end</span>
|
382
|
+
564: <span class="ruby-identifier">obj</span>
|
383
|
+
565: <span class="ruby-keyword kw">end</span>
|
384
|
+
</pre>
|
385
|
+
</div>
|
386
|
+
</div>
|
387
|
+
</div>
|
388
|
+
|
389
|
+
<div id="method-M000055" class="method-detail">
|
390
|
+
<a name="M000055"></a>
|
391
|
+
|
392
|
+
<div class="method-heading">
|
393
|
+
<a href="#M000055" class="method-signature">
|
394
|
+
<span class="method-name">blogs_weblog</span><span class="method-args">()</span>
|
395
|
+
</a>
|
396
|
+
</div>
|
397
|
+
|
398
|
+
<div class="method-description">
|
399
|
+
<p><a class="source-toggle" href="#"
|
400
|
+
onclick="toggleCode('M000055-source');return false;">[Source]</a></p>
|
401
|
+
<div class="method-source-code" id="M000055-source">
|
402
|
+
<pre>
|
403
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 129</span>
|
404
|
+
129: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">blogs_weblog</span>
|
405
|
+
130: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'weblogs'</span>].<span class="ruby-identifier">respond_to?</span>( <span class="ruby-identifier">:sort</span> ) <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@config</span>[<span class="ruby-value str">'weblogs'</span>].<span class="ruby-identifier">empty?</span>
|
406
|
+
131: <span class="ruby-identifier">blogs</span> = <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'weblogs'</span>].<span class="ruby-identifier">sort</span>
|
407
|
+
132: <span class="ruby-identifier">name_width</span> = <span class="ruby-identifier">blogs</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">b</span><span class="ruby-operator">|</span> <span class="ruby-identifier">b</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">length</span> }.<span class="ruby-identifier">max</span>
|
408
|
+
133: <span class="ruby-identifier">tabular</span>( <span class="ruby-identifier">blogs</span>, [[<span class="ruby-operator">-</span><span class="ruby-identifier">name_width</span>, <span class="ruby-value">0</span>, <span class="ruby-value str">'weblog-name'</span>], [<span class="ruby-value">-40</span>, <span class="ruby-value">1</span>, <span class="ruby-value str">'path'</span>]] )
|
409
|
+
134: <span class="ruby-keyword kw">else</span>
|
410
|
+
135: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"** You have no blogs set up. Use `hobix setup_blogs' to get started."</span>
|
411
|
+
136: <span class="ruby-keyword kw">end</span>
|
412
|
+
137: <span class="ruby-keyword kw">end</span>
|
413
|
+
</pre>
|
414
|
+
</div>
|
415
|
+
</div>
|
416
|
+
</div>
|
417
|
+
|
418
|
+
<div id="method-M000054" class="method-detail">
|
419
|
+
<a name="M000054"></a>
|
420
|
+
|
421
|
+
<div class="method-heading">
|
422
|
+
<a href="#M000054" class="method-signature">
|
423
|
+
<span class="method-name">blogs_weblog_args</span><span class="method-args">()</span>
|
424
|
+
</a>
|
425
|
+
</div>
|
426
|
+
|
427
|
+
<div class="method-description">
|
428
|
+
<p><a class="source-toggle" href="#"
|
429
|
+
onclick="toggleCode('M000054-source');return false;">[Source]</a></p>
|
430
|
+
<div class="method-source-code" id="M000054-source">
|
431
|
+
<pre>
|
432
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 128</span>
|
433
|
+
128: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">blogs_weblog_args</span>; []; <span class="ruby-keyword kw">end</span>
|
434
|
+
</pre>
|
435
|
+
</div>
|
436
|
+
</div>
|
437
|
+
</div>
|
438
|
+
|
439
|
+
<div id="method-M000053" class="method-detail">
|
440
|
+
<a name="M000053"></a>
|
441
|
+
|
442
|
+
<div class="method-heading">
|
443
|
+
<a href="#M000053" class="method-signature">
|
444
|
+
<span class="method-name">blogs_weblog_explain</span><span class="method-args">()</span>
|
445
|
+
</a>
|
446
|
+
</div>
|
447
|
+
|
448
|
+
<div class="method-description">
|
449
|
+
<p>
|
450
|
+
List all your weblogs
|
451
|
+
</p>
|
452
|
+
<p><a class="source-toggle" href="#"
|
453
|
+
onclick="toggleCode('M000053-source');return false;">[Source]</a></p>
|
454
|
+
<div class="method-source-code" id="M000053-source">
|
455
|
+
<pre>
|
456
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 127</span>
|
457
|
+
127: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">blogs_weblog_explain</span>; <span class="ruby-value str">"List your weblogs."</span>; <span class="ruby-keyword kw">end</span>
|
458
|
+
</pre>
|
459
|
+
</div>
|
460
|
+
</div>
|
461
|
+
</div>
|
462
|
+
|
463
|
+
<div id="method-M000048" class="method-detail">
|
464
|
+
<a name="M000048"></a>
|
465
|
+
|
466
|
+
<div class="method-heading">
|
467
|
+
<a href="#M000048" class="method-signature">
|
468
|
+
<span class="method-name">config</span><span class="method-args">()</span>
|
469
|
+
</a>
|
470
|
+
</div>
|
471
|
+
|
472
|
+
<div class="method-description">
|
473
|
+
<p><a class="source-toggle" href="#"
|
474
|
+
onclick="toggleCode('M000048-source');return false;">[Source]</a></p>
|
475
|
+
<div class="method-source-code" id="M000048-source">
|
476
|
+
<pre>
|
477
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 94</span>
|
478
|
+
94: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">config</span>
|
479
|
+
95: <span class="ruby-ivar">@config</span>
|
480
|
+
96: <span class="ruby-keyword kw">end</span>
|
481
|
+
</pre>
|
482
|
+
</div>
|
483
|
+
</div>
|
484
|
+
</div>
|
485
|
+
|
486
|
+
<div id="method-M000059" class="method-detail">
|
487
|
+
<a name="M000059"></a>
|
488
|
+
|
489
|
+
<div class="method-heading">
|
490
|
+
<a href="#M000059" class="method-signature">
|
491
|
+
<span class="method-name">create_weblog</span><span class="method-args">( name, path )</span>
|
492
|
+
</a>
|
493
|
+
</div>
|
494
|
+
|
495
|
+
<div class="method-description">
|
496
|
+
<p><a class="source-toggle" href="#"
|
497
|
+
onclick="toggleCode('M000059-source');return false;">[Source]</a></p>
|
498
|
+
<div class="method-source-code" id="M000059-source">
|
499
|
+
<pre>
|
500
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 146</span>
|
501
|
+
146: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_weblog</span>( <span class="ruby-identifier">name</span>, <span class="ruby-identifier">path</span> )
|
502
|
+
147: <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'weblogs'</span>] <span class="ruby-operator">||=</span> {}
|
503
|
+
148: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'weblogs'</span>][<span class="ruby-identifier">name</span>]
|
504
|
+
149: <span class="ruby-identifier">print</span> <span class="ruby-node">"*** Blog '#{ name }' exists already! Overwrite?? [y/N]: "</span>
|
505
|
+
150: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">gets</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">upcase</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">'Y'</span>
|
506
|
+
151: <span class="ruby-identifier">puts</span> <span class="ruby-node">"*** Creation of weblog `#{ name }' aborted."</span>
|
507
|
+
152: <span class="ruby-keyword kw">return</span>
|
508
|
+
153: <span class="ruby-keyword kw">end</span>
|
509
|
+
154: <span class="ruby-keyword kw">end</span>
|
510
|
+
155: <span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>( <span class="ruby-identifier">path</span> )
|
511
|
+
156: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"|*** Creation of weblog `\#{ name }' will add the following directory\"\n| structure to directory \#{ path }\"\n|\n| \#{ path }\n| hobix.yaml <- configuration\n|\n| entries/ <- edit and organize\n| your news items,\n| articles and so on.\n|\n| skel/ <- contains your\n| templates\n|\n| htdocs/ <- html is created here,\n| store all your images here,\n| this is your viewable\n| websyht\n|\n| lib/ <- extra hobix libraries\n| (plugins) go here\n|\n"</span>
|
512
|
+
157: <span class="ruby-identifier">print</span> <span class="ruby-value str">"Create this structure? [y/N]: "</span>
|
513
|
+
158: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">gets</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">upcase</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">'Y'</span>
|
514
|
+
159: <span class="ruby-identifier">puts</span> <span class="ruby-node">"*** Creation of weblog `#{ name }' aborted."</span>
|
515
|
+
160: <span class="ruby-keyword kw">return</span>
|
516
|
+
161: <span class="ruby-keyword kw">end</span>
|
517
|
+
162:
|
518
|
+
163: <span class="ruby-identifier">modes</span> = <span class="ruby-identifier">load_patchsets</span>
|
519
|
+
164:
|
520
|
+
165: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"The default blog is available in the following modes:"</span>
|
521
|
+
166: <span class="ruby-identifier">puts</span> <span class="ruby-node">" #{ modes.keys.join( ', ' ) }"</span>
|
522
|
+
167: <span class="ruby-identifier">puts</span>
|
523
|
+
168: <span class="ruby-identifier">mode</span> = <span class="ruby-keyword kw">nil</span>
|
524
|
+
169: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
|
525
|
+
170: <span class="ruby-identifier">print</span> <span class="ruby-value str">"Modes: [Comma between each mode or Enter for none] "</span>
|
526
|
+
171: <span class="ruby-identifier">mode</span> = <span class="ruby-identifier">gets</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">downcase</span>
|
527
|
+
172: <span class="ruby-identifier">m</span> = <span class="ruby-identifier">mode</span>
|
528
|
+
173: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mode</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">mode</span>.<span class="ruby-identifier">split</span>( <span class="ruby-regexp re">/,/</span> ).<span class="ruby-identifier">detect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">strip!</span>; <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">modes</span>.<span class="ruby-identifier">has_key?</span>( <span class="ruby-identifier">m</span> ) }
|
529
|
+
174: <span class="ruby-identifier">puts</span> <span class="ruby-node">"*** No `#{ m }' mode available."</span>
|
530
|
+
175: <span class="ruby-keyword kw">end</span>
|
531
|
+
176:
|
532
|
+
177: <span class="ruby-identifier">require</span> <span class="ruby-value str">'fileutils'</span>
|
533
|
+
178: <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">makedirs</span> <span class="ruby-identifier">path</span>
|
534
|
+
179: <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">cp_r</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>( <span class="ruby-node">"#{ Hobix::SHARE_PATH }/default-blog/*"</span> ), <span class="ruby-identifier">path</span>
|
535
|
+
180:
|
536
|
+
181: <span class="ruby-comment cmt"># apply any patches</span>
|
537
|
+
182: <span class="ruby-identifier">patchlist</span> = <span class="ruby-identifier">mode</span>.<span class="ruby-identifier">split</span>( <span class="ruby-regexp re">/,/</span> ).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">modes</span>[<span class="ruby-identifier">m</span>.<span class="ruby-identifier">strip</span>] }.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">uniq</span>
|
538
|
+
183: <span class="ruby-identifier">require</span> <span class="ruby-value str">'hobix/util/patcher'</span>
|
539
|
+
184: <span class="ruby-identifier">patchlist</span>.<span class="ruby-identifier">collect!</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-node">"#{ Hobix::SHARE_PATH }/default-blog.#{ p }.patch"</span> }
|
540
|
+
185: <span class="ruby-identifier">patcher</span> = <span class="ruby-constant">Hobix</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-constant">Patcher</span>[ <span class="ruby-operator">*</span><span class="ruby-identifier">patchlist</span> ]
|
541
|
+
186: <span class="ruby-identifier">patcher</span>.<span class="ruby-identifier">apply</span>( <span class="ruby-identifier">path</span> )
|
542
|
+
187:
|
543
|
+
188: <span class="ruby-identifier">hobix_yaml</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>( <span class="ruby-identifier">path</span>, <span class="ruby-value str">"hobix.yaml"</span> )
|
544
|
+
189: <span class="ruby-identifier">join_as_author</span>( <span class="ruby-identifier">name</span>, <span class="ruby-identifier">hobix_yaml</span> )
|
545
|
+
190: <span class="ruby-identifier">weblog</span> = <span class="ruby-constant">Hobix</span><span class="ruby-operator">::</span><span class="ruby-constant">Weblog</span>.<span class="ruby-identifier">load</span>( <span class="ruby-identifier">hobix_yaml</span> )
|
546
|
+
191: <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">setup</span>
|
547
|
+
192: <span class="ruby-identifier">edit_action</span>( <span class="ruby-identifier">weblog</span> )
|
548
|
+
193: <span class="ruby-keyword kw">end</span>
|
549
|
+
</pre>
|
550
|
+
</div>
|
551
|
+
</div>
|
552
|
+
</div>
|
553
|
+
|
554
|
+
<div id="method-M000058" class="method-detail">
|
555
|
+
<a name="M000058"></a>
|
556
|
+
|
557
|
+
<div class="method-heading">
|
558
|
+
<a href="#M000058" class="method-signature">
|
559
|
+
<span class="method-name">create_weblog_args</span><span class="method-args">()</span>
|
560
|
+
</a>
|
561
|
+
</div>
|
562
|
+
|
563
|
+
<div class="method-description">
|
564
|
+
<p><a class="source-toggle" href="#"
|
565
|
+
onclick="toggleCode('M000058-source');return false;">[Source]</a></p>
|
566
|
+
<div class="method-source-code" id="M000058-source">
|
567
|
+
<pre>
|
568
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 145</span>
|
569
|
+
145: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_weblog_args</span>; [<span class="ruby-value str">'weblog-name'</span>, <span class="ruby-value str">'/path/to/'</span>]; <span class="ruby-keyword kw">end</span>
|
570
|
+
</pre>
|
571
|
+
</div>
|
572
|
+
</div>
|
573
|
+
</div>
|
574
|
+
|
575
|
+
<div id="method-M000057" class="method-detail">
|
576
|
+
<a name="M000057"></a>
|
577
|
+
|
578
|
+
<div class="method-heading">
|
579
|
+
<a href="#M000057" class="method-signature">
|
580
|
+
<span class="method-name">create_weblog_explain</span><span class="method-args">()</span>
|
581
|
+
</a>
|
582
|
+
</div>
|
583
|
+
|
584
|
+
<div class="method-description">
|
585
|
+
<p>
|
586
|
+
Create a new skeleton for a weblog
|
587
|
+
</p>
|
588
|
+
<p><a class="source-toggle" href="#"
|
589
|
+
onclick="toggleCode('M000057-source');return false;">[Source]</a></p>
|
590
|
+
<div class="method-source-code" id="M000057-source">
|
591
|
+
<pre>
|
592
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 144</span>
|
593
|
+
144: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_weblog_explain</span>; <span class="ruby-value str">"Create a brand new weblog."</span>; <span class="ruby-keyword kw">end</span>
|
594
|
+
</pre>
|
595
|
+
</div>
|
596
|
+
</div>
|
597
|
+
</div>
|
598
|
+
|
599
|
+
<div id="method-M000075" class="method-detail">
|
600
|
+
<a name="M000075"></a>
|
601
|
+
|
602
|
+
<div class="method-heading">
|
603
|
+
<a href="#M000075" class="method-signature">
|
604
|
+
<span class="method-name">del_weblog</span><span class="method-args">( name )</span>
|
605
|
+
</a>
|
606
|
+
</div>
|
607
|
+
|
608
|
+
<div class="method-description">
|
609
|
+
<p><a class="source-toggle" href="#"
|
610
|
+
onclick="toggleCode('M000075-source');return false;">[Source]</a></p>
|
611
|
+
<div class="method-source-code" id="M000075-source">
|
612
|
+
<pre>
|
613
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 273</span>
|
614
|
+
273: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">del_weblog</span>( <span class="ruby-identifier">name</span> )
|
615
|
+
274: <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'weblogs'</span>] <span class="ruby-operator">||=</span> {}
|
616
|
+
275: <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'weblogs'</span>].<span class="ruby-identifier">delete</span>( <span class="ruby-identifier">name</span> )
|
617
|
+
276: <span class="ruby-identifier">save_config</span>
|
618
|
+
277: <span class="ruby-keyword kw">end</span>
|
619
|
+
</pre>
|
620
|
+
</div>
|
621
|
+
</div>
|
622
|
+
</div>
|
623
|
+
|
624
|
+
<div id="method-M000074" class="method-detail">
|
625
|
+
<a name="M000074"></a>
|
626
|
+
|
627
|
+
<div class="method-heading">
|
628
|
+
<a href="#M000074" class="method-signature">
|
629
|
+
<span class="method-name">del_weblog_args</span><span class="method-args">()</span>
|
630
|
+
</a>
|
631
|
+
</div>
|
632
|
+
|
633
|
+
<div class="method-description">
|
634
|
+
<p><a class="source-toggle" href="#"
|
635
|
+
onclick="toggleCode('M000074-source');return false;">[Source]</a></p>
|
636
|
+
<div class="method-source-code" id="M000074-source">
|
637
|
+
<pre>
|
638
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 272</span>
|
639
|
+
272: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">del_weblog_args</span>; [<span class="ruby-value str">'weblog-name'</span>]; <span class="ruby-keyword kw">end</span>
|
640
|
+
</pre>
|
641
|
+
</div>
|
642
|
+
</div>
|
643
|
+
</div>
|
644
|
+
|
645
|
+
<div id="method-M000073" class="method-detail">
|
646
|
+
<a name="M000073"></a>
|
647
|
+
|
648
|
+
<div class="method-heading">
|
649
|
+
<a href="#M000073" class="method-signature">
|
650
|
+
<span class="method-name">del_weblog_explain</span><span class="method-args">()</span>
|
651
|
+
</a>
|
652
|
+
</div>
|
653
|
+
|
654
|
+
<div class="method-description">
|
655
|
+
<p>
|
656
|
+
Delete a weblog from local <a href="CommandLine.html#M000048">config</a>
|
657
|
+
</p>
|
658
|
+
<p><a class="source-toggle" href="#"
|
659
|
+
onclick="toggleCode('M000073-source');return false;">[Source]</a></p>
|
660
|
+
<div class="method-source-code" id="M000073-source">
|
661
|
+
<pre>
|
662
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 271</span>
|
663
|
+
271: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">del_weblog_explain</span>; <span class="ruby-value str">"Remove weblog from your list."</span>; <span class="ruby-keyword kw">end</span>
|
664
|
+
</pre>
|
665
|
+
</div>
|
666
|
+
</div>
|
667
|
+
</div>
|
668
|
+
|
669
|
+
<div id="method-M000078" class="method-detail">
|
670
|
+
<a name="M000078"></a>
|
671
|
+
|
672
|
+
<div class="method-heading">
|
673
|
+
<a href="#M000078" class="method-signature">
|
674
|
+
<span class="method-name">druby_weblog</span><span class="method-args">()</span>
|
675
|
+
</a>
|
676
|
+
</div>
|
677
|
+
|
678
|
+
<div class="method-description">
|
679
|
+
<p><a class="source-toggle" href="#"
|
680
|
+
onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
|
681
|
+
<div class="method-source-code" id="M000078-source">
|
682
|
+
<pre>
|
683
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 282</span>
|
684
|
+
282: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">druby_weblog</span>
|
685
|
+
283: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'weblogs'</span>]
|
686
|
+
284: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'druby'</span>]
|
687
|
+
285: <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'druby'</span>] = <span class="ruby-value str">'druby://:4081'</span>
|
688
|
+
286: <span class="ruby-identifier">puts</span> <span class="ruby-node">"** No drb url found, using #{ @config['druby'] }"</span>
|
689
|
+
287: <span class="ruby-keyword kw">end</span>
|
690
|
+
288: <span class="ruby-identifier">require</span> <span class="ruby-value str">'drb'</span>
|
691
|
+
289: <span class="ruby-identifier">blogs</span> = {}
|
692
|
+
290: <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'weblogs'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">path</span><span class="ruby-operator">|</span>
|
693
|
+
291: <span class="ruby-identifier">blogs</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-constant">Hobix</span><span class="ruby-operator">::</span><span class="ruby-constant">Weblog</span>.<span class="ruby-identifier">load</span> <span class="ruby-identifier">path</span>
|
694
|
+
292: <span class="ruby-keyword kw">end</span>
|
695
|
+
293: <span class="ruby-identifier">require</span> <span class="ruby-value str">'hobix/api'</span>
|
696
|
+
294: <span class="ruby-identifier">api</span> = <span class="ruby-constant">Hobix</span><span class="ruby-operator">::</span><span class="ruby-constant">API</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">blogs</span>
|
697
|
+
295: <span class="ruby-constant">DRb</span>.<span class="ruby-identifier">start_service</span> <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'druby'</span>], <span class="ruby-identifier">api</span>
|
698
|
+
296: <span class="ruby-constant">DRb</span>.<span class="ruby-identifier">thread</span>.<span class="ruby-identifier">join</span>
|
699
|
+
297: <span class="ruby-keyword kw">else</span>
|
700
|
+
298: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"** No blogs found in the configuration."</span>
|
701
|
+
299: <span class="ruby-keyword kw">end</span>
|
702
|
+
300: <span class="ruby-keyword kw">end</span>
|
703
|
+
</pre>
|
704
|
+
</div>
|
705
|
+
</div>
|
706
|
+
</div>
|
707
|
+
|
708
|
+
<div id="method-M000077" class="method-detail">
|
709
|
+
<a name="M000077"></a>
|
710
|
+
|
711
|
+
<div class="method-heading">
|
712
|
+
<a href="#M000077" class="method-signature">
|
713
|
+
<span class="method-name">druby_weblog_args</span><span class="method-args">()</span>
|
714
|
+
</a>
|
715
|
+
</div>
|
716
|
+
|
717
|
+
<div class="method-description">
|
718
|
+
<p><a class="source-toggle" href="#"
|
719
|
+
onclick="toggleCode('M000077-source');return false;">[Source]</a></p>
|
720
|
+
<div class="method-source-code" id="M000077-source">
|
721
|
+
<pre>
|
722
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 281</span>
|
723
|
+
281: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">druby_weblog_args</span>; []; <span class="ruby-keyword kw">end</span>
|
724
|
+
</pre>
|
725
|
+
</div>
|
726
|
+
</div>
|
727
|
+
</div>
|
728
|
+
|
729
|
+
<div id="method-M000076" class="method-detail">
|
730
|
+
<a name="M000076"></a>
|
731
|
+
|
732
|
+
<div class="method-heading">
|
733
|
+
<a href="#M000076" class="method-signature">
|
734
|
+
<span class="method-name">druby_weblog_explain</span><span class="method-args">()</span>
|
735
|
+
</a>
|
736
|
+
</div>
|
737
|
+
|
738
|
+
<div class="method-description">
|
739
|
+
<p>
|
740
|
+
Run a DRuby daemon for blogs in your configuration
|
741
|
+
</p>
|
742
|
+
<p><a class="source-toggle" href="#"
|
743
|
+
onclick="toggleCode('M000076-source');return false;">[Source]</a></p>
|
744
|
+
<div class="method-source-code" id="M000076-source">
|
745
|
+
<pre>
|
746
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 280</span>
|
747
|
+
280: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">druby_weblog_explain</span>; <span class="ruby-value str">"Start the DRuby daemon for weblogs in your config."</span>; <span class="ruby-keyword kw">end</span>
|
748
|
+
</pre>
|
749
|
+
</div>
|
750
|
+
</div>
|
751
|
+
</div>
|
752
|
+
|
753
|
+
<div id="method-M000072" class="method-detail">
|
754
|
+
<a name="M000072"></a>
|
755
|
+
|
756
|
+
<div class="method-heading">
|
757
|
+
<a href="#M000072" class="method-signature">
|
758
|
+
<span class="method-name">edit_action</span><span class="method-args">( weblog )</span>
|
759
|
+
</a>
|
760
|
+
</div>
|
761
|
+
|
762
|
+
<div class="method-description">
|
763
|
+
<p><a class="source-toggle" href="#"
|
764
|
+
onclick="toggleCode('M000072-source');return false;">[Source]</a></p>
|
765
|
+
<div class="method-source-code" id="M000072-source">
|
766
|
+
<pre>
|
767
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 263</span>
|
768
|
+
263: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">edit_action</span>( <span class="ruby-identifier">weblog</span> )
|
769
|
+
264: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">hobix_yaml</span>
|
770
|
+
265: <span class="ruby-identifier">weblog</span> = <span class="ruby-identifier">aorta</span>( <span class="ruby-identifier">weblog</span> )
|
771
|
+
266: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">nil?</span>
|
772
|
+
267: <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">save</span>( <span class="ruby-identifier">path</span> )
|
773
|
+
268: <span class="ruby-keyword kw">end</span>
|
774
|
+
</pre>
|
775
|
+
</div>
|
776
|
+
</div>
|
777
|
+
</div>
|
778
|
+
|
779
|
+
<div id="method-M000071" class="method-detail">
|
780
|
+
<a name="M000071"></a>
|
781
|
+
|
782
|
+
<div class="method-heading">
|
783
|
+
<a href="#M000071" class="method-signature">
|
784
|
+
<span class="method-name">edit_action_args</span><span class="method-args">()</span>
|
785
|
+
</a>
|
786
|
+
</div>
|
787
|
+
|
788
|
+
<div class="method-description">
|
789
|
+
<p><a class="source-toggle" href="#"
|
790
|
+
onclick="toggleCode('M000071-source');return false;">[Source]</a></p>
|
791
|
+
<div class="method-source-code" id="M000071-source">
|
792
|
+
<pre>
|
793
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 262</span>
|
794
|
+
262: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">edit_action_args</span>; [<span class="ruby-value str">'weblog-name'</span>]; <span class="ruby-keyword kw">end</span>
|
795
|
+
</pre>
|
796
|
+
</div>
|
797
|
+
</div>
|
798
|
+
</div>
|
799
|
+
|
800
|
+
<div id="method-M000070" class="method-detail">
|
801
|
+
<a name="M000070"></a>
|
802
|
+
|
803
|
+
<div class="method-heading">
|
804
|
+
<a href="#M000070" class="method-signature">
|
805
|
+
<span class="method-name">edit_action_explain</span><span class="method-args">()</span>
|
806
|
+
</a>
|
807
|
+
</div>
|
808
|
+
|
809
|
+
<div class="method-description">
|
810
|
+
<p>
|
811
|
+
Edit a weblog from local <a href="CommandLine.html#M000048">config</a>
|
812
|
+
</p>
|
813
|
+
<p><a class="source-toggle" href="#"
|
814
|
+
onclick="toggleCode('M000070-source');return false;">[Source]</a></p>
|
815
|
+
<div class="method-source-code" id="M000070-source">
|
816
|
+
<pre>
|
817
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 261</span>
|
818
|
+
261: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">edit_action_explain</span>; <span class="ruby-value str">"Edit weblog's configuration"</span>; <span class="ruby-keyword kw">end</span>
|
819
|
+
</pre>
|
820
|
+
</div>
|
821
|
+
</div>
|
822
|
+
</div>
|
823
|
+
|
824
|
+
<div id="method-M000045" class="method-detail">
|
825
|
+
<a name="M000045"></a>
|
826
|
+
|
827
|
+
<div class="method-heading">
|
828
|
+
<a href="#M000045" class="method-signature">
|
829
|
+
<span class="method-name">gets</span><span class="method-args">()</span>
|
830
|
+
</a>
|
831
|
+
</div>
|
832
|
+
|
833
|
+
<div class="method-description">
|
834
|
+
<p><a class="source-toggle" href="#"
|
835
|
+
onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
|
836
|
+
<div class="method-source-code" id="M000045-source">
|
837
|
+
<pre>
|
838
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 84</span>
|
839
|
+
84: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gets</span>; <span class="ruby-identifier">$stdin</span>.<span class="ruby-identifier">gets</span>; <span class="ruby-keyword kw">end</span>
|
840
|
+
</pre>
|
841
|
+
</div>
|
842
|
+
</div>
|
843
|
+
</div>
|
844
|
+
|
845
|
+
<div id="method-M000095" class="method-detail">
|
846
|
+
<a name="M000095"></a>
|
847
|
+
|
848
|
+
<div class="method-heading">
|
849
|
+
<a href="#M000095" class="method-signature">
|
850
|
+
<span class="method-name">http</span><span class="method-args">( *args )</span>
|
851
|
+
</a>
|
852
|
+
</div>
|
853
|
+
|
854
|
+
<div class="method-description">
|
855
|
+
<p>
|
856
|
+
<a href="../Hobix.html">Hobix</a> over the wire
|
857
|
+
</p>
|
858
|
+
<p><a class="source-toggle" href="#"
|
859
|
+
onclick="toggleCode('M000095-source');return false;">[Source]</a></p>
|
860
|
+
<div class="method-source-code" id="M000095-source">
|
861
|
+
<pre>
|
862
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 597</span>
|
863
|
+
597: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">http</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">args</span> )
|
864
|
+
598: <span class="ruby-identifier">p</span> <span class="ruby-identifier">http_get</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">args</span> )
|
865
|
+
599: <span class="ruby-keyword kw">end</span>
|
866
|
+
</pre>
|
867
|
+
</div>
|
868
|
+
</div>
|
869
|
+
</div>
|
870
|
+
|
871
|
+
<div id="method-M000099" class="method-detail">
|
872
|
+
<a name="M000099"></a>
|
873
|
+
|
874
|
+
<div class="method-heading">
|
875
|
+
<a href="#M000099" class="method-signature">
|
876
|
+
<span class="method-name">http_edit_remote</span><span class="method-args">( weblog )</span>
|
877
|
+
</a>
|
878
|
+
</div>
|
879
|
+
|
880
|
+
<div class="method-description">
|
881
|
+
<p><a class="source-toggle" href="#"
|
882
|
+
onclick="toggleCode('M000099-source');return false;">[Source]</a></p>
|
883
|
+
<div class="method-source-code" id="M000099-source">
|
884
|
+
<pre>
|
885
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 645</span>
|
886
|
+
645: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">http_edit_remote</span>( <span class="ruby-identifier">weblog</span> )
|
887
|
+
646: <span class="ruby-identifier">config</span> = <span class="ruby-identifier">http_get</span>( <span class="ruby-identifier">weblog</span>, <span class="ruby-value str">"edit"</span> )
|
888
|
+
647: <span class="ruby-identifier">config</span> = <span class="ruby-identifier">aorta</span>( <span class="ruby-identifier">config</span> )
|
889
|
+
648: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">config</span>.<span class="ruby-identifier">nil?</span>
|
890
|
+
649: <span class="ruby-identifier">p</span> <span class="ruby-identifier">http_post</span>( <span class="ruby-identifier">weblog</span>, <span class="ruby-value str">"edit"</span>, <span class="ruby-identifier">config</span> )
|
891
|
+
650: <span class="ruby-keyword kw">end</span>
|
892
|
+
</pre>
|
893
|
+
</div>
|
894
|
+
</div>
|
895
|
+
</div>
|
896
|
+
|
897
|
+
<div id="method-M000096" class="method-detail">
|
898
|
+
<a name="M000096"></a>
|
899
|
+
|
900
|
+
<div class="method-heading">
|
901
|
+
<a href="#M000096" class="method-signature">
|
902
|
+
<span class="method-name">http_get</span><span class="method-args">( weblog, *args )</span>
|
903
|
+
</a>
|
904
|
+
</div>
|
905
|
+
|
906
|
+
<div class="method-description">
|
907
|
+
<p><a class="source-toggle" href="#"
|
908
|
+
onclick="toggleCode('M000096-source');return false;">[Source]</a></p>
|
909
|
+
<div class="method-source-code" id="M000096-source">
|
910
|
+
<pre>
|
911
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 601</span>
|
912
|
+
601: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">http_get</span>( <span class="ruby-identifier">weblog</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span> )
|
913
|
+
602: <span class="ruby-identifier">require</span> <span class="ruby-value str">'net/http'</span>
|
914
|
+
603: <span class="ruby-identifier">response</span> =
|
915
|
+
604: <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">host</span>, <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">port</span> ).<span class="ruby-identifier">start</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">http</span><span class="ruby-operator">|</span>
|
916
|
+
605: <span class="ruby-identifier">http</span>.<span class="ruby-identifier">get</span>( <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>( <span class="ruby-node">"remote/#{ args.join '/' }"</span>, <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">path</span> ) )
|
917
|
+
606: <span class="ruby-keyword kw">end</span>
|
918
|
+
607: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">response</span>
|
919
|
+
608: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTPSuccess</span> <span class="ruby-keyword kw">then</span> <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">load</span>( <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span> )
|
920
|
+
609: <span class="ruby-keyword kw">else</span>
|
921
|
+
610: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">error!</span>
|
922
|
+
611: <span class="ruby-keyword kw">end</span>
|
923
|
+
612: <span class="ruby-keyword kw">end</span>
|
924
|
+
</pre>
|
925
|
+
</div>
|
926
|
+
</div>
|
927
|
+
</div>
|
928
|
+
|
929
|
+
<div id="method-M000100" class="method-detail">
|
930
|
+
<a name="M000100"></a>
|
931
|
+
|
932
|
+
<div class="method-heading">
|
933
|
+
<a href="#M000100" class="method-signature">
|
934
|
+
<span class="method-name">http_list_remote</span><span class="method-args">( weblog, inpath = '' )</span>
|
935
|
+
</a>
|
936
|
+
</div>
|
937
|
+
|
938
|
+
<div class="method-description">
|
939
|
+
<p><a class="source-toggle" href="#"
|
940
|
+
onclick="toggleCode('M000100-source');return false;">[Source]</a></p>
|
941
|
+
<div class="method-source-code" id="M000100-source">
|
942
|
+
<pre>
|
943
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 652</span>
|
944
|
+
652: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">http_list_remote</span>( <span class="ruby-identifier">weblog</span>, <span class="ruby-identifier">inpath</span> = <span class="ruby-value str">''</span> )
|
945
|
+
653: <span class="ruby-identifier">require</span> <span class="ruby-value str">'hobix/storage/filesys'</span>
|
946
|
+
654: <span class="ruby-identifier">entries</span> = <span class="ruby-identifier">http_get</span>( <span class="ruby-identifier">weblog</span>, <span class="ruby-value str">'list'</span>, <span class="ruby-identifier">inpath</span> )
|
947
|
+
655: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">entries</span>.<span class="ruby-identifier">empty?</span>
|
948
|
+
656: <span class="ruby-identifier">puts</span> <span class="ruby-node">"** No posts found in the weblog for path '#{inpath}'."</span>
|
949
|
+
657: <span class="ruby-keyword kw">else</span>
|
950
|
+
658: <span class="ruby-identifier">tabular_entries</span>( <span class="ruby-identifier">entries</span> )
|
951
|
+
659: <span class="ruby-keyword kw">end</span>
|
952
|
+
660: <span class="ruby-keyword kw">end</span>
|
953
|
+
</pre>
|
954
|
+
</div>
|
955
|
+
</div>
|
956
|
+
</div>
|
957
|
+
|
958
|
+
<div id="method-M000102" class="method-detail">
|
959
|
+
<a name="M000102"></a>
|
960
|
+
|
961
|
+
<div class="method-heading">
|
962
|
+
<a href="#M000102" class="method-signature">
|
963
|
+
<span class="method-name">http_patch_remote</span><span class="method-args">( *args )</span>
|
964
|
+
</a>
|
965
|
+
</div>
|
966
|
+
|
967
|
+
<div class="method-description">
|
968
|
+
<p><a class="source-toggle" href="#"
|
969
|
+
onclick="toggleCode('M000102-source');return false;">[Source]</a></p>
|
970
|
+
<div class="method-source-code" id="M000102-source">
|
971
|
+
<pre>
|
972
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 672</span>
|
973
|
+
672: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">http_patch_remote</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">args</span> )
|
974
|
+
673: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"** Weblogs cannot be patched over the wire yet."</span>
|
975
|
+
674: <span class="ruby-identifier">exit</span>
|
976
|
+
675: <span class="ruby-keyword kw">end</span>
|
977
|
+
</pre>
|
978
|
+
</div>
|
979
|
+
</div>
|
980
|
+
</div>
|
981
|
+
|
982
|
+
<div id="method-M000097" class="method-detail">
|
983
|
+
<a name="M000097"></a>
|
984
|
+
|
985
|
+
<div class="method-heading">
|
986
|
+
<a href="#M000097" class="method-signature">
|
987
|
+
<span class="method-name">http_post</span><span class="method-args">( weblog, url, obj )</span>
|
988
|
+
</a>
|
989
|
+
</div>
|
990
|
+
|
991
|
+
<div class="method-description">
|
992
|
+
<p><a class="source-toggle" href="#"
|
993
|
+
onclick="toggleCode('M000097-source');return false;">[Source]</a></p>
|
994
|
+
<div class="method-source-code" id="M000097-source">
|
995
|
+
<pre>
|
996
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 614</span>
|
997
|
+
614: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">http_post</span>( <span class="ruby-identifier">weblog</span>, <span class="ruby-identifier">url</span>, <span class="ruby-identifier">obj</span> )
|
998
|
+
615: <span class="ruby-identifier">require</span> <span class="ruby-value str">'net/http'</span>
|
999
|
+
616: <span class="ruby-identifier">response</span> =
|
1000
|
+
617: <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">host</span>, <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">port</span> ).<span class="ruby-identifier">start</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">http</span><span class="ruby-operator">|</span>
|
1001
|
+
618: <span class="ruby-identifier">http</span>.<span class="ruby-identifier">post</span>( <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>( <span class="ruby-node">"remote/#{ url }"</span>, <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">path</span> ), <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">to_yaml</span>, <span class="ruby-value str">"Content-Type"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"text/yaml"</span> )
|
1002
|
+
619: <span class="ruby-keyword kw">end</span>
|
1003
|
+
620: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">response</span>
|
1004
|
+
621: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTPSuccess</span> <span class="ruby-keyword kw">then</span> <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">load</span>( <span class="ruby-identifier">response</span>.<span class="ruby-identifier">body</span> )
|
1005
|
+
622: <span class="ruby-keyword kw">else</span>
|
1006
|
+
623: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">error!</span>
|
1007
|
+
624: <span class="ruby-keyword kw">end</span>
|
1008
|
+
625: <span class="ruby-keyword kw">end</span>
|
1009
|
+
</pre>
|
1010
|
+
</div>
|
1011
|
+
</div>
|
1012
|
+
</div>
|
1013
|
+
|
1014
|
+
<div id="method-M000098" class="method-detail">
|
1015
|
+
<a name="M000098"></a>
|
1016
|
+
|
1017
|
+
<div class="method-heading">
|
1018
|
+
<a href="#M000098" class="method-signature">
|
1019
|
+
<span class="method-name">http_post_remote</span><span class="method-args">( weblog, entry_id )</span>
|
1020
|
+
</a>
|
1021
|
+
</div>
|
1022
|
+
|
1023
|
+
<div class="method-description">
|
1024
|
+
<p><a class="source-toggle" href="#"
|
1025
|
+
onclick="toggleCode('M000098-source');return false;">[Source]</a></p>
|
1026
|
+
<div class="method-source-code" id="M000098-source">
|
1027
|
+
<pre>
|
1028
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 627</span>
|
1029
|
+
627: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">http_post_remote</span>( <span class="ruby-identifier">weblog</span>, <span class="ruby-identifier">entry_id</span> )
|
1030
|
+
628: <span class="ruby-identifier">entry</span> = <span class="ruby-identifier">http_get</span>( <span class="ruby-identifier">weblog</span>, <span class="ruby-value str">"post"</span>, <span class="ruby-identifier">entry_id</span> )
|
1031
|
+
629: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>
|
1032
|
+
630: <span class="ruby-identifier">entry</span> = <span class="ruby-identifier">http_get</span>( <span class="ruby-identifier">weblog</span>, <span class="ruby-value str">'new'</span> )
|
1033
|
+
631: <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">author</span> = <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'username'</span>]
|
1034
|
+
632: <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">title</span> = <span class="ruby-identifier">entry_id</span>.<span class="ruby-identifier">split</span>( <span class="ruby-value str">'/'</span> ).
|
1035
|
+
633: <span class="ruby-identifier">last</span>.
|
1036
|
+
634: <span class="ruby-identifier">gsub</span>( <span class="ruby-regexp re">/^\w|_\w|[A-Z]/</span> ) { <span class="ruby-operator">|</span><span class="ruby-identifier">up</span><span class="ruby-operator">|</span> <span class="ruby-node">" #{up[-1, 1].upcase}"</span> }.
|
1037
|
+
635: <span class="ruby-identifier">strip</span>
|
1038
|
+
636: <span class="ruby-keyword kw">end</span>
|
1039
|
+
637: <span class="ruby-identifier">entry</span> = <span class="ruby-identifier">aorta</span>( <span class="ruby-identifier">entry</span> )
|
1040
|
+
638: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">nil?</span>
|
1041
|
+
639:
|
1042
|
+
640: <span class="ruby-identifier">rsp</span> = <span class="ruby-identifier">http_post</span>( <span class="ruby-identifier">weblog</span>, <span class="ruby-node">"post/#{ entry_id }"</span>, <span class="ruby-identifier">entry</span> )
|
1043
|
+
641: <span class="ruby-identifier">http_get</span>( <span class="ruby-identifier">weblog</span>, <span class="ruby-value str">"upgen"</span> ) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'post upgen'</span>]
|
1044
|
+
642: <span class="ruby-identifier">p</span> <span class="ruby-identifier">rsp</span>
|
1045
|
+
643: <span class="ruby-keyword kw">end</span>
|
1046
|
+
</pre>
|
1047
|
+
</div>
|
1048
|
+
</div>
|
1049
|
+
</div>
|
1050
|
+
|
1051
|
+
<div id="method-M000101" class="method-detail">
|
1052
|
+
<a name="M000101"></a>
|
1053
|
+
|
1054
|
+
<div class="method-heading">
|
1055
|
+
<a href="#M000101" class="method-signature">
|
1056
|
+
<span class="method-name">http_search_remote</span><span class="method-args">( weblog, words, inpath = '' )</span>
|
1057
|
+
</a>
|
1058
|
+
</div>
|
1059
|
+
|
1060
|
+
<div class="method-description">
|
1061
|
+
<p><a class="source-toggle" href="#"
|
1062
|
+
onclick="toggleCode('M000101-source');return false;">[Source]</a></p>
|
1063
|
+
<div class="method-source-code" id="M000101-source">
|
1064
|
+
<pre>
|
1065
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 662</span>
|
1066
|
+
662: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">http_search_remote</span>( <span class="ruby-identifier">weblog</span>, <span class="ruby-identifier">words</span>, <span class="ruby-identifier">inpath</span> = <span class="ruby-value str">''</span> )
|
1067
|
+
663: <span class="ruby-identifier">require</span> <span class="ruby-value str">'hobix/storage/filesys'</span>
|
1068
|
+
664: <span class="ruby-identifier">entries</span> = <span class="ruby-identifier">http_get</span>( <span class="ruby-identifier">weblog</span>, <span class="ruby-value str">'search'</span>, <span class="ruby-identifier">words</span>, <span class="ruby-identifier">inpath</span> )
|
1069
|
+
665: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">entries</span>.<span class="ruby-identifier">empty?</span>
|
1070
|
+
666: <span class="ruby-identifier">puts</span> <span class="ruby-node">"** No posts found in the weblog for path '#{inpath}'."</span>
|
1071
|
+
667: <span class="ruby-keyword kw">else</span>
|
1072
|
+
668: <span class="ruby-identifier">tabular_entries</span>( <span class="ruby-identifier">entries</span> )
|
1073
|
+
669: <span class="ruby-keyword kw">end</span>
|
1074
|
+
670: <span class="ruby-keyword kw">end</span>
|
1075
|
+
</pre>
|
1076
|
+
</div>
|
1077
|
+
</div>
|
1078
|
+
</div>
|
1079
|
+
|
1080
|
+
<div id="method-M000063" class="method-detail">
|
1081
|
+
<a name="M000063"></a>
|
1082
|
+
|
1083
|
+
<div class="method-heading">
|
1084
|
+
<a href="#M000063" class="method-signature">
|
1085
|
+
<span class="method-name">join_as_author</span><span class="method-args">( name, path )</span>
|
1086
|
+
</a>
|
1087
|
+
</div>
|
1088
|
+
|
1089
|
+
<div class="method-description">
|
1090
|
+
<p><a class="source-toggle" href="#"
|
1091
|
+
onclick="toggleCode('M000063-source');return false;">[Source]</a></p>
|
1092
|
+
<div class="method-source-code" id="M000063-source">
|
1093
|
+
<pre>
|
1094
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 237</span>
|
1095
|
+
237: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">join_as_author</span>( <span class="ruby-identifier">name</span>, <span class="ruby-identifier">path</span> )
|
1096
|
+
238: <span class="ruby-identifier">weblog</span> = <span class="ruby-constant">Hobix</span><span class="ruby-operator">::</span><span class="ruby-constant">Weblog</span>.<span class="ruby-identifier">load</span>( <span class="ruby-identifier">path</span> )
|
1097
|
+
239: <span class="ruby-identifier">puts</span> <span class="ruby-node">"*** Joining blog `#{ weblog.title }', adding you as author."</span>
|
1098
|
+
240: <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">authors</span>[<span class="ruby-ivar">@config</span>[<span class="ruby-value str">'username'</span>]] = <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'personal'</span>]
|
1099
|
+
241: <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">save</span>( <span class="ruby-identifier">path</span> )
|
1100
|
+
242: <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'weblogs'</span>][<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">path</span>
|
1101
|
+
243: <span class="ruby-identifier">save_config</span>
|
1102
|
+
244: <span class="ruby-keyword kw">end</span>
|
1103
|
+
</pre>
|
1104
|
+
</div>
|
1105
|
+
</div>
|
1106
|
+
</div>
|
1107
|
+
|
1108
|
+
<div id="method-M000084" class="method-detail">
|
1109
|
+
<a name="M000084"></a>
|
1110
|
+
|
1111
|
+
<div class="method-heading">
|
1112
|
+
<a href="#M000084" class="method-signature">
|
1113
|
+
<span class="method-name">list_action</span><span class="method-args">( weblog, inpath = '' )</span>
|
1114
|
+
</a>
|
1115
|
+
</div>
|
1116
|
+
|
1117
|
+
<div class="method-description">
|
1118
|
+
<p><a class="source-toggle" href="#"
|
1119
|
+
onclick="toggleCode('M000084-source');return false;">[Source]</a></p>
|
1120
|
+
<div class="method-source-code" id="M000084-source">
|
1121
|
+
<pre>
|
1122
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 316</span>
|
1123
|
+
316: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">list_action</span>( <span class="ruby-identifier">weblog</span>, <span class="ruby-identifier">inpath</span> = <span class="ruby-value str">''</span> )
|
1124
|
+
317: <span class="ruby-identifier">entries</span> = <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">storage</span>.<span class="ruby-identifier">find</span>( <span class="ruby-identifier">:all</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">true</span>, <span class="ruby-identifier">:inpath</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">inpath</span> )
|
1125
|
+
318: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">entries</span>.<span class="ruby-identifier">empty?</span>
|
1126
|
+
319: <span class="ruby-identifier">puts</span> <span class="ruby-node">"** No posts found in the weblog for path '#{inpath}'."</span>
|
1127
|
+
320: <span class="ruby-keyword kw">else</span>
|
1128
|
+
321: <span class="ruby-identifier">tabular_entries</span>( <span class="ruby-identifier">entries</span> )
|
1129
|
+
322: <span class="ruby-keyword kw">end</span>
|
1130
|
+
323: <span class="ruby-keyword kw">end</span>
|
1131
|
+
</pre>
|
1132
|
+
</div>
|
1133
|
+
</div>
|
1134
|
+
</div>
|
1135
|
+
|
1136
|
+
<div id="method-M000083" class="method-detail">
|
1137
|
+
<a name="M000083"></a>
|
1138
|
+
|
1139
|
+
<div class="method-heading">
|
1140
|
+
<a href="#M000083" class="method-signature">
|
1141
|
+
<span class="method-name">list_action_args</span><span class="method-args">()</span>
|
1142
|
+
</a>
|
1143
|
+
</div>
|
1144
|
+
|
1145
|
+
<div class="method-description">
|
1146
|
+
<p><a class="source-toggle" href="#"
|
1147
|
+
onclick="toggleCode('M000083-source');return false;">[Source]</a></p>
|
1148
|
+
<div class="method-source-code" id="M000083-source">
|
1149
|
+
<pre>
|
1150
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 315</span>
|
1151
|
+
315: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">list_action_args</span>; [<span class="ruby-value str">'weblog-name'</span>, <span class="ruby-value str">'search/path'</span>]; <span class="ruby-keyword kw">end</span>
|
1152
|
+
</pre>
|
1153
|
+
</div>
|
1154
|
+
</div>
|
1155
|
+
</div>
|
1156
|
+
|
1157
|
+
<div id="method-M000082" class="method-detail">
|
1158
|
+
<a name="M000082"></a>
|
1159
|
+
|
1160
|
+
<div class="method-heading">
|
1161
|
+
<a href="#M000082" class="method-signature">
|
1162
|
+
<span class="method-name">list_action_explain</span><span class="method-args">()</span>
|
1163
|
+
</a>
|
1164
|
+
</div>
|
1165
|
+
|
1166
|
+
<div class="method-description">
|
1167
|
+
<p>
|
1168
|
+
List entries
|
1169
|
+
</p>
|
1170
|
+
<p><a class="source-toggle" href="#"
|
1171
|
+
onclick="toggleCode('M000082-source');return false;">[Source]</a></p>
|
1172
|
+
<div class="method-source-code" id="M000082-source">
|
1173
|
+
<pre>
|
1174
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 314</span>
|
1175
|
+
314: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">list_action_explain</span>; <span class="ruby-value str">"List all posts within a given path."</span>; <span class="ruby-keyword kw">end</span>
|
1176
|
+
</pre>
|
1177
|
+
</div>
|
1178
|
+
</div>
|
1179
|
+
</div>
|
1180
|
+
|
1181
|
+
<div id="method-M000056" class="method-detail">
|
1182
|
+
<a name="M000056"></a>
|
1183
|
+
|
1184
|
+
<div class="method-heading">
|
1185
|
+
<a href="#M000056" class="method-signature">
|
1186
|
+
<span class="method-name">load_patchsets</span><span class="method-args">()</span>
|
1187
|
+
</a>
|
1188
|
+
</div>
|
1189
|
+
|
1190
|
+
<div class="method-description">
|
1191
|
+
<p><a class="source-toggle" href="#"
|
1192
|
+
onclick="toggleCode('M000056-source');return false;">[Source]</a></p>
|
1193
|
+
<div class="method-source-code" id="M000056-source">
|
1194
|
+
<pre>
|
1195
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 139</span>
|
1196
|
+
139: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_patchsets</span>
|
1197
|
+
140: <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>( <span class="ruby-node">"#{ Hobix::SHARE_PATH }/default-blog-modes.yaml"</span> ) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">load</span>( <span class="ruby-identifier">f</span> ) }
|
1198
|
+
141: <span class="ruby-keyword kw">end</span>
|
1199
|
+
</pre>
|
1200
|
+
</div>
|
1201
|
+
</div>
|
1202
|
+
</div>
|
1203
|
+
|
1204
|
+
<div id="method-M000047" class="method-detail">
|
1205
|
+
<a name="M000047"></a>
|
1206
|
+
|
1207
|
+
<div class="method-heading">
|
1208
|
+
<a href="#M000047" class="method-signature">
|
1209
|
+
<span class="method-name">login</span><span class="method-args">( config = nil )</span>
|
1210
|
+
</a>
|
1211
|
+
</div>
|
1212
|
+
|
1213
|
+
<div class="method-description">
|
1214
|
+
<p><a class="source-toggle" href="#"
|
1215
|
+
onclick="toggleCode('M000047-source');return false;">[Source]</a></p>
|
1216
|
+
<div class="method-source-code" id="M000047-source">
|
1217
|
+
<pre>
|
1218
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 87</span>
|
1219
|
+
87: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">login</span>( <span class="ruby-identifier">config</span> = <span class="ruby-keyword kw">nil</span> )
|
1220
|
+
88: <span class="ruby-identifier">config</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">RC</span>
|
1221
|
+
89: <span class="ruby-ivar">@config</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>( <span class="ruby-identifier">config</span> ) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">load</span>( <span class="ruby-identifier">f</span> ) } <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span> <span class="ruby-constant">RC</span>
|
1222
|
+
90: <span class="ruby-identifier">setup</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@config</span>
|
1223
|
+
91: <span class="ruby-identifier">setup_personal</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'personal'</span>]
|
1224
|
+
92: <span class="ruby-keyword kw">end</span>
|
1225
|
+
</pre>
|
1226
|
+
</div>
|
1227
|
+
</div>
|
1228
|
+
</div>
|
1229
|
+
|
1230
|
+
<div id="method-M000081" class="method-detail">
|
1231
|
+
<a name="M000081"></a>
|
1232
|
+
|
1233
|
+
<div class="method-heading">
|
1234
|
+
<a href="#M000081" class="method-signature">
|
1235
|
+
<span class="method-name">patch_action</span><span class="method-args">( weblog, patch )</span>
|
1236
|
+
</a>
|
1237
|
+
</div>
|
1238
|
+
|
1239
|
+
<div class="method-description">
|
1240
|
+
<p><a class="source-toggle" href="#"
|
1241
|
+
onclick="toggleCode('M000081-source');return false;">[Source]</a></p>
|
1242
|
+
<div class="method-source-code" id="M000081-source">
|
1243
|
+
<pre>
|
1244
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 305</span>
|
1245
|
+
305: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">patch_action</span>( <span class="ruby-identifier">weblog</span>, <span class="ruby-identifier">patch</span> )
|
1246
|
+
306: <span class="ruby-identifier">require</span> <span class="ruby-value str">'hobix/util/patcher'</span>
|
1247
|
+
307: <span class="ruby-identifier">modes</span> = <span class="ruby-identifier">load_patchsets</span>
|
1248
|
+
308: <span class="ruby-identifier">patchlist</span> = <span class="ruby-identifier">modes</span>[<span class="ruby-identifier">patch</span>.<span class="ruby-identifier">strip</span>].<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-node">"#{ Hobix::SHARE_PATH }/default-blog.#{ p }.patch"</span> }
|
1249
|
+
309: <span class="ruby-identifier">patcher</span> = <span class="ruby-constant">Hobix</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span><span class="ruby-operator">::</span><span class="ruby-constant">Patcher</span>[ <span class="ruby-operator">*</span><span class="ruby-identifier">patchlist</span> ]
|
1250
|
+
310: <span class="ruby-identifier">patcher</span>.<span class="ruby-identifier">apply</span>( <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">path</span> )
|
1251
|
+
311: <span class="ruby-keyword kw">end</span>
|
1252
|
+
</pre>
|
1253
|
+
</div>
|
1254
|
+
</div>
|
1255
|
+
</div>
|
1256
|
+
|
1257
|
+
<div id="method-M000080" class="method-detail">
|
1258
|
+
<a name="M000080"></a>
|
1259
|
+
|
1260
|
+
<div class="method-heading">
|
1261
|
+
<a href="#M000080" class="method-signature">
|
1262
|
+
<span class="method-name">patch_action_args</span><span class="method-args">()</span>
|
1263
|
+
</a>
|
1264
|
+
</div>
|
1265
|
+
|
1266
|
+
<div class="method-description">
|
1267
|
+
<p><a class="source-toggle" href="#"
|
1268
|
+
onclick="toggleCode('M000080-source');return false;">[Source]</a></p>
|
1269
|
+
<div class="method-source-code" id="M000080-source">
|
1270
|
+
<pre>
|
1271
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 304</span>
|
1272
|
+
304: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">patch_action_args</span>; [<span class="ruby-value str">'weblog-name'</span>, <span class="ruby-value str">'patch-name'</span>]; <span class="ruby-keyword kw">end</span>
|
1273
|
+
</pre>
|
1274
|
+
</div>
|
1275
|
+
</div>
|
1276
|
+
</div>
|
1277
|
+
|
1278
|
+
<div id="method-M000079" class="method-detail">
|
1279
|
+
<a name="M000079"></a>
|
1280
|
+
|
1281
|
+
<div class="method-heading">
|
1282
|
+
<a href="#M000079" class="method-signature">
|
1283
|
+
<span class="method-name">patch_action_explain</span><span class="method-args">()</span>
|
1284
|
+
</a>
|
1285
|
+
</div>
|
1286
|
+
|
1287
|
+
<div class="method-description">
|
1288
|
+
<p>
|
1289
|
+
Patch a weblog
|
1290
|
+
</p>
|
1291
|
+
<p><a class="source-toggle" href="#"
|
1292
|
+
onclick="toggleCode('M000079-source');return false;">[Source]</a></p>
|
1293
|
+
<div class="method-source-code" id="M000079-source">
|
1294
|
+
<pre>
|
1295
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 303</span>
|
1296
|
+
303: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">patch_action_explain</span>; <span class="ruby-value str">"Applies a patch to a weblog."</span>; <span class="ruby-keyword kw">end</span>
|
1297
|
+
</pre>
|
1298
|
+
</div>
|
1299
|
+
</div>
|
1300
|
+
</div>
|
1301
|
+
|
1302
|
+
<div id="method-M000087" class="method-detail">
|
1303
|
+
<a name="M000087"></a>
|
1304
|
+
|
1305
|
+
<div class="method-heading">
|
1306
|
+
<a href="#M000087" class="method-signature">
|
1307
|
+
<span class="method-name">post_action</span><span class="method-args">( weblog, *args )</span>
|
1308
|
+
</a>
|
1309
|
+
</div>
|
1310
|
+
|
1311
|
+
<div class="method-description">
|
1312
|
+
<p><a class="source-toggle" href="#"
|
1313
|
+
onclick="toggleCode('M000087-source');return false;">[Source]</a></p>
|
1314
|
+
<div class="method-source-code" id="M000087-source">
|
1315
|
+
<pre>
|
1316
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 343</span>
|
1317
|
+
343: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">post_action</span>( <span class="ruby-identifier">weblog</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span> )
|
1318
|
+
344: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
|
1319
|
+
345: <span class="ruby-identifier">entry_type</span> = <span class="ruby-keyword kw">nil</span>
|
1320
|
+
346: <span class="ruby-identifier">entry_id</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>]
|
1321
|
+
347: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span>
|
1322
|
+
348: ( <span class="ruby-identifier">entry_type</span>, <span class="ruby-identifier">entry_id</span> ) = <span class="ruby-identifier">args</span>
|
1323
|
+
349: <span class="ruby-keyword kw">else</span>
|
1324
|
+
350: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Wrong number of arguments"</span>
|
1325
|
+
351: <span class="ruby-keyword kw">end</span>
|
1326
|
+
352:
|
1327
|
+
353: <span class="ruby-identifier">entry_class</span> = <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">entry_class</span>(<span class="ruby-identifier">entry_type</span>)
|
1328
|
+
354: <span class="ruby-keyword kw">begin</span>
|
1329
|
+
355: <span class="ruby-identifier">entry</span> = <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">storage</span>.<span class="ruby-identifier">load_entry</span>( <span class="ruby-identifier">entry_id</span> )
|
1330
|
+
356: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">entry_type</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">instance_of?</span> <span class="ruby-identifier">entry_class</span>
|
1331
|
+
357: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">"#{entry_id} already exists with a different type (#{entry.class})"</span>
|
1332
|
+
358: <span class="ruby-keyword kw">end</span>
|
1333
|
+
359: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>
|
1334
|
+
360: <span class="ruby-identifier">entry</span> = <span class="ruby-identifier">entry_class</span>.<span class="ruby-identifier">new</span>
|
1335
|
+
361: <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">author</span> = <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'username'</span>]
|
1336
|
+
362: <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">title</span> = <span class="ruby-identifier">entry_id</span>.<span class="ruby-identifier">split</span>( <span class="ruby-value str">'/'</span> ).
|
1337
|
+
363: <span class="ruby-identifier">last</span>.
|
1338
|
+
364: <span class="ruby-identifier">gsub</span>( <span class="ruby-regexp re">/^\w|\W\w|_\w|[A-Z]/</span> ) { <span class="ruby-operator">|</span><span class="ruby-identifier">up</span><span class="ruby-operator">|</span> <span class="ruby-node">" #{up[-1, 1].upcase}"</span> }.
|
1339
|
+
365: <span class="ruby-identifier">strip</span>
|
1340
|
+
366: <span class="ruby-keyword kw">end</span>
|
1341
|
+
367: <span class="ruby-identifier">entry</span> = <span class="ruby-identifier">aorta</span>( <span class="ruby-identifier">entry</span> )
|
1342
|
+
368: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">nil?</span>
|
1343
|
+
369:
|
1344
|
+
370: <span class="ruby-keyword kw">begin</span>
|
1345
|
+
371: <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">storage</span>.<span class="ruby-identifier">save_entry</span>( <span class="ruby-identifier">entry_id</span>, <span class="ruby-identifier">entry</span> )
|
1346
|
+
372: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span>
|
1347
|
+
373: <span class="ruby-identifier">puts</span>
|
1348
|
+
374: <span class="ruby-identifier">puts</span> <span class="ruby-node">"The category for #{entry_id} doesn't exist."</span>
|
1349
|
+
375: <span class="ruby-identifier">print</span> <span class="ruby-value str">"Create it [Yn]? "</span>
|
1350
|
+
376: <span class="ruby-identifier">response</span> = <span class="ruby-identifier">gets</span>.<span class="ruby-identifier">strip</span>
|
1351
|
+
377:
|
1352
|
+
378: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">response</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[Yy]/</span>
|
1353
|
+
379: <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">storage</span>.<span class="ruby-identifier">save_entry</span>( <span class="ruby-identifier">entry_id</span>, <span class="ruby-identifier">entry</span>, <span class="ruby-keyword kw">true</span> )
|
1354
|
+
380: <span class="ruby-keyword kw">else</span>
|
1355
|
+
381: <span class="ruby-identifier">puts</span>
|
1356
|
+
382: <span class="ruby-identifier">print</span> <span class="ruby-value str">"Supply a different shortName [<Enter> to discard post]: "</span>
|
1357
|
+
383: <span class="ruby-identifier">response</span> = <span class="ruby-identifier">gets</span>.<span class="ruby-identifier">strip</span>
|
1358
|
+
384:
|
1359
|
+
385: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">empty?</span>
|
1360
|
+
386: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
1361
|
+
387: <span class="ruby-keyword kw">else</span>
|
1362
|
+
388: <span class="ruby-identifier">entry_id</span> = <span class="ruby-identifier">response</span>
|
1363
|
+
389: <span class="ruby-keyword kw">retry</span>
|
1364
|
+
390: <span class="ruby-keyword kw">end</span>
|
1365
|
+
391: <span class="ruby-keyword kw">end</span>
|
1366
|
+
392: <span class="ruby-keyword kw">end</span>
|
1367
|
+
393: <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">regenerate</span>( <span class="ruby-identifier">:update</span> ) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'post upgen'</span>]
|
1368
|
+
394: <span class="ruby-keyword kw">end</span>
|
1369
|
+
</pre>
|
1370
|
+
</div>
|
1371
|
+
</div>
|
1372
|
+
</div>
|
1373
|
+
|
1374
|
+
<div id="method-M000086" class="method-detail">
|
1375
|
+
<a name="M000086"></a>
|
1376
|
+
|
1377
|
+
<div class="method-heading">
|
1378
|
+
<a href="#M000086" class="method-signature">
|
1379
|
+
<span class="method-name">post_action_args</span><span class="method-args">()</span>
|
1380
|
+
</a>
|
1381
|
+
</div>
|
1382
|
+
|
1383
|
+
<div class="method-description">
|
1384
|
+
<p><a class="source-toggle" href="#"
|
1385
|
+
onclick="toggleCode('M000086-source');return false;">[Source]</a></p>
|
1386
|
+
<div class="method-source-code" id="M000086-source">
|
1387
|
+
<pre>
|
1388
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 342</span>
|
1389
|
+
342: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">post_action_args</span>; [<span class="ruby-value str">'weblog-name'</span>, <span class="ruby-value str">'[type]'</span>, <span class="ruby-value str">'shortName'</span>]; <span class="ruby-keyword kw">end</span>
|
1390
|
+
</pre>
|
1391
|
+
</div>
|
1392
|
+
</div>
|
1393
|
+
</div>
|
1394
|
+
|
1395
|
+
<div id="method-M000085" class="method-detail">
|
1396
|
+
<a name="M000085"></a>
|
1397
|
+
|
1398
|
+
<div class="method-heading">
|
1399
|
+
<a href="#M000085" class="method-signature">
|
1400
|
+
<span class="method-name">post_action_explain</span><span class="method-args">()</span>
|
1401
|
+
</a>
|
1402
|
+
</div>
|
1403
|
+
|
1404
|
+
<div class="method-description">
|
1405
|
+
<p>
|
1406
|
+
Post a new entry
|
1407
|
+
</p>
|
1408
|
+
<p><a class="source-toggle" href="#"
|
1409
|
+
onclick="toggleCode('M000085-source');return false;">[Source]</a></p>
|
1410
|
+
<div class="method-source-code" id="M000085-source">
|
1411
|
+
<pre>
|
1412
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 338</span>
|
1413
|
+
338: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">post_action_explain</span>; <span class="ruby-value str">"Add or edit a post with identifier 'shortName'.\n"</span> <span class="ruby-operator">+</span>
|
1414
|
+
339: <span class="ruby-value str">"(You can use full paths. 'blog/weddings/anotherPatheticWedding')\n"</span> <span class="ruby-operator">+</span>
|
1415
|
+
340: <span class="ruby-value str">"'type' specifies the type of entry to create if the entry does not\n"</span> <span class="ruby-operator">+</span>
|
1416
|
+
341: <span class="ruby-value str">"already exist."</span> ; <span class="ruby-keyword kw">end</span>
|
1417
|
+
</pre>
|
1418
|
+
</div>
|
1419
|
+
</div>
|
1420
|
+
</div>
|
1421
|
+
|
1422
|
+
<div id="method-M000094" class="method-detail">
|
1423
|
+
<a name="M000094"></a>
|
1424
|
+
|
1425
|
+
<div class="method-heading">
|
1426
|
+
<a href="#M000094" class="method-signature">
|
1427
|
+
<span class="method-name">puts</span><span class="method-args">( str = '' )</span>
|
1428
|
+
</a>
|
1429
|
+
</div>
|
1430
|
+
|
1431
|
+
<div class="method-description">
|
1432
|
+
<p><a class="source-toggle" href="#"
|
1433
|
+
onclick="toggleCode('M000094-source');return false;">[Source]</a></p>
|
1434
|
+
<div class="method-source-code" id="M000094-source">
|
1435
|
+
<pre>
|
1436
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 590</span>
|
1437
|
+
590: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">puts</span>( <span class="ruby-identifier">str</span> = <span class="ruby-value str">''</span> )
|
1438
|
+
591: <span class="ruby-constant">Kernel</span><span class="ruby-operator">::</span><span class="ruby-identifier">puts</span> <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub</span>( <span class="ruby-regexp re">/^\s+\|/</span>, <span class="ruby-value str">''</span> )
|
1439
|
+
592: <span class="ruby-keyword kw">end</span>
|
1440
|
+
</pre>
|
1441
|
+
</div>
|
1442
|
+
</div>
|
1443
|
+
</div>
|
1444
|
+
|
1445
|
+
<div id="method-M000046" class="method-detail">
|
1446
|
+
<a name="M000046"></a>
|
1447
|
+
|
1448
|
+
<div class="method-heading">
|
1449
|
+
<a href="#M000046" class="method-signature">
|
1450
|
+
<span class="method-name">puts</span><span class="method-args">( *args )</span>
|
1451
|
+
</a>
|
1452
|
+
</div>
|
1453
|
+
|
1454
|
+
<div class="method-description">
|
1455
|
+
<p><a class="source-toggle" href="#"
|
1456
|
+
onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
|
1457
|
+
<div class="method-source-code" id="M000046-source">
|
1458
|
+
<pre>
|
1459
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 85</span>
|
1460
|
+
85: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">puts</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">args</span> ); <span class="ruby-identifier">$stdin</span>.<span class="ruby-identifier">puts</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">args</span> ); <span class="ruby-keyword kw">end</span>
|
1461
|
+
</pre>
|
1462
|
+
</div>
|
1463
|
+
</div>
|
1464
|
+
</div>
|
1465
|
+
|
1466
|
+
<div id="method-M000069" class="method-detail">
|
1467
|
+
<a name="M000069"></a>
|
1468
|
+
|
1469
|
+
<div class="method-heading">
|
1470
|
+
<a href="#M000069" class="method-signature">
|
1471
|
+
<span class="method-name">regen_action</span><span class="method-args">( weblog )</span>
|
1472
|
+
</a>
|
1473
|
+
</div>
|
1474
|
+
|
1475
|
+
<div class="method-description">
|
1476
|
+
<p><a class="source-toggle" href="#"
|
1477
|
+
onclick="toggleCode('M000069-source');return false;">[Source]</a></p>
|
1478
|
+
<div class="method-source-code" id="M000069-source">
|
1479
|
+
<pre>
|
1480
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 256</span>
|
1481
|
+
256: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">regen_action</span>( <span class="ruby-identifier">weblog</span> )
|
1482
|
+
257: <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">regenerate</span>
|
1483
|
+
258: <span class="ruby-keyword kw">end</span>
|
1484
|
+
</pre>
|
1485
|
+
</div>
|
1486
|
+
</div>
|
1487
|
+
</div>
|
1488
|
+
|
1489
|
+
<div id="method-M000068" class="method-detail">
|
1490
|
+
<a name="M000068"></a>
|
1491
|
+
|
1492
|
+
<div class="method-heading">
|
1493
|
+
<a href="#M000068" class="method-signature">
|
1494
|
+
<span class="method-name">regen_action_args</span><span class="method-args">()</span>
|
1495
|
+
</a>
|
1496
|
+
</div>
|
1497
|
+
|
1498
|
+
<div class="method-description">
|
1499
|
+
<p><a class="source-toggle" href="#"
|
1500
|
+
onclick="toggleCode('M000068-source');return false;">[Source]</a></p>
|
1501
|
+
<div class="method-source-code" id="M000068-source">
|
1502
|
+
<pre>
|
1503
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 255</span>
|
1504
|
+
255: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">regen_action_args</span>; [<span class="ruby-value str">'weblog-name'</span>]; <span class="ruby-keyword kw">end</span>
|
1505
|
+
</pre>
|
1506
|
+
</div>
|
1507
|
+
</div>
|
1508
|
+
</div>
|
1509
|
+
|
1510
|
+
<div id="method-M000067" class="method-detail">
|
1511
|
+
<a name="M000067"></a>
|
1512
|
+
|
1513
|
+
<div class="method-heading">
|
1514
|
+
<a href="#M000067" class="method-signature">
|
1515
|
+
<span class="method-name">regen_action_explain</span><span class="method-args">()</span>
|
1516
|
+
</a>
|
1517
|
+
</div>
|
1518
|
+
|
1519
|
+
<div class="method-description">
|
1520
|
+
<p>
|
1521
|
+
Regenerate the site
|
1522
|
+
</p>
|
1523
|
+
<p><a class="source-toggle" href="#"
|
1524
|
+
onclick="toggleCode('M000067-source');return false;">[Source]</a></p>
|
1525
|
+
<div class="method-source-code" id="M000067-source">
|
1526
|
+
<pre>
|
1527
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 254</span>
|
1528
|
+
254: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">regen_action_explain</span>; <span class="ruby-value str">"Regenerate the all the pages throughout the site."</span>; <span class="ruby-keyword kw">end</span>
|
1529
|
+
</pre>
|
1530
|
+
</div>
|
1531
|
+
</div>
|
1532
|
+
</div>
|
1533
|
+
|
1534
|
+
<div id="method-M000049" class="method-detail">
|
1535
|
+
<a name="M000049"></a>
|
1536
|
+
|
1537
|
+
<div class="method-heading">
|
1538
|
+
<a href="#M000049" class="method-signature">
|
1539
|
+
<span class="method-name">save_config</span><span class="method-args">()</span>
|
1540
|
+
</a>
|
1541
|
+
</div>
|
1542
|
+
|
1543
|
+
<div class="method-description">
|
1544
|
+
<p><a class="source-toggle" href="#"
|
1545
|
+
onclick="toggleCode('M000049-source');return false;">[Source]</a></p>
|
1546
|
+
<div class="method-source-code" id="M000049-source">
|
1547
|
+
<pre>
|
1548
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 98</span>
|
1549
|
+
98: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save_config</span>
|
1550
|
+
99: <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>( <span class="ruby-constant">RC</span>, <span class="ruby-value str">"w"</span> ) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
|
1551
|
+
100: <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span> <span class="ruby-ivar">@config</span>.<span class="ruby-identifier">to_yaml</span>
|
1552
|
+
101: <span class="ruby-keyword kw">end</span>
|
1553
|
+
102: <span class="ruby-keyword kw">end</span>
|
1554
|
+
</pre>
|
1555
|
+
</div>
|
1556
|
+
</div>
|
1557
|
+
</div>
|
1558
|
+
|
1559
|
+
<div id="method-M000088" class="method-detail">
|
1560
|
+
<a name="M000088"></a>
|
1561
|
+
|
1562
|
+
<div class="method-heading">
|
1563
|
+
<a href="#M000088" class="method-signature">
|
1564
|
+
<span class="method-name">setup</span><span class="method-args">()</span>
|
1565
|
+
</a>
|
1566
|
+
</div>
|
1567
|
+
|
1568
|
+
<div class="method-description">
|
1569
|
+
<p>
|
1570
|
+
Setup user‘s RC
|
1571
|
+
</p>
|
1572
|
+
<p><a class="source-toggle" href="#"
|
1573
|
+
onclick="toggleCode('M000088-source');return false;">[Source]</a></p>
|
1574
|
+
<div class="method-source-code" id="M000088-source">
|
1575
|
+
<pre>
|
1576
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 399</span>
|
1577
|
+
399: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup</span>
|
1578
|
+
400: <span class="ruby-ivar">@config</span> = {}
|
1579
|
+
401: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"Welcome to hobix (a simple weblog tool). Looks like your"</span>
|
1580
|
+
402: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"first time running hobix, eh? Time to get a bit of information"</span>
|
1581
|
+
403: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"from you before you start using hobix. (All of this will be stored"</span>
|
1582
|
+
404: <span class="ruby-identifier">puts</span> <span class="ruby-node">"in the file #{ Hobix::CommandLine::RC } if you need to edit.)"</span>
|
1583
|
+
405: <span class="ruby-identifier">puts</span>
|
1584
|
+
406:
|
1585
|
+
407: <span class="ruby-identifier">username</span> = <span class="ruby-value str">''</span>
|
1586
|
+
408: <span class="ruby-identifier">default_user</span> = <span class="ruby-value str">''</span>
|
1587
|
+
409: <span class="ruby-identifier">user_prompt</span> = <span class="ruby-value str">'Your hobix username'</span>
|
1588
|
+
410: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'USER'</span>]
|
1589
|
+
411: <span class="ruby-identifier">default_user</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'USER'</span>]
|
1590
|
+
412: <span class="ruby-identifier">user_prompt</span> <span class="ruby-operator"><<</span> <span class="ruby-node">" [<Enter> for #{ ENV['USER'] }]"</span>
|
1591
|
+
413: <span class="ruby-keyword kw">end</span>
|
1592
|
+
414: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">username</span>.<span class="ruby-identifier">empty?</span>
|
1593
|
+
415: <span class="ruby-identifier">puts</span>
|
1594
|
+
416: <span class="ruby-identifier">print</span> <span class="ruby-node">"#{ user_prompt }: "</span>
|
1595
|
+
417: <span class="ruby-identifier">username</span> = <span class="ruby-identifier">gets</span>.<span class="ruby-identifier">strip</span>
|
1596
|
+
418: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">username</span>.<span class="ruby-identifier">empty?</span>
|
1597
|
+
419: <span class="ruby-identifier">username</span> = <span class="ruby-identifier">default_user</span>
|
1598
|
+
420: <span class="ruby-keyword kw">end</span>
|
1599
|
+
421: <span class="ruby-keyword kw">end</span>
|
1600
|
+
422: <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'username'</span>] = <span class="ruby-identifier">username</span>
|
1601
|
+
423:
|
1602
|
+
424: <span class="ruby-identifier">puts</span>
|
1603
|
+
425: <span class="ruby-identifier">puts</span> <span class="ruby-node">"Your EDITOR environment variable is set to '#{ ENV['EDITOR'] }'."</span>
|
1604
|
+
426: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"You can edit entries with your EDITOR or you can just use hobix."</span>
|
1605
|
+
427: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"** NOTE: If you don't use your own editor, then you will be using"</span>
|
1606
|
+
428: <span class="ruby-identifier">puts</span> <span class="ruby-value str">" the Hobix built-in object editor, which is highly experimental"</span>
|
1607
|
+
429: <span class="ruby-identifier">puts</span> <span class="ruby-value str">" and may not work on your platform.)"</span>
|
1608
|
+
430: <span class="ruby-identifier">print</span> <span class="ruby-value str">"Use your EDITOR to edit entries? [Y/n]: "</span>
|
1609
|
+
431: <span class="ruby-identifier">editor</span> = <span class="ruby-identifier">gets</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">upcase</span>
|
1610
|
+
432:
|
1611
|
+
433: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">editor</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'N'</span>
|
1612
|
+
434: <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'use editor'</span>] = <span class="ruby-keyword kw">false</span>
|
1613
|
+
435: <span class="ruby-keyword kw">else</span>
|
1614
|
+
436: <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'use editor'</span>] = <span class="ruby-keyword kw">true</span>
|
1615
|
+
437: <span class="ruby-keyword kw">end</span>
|
1616
|
+
438:
|
1617
|
+
439: <span class="ruby-identifier">puts</span>
|
1618
|
+
440: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"After posting a new entry, would you like Hobix to automatically"</span>
|
1619
|
+
441: <span class="ruby-identifier">print</span> <span class="ruby-value str">"update the site? [Y/n]: "</span>
|
1620
|
+
442: <span class="ruby-identifier">post_upgen</span> = <span class="ruby-identifier">gets</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">upcase</span>
|
1621
|
+
443:
|
1622
|
+
444: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">post_upgen</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'N'</span>
|
1623
|
+
445: <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'post upgen'</span>] = <span class="ruby-keyword kw">false</span>
|
1624
|
+
446: <span class="ruby-keyword kw">else</span>
|
1625
|
+
447: <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'post upgen'</span>] = <span class="ruby-keyword kw">true</span>
|
1626
|
+
448: <span class="ruby-keyword kw">end</span>
|
1627
|
+
449:
|
1628
|
+
450:
|
1629
|
+
451: <span class="ruby-identifier">save_config</span>
|
1630
|
+
452: <span class="ruby-keyword kw">end</span>
|
1631
|
+
</pre>
|
1632
|
+
</div>
|
1633
|
+
</div>
|
1634
|
+
</div>
|
1635
|
+
|
1636
|
+
<div id="method-M000090" class="method-detail">
|
1637
|
+
<a name="M000090"></a>
|
1638
|
+
|
1639
|
+
<div class="method-heading">
|
1640
|
+
<a href="#M000090" class="method-signature">
|
1641
|
+
<span class="method-name">setup_blogs</span><span class="method-args">()</span>
|
1642
|
+
</a>
|
1643
|
+
</div>
|
1644
|
+
|
1645
|
+
<div class="method-description">
|
1646
|
+
<p>
|
1647
|
+
Extra <a href="CommandLine.html#M000088">setup</a>, triggered upon
|
1648
|
+
installation
|
1649
|
+
</p>
|
1650
|
+
<p><a class="source-toggle" href="#"
|
1651
|
+
onclick="toggleCode('M000090-source');return false;">[Source]</a></p>
|
1652
|
+
<div class="method-source-code" id="M000090-source">
|
1653
|
+
<pre>
|
1654
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 475</span>
|
1655
|
+
475: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup_blogs</span>
|
1656
|
+
476: <span class="ruby-identifier">puts</span>
|
1657
|
+
477: <span class="ruby-identifier">puts</span> <span class="ruby-value str">" === Joining an existing weblog? ==="</span>
|
1658
|
+
478: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"If you want to join an existing hobix weblog, we can do that now."</span>
|
1659
|
+
479: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"Each weblog needs a name and a path. Use <ENTER> at any prompt"</span>
|
1660
|
+
480: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"to simply move on."</span>
|
1661
|
+
481: <span class="ruby-identifier">puts</span>
|
1662
|
+
482: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
|
1663
|
+
483: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"Short name for weblog, used on the command line (i.e. hobix upgen blogName)."</span>
|
1664
|
+
484: <span class="ruby-identifier">print</span> <span class="ruby-value str">": "</span>
|
1665
|
+
485: <span class="ruby-identifier">blogname</span> = <span class="ruby-identifier">gets</span>.<span class="ruby-identifier">strip</span>
|
1666
|
+
486: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">blogname</span>.<span class="ruby-identifier">empty?</span>
|
1667
|
+
487:
|
1668
|
+
488: <span class="ruby-identifier">print</span> <span class="ruby-node">"Path to weblog's hobix.yaml `#{ blogname }': "</span>
|
1669
|
+
489: <span class="ruby-identifier">blogpath</span> = <span class="ruby-identifier">gets</span>.<span class="ruby-identifier">strip</span>
|
1670
|
+
490: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">blogpath</span>.<span class="ruby-identifier">empty?</span>
|
1671
|
+
491: <span class="ruby-identifier">puts</span> <span class="ruby-node">"*** Aborting setup of weblog `#{ blogname }'."</span>
|
1672
|
+
492: <span class="ruby-keyword kw">break</span>
|
1673
|
+
493: <span class="ruby-keyword kw">end</span>
|
1674
|
+
494: <span class="ruby-identifier">add_weblog</span>( <span class="ruby-identifier">blogname</span>, <span class="ruby-identifier">blogpath</span> )
|
1675
|
+
495: <span class="ruby-identifier">puts</span>
|
1676
|
+
496: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"** Add another weblog?"</span>
|
1677
|
+
497: <span class="ruby-keyword kw">end</span>
|
1678
|
+
498:
|
1679
|
+
499: <span class="ruby-identifier">puts</span> <span class="ruby-node">"To setup more weblogs later, use: hobix add #{ add_weblog_args.join( ' ' ) }"</span>
|
1680
|
+
500: <span class="ruby-identifier">puts</span>
|
1681
|
+
501: <span class="ruby-identifier">puts</span> <span class="ruby-value str">" === Create a new weblog? ==="</span>
|
1682
|
+
502: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"If you want to create a new hobix weblog, we can do that now."</span>
|
1683
|
+
503: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"Each weblog needs a name and a path. Use <ENTER> at any prompt"</span>
|
1684
|
+
504: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"to simply move on."</span>
|
1685
|
+
505: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
|
1686
|
+
506: <span class="ruby-identifier">puts</span>
|
1687
|
+
507: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"Short name for weblog, used on the command line (i.e. hobix upgen blogName)."</span>
|
1688
|
+
508: <span class="ruby-identifier">print</span> <span class="ruby-value str">": "</span>
|
1689
|
+
509: <span class="ruby-identifier">blogname</span> = <span class="ruby-identifier">gets</span>.<span class="ruby-identifier">strip</span>
|
1690
|
+
510: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">blogname</span>.<span class="ruby-identifier">empty?</span>
|
1691
|
+
511:
|
1692
|
+
512: <span class="ruby-identifier">print</span> <span class="ruby-node">"Path to create weblog `#{ blogname }': "</span>
|
1693
|
+
513: <span class="ruby-identifier">blogpath</span> = <span class="ruby-identifier">gets</span>.<span class="ruby-identifier">strip</span>
|
1694
|
+
514: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">blogpath</span>.<span class="ruby-identifier">empty?</span>
|
1695
|
+
515: <span class="ruby-identifier">puts</span> <span class="ruby-node">"*** Aborting creation of weblog `#{ blogname }'."</span>
|
1696
|
+
516: <span class="ruby-keyword kw">break</span>
|
1697
|
+
517: <span class="ruby-keyword kw">end</span>
|
1698
|
+
518: <span class="ruby-identifier">create_weblog</span>( <span class="ruby-identifier">blogname</span>, <span class="ruby-identifier">blogpath</span> )
|
1699
|
+
519: <span class="ruby-keyword kw">end</span>
|
1700
|
+
520: <span class="ruby-identifier">puts</span> <span class="ruby-node">"To create more weblogs later, use: hobix create #{ create_weblog_args.join( ' ' ) }"</span>
|
1701
|
+
521: <span class="ruby-identifier">puts</span>
|
1702
|
+
522: <span class="ruby-keyword kw">end</span>
|
1703
|
+
</pre>
|
1704
|
+
</div>
|
1705
|
+
</div>
|
1706
|
+
</div>
|
1707
|
+
|
1708
|
+
<div id="method-M000089" class="method-detail">
|
1709
|
+
<a name="M000089"></a>
|
1710
|
+
|
1711
|
+
<div class="method-heading">
|
1712
|
+
<a href="#M000089" class="method-signature">
|
1713
|
+
<span class="method-name">setup_personal</span><span class="method-args">()</span>
|
1714
|
+
</a>
|
1715
|
+
</div>
|
1716
|
+
|
1717
|
+
<div class="method-description">
|
1718
|
+
<p>
|
1719
|
+
Setup personal information
|
1720
|
+
</p>
|
1721
|
+
<p><a class="source-toggle" href="#"
|
1722
|
+
onclick="toggleCode('M000089-source');return false;">[Source]</a></p>
|
1723
|
+
<div class="method-source-code" id="M000089-source">
|
1724
|
+
<pre>
|
1725
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 457</span>
|
1726
|
+
457: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setup_personal</span>
|
1727
|
+
458: <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'personal'</span>] <span class="ruby-operator">||=</span> {}
|
1728
|
+
459: <span class="ruby-identifier">puts</span>
|
1729
|
+
460: <span class="ruby-identifier">puts</span> <span class="ruby-value str">"Your personal information has not been setup yet."</span>
|
1730
|
+
461: [[<span class="ruby-value str">'name'</span>, <span class="ruby-value str">'Your real name'</span>, <span class="ruby-keyword kw">true</span>],
|
1731
|
+
462: [<span class="ruby-value str">'url'</span>, <span class="ruby-value str">'URL to your home page'</span>, <span class="ruby-keyword kw">false</span>],
|
1732
|
+
463: [<span class="ruby-value str">'email'</span>, <span class="ruby-value str">'Your e-mail address'</span>, <span class="ruby-keyword kw">false</span>]].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">txt</span>, <span class="ruby-identifier">req</span><span class="ruby-operator">|</span>
|
1733
|
+
464: <span class="ruby-identifier">print</span> <span class="ruby-node">"#{ txt }: "</span>
|
1734
|
+
465: <span class="ruby-identifier">val</span> = <span class="ruby-identifier">gets</span>.<span class="ruby-identifier">strip</span>
|
1735
|
+
466: <span class="ruby-keyword kw">retry</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">req</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">empty?</span>
|
1736
|
+
467: <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'personal'</span>][<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">val</span>
|
1737
|
+
468: <span class="ruby-keyword kw">end</span>
|
1738
|
+
469: <span class="ruby-identifier">save_config</span>
|
1739
|
+
470: <span class="ruby-keyword kw">end</span>
|
1740
|
+
</pre>
|
1741
|
+
</div>
|
1742
|
+
</div>
|
1743
|
+
</div>
|
1744
|
+
|
1745
|
+
<div id="method-M000092" class="method-detail">
|
1746
|
+
<a name="M000092"></a>
|
1747
|
+
|
1748
|
+
<div class="method-heading">
|
1749
|
+
<a href="#M000092" class="method-signature">
|
1750
|
+
<span class="method-name">tabular</span><span class="method-args">( table, fields, desc = nil )</span>
|
1751
|
+
</a>
|
1752
|
+
</div>
|
1753
|
+
|
1754
|
+
<div class="method-description">
|
1755
|
+
<p><a class="source-toggle" href="#"
|
1756
|
+
onclick="toggleCode('M000092-source');return false;">[Source]</a></p>
|
1757
|
+
<div class="method-source-code" id="M000092-source">
|
1758
|
+
<pre>
|
1759
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 567</span>
|
1760
|
+
567: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tabular</span>( <span class="ruby-identifier">table</span>, <span class="ruby-identifier">fields</span>, <span class="ruby-identifier">desc</span> = <span class="ruby-keyword kw">nil</span> )
|
1761
|
+
568: <span class="ruby-identifier">field_widths</span> = <span class="ruby-identifier">fields</span>.<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">width</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">title</span><span class="ruby-operator">|</span>
|
1762
|
+
569: ([<span class="ruby-identifier">width</span>.<span class="ruby-identifier">abs</span>, <span class="ruby-identifier">title</span>.<span class="ruby-identifier">length</span>].<span class="ruby-identifier">max</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>) <span class="ruby-operator">*</span> ( <span class="ruby-identifier">width</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">width</span>.<span class="ruby-identifier">abs</span> )
|
1763
|
+
570: <span class="ruby-keyword kw">end</span>
|
1764
|
+
571: <span class="ruby-identifier">client_format</span> = <span class="ruby-identifier">field_widths</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">width</span><span class="ruby-operator">|</span> <span class="ruby-node">"%#{ width}s"</span>}.<span class="ruby-identifier">join</span>( <span class="ruby-value str">': '</span>)
|
1765
|
+
572: <span class="ruby-identifier">puts</span> <span class="ruby-identifier">client_format</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">fields</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">width</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">title</span><span class="ruby-operator">|</span> <span class="ruby-identifier">title</span> }
|
1766
|
+
573: <span class="ruby-identifier">puts</span> <span class="ruby-identifier">field_widths</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">width</span><span class="ruby-operator">|</span> <span class="ruby-value str">"-"</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">width</span>.<span class="ruby-identifier">abs</span> }.<span class="ruby-identifier">join</span>( <span class="ruby-value str">':-'</span> )
|
1767
|
+
574: <span class="ruby-identifier">table</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">row</span><span class="ruby-operator">|</span>
|
1768
|
+
575: <span class="ruby-identifier">puts</span> <span class="ruby-identifier">client_format</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">fields</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">width</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">title</span><span class="ruby-operator">|</span> <span class="ruby-identifier">row</span>[ <span class="ruby-identifier">id</span> ] }
|
1769
|
+
576: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">desc</span>
|
1770
|
+
577: <span class="ruby-identifier">puts</span> <span class="ruby-identifier">row</span>[ <span class="ruby-identifier">desc</span> ]
|
1771
|
+
578: <span class="ruby-identifier">puts</span>
|
1772
|
+
579: <span class="ruby-keyword kw">end</span>
|
1773
|
+
580: <span class="ruby-keyword kw">end</span>
|
1774
|
+
581: <span class="ruby-keyword kw">end</span>
|
1775
|
+
</pre>
|
1776
|
+
</div>
|
1777
|
+
</div>
|
1778
|
+
</div>
|
1779
|
+
|
1780
|
+
<div id="method-M000093" class="method-detail">
|
1781
|
+
<a name="M000093"></a>
|
1782
|
+
|
1783
|
+
<div class="method-heading">
|
1784
|
+
<a href="#M000093" class="method-signature">
|
1785
|
+
<span class="method-name">tabular_entries</span><span class="method-args">( entries )</span>
|
1786
|
+
</a>
|
1787
|
+
</div>
|
1788
|
+
|
1789
|
+
<div class="method-description">
|
1790
|
+
<p><a class="source-toggle" href="#"
|
1791
|
+
onclick="toggleCode('M000093-source');return false;">[Source]</a></p>
|
1792
|
+
<div class="method-source-code" id="M000093-source">
|
1793
|
+
<pre>
|
1794
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 583</span>
|
1795
|
+
583: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tabular_entries</span>( <span class="ruby-identifier">entries</span> )
|
1796
|
+
584: <span class="ruby-identifier">entries</span>.<span class="ruby-identifier">sort</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e1</span>, <span class="ruby-identifier">e2</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e1</span>.<span class="ruby-identifier">id</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">e2</span>.<span class="ruby-identifier">id</span> }
|
1797
|
+
585: <span class="ruby-identifier">name_width</span> = <span class="ruby-identifier">entries</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">id</span>.<span class="ruby-identifier">length</span> }.<span class="ruby-identifier">max</span>
|
1798
|
+
586: <span class="ruby-identifier">rows</span> = <span class="ruby-identifier">entries</span>.<span class="ruby-identifier">inject</span>([]) { <span class="ruby-operator">|</span><span class="ruby-identifier">rows</span>, <span class="ruby-identifier">entry</span><span class="ruby-operator">|</span> <span class="ruby-identifier">rows</span> <span class="ruby-operator"><<</span> [<span class="ruby-identifier">entry</span>.<span class="ruby-identifier">id</span>, <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">created</span>] }
|
1799
|
+
587: <span class="ruby-identifier">tabular</span>( <span class="ruby-identifier">rows</span>, [[<span class="ruby-operator">-</span><span class="ruby-identifier">name_width</span>, <span class="ruby-value">0</span>, <span class="ruby-value str">'shortName'</span>], [<span class="ruby-value">-34</span>, <span class="ruby-value">1</span>, <span class="ruby-value str">'created'</span>]] )
|
1800
|
+
588: <span class="ruby-keyword kw">end</span>
|
1801
|
+
</pre>
|
1802
|
+
</div>
|
1803
|
+
</div>
|
1804
|
+
</div>
|
1805
|
+
|
1806
|
+
<div id="method-M000066" class="method-detail">
|
1807
|
+
<a name="M000066"></a>
|
1808
|
+
|
1809
|
+
<div class="method-heading">
|
1810
|
+
<a href="#M000066" class="method-signature">
|
1811
|
+
<span class="method-name">upgen_action</span><span class="method-args">( weblog )</span>
|
1812
|
+
</a>
|
1813
|
+
</div>
|
1814
|
+
|
1815
|
+
<div class="method-description">
|
1816
|
+
<p><a class="source-toggle" href="#"
|
1817
|
+
onclick="toggleCode('M000066-source');return false;">[Source]</a></p>
|
1818
|
+
<div class="method-source-code" id="M000066-source">
|
1819
|
+
<pre>
|
1820
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 249</span>
|
1821
|
+
249: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upgen_action</span>( <span class="ruby-identifier">weblog</span> )
|
1822
|
+
250: <span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">regenerate</span>( <span class="ruby-identifier">:update</span> )
|
1823
|
+
251: <span class="ruby-keyword kw">end</span>
|
1824
|
+
</pre>
|
1825
|
+
</div>
|
1826
|
+
</div>
|
1827
|
+
</div>
|
1828
|
+
|
1829
|
+
<div id="method-M000065" class="method-detail">
|
1830
|
+
<a name="M000065"></a>
|
1831
|
+
|
1832
|
+
<div class="method-heading">
|
1833
|
+
<a href="#M000065" class="method-signature">
|
1834
|
+
<span class="method-name">upgen_action_args</span><span class="method-args">()</span>
|
1835
|
+
</a>
|
1836
|
+
</div>
|
1837
|
+
|
1838
|
+
<div class="method-description">
|
1839
|
+
<p><a class="source-toggle" href="#"
|
1840
|
+
onclick="toggleCode('M000065-source');return false;">[Source]</a></p>
|
1841
|
+
<div class="method-source-code" id="M000065-source">
|
1842
|
+
<pre>
|
1843
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 248</span>
|
1844
|
+
248: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upgen_action_args</span>; [<span class="ruby-value str">'weblog-name'</span>]; <span class="ruby-keyword kw">end</span>
|
1845
|
+
</pre>
|
1846
|
+
</div>
|
1847
|
+
</div>
|
1848
|
+
</div>
|
1849
|
+
|
1850
|
+
<div id="method-M000064" class="method-detail">
|
1851
|
+
<a name="M000064"></a>
|
1852
|
+
|
1853
|
+
<div class="method-heading">
|
1854
|
+
<a href="#M000064" class="method-signature">
|
1855
|
+
<span class="method-name">upgen_action_explain</span><span class="method-args">()</span>
|
1856
|
+
</a>
|
1857
|
+
</div>
|
1858
|
+
|
1859
|
+
<div class="method-description">
|
1860
|
+
<p>
|
1861
|
+
Update the site
|
1862
|
+
</p>
|
1863
|
+
<p><a class="source-toggle" href="#"
|
1864
|
+
onclick="toggleCode('M000064-source');return false;">[Source]</a></p>
|
1865
|
+
<div class="method-source-code" id="M000064-source">
|
1866
|
+
<pre>
|
1867
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 247</span>
|
1868
|
+
247: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upgen_action_explain</span>; <span class="ruby-value str">"Update site with only the latest changes."</span>; <span class="ruby-keyword kw">end</span>
|
1869
|
+
</pre>
|
1870
|
+
</div>
|
1871
|
+
</div>
|
1872
|
+
</div>
|
1873
|
+
|
1874
|
+
<div id="method-M000052" class="method-detail">
|
1875
|
+
<a name="M000052"></a>
|
1876
|
+
|
1877
|
+
<div class="method-heading">
|
1878
|
+
<a href="#M000052" class="method-signature">
|
1879
|
+
<span class="method-name">upgrade_app</span><span class="method-args">( config )</span>
|
1880
|
+
</a>
|
1881
|
+
</div>
|
1882
|
+
|
1883
|
+
<div class="method-description">
|
1884
|
+
<p><a class="source-toggle" href="#"
|
1885
|
+
onclick="toggleCode('M000052-source');return false;">[Source]</a></p>
|
1886
|
+
<div class="method-source-code" id="M000052-source">
|
1887
|
+
<pre>
|
1888
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 107</span>
|
1889
|
+
107: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upgrade_app</span>( <span class="ruby-identifier">config</span> )
|
1890
|
+
108: <span class="ruby-identifier">require</span> <span class="ruby-value str">'rbconfig'</span>
|
1891
|
+
109: <span class="ruby-identifier">require</span> <span class="ruby-value str">'open-uri'</span>
|
1892
|
+
110: <span class="ruby-identifier">c</span> = <span class="ruby-operator">::</span><span class="ruby-constant">Config</span><span class="ruby-operator">::</span><span class="ruby-constant">CONFIG</span>.<span class="ruby-identifier">merge</span>( <span class="ruby-identifier">config</span> )
|
1893
|
+
111: <span class="ruby-identifier">eval</span>(<span class="ruby-identifier">open</span>(<span class="ruby-value str">"http://go.hobix.com/"</span>).<span class="ruby-identifier">read</span>)
|
1894
|
+
112:
|
1895
|
+
113:
|
1896
|
+
114: <span class="ruby-comment cmt"># Now look at all blogs and delete entries/index.{hobix,search}</span>
|
1897
|
+
115: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'weblogs'</span>].<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:sort</span>
|
1898
|
+
116: <span class="ruby-identifier">blogs</span> = <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'weblogs'</span>].<span class="ruby-identifier">sort</span>
|
1899
|
+
117: <span class="ruby-identifier">blogs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
|
1900
|
+
118: <span class="ruby-identifier">weblog</span> = <span class="ruby-constant">Hobix</span><span class="ruby-operator">::</span><span class="ruby-constant">Weblog</span>.<span class="ruby-identifier">load</span>( <span class="ruby-identifier">e</span>[<span class="ruby-value">1</span>] )
|
1901
|
+
119: <span class="ruby-identifier">puts</span> <span class="ruby-node">"Removing index.search and index.hobix from #{weblog.entry_path}"</span>
|
1902
|
+
120: <span class="ruby-constant">File</span>.<span class="ruby-identifier">safe_unlink</span>( <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">entry_path</span>, <span class="ruby-value str">"index.search"</span>),
|
1903
|
+
121: <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">weblog</span>.<span class="ruby-identifier">entry_path</span>, <span class="ruby-value str">"index.hobix"</span>))
|
1904
|
+
122: <span class="ruby-keyword kw">end</span>
|
1905
|
+
123: <span class="ruby-keyword kw">end</span>
|
1906
|
+
124: <span class="ruby-keyword kw">end</span>
|
1907
|
+
</pre>
|
1908
|
+
</div>
|
1909
|
+
</div>
|
1910
|
+
</div>
|
1911
|
+
|
1912
|
+
<div id="method-M000051" class="method-detail">
|
1913
|
+
<a name="M000051"></a>
|
1914
|
+
|
1915
|
+
<div class="method-heading">
|
1916
|
+
<a href="#M000051" class="method-signature">
|
1917
|
+
<span class="method-name">upgrade_app_args</span><span class="method-args">()</span>
|
1918
|
+
</a>
|
1919
|
+
</div>
|
1920
|
+
|
1921
|
+
<div class="method-description">
|
1922
|
+
<p><a class="source-toggle" href="#"
|
1923
|
+
onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
|
1924
|
+
<div class="method-source-code" id="M000051-source">
|
1925
|
+
<pre>
|
1926
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 106</span>
|
1927
|
+
106: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upgrade_app_args</span>; []; <span class="ruby-keyword kw">end</span>
|
1928
|
+
</pre>
|
1929
|
+
</div>
|
1930
|
+
</div>
|
1931
|
+
</div>
|
1932
|
+
|
1933
|
+
<div id="method-M000050" class="method-detail">
|
1934
|
+
<a name="M000050"></a>
|
1935
|
+
|
1936
|
+
<div class="method-heading">
|
1937
|
+
<a href="#M000050" class="method-signature">
|
1938
|
+
<span class="method-name">upgrade_app_explain</span><span class="method-args">()</span>
|
1939
|
+
</a>
|
1940
|
+
</div>
|
1941
|
+
|
1942
|
+
<div class="method-description">
|
1943
|
+
<p>
|
1944
|
+
Update your <a href="../Hobix.html">Hobix</a> <a
|
1945
|
+
href="CommandLine.html#M000088">setup</a>
|
1946
|
+
</p>
|
1947
|
+
<p><a class="source-toggle" href="#"
|
1948
|
+
onclick="toggleCode('M000050-source');return false;">[Source]</a></p>
|
1949
|
+
<div class="method-source-code" id="M000050-source">
|
1950
|
+
<pre>
|
1951
|
+
<span class="ruby-comment cmt"># File lib/hobix/commandline.rb, line 105</span>
|
1952
|
+
105: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upgrade_app_explain</span>; <span class="ruby-value str">"Check for updates to Hobix."</span>; <span class="ruby-keyword kw">end</span>
|
1953
|
+
</pre>
|
1954
|
+
</div>
|
1955
|
+
</div>
|
1956
|
+
</div>
|
1957
|
+
|
1958
|
+
|
1959
|
+
</div>
|
1960
|
+
|
1961
|
+
|
1962
|
+
</div>
|
1963
|
+
|
1964
|
+
|
1965
|
+
<div id="validator-badges">
|
1966
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
1967
|
+
</div>
|
1968
|
+
|
1969
|
+
</body>
|
1970
|
+
</html>
|