runeblog 0.1.24 → 0.1.25

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f04213603ad7442242abfeeff05336fe1c3c47599c1228c1536454a3e15506b7
4
- data.tar.gz: 334d6df9b57edf8e8c0c23cb0c74a12623cd152127e6ef5cfde696f54a27946d
3
+ metadata.gz: c0fcd07e427eb105db2a6dcad6fdd340570b031bbf9bf4c2a07e69d92ec4fcf7
4
+ data.tar.gz: 8d4b005099a777e60819439a0e34270dccdb2adbc284e5d8092dfea470a4be58
5
5
  SHA512:
6
- metadata.gz: d9729e32ff5d6001992bd1ef136f44a6ab9efcdade913862b08b22aaee1b97e87796647b1e6fb425b60fad68af8ee091c1b2aa17019f2f91ad224efbc5dfb7e8
7
- data.tar.gz: 2cc280923f48d76cf89cc54ae62089bb047dfdcf1114464f2c6eefe714a2656868c5fcfed0098ccbb7f7ab5ca71dfa56ff08efe42a109554e5f6267d374270d6
6
+ metadata.gz: f31952b35035981bf3f7a8a6166da37b4c227ece9388d4ccdb6efa02a3415e0b22dd5e01fcbf7c8e5ce1c2e8616b573c2d9211c7bcd61ebc22f2bda720be0ebe
7
+ data.tar.gz: b3a3d44b0b14f20d8e87ff74f91ff5c858d2460942755cc8000b9598725db2ff8b80b26b1791fe7ce3ac0c47ed8382af0894fc3c5e582dbbf70490d010cbe2ef
data/bin/blog CHANGED
@@ -16,8 +16,7 @@ def mainloop
16
16
  cmd.chomp!
17
17
  return if cmd.empty? # CR does nothing
18
18
  meth, params = RuneBlog::REPL.choose_method(cmd)
19
- old, str = send(meth, params)
20
- puts str if old && ! str.nil?
19
+ ret, str = send(meth, params)
21
20
  rescue => err
22
21
  puts err
23
22
  end
@@ -43,3 +43,14 @@ def check_meta(meta, where = "")
43
43
  end
44
44
  end
45
45
 
46
+ def verify(hash)
47
+ hash.each_pair do |expr, msg|
48
+ puts "<< #{msg}" unless expr
49
+ end
50
+ end
51
+
52
+ def assure(hash) # really the same as verify for now...
53
+ hash.each_pair do |expr, msg|
54
+ puts "<< #{msg}" unless expr
55
+ end
56
+ end
@@ -3,6 +3,7 @@ require 'runeblog_version'
3
3
  module RuneBlog::Helpers
4
4
 
5
5
  def read_config(file, *syms)
6
+ verify(File.exist?(file) => "File #{file} doesn't exist")
6
7
  lines = File.readlines(file).map(&:chomp)
7
8
  obj = OpenStruct.new
8
9
  lines.each do |line|
@@ -36,6 +37,7 @@ module RuneBlog::Helpers
36
37
  end
37
38
 
38
39
  def get_views # read from filesystem
40
+ verify(Dir.exist?("#@root/views") => "#{@root/views} doesn't exist")
39
41
  dirs = subdirs("#@root/views/").sort
40
42
  dirs.map {|name| RuneBlog::View.new(name) }
41
43
  end
@@ -33,7 +33,7 @@ module RuneBlog::REPL
33
33
  check_empty(arg)
34
34
  output RuneBlog::VERSION
35
35
  puts fx("\n RuneBlog", :bold), fx(" v #{RuneBlog::VERSION}\n", Red) unless testing
36
- [false, @out]
36
+ [true, @out]
37
37
  end
38
38
 
39
39
  def cmd_config(arg, testing = false)
@@ -51,7 +51,6 @@ module RuneBlog::REPL
51
51
  reset_output
52
52
  check_empty(arg)
53
53
  url = @blog.view.publisher.url
54
- # FIXME Bad logic here.
55
54
  if url.nil?
56
55
  output! "Publish first."
57
56
  puts "\n Publish first."
@@ -59,7 +58,7 @@ module RuneBlog::REPL
59
58
  end
60
59
  result = system("open '#{url}'")
61
60
  raise CantOpen(url) unless result
62
- return [false, @out]
61
+ return [true, @out]
63
62
  end
64
63
 
65
64
  def cmd_preview(arg, testing = false)
@@ -68,9 +67,10 @@ module RuneBlog::REPL
68
67
  local = @blog.view.index
69
68
  result = system("open #{local}")
70
69
  raise CantOpen(local) unless result
70
+ [true, @out]
71
71
  end
72
72
 
73
- def cmd_publish(arg, testing = false) # FIXME non-string return expected in caller?
73
+ def cmd_publish(arg, testing = false)
74
74
  puts unless testing
75
75
  reset_output
76
76
  check_empty(arg)
@@ -88,7 +88,7 @@ module RuneBlog::REPL
88
88
  yn = RubyText.gets.chomp
89
89
  files = all if yn == "y"
90
90
  end
91
- return if files.empty?
91
+ return [false, @out] if files.empty?
92
92
 
93
93
  ret = RubyText.spinner(label: " Publishing... ") do
94
94
  @blog.view.publisher.publish(files, assets) # FIXME weird?
@@ -100,7 +100,7 @@ module RuneBlog::REPL
100
100
  puts " ...finished.\n "
101
101
  output! "...finished.\n"
102
102
  end
103
- return [false, @out]
103
+ return [true, @out]
104
104
  end
105
105
 
106
106
  def cmd_rebuild(arg, testing = false)
@@ -110,14 +110,14 @@ module RuneBlog::REPL
110
110
  puts unless testing
111
111
  files = @blog.find_src_slugs
112
112
  files.each {|file| @blog.rebuild_post(file) }
113
- nil
113
+ [true, @out]
114
114
  end
115
115
 
116
116
  def cmd_relink(arg, testing = false)
117
117
  reset_output
118
118
  check_empty(arg)
119
119
  @blog.relink
120
- nil
120
+ [true, @out]
121
121
  end
122
122
 
123
123
  def cmd_change_view(arg, testing = false)
@@ -139,7 +139,7 @@ module RuneBlog::REPL
139
139
  puts "\n ", fx(arg, :bold), "\n" unless testing
140
140
  end
141
141
  end
142
- return [false, @out]
142
+ return [true, @out]
143
143
  end
144
144
 
145
145
  def cmd_new_view(arg, testing = false)
@@ -148,7 +148,7 @@ module RuneBlog::REPL
148
148
  resp = yesno("Add publishing info now? ")
149
149
  @blog.view.publisher = ask_publishing_info
150
150
  write_config(@blog.view.publisher, @blog.view.dir + "/publish") # change this?
151
- nil
151
+ [true, @out]
152
152
  end
153
153
 
154
154
  def cmd_new_post(arg, testing = false)
@@ -157,7 +157,7 @@ module RuneBlog::REPL
157
157
  title = ask("\nTitle: ")
158
158
  @blog.create_new_post(title)
159
159
  STDSCR.clear
160
- nil
160
+ [true, @out]
161
161
  rescue => err
162
162
  puts err
163
163
  puts err.backtrace.join("\n")
@@ -172,7 +172,7 @@ module RuneBlog::REPL
172
172
  puts ret
173
173
  output ret
174
174
  end
175
- return [false, @out]
175
+ [true, @out]
176
176
  end
177
177
 
178
178
  #-- FIXME affects linking, building, publishing...
@@ -184,7 +184,7 @@ module RuneBlog::REPL
184
184
  result = @blog.remove_post(id)
185
185
  output! "Post #{id} not found" if result.nil?
186
186
  # puts "Post #{id} not found" if result.nil?
187
- return [false, @out]
187
+ [true, @out]
188
188
  end
189
189
 
190
190
  #-- FIXME affects linking, building, publishing...
@@ -213,7 +213,7 @@ module RuneBlog::REPL
213
213
  file = files.first
214
214
  result = edit_file("#{@blog.root}/src/#{file}")
215
215
  @blog.rebuild_post(file)
216
- return [false, @out]
216
+ [true, @out]
217
217
  end
218
218
 
219
219
  def cmd_list_views(arg, testing = false)
@@ -227,7 +227,7 @@ module RuneBlog::REPL
227
227
  puts " ", v unless testing
228
228
  end
229
229
  puts unless testing
230
- return [false, @out]
230
+ [true, @out]
231
231
  end
232
232
 
233
233
  def cmd_list_posts(arg, testing = false)
@@ -250,7 +250,7 @@ module RuneBlog::REPL
250
250
  end
251
251
  end
252
252
  puts unless testing
253
- return [false, @out]
253
+ [true, @out]
254
254
  end
255
255
 
256
256
  def cmd_list_drafts(arg, testing = false)
@@ -271,7 +271,7 @@ module RuneBlog::REPL
271
271
  end
272
272
  end
273
273
  puts unless testing
274
- return [false, @out]
274
+ [true, @out]
275
275
  end
276
276
 
277
277
  def cmd_INVALID(arg, testing = false)
@@ -279,7 +279,7 @@ module RuneBlog::REPL
279
279
  print fx("\n Command ", :bold)
280
280
  print fx(arg, Red, :bold)
281
281
  puts fx(" was not understood.\n ", :bold)
282
- return [false, @out]
282
+ [true, @out]
283
283
  end
284
284
 
285
285
  def cmd_help(arg, testing = false)
@@ -328,7 +328,7 @@ module RuneBlog::REPL
328
328
  puts s2
329
329
  end
330
330
  puts unless testing
331
- return [false, @out]
331
+ [true, @out]
332
332
  end
333
333
 
334
334
  end
@@ -1,6 +1,6 @@
1
1
 
2
2
  class RuneBlog
3
- VERSION = "0.1.24"
3
+ VERSION = "0.1.25"
4
4
 
5
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  end
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.1.24
4
+ version: 0.1.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-31 00:00:00.000000000 Z
11
+ date: 2019-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext