runeblog 0.0.42 → 0.0.43

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/data/VERSION +1 -1
  3. data/lib/repl.rb +61 -71
  4. data/lib/runeblog.rb +1 -1
  5. metadata +3 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8aae622425a4dd36621308f9e25b45993de18ab
4
- data.tar.gz: c8a7fec0e40174b163f2bf103dbbf7ec7ab4e834
3
+ metadata.gz: b3fbf51af336c1442a5aa62e13df695d2c2cd318
4
+ data.tar.gz: 4fa03ce9ff83cc6144cc580f346733b5b8d34916
5
5
  SHA512:
6
- metadata.gz: c44b9c023d1bafbdf235bb15d203553e33db157ac0c7b0e493060ca8a2d11bc322747d92fe149681a19f51fb5c4145e8bb0ab343400c734488229d5f51ffedd0
7
- data.tar.gz: d864da3195902099465f376e6c7fe6dd9c04f2d4c18861cde2ad5c8896b985204a377835efcac5bcebfa375235054e77169f1dc1c864f8bc555b4bdb19a04631
6
+ metadata.gz: 30001b22c7851778c22b3cb7be20c5af16563e89408308f42d6813dfd70d8ddd3c384dc2a7d35feac71aa6bae8631cf938051b3f11254a28d3fe119134e2514f
7
+ data.tar.gz: 902447ebf5221a2130df2a1f504ab07bc086aee612af57479183e04042f963a8ef1edf9b5a041f5ae8d69b7eefd0bccc1bca24e9b9ef1effd5756dbbb32aa909
@@ -1 +1 @@
1
- RuneBlog v 0.0.42 2017-05-26
1
+ RuneBlog v 0.0.43 2018-07-31
@@ -1,5 +1,7 @@
1
1
  require 'runeblog'
2
2
 
3
+ require 'ostruct'
4
+
3
5
  module RuneBlog::REPL
4
6
 
5
7
  def clear
@@ -27,6 +29,14 @@ module RuneBlog::REPL
27
29
  red(slug[0..3])+blue(slug[4..-1])
28
30
  end
29
31
 
32
+ ### error
33
+
34
+ def error(err, line, file)
35
+ str = "\n Error: (line #{line} of #{File.basename(file)}) "
36
+ str << err.to_s
37
+ puts red(str)
38
+ puts err.backtrace
39
+ end
30
40
 
31
41
  ### ask
32
42
 
@@ -67,8 +77,7 @@ module RuneBlog::REPL
67
77
  end
68
78
  end
69
79
  rescue => err
70
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
71
- puts err.backtrace
80
+ error(err, __LINE__, __FILE__)
72
81
  end
73
82
 
74
83
  ### make_slug
@@ -92,8 +101,7 @@ module RuneBlog::REPL
92
101
  @root = @config.root
93
102
  @config
94
103
  rescue => err
95
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
96
- puts err.backtrace
104
+ error(err, __LINE__, __FILE__)
97
105
  end
98
106
 
99
107
  ### create_empty_post
@@ -117,8 +125,7 @@ Remainder of post goes here.
117
125
  File.open("#@root/src/#@fname", "w") {|f| f.puts @template }
118
126
  @fname
119
127
  rescue => err
120
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
121
- puts err.backtrace
128
+ error(err, __LINE__, __FILE__)
122
129
  end
123
130
 
124
131
  ### edit_initial_post
@@ -127,8 +134,7 @@ Remainder of post goes here.
127
134
  result = system("vi #@root/src/#{file} +8 ")
128
135
  raise "Problem editing #@root/src/#{file}" unless result
129
136
  rescue => err
130
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
131
- puts err.backtrace
137
+ error(err, __LINE__, __FILE__)
132
138
  end
133
139
 
134
140
  ### open_remote
@@ -142,8 +148,7 @@ Remainder of post goes here.
142
148
  result = system("open 'http://#{server}/#{spath}'")
143
149
  raise "Problem opening http://#{server}/#{spath}" unless result
144
150
  rescue => err
145
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
146
- puts err.backtrace
151
+ error(err, __LINE__, __FILE__)
147
152
  end
148
153
 
149
154
  ### open_local
@@ -152,8 +157,7 @@ Remainder of post goes here.
152
157
  result = system("open #{@config.viewdir(@view)}/index.html")
153
158
  raise "Problem opening #{@config.viewdir(@view)}/index.html" unless result
154
159
  rescue => err
155
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
156
- puts err.backtrace
160
+ error(err, __LINE__, __FILE__)
157
161
  end
158
162
 
159
163
  def deploy
@@ -186,8 +190,7 @@ Remainder of post goes here.
186
190
  File.write("#{vdir}/last_deployed", files)
187
191
  puts red("finished.")
188
192
  rescue => err
189
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
190
- puts err.backtrace
193
+ error(err, __LINE__, __FILE__)
191
194
  end
192
195
 
193
196
  ### process_post
@@ -203,9 +206,7 @@ Remainder of post goes here.
203
206
  @meta.slug = file.sub(/.lt3$/, "")
204
207
  @meta
205
208
  rescue => err
206
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
207
- puts err.backtrace
208
- puts
209
+ error(err, __LINE__, __FILE__)
209
210
  end
210
211
 
211
212
  ### reload_post
@@ -217,7 +218,7 @@ Remainder of post goes here.
217
218
  @meta.slug = file.sub(/.lt3$/, "")
218
219
  @meta
219
220
  rescue => err
220
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
221
+ error(err, __LINE__, __FILE__)
221
222
  end
222
223
 
223
224
  ### posting
@@ -258,8 +259,7 @@ Remainder of post goes here.
258
259
  f.puts @blogtail
259
260
  end
260
261
  rescue => err
261
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
262
- puts err.backtrace
262
+ error(err, __LINE__, __FILE__)
263
263
  end
264
264
 
265
265
  ### create_dir
@@ -283,43 +283,42 @@ Remainder of post goes here.
283
283
  File.write(dir + "index.html", post)
284
284
  generate_index(view)
285
285
  rescue => err
286
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
287
- puts err.backtrace
286
+ error(err, __LINE__, __FILE__)
288
287
  end
289
288
 
290
289
  ### find_asset
291
290
 
292
- def find_asset(asset) # , views)
293
- # STDERR.puts "repl find_asset: @meta = #{@meta.inspect}"
294
- views = @meta.views
295
- views.each do |view|
296
- vdir = @config.viewdir(view)
297
- post_dir = "#{vdir}#{@meta.slug}/assets/"
298
- path = post_dir + asset
299
- STDERR.puts " Seeking #{path}"
300
- return path if File.exist?(path)
301
- end
302
- views.each do |view|
303
- dir = @config.viewdir(view) + "/assets/"
304
- path = dir + asset
305
- STDERR.puts " Seeking #{path}"
306
- return path if File.exist?(path)
307
- end
308
- top = @root + "/assets/"
309
- path = top + asset
310
- STDERR.puts " Seeking #{path}"
311
- return path if File.exist?(path)
312
-
313
- return nil
314
- end
315
-
316
- ### find_all_assets
317
-
318
- def find_all_assets(list, views)
319
- # STDERR.puts "\n Called find_all_assets with #{list.inspect}"
320
- list ||= []
321
- list.each {|asset| puts "#{asset} => #{find_asset(asset, views)}" }
322
- end
291
+ # def find_asset(asset) # , views)
292
+ # # STDERR.puts "repl find_asset: @meta = #{@meta.inspect}"
293
+ # views = @meta.views
294
+ # views.each do |view|
295
+ # vdir = @config.viewdir(view)
296
+ # post_dir = "#{vdir}#{@meta.slug}/assets/"
297
+ # path = post_dir + asset
298
+ # STDERR.puts " Seeking #{path}"
299
+ # return path if File.exist?(path)
300
+ # end
301
+ # views.each do |view|
302
+ # dir = @config.viewdir(view) + "/assets/"
303
+ # path = dir + asset
304
+ # STDERR.puts " Seeking #{path}"
305
+ # return path if File.exist?(path)
306
+ # end
307
+ # top = @root + "/assets/"
308
+ # path = top + asset
309
+ # STDERR.puts " Seeking #{path}"
310
+ # return path if File.exist?(path)
311
+ #
312
+ # return nil
313
+ # end
314
+ #
315
+ # ### find_all_assets
316
+ #
317
+ # def find_all_assets(list, views)
318
+ # # STDERR.puts "\n Called find_all_assets with #{list.inspect}"
319
+ # list ||= []
320
+ # list.each {|asset| puts "#{asset} => #{find_asset(asset, views)}" }
321
+ # end
323
322
 
324
323
  ### publish_post
325
324
 
@@ -335,8 +334,7 @@ Remainder of post goes here.
335
334
  # assets = find_all_assets(@meta.assets, views)
336
335
  puts
337
336
  rescue => err
338
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
339
- puts err.backtrace
337
+ error(err, __LINE__, __FILE__)
340
338
  end
341
339
 
342
340
  ### rebuild_post
@@ -345,8 +343,7 @@ Remainder of post goes here.
345
343
  reload_post(file)
346
344
  publish_post(@meta) # FIXME ??
347
345
  rescue => err
348
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
349
- puts err.backtrace
346
+ error(err, __LINE__, __FILE__)
350
347
  end
351
348
 
352
349
  ### rebuild
@@ -358,8 +355,7 @@ Remainder of post goes here.
358
355
  files = files.sort.reverse
359
356
  files.each {|file| rebuild_post(file) }
360
357
  rescue => err
361
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
362
- puts err.backtrace
358
+ error(err, __LINE__, __FILE__)
363
359
  end
364
360
 
365
361
  ### relink
@@ -367,8 +363,7 @@ Remainder of post goes here.
367
363
  def relink
368
364
  @config.views.each {|view| generate_index(view) }
369
365
  rescue => err
370
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
371
- puts err.backtrace
366
+ error(err, __LINE__, __FILE__)
372
367
  end
373
368
 
374
369
  # ### publish?
@@ -385,8 +380,7 @@ Remainder of post goes here.
385
380
  puts
386
381
  @config.views.each {|v| puts " #{v}" }
387
382
  rescue => err
388
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
389
- puts err.backtrace
383
+ error(err, __LINE__, __FILE__)
390
384
  end
391
385
 
392
386
  ### change_view
@@ -404,8 +398,7 @@ Remainder of post goes here.
404
398
  end
405
399
  end
406
400
  rescue => err
407
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
408
- puts err.backtrace
401
+ error(err, __LINE__, __FILE__)
409
402
  end
410
403
 
411
404
  ### new_view
@@ -425,8 +418,7 @@ Remainder of post goes here.
425
418
  File.write(dir + "last_deployed", "Initial creation")
426
419
  @config.views << arg
427
420
  rescue => err
428
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
429
- puts err.backtrace
421
+ error(err, __LINE__, __FILE__)
430
422
  end
431
423
 
432
424
  ### import
@@ -447,8 +439,7 @@ Remainder of post goes here.
447
439
  process_post(@fname)
448
440
  publish_post(@meta) # if publish?
449
441
  rescue => err
450
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
451
- puts err.backtrace
442
+ error(err, __LINE__, __FILE__)
452
443
  end
453
444
 
454
445
  ### new_post
@@ -465,8 +456,7 @@ Remainder of post goes here.
465
456
  process_post(file) #- FIXME handle each view
466
457
  publish_post(@meta) # if publish?
467
458
  rescue => err
468
- puts red("\n Error: (line #{__LINE__} of #{File.basename(__FILE__)}) ") + err.to_s
469
- puts err.backtrace
459
+ error(err, __LINE__, __FILE__)
470
460
  end
471
461
 
472
462
  ### remove_multiple_posts
@@ -3,7 +3,7 @@ require 'yaml'
3
3
  require 'livetext'
4
4
 
5
5
  class RuneBlog
6
- VERSION = "0.0.42"
6
+ VERSION = "0.0.43"
7
7
 
8
8
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
9
9
  DefaultData = Path + "/../data"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runeblog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.42
4
+ version: 0.0.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-26 00:00:00.000000000 Z
11
+ date: 2018-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext
@@ -69,9 +69,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  version: '0'
70
70
  requirements: []
71
71
  rubyforge_project:
72
- rubygems_version: 2.4.2
72
+ rubygems_version: 2.2.2
73
73
  signing_key:
74
74
  specification_version: 4
75
75
  summary: A command-line blogging system
76
76
  test_files: []
77
- has_rdoc: