runeblog 0.0.34 → 0.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/data/VERSION +1 -1
- data/lib/repl.rb +81 -18
- data/lib/runeblog.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20a50ba1851a59956f6e0a5f8e4e7336eb3d281d
|
4
|
+
data.tar.gz: b8daf3b75311b8c994d1cd0c83ca1b2ef197f31b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6799ffd887af0552c87aedfaedfda1109c38ddd106709b957000a8c42a410f0c8024cd391c1a41c0a48e046ffd9f8534e7af905abd89f56860d0eb572d22eb7
|
7
|
+
data.tar.gz: 6a447ba64c6327f20bbdfde0421d5782575180ca80f2b0ea85ebbab3e65b2b6ac728859d84f281ed8673eda7040200d7200e8173afbce675d01d3ff3135f96b8
|
data/data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
RuneBlog v 0.0.
|
1
|
+
RuneBlog v 0.0.35 2017-05-15
|
data/lib/repl.rb
CHANGED
@@ -56,7 +56,9 @@ module RuneBlog::REPL
|
|
56
56
|
yn = ask(red(" No .blog found. Create new blog? "))
|
57
57
|
if yn.upcase == "Y"
|
58
58
|
#-- what if data already exists?
|
59
|
-
system("cp -r #{RuneBlog::DefaultData} .")
|
59
|
+
result = system("cp -r #{RuneBlog::DefaultData} .")
|
60
|
+
raise "Error copying default data" unless result
|
61
|
+
|
60
62
|
File.open(".blog", "w") do |f|
|
61
63
|
f.puts "data"
|
62
64
|
f.puts "no_default"
|
@@ -64,6 +66,8 @@ module RuneBlog::REPL
|
|
64
66
|
File.open("data/VERSION", "a") {|f| f.puts "\nBlog created: " + Time.now.to_s }
|
65
67
|
end
|
66
68
|
end
|
69
|
+
rescue => err
|
70
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
67
71
|
end
|
68
72
|
|
69
73
|
### make_slug
|
@@ -85,35 +89,43 @@ module RuneBlog::REPL
|
|
85
89
|
@view = @config.view # current view
|
86
90
|
@sequence = @config.sequence
|
87
91
|
@root = @config.root
|
92
|
+
rescue => err
|
93
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
88
94
|
end
|
89
95
|
|
90
96
|
### create_empty_post
|
91
97
|
|
92
98
|
def create_empty_post
|
93
99
|
@template = <<-EOS
|
94
|
-
|
100
|
+
.mixin liveblog
|
95
101
|
|
96
|
-
|
102
|
+
.liveblog_version
|
97
103
|
|
98
|
-
|
99
|
-
|
100
|
-
|
104
|
+
.title #@title
|
105
|
+
.pubdate #@date
|
106
|
+
.views #@view
|
101
107
|
|
102
|
-
|
103
|
-
|
104
|
-
|
108
|
+
.teaser
|
109
|
+
Teaser goes here.
|
110
|
+
.end
|
111
|
+
Remainder of post goes here.
|
105
112
|
EOS
|
106
113
|
|
107
114
|
@slug = make_slug(@title)
|
108
115
|
@fname = @slug + ".lt3"
|
109
116
|
File.open("#@root/src/#@fname", "w") {|f| f.puts @template }
|
110
117
|
@fname
|
118
|
+
rescue => err
|
119
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
111
120
|
end
|
112
121
|
|
113
122
|
### edit_initial_post
|
114
123
|
|
115
124
|
def edit_initial_post(file)
|
116
|
-
system("vi #@root/src/#{file} +8 ")
|
125
|
+
result = system("vi #@root/src/#{file} +8 ")
|
126
|
+
raise "Problem editing #@root/src/#{file}" unless result
|
127
|
+
rescue => err
|
128
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
117
129
|
end
|
118
130
|
|
119
131
|
### open_remote
|
@@ -124,19 +136,27 @@ module RuneBlog::REPL
|
|
124
136
|
|
125
137
|
lines = @deploy[@view]
|
126
138
|
user, server, sroot, spath = *lines
|
127
|
-
system("open 'http://#{server}/#{spath}'")
|
139
|
+
result = system("open 'http://#{server}/#{spath}'")
|
140
|
+
raise "Problem opening http://#{server}/#{spath}" unless result
|
141
|
+
rescue => err
|
142
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
128
143
|
end
|
129
144
|
|
130
145
|
### open_local
|
131
146
|
|
132
147
|
def open_local
|
133
148
|
system("open #{@config.viewdir(@view)}/index.html")
|
149
|
+
raise "Problem opening #{@config.viewdir(@view)}/index.html" unless result
|
150
|
+
rescue => err
|
151
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
134
152
|
end
|
135
153
|
|
136
154
|
def deploy
|
137
155
|
# TBD clunky FIXME
|
138
156
|
@deploy ||= {}
|
139
157
|
deployment = @config.viewdir(@view) + "deploy"
|
158
|
+
raise "File '#{deployment}' not found" unless File.exist?(deployment)
|
159
|
+
|
140
160
|
lines = File.readlines(deployment).map {|x| x.chomp }
|
141
161
|
@deploy[@view] = lines
|
142
162
|
user, server, sroot, spath = *lines
|
@@ -148,12 +168,18 @@ module RuneBlog::REPL
|
|
148
168
|
files.each {|f| puts " " + f }
|
149
169
|
puts
|
150
170
|
dir = "#{sroot}/#{spath}"
|
171
|
+
# FIXME - may or may not already exist
|
172
|
+
result = system("ssh root@#{server} mkdir #{dir}")
|
173
|
+
|
151
174
|
cmd = "scp -r #{files.join(' ')} root@#{server}:#{dir} >/dev/null 2>&1"
|
152
175
|
print red("\n Deploying #{files.size} files... ")
|
153
|
-
|
154
|
-
|
176
|
+
result = system(cmd)
|
177
|
+
raise "Problem occurred in deployment" unless result
|
178
|
+
|
155
179
|
File.write("#{vdir}/last_deployed", files)
|
156
180
|
puts red("finished.")
|
181
|
+
rescue => err
|
182
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
157
183
|
end
|
158
184
|
|
159
185
|
### process_post
|
@@ -164,9 +190,13 @@ module RuneBlog::REPL
|
|
164
190
|
# puts " Processing: #{Dir.pwd} :: #{file}"
|
165
191
|
path = @root + "/src/#{file}"
|
166
192
|
@meta = @main.process_file(path)
|
193
|
+
raise "process_file returned nil" if @meta.nil?
|
194
|
+
|
167
195
|
@meta.slug = make_slug(@meta.title, @config.sequence)
|
168
196
|
@meta.slug = file.sub(/.lt3$/, "")
|
169
197
|
@meta
|
198
|
+
rescue => err
|
199
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
170
200
|
end
|
171
201
|
|
172
202
|
### reload_post
|
@@ -177,6 +207,8 @@ module RuneBlog::REPL
|
|
177
207
|
@meta = process_post(file)
|
178
208
|
@meta.slug = file.sub(/.lt3$/, "")
|
179
209
|
@meta
|
210
|
+
rescue => err
|
211
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
180
212
|
end
|
181
213
|
|
182
214
|
### posting
|
@@ -216,6 +248,8 @@ module RuneBlog::REPL
|
|
216
248
|
posts.each {|post| f.puts posting(view, post) }
|
217
249
|
f.puts @blogtail
|
218
250
|
end
|
251
|
+
rescue => err
|
252
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
219
253
|
end
|
220
254
|
|
221
255
|
### link_post_view
|
@@ -225,13 +259,16 @@ module RuneBlog::REPL
|
|
225
259
|
vdir = @config.viewdir(view)
|
226
260
|
dir = vdir + @meta.slug + "/"
|
227
261
|
cmd = "mkdir -p #{dir}"
|
228
|
-
system(cmd) unless File.exist?(dir) and File.directory?(dir)
|
262
|
+
result = system(cmd) unless File.exist?(dir) and File.directory?(dir)
|
263
|
+
raise "Can't create #{dir}" unless result
|
229
264
|
|
230
265
|
File.write("#{dir}/metadata.yaml", @meta.to_yaml)
|
231
266
|
template = File.read(vdir + "custom/post_template.html")
|
232
267
|
post = interpolate(template)
|
233
268
|
File.write(dir + "index.html", post)
|
234
269
|
generate_index(view)
|
270
|
+
rescue => err
|
271
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
235
272
|
end
|
236
273
|
|
237
274
|
### link_post
|
@@ -246,6 +283,8 @@ module RuneBlog::REPL
|
|
246
283
|
link_post_view(view)
|
247
284
|
end
|
248
285
|
puts
|
286
|
+
rescue => err
|
287
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
249
288
|
end
|
250
289
|
|
251
290
|
### rebuild_post
|
@@ -254,6 +293,8 @@ module RuneBlog::REPL
|
|
254
293
|
reload_post(file)
|
255
294
|
link_post(@meta) # FIXME ??
|
256
295
|
publish_post
|
296
|
+
rescue => err
|
297
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
257
298
|
end
|
258
299
|
|
259
300
|
### rebuild
|
@@ -264,12 +305,16 @@ module RuneBlog::REPL
|
|
264
305
|
files.map! {|f| File.basename(f) }
|
265
306
|
files = files.sort.reverse
|
266
307
|
files.each {|file| rebuild_post(file) }
|
308
|
+
rescue => err
|
309
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
267
310
|
end
|
268
311
|
|
269
312
|
### relink
|
270
313
|
|
271
314
|
def relink
|
272
315
|
@config.views.each {|view| generate_index(view) }
|
316
|
+
rescue => err
|
317
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
273
318
|
end
|
274
319
|
|
275
320
|
### publish?
|
@@ -293,6 +338,8 @@ module RuneBlog::REPL
|
|
293
338
|
abort "Config file not read" unless @config
|
294
339
|
puts
|
295
340
|
@config.views.each {|v| puts " #{v}" }
|
341
|
+
rescue => err
|
342
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
296
343
|
end
|
297
344
|
|
298
345
|
### change_view
|
@@ -305,6 +352,8 @@ module RuneBlog::REPL
|
|
305
352
|
else
|
306
353
|
puts "view #{arg.inspect} does not exist"
|
307
354
|
end
|
355
|
+
rescue => err
|
356
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
308
357
|
end
|
309
358
|
|
310
359
|
### new_view
|
@@ -317,11 +366,15 @@ module RuneBlog::REPL
|
|
317
366
|
|
318
367
|
dir = @root + "/views/" + arg + "/"
|
319
368
|
cmd = "mkdir -p #{dir + 'custom'}"
|
320
|
-
system(cmd)
|
369
|
+
result = system(cmd)
|
370
|
+
raise "Could not create #{dir}/custom" unless result
|
371
|
+
|
321
372
|
File.write(dir + "custom/blog_header.html", RuneBlog::BlogHeader)
|
322
373
|
File.write(dir + "custom/blog_trailer.html", RuneBlog::BlogTrailer)
|
323
374
|
File.write(dir + "last_deployed", "Initial creation")
|
324
375
|
@config.views << arg
|
376
|
+
rescue => err
|
377
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
325
378
|
end
|
326
379
|
|
327
380
|
### import
|
@@ -335,13 +388,17 @@ module RuneBlog::REPL
|
|
335
388
|
@title = grep.sub(/^.title /, "")
|
336
389
|
@slug = make_slug(@title)
|
337
390
|
@fname = @slug + ".lt3"
|
338
|
-
system("cp #{name} #@root/src/#@fname")
|
391
|
+
result = system("cp #{name} #@root/src/#@fname")
|
392
|
+
raise "Could not copy #{name} to #@root/src/#@fname" unless result
|
393
|
+
|
339
394
|
edit_initial_post(@fname)
|
340
395
|
process_post(@fname)
|
341
396
|
if publish?
|
342
397
|
link_post(@meta)
|
343
398
|
publish_post
|
344
399
|
end
|
400
|
+
rescue => err
|
401
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
345
402
|
end
|
346
403
|
|
347
404
|
### new_post
|
@@ -360,6 +417,8 @@ module RuneBlog::REPL
|
|
360
417
|
link_post(@meta)
|
361
418
|
publish_post
|
362
419
|
end
|
420
|
+
rescue => err
|
421
|
+
puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
|
363
422
|
end
|
364
423
|
|
365
424
|
### remove_post
|
@@ -378,7 +437,9 @@ module RuneBlog::REPL
|
|
378
437
|
ques = files.size > 1 ? "\n Delete all these? " : "\n Delete? "
|
379
438
|
yn = ask red(ques)
|
380
439
|
if yn.downcase == "y" #-- maybe implement trash later?
|
381
|
-
system("rm -rf #{files.join(' ')}")
|
440
|
+
result = system("rm -rf #{files.join(' ')}")
|
441
|
+
raise "Problem deleting file(s)" unless result
|
442
|
+
|
382
443
|
puts red("\n Deleted")
|
383
444
|
else
|
384
445
|
puts red("\n No action taken")
|
@@ -402,7 +463,9 @@ module RuneBlog::REPL
|
|
402
463
|
return puts red("\n No such post found") if files.empty?
|
403
464
|
|
404
465
|
file = files.first
|
405
|
-
system("vi #@root/src/#{file}")
|
466
|
+
result = system("vi #@root/src/#{file}")
|
467
|
+
raise "Problem editing #{file}" unless result
|
468
|
+
|
406
469
|
rebuild_post(file)
|
407
470
|
rescue => err
|
408
471
|
puts err
|
data/lib/runeblog.rb
CHANGED