runeblog 0.1.39 → 0.1.40

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: 62fde463d4650be5151082ff3264dac4858951cc922e374631c514e1be69496c
4
- data.tar.gz: c21b97c8f632abb8562af9f954c4c002c960a4e184d8522a4188cddbe90555ae
3
+ metadata.gz: c7e60e928c25021c92aebd529ba8f6055f84c308669621288682b39b0c26f3e7
4
+ data.tar.gz: 20e95da9e75e8a81cb0b817e5ae14c14966b290e45cd53c1853667d130b20cbf
5
5
  SHA512:
6
- metadata.gz: 4017885e99583e03ef36a040b1dfc295e2d792a1fff3284ec575548d8fc3323bed79fd2e82ff6d3256fef6502e0828c8c26c657687504150c763c9cf72ef423b
7
- data.tar.gz: c85df56291b2dc303a46975ead280669493a122e3828578bdcb95fab7f049e6d2a735bcb643b99a322ca6df741299a47bfb76ba45cc60cd860b636f3e57ba593
6
+ metadata.gz: ea7b874a79b7578d965f7168d3297e323007c2d508376dee2117f018fd945431f4c11aefb6a003a547ceed1ea242323c94596a9375a18dc3ec330a8e32e4c5d0
7
+ data.tar.gz: 4b407b0fc756bef01e25e6192ab5fc51c623cc5dd2ac02b0cfae80345b6683d93ca5f4d8fd7d78c1aff0cf63cf9b630801e6aa45886604c9b15af49b16a01858
data/lib/repl.rb CHANGED
@@ -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
- [true, @out]
36
+ @out
37
37
  end
38
38
 
39
39
  def cmd_config(arg, testing = false)
@@ -81,11 +81,11 @@ module RuneBlog::REPL
81
81
  if url.nil?
82
82
  output! "Publish first."
83
83
  puts "\n Publish first."
84
- return [false, @out]
84
+ return @out
85
85
  end
86
86
  result = system("open '#{url}'")
87
87
  raise CantOpen(url) unless result
88
- return [true, @out]
88
+ return @out
89
89
  end
90
90
 
91
91
  def cmd_preview(arg, testing = false)
@@ -94,7 +94,7 @@ module RuneBlog::REPL
94
94
  local = @blog.view.index
95
95
  result = system("open #{local}")
96
96
  raise CantOpen(local) unless result
97
- [true, @out]
97
+ @out
98
98
  end
99
99
 
100
100
  def cmd_publish(arg, testing = false)
@@ -104,7 +104,7 @@ module RuneBlog::REPL
104
104
  unless @blog.view.can_publish?
105
105
  puts "Can't publish without entries in #{@blog.view.name}/publish" unless testing
106
106
  output! "Can't publish without entries in #{@blog.view.name}/publish"
107
- return [false, @out]
107
+ return @out
108
108
  end
109
109
  # Need to check dirty/clean status first
110
110
  dirty, all, assets = @blog.view.publishable_files
@@ -115,19 +115,19 @@ module RuneBlog::REPL
115
115
  yn = RubyText.gets.chomp
116
116
  files = all if yn == "y"
117
117
  end
118
- return [false, @out] if files.empty?
118
+ return @out if files.empty?
119
119
 
120
120
  ret = RubyText.spinner(label: " Publishing... ") do
121
121
  @blog.view.publisher.publish(files, assets) # FIXME weird?
122
122
  end
123
- return [false, @out] unless ret
123
+ return @out unless ret
124
124
  vdir = @blog.view.dir
125
125
  dump("fix this later", "#{vdir}/last_published")
126
126
  if ! testing || ! ret
127
127
  puts " ...finished.\n "
128
128
  output! "...finished.\n"
129
129
  end
130
- return [true, @out]
130
+ return @out
131
131
  end
132
132
 
133
133
  def cmd_rebuild(arg, testing = false)
@@ -138,14 +138,14 @@ module RuneBlog::REPL
138
138
  files = @blog.find_src_slugs
139
139
  files.each {|file| @blog.rebuild_post(file) }
140
140
  File.write("#{@blog.root}/src/last_rebuild", Time.now)
141
- [true, @out]
141
+ @out
142
142
  end
143
143
 
144
144
  def cmd_relink(arg, testing = false)
145
145
  reset_output
146
146
  check_empty(arg)
147
147
  @blog.relink
148
- [true, @out]
148
+ @out
149
149
  end
150
150
 
151
151
  def cmd_change_view(arg, testing = false)
@@ -159,7 +159,7 @@ module RuneBlog::REPL
159
159
  @blog.view = name
160
160
  output name + "\n"
161
161
  puts "\n ", fx(name, :bold), "\n" unless testing
162
- return [false, @out]
162
+ return @out
163
163
  else
164
164
  if @blog.view?(arg)
165
165
  @blog.view = arg # reads config
@@ -167,7 +167,7 @@ module RuneBlog::REPL
167
167
  puts "\n ", fx(arg, :bold), "\n" unless testing
168
168
  end
169
169
  end
170
- return [true, @out]
170
+ return @out
171
171
  end
172
172
 
173
173
  def cmd_new_view(arg, testing = false)
@@ -176,7 +176,7 @@ module RuneBlog::REPL
176
176
  resp = yesno("Add publishing info now? ")
177
177
  @blog.view.publisher = ask_publishing_info
178
178
  write_config(@blog.view.publisher, @blog.view.dir + "/publish") # change this?
179
- [true, @out]
179
+ @out
180
180
  end
181
181
 
182
182
  def cmd_new_post(arg, testing = false)
@@ -185,7 +185,7 @@ module RuneBlog::REPL
185
185
  title = ask("\nTitle: ")
186
186
  @blog.create_new_post(title)
187
187
  STDSCR.clear
188
- [true, @out]
188
+ @out
189
189
  rescue => err
190
190
  puts err
191
191
  puts err.backtrace.join("\n")
@@ -200,7 +200,7 @@ module RuneBlog::REPL
200
200
  puts ret
201
201
  output ret
202
202
  end
203
- [true, @out]
203
+ @out
204
204
  end
205
205
 
206
206
  #-- FIXME affects linking, building, publishing...
@@ -212,7 +212,7 @@ module RuneBlog::REPL
212
212
  result = @blog.remove_post(id)
213
213
  output! "Post #{id} not found" if result.nil?
214
214
  # puts "Post #{id} not found" if result.nil?
215
- [true, @out]
215
+ @out
216
216
  end
217
217
 
218
218
  #-- FIXME affects linking, building, publishing...
@@ -241,7 +241,7 @@ module RuneBlog::REPL
241
241
  file = files.first
242
242
  result = edit_file("#{@blog.root}/src/#{file}")
243
243
  @blog.rebuild_post(file)
244
- [true, @out]
244
+ @out
245
245
  end
246
246
 
247
247
  def cmd_list_views(arg, testing = false)
@@ -255,7 +255,7 @@ module RuneBlog::REPL
255
255
  puts " ", v unless testing
256
256
  end
257
257
  puts unless testing
258
- [true, @out]
258
+ @out
259
259
  end
260
260
 
261
261
  def cmd_list_posts(arg, testing = false)
@@ -278,7 +278,7 @@ module RuneBlog::REPL
278
278
  end
279
279
  end
280
280
  puts unless testing
281
- [true, @out]
281
+ @out
282
282
  end
283
283
 
284
284
  def cmd_list_drafts(arg, testing = false)
@@ -288,7 +288,7 @@ module RuneBlog::REPL
288
288
  if drafts.empty?
289
289
  output! "No drafts"
290
290
  puts "\n No drafts\n " unless testing
291
- return [false, @out]
291
+ return @out
292
292
  else
293
293
  puts unless testing
294
294
  drafts.each do |draft|
@@ -299,7 +299,7 @@ module RuneBlog::REPL
299
299
  end
300
300
  end
301
301
  puts unless testing
302
- [true, @out]
302
+ @out
303
303
  end
304
304
 
305
305
  def cmd_list_assets(arg, testing = false)
@@ -310,7 +310,7 @@ module RuneBlog::REPL
310
310
  if assets.empty?
311
311
  output! "No assets"
312
312
  puts " No assets" unless testing
313
- return [false, @out]
313
+ return @out
314
314
  else
315
315
  puts unless testing
316
316
  assets.each do |name|
@@ -320,7 +320,7 @@ module RuneBlog::REPL
320
320
  end
321
321
  end
322
322
  puts unless testing
323
- [true, @out]
323
+ @out
324
324
  end
325
325
 
326
326
  def cmd_ssh(arg, testing = false)
@@ -333,7 +333,7 @@ module RuneBlog::REPL
333
333
  print fx("\n Command ", :bold)
334
334
  print fx(arg, Red, :bold)
335
335
  puts fx(" was not understood.\n ", :bold)
336
- [true, @out]
336
+ @out
337
337
  end
338
338
 
339
339
  def cmd_help(arg, testing = false)
@@ -387,7 +387,7 @@ module RuneBlog::REPL
387
387
  puts s2
388
388
  end
389
389
  puts unless testing
390
- [true, @out]
390
+ @out
391
391
  end
392
392
 
393
393
  end
@@ -1,6 +1,6 @@
1
1
 
2
2
  class RuneBlog
3
- VERSION = "0.1.39"
3
+ VERSION = "0.1.40"
4
4
 
5
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  end
@@ -1,6 +1,8 @@
1
1
  $LOAD_PATH << "."
2
+ # require "test_helper"
2
3
 
3
4
  require "minitest/autorun"
5
+ require "minitest/fail_fast"
4
6
 
5
7
  require 'runeblog'
6
8
  require 'lib/repl'
@@ -34,15 +36,15 @@ class TestREPL < Minitest::Test
34
36
 
35
37
  def test_001_cmd_help
36
38
  # puts __method__
37
- flag, out = cmd_help(nil, true)
39
+ out = cmd_help(nil, true)
38
40
  assert out.is_a?(String), "Expected a string returned"
39
41
  lines = out.split("\n").length
40
- assert lines > 25, "Expecting lengthy help message"
42
+ assert lines > 15, "Expecting lengthy help message"
41
43
  end
42
44
 
43
45
  def test_002_cmd_version
44
46
  # puts __method__
45
- flag, out = cmd_version(nil, true)
47
+ out = cmd_version(nil, true)
46
48
  assert out.is_a?(String), "Expected a string returned"
47
49
  lines = out
48
50
  assert lines =~ /\d+\.\d+\.\d+/m,
@@ -51,7 +53,7 @@ class TestREPL < Minitest::Test
51
53
 
52
54
  def test_003_list_views!
53
55
  # puts __method__
54
- flag, out = cmd_list_views(nil, true)
56
+ out = cmd_list_views(nil, true)
55
57
  assert out.is_a?(String), "Expected a string returned"
56
58
  lines = out.split("\n").length
57
59
  assert lines >= 2, "Expecting at least 2 lines"
@@ -59,14 +61,14 @@ class TestREPL < Minitest::Test
59
61
 
60
62
  def test_004_change_view!
61
63
  # puts __method__
62
- flag, out = cmd_change_view(nil, true) # no param, but testing
64
+ out = cmd_change_view(nil, true) # no param, but testing
63
65
  assert out.is_a?(String), "Expected a string; got: #{out.inspect}"
64
66
  assert out =~ /alpha_view/m, "Expecting 'alpha_view' as default; got: #{out.inspect}"
65
67
  end
66
68
 
67
69
  def test_005_lsd!
68
70
  # puts __method__
69
- flag, out = cmd_list_drafts(nil, true)
71
+ out = cmd_list_drafts(nil, true)
70
72
  assert out.is_a?(String), "Expected a string returned"
71
73
  lines = out.split("\n").length
72
74
  assert lines == 10, "Expecting 10 lines; got #{show_lines(out)}"
@@ -74,7 +76,7 @@ class TestREPL < Minitest::Test
74
76
 
75
77
  def test_006_lsp!
76
78
  # puts __method__
77
- flag, out = cmd_list_posts(nil, true)
79
+ out = cmd_list_posts(nil, true)
78
80
  assert out.is_a?(String), "Expected a string returned; got: #{out.inspect}"
79
81
  lines = out.split("\n").length
80
82
  assert lines == 6, "Expecting 6 lines; got #{show_lines(out)}"
@@ -198,19 +200,17 @@ class TestREPL < Minitest::Test
198
200
  end
199
201
 
200
202
  def xtest_014_remove_nonexistent_post!
201
- # puts __method__
202
203
  @blog.change_view("alpha_view")
203
- flag, out = cmd_remove_post(99, true)
204
+ out = cmd_remove_post(99, true)
204
205
  assert out =~ /Post 99 not found/, "Expected error about nonexistent post, got: #{out}"
205
206
  end
206
207
 
207
208
  def xtest_015_kill_multiple_posts!
208
- # puts __method__
209
209
  @blog.change_view("alpha_view")
210
- flag, out = cmd_list_posts(nil, true)
210
+ out = cmd_list_posts(nil, true)
211
211
  before = out.split("\n").length
212
- flag, out = cmd_kill("1 2 7", true)
213
- flag, out = cmd_list_posts(nil, true)
212
+ cmd_kill("1 2 7", true)
213
+ out = cmd_list_posts(nil, true)
214
214
  after = out.split("\n").length
215
215
  expecting = before - 3
216
216
  assert after == expecting, "list_posts saw #{before} posts, now #{after} (not #{expecting})"
data/test/make_blog.rb CHANGED
@@ -1,4 +1,4 @@
1
- $LOAD_PATH << "."
1
+ $LOAD_PATH << "./li"
2
2
 
3
3
  major, minor = RUBY_VERSION.split(".").values_at(0,1)
4
4
  ver = major.to_i*10 + minor.to_i
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.39
4
+ version: 0.1.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-03 00:00:00.000000000 Z
11
+ date: 2019-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext
@@ -72,7 +72,7 @@ files:
72
72
  - lib/runeblog.rb
73
73
  - lib/runeblog_version.rb
74
74
  - lib/view.rb
75
- - test/general.rb
75
+ - test/general_test.rb
76
76
  - test/make_blog.rb
77
77
  - test/test
78
78
  homepage: https://github.com/Hal9000/runeblog