runeblog 0.1.2 → 0.1.3

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: aef7d403afc6196d75ad2f03efd4cd17f20e9e3afe553719caf8ea9417d27470
4
- data.tar.gz: ee65d44e639ff13c4817fec44df9899d0f38fb234fbcc6d4e8e19bfbb25f5284
3
+ metadata.gz: 38afc33e9e97a55dccd711b54044be6c46b6362435d8c25e7a69940c29d77c47
4
+ data.tar.gz: 387e5a9df5fdc890e39113e41e12d8b61b463861915b0b54fa6a26313746fb45
5
5
  SHA512:
6
- metadata.gz: 6dd26d351a24e5b558fb897fb7cc818d370a01688c7eba89e9296bf763e31c6faa57ab42342306bb5ddbb349b0744460f590fd7ba74c4da3b830aeab5d861785
7
- data.tar.gz: 255a1a568efaf58bd4ebe8f8ed47a58244d59cc0d5d5c849c240698ca048a4265688322360f16ef158de5c6ec5fc5f0f43d5066e72fff88414244207813c8087
6
+ metadata.gz: 1b62e82c4f925b410c1a7042b2b37cb668bc6304b324019379742c02bdefba45f322f5e39cbee9f3d1625f4374ecf02c6976a2a3dd8d47f28659578ca2d8edaf
7
+ data.tar.gz: 828618444b225d1030e85d677292878138323734147077770e9158664145185bfb4179c67e27961443662324a6bee2c618f813048b121037b6ae0006c5c03d65
data/bin/blog CHANGED
@@ -19,25 +19,9 @@ def get_argv
19
19
  [cmd, arg]
20
20
  end
21
21
 
22
- ###########
23
-
24
- STDOUT.sync = true
25
-
26
- cmd, arg = get_argv
27
-
28
- if ! RuneBlog.exist?
29
- print "No blog found. Create new one? (y/n) "
30
- resp = gets.chomp
31
- if resp == "y"
32
- RuneBlog.create_new_blog
33
- else
34
- exit
35
- end
36
- end
37
-
38
22
  def mainloop
39
23
  if curses?
40
- print red("blog> ")
24
+ print :red, "\nblog> "
41
25
  cmd = gets
42
26
  else
43
27
  cmd = Readline.readline(red("\nblog> "), true)
@@ -53,17 +37,30 @@ rescue => err
53
37
  end
54
38
 
55
39
 
56
- puts curses?
57
- sleep 6
40
+ ###########
41
+
42
+ RubyText.start(:echo, :_raw, log: "debug.out", fg: :blue, bg: :white)
43
+
44
+ STDOUT.sync = true
58
45
 
59
- if curses?
60
- RubyText.start(:echo, :noraw, log: "debug.out")
46
+ cmd, arg = get_argv
47
+
48
+ if ! RuneBlog.exist?
49
+ print "No blog found. Create new one? (y/n) "
50
+ resp = gets.chomp
51
+ if resp == "y"
52
+ RuneBlog.create_new_blog
53
+ else
54
+ exit
55
+ end
61
56
  end
62
57
 
63
58
  @blog = RuneBlog.new
64
59
 
60
+ # STDSCR.clear if curses?
61
+
65
62
  if cmd.nil? # REPL
66
- system("tput smcup") # see: tput rmcup in cmd_quit
63
+ # system("tput smcup") # see: tput rmcup in cmd_quit
67
64
 
68
65
  puts red("\n RuneBlog v #{RuneBlog::VERSION}")
69
66
  loop { mainloop }
data/lib/global.rb CHANGED
@@ -18,7 +18,7 @@ class RuneBlog
18
18
  end
19
19
 
20
20
  def curses?
21
- false
21
+ true
22
22
  end
23
23
 
24
24
  def make_exception(sym, str)
data/lib/helpers-repl.rb CHANGED
@@ -32,7 +32,7 @@ module NoANSI
32
32
  loop do
33
33
  ch = ::STDSCR.getch
34
34
  if ch == 10
35
- # puts "\n\n "
35
+ STDSCR.crlf
36
36
  break
37
37
  end
38
38
  str << ch
@@ -172,17 +172,17 @@ module RuneBlog::REPL
172
172
 
173
173
  def output(str) # \n and indent
174
174
  @out ||= ""
175
- @out << "\n " + str
175
+ @out << " " + str.to_s
176
176
  end
177
177
 
178
- def outstr(str) # \n and indent
178
+ def outstr(str) # indent
179
179
  @out ||= ""
180
180
  @out << str
181
181
  end
182
182
 
183
183
  def output!(str) # red, \n and indent
184
184
  @out ||= ""
185
- @out << "\n " + red(str)
185
+ @out << " " + red(str)
186
186
  end
187
187
 
188
188
  def output_newline(n = 1)
data/lib/publish.rb CHANGED
@@ -34,7 +34,7 @@ class RuneBlog::Publishing
34
34
  dir = "#@docroot/#@path"
35
35
  result = system("ssh #@user@#@server -x mkdir #{dir}")
36
36
  list = files.join(' ')
37
- cmd = "scp -r #{list} #@user@##server:#{dir} >/dev/null 2>&1"
37
+ cmd = "scp -r #{list} #@user@#@server:#{dir} >/dev/null 2>/tmp/wtf"
38
38
  output! "Publishing #{files.size} files...\n"
39
39
  result = system(cmd)
40
40
  raise PublishError unless result
data/lib/repl.rb CHANGED
@@ -58,7 +58,7 @@ module RuneBlog::REPL
58
58
  reset_output
59
59
  check_empty(arg)
60
60
  unless @blog.view.can_publish?
61
- output! "Can't publish without entries in #{@blog.view}/publish"
61
+ output! "Can't publish without entries in #{@blog.view.name}/publish"
62
62
  return @out
63
63
  end
64
64
  @blog.view.publish
@@ -102,16 +102,6 @@ module RuneBlog::REPL
102
102
  nil
103
103
  end
104
104
 
105
- def cmd_list_views(arg)
106
- reset_output("\n")
107
- check_empty(arg)
108
- @blog.views.each do |v|
109
- v = bold(v) if v == @blog.view
110
- outstr " #{v}\n"
111
- end
112
- @out
113
- end
114
-
115
105
  def cmd_change_view(arg)
116
106
  reset_output
117
107
  # Simplify this
@@ -121,7 +111,7 @@ module RuneBlog::REPL
121
111
  else
122
112
  if @blog.view?(arg)
123
113
  @blog.view = arg # reads config
124
- output red("View: ") + bold(@blog.view)
114
+ output red("View: ") + bold(@blog.view.name.to_s) # FIXME?
125
115
  end
126
116
  end
127
117
  @out
@@ -147,7 +137,7 @@ module RuneBlog::REPL
147
137
  end
148
138
 
149
139
  def cmd_kill(arg)
150
- reset_output "\n"
140
+ reset_output
151
141
  args = arg.split
152
142
  args.each do |x|
153
143
  # FIXME
@@ -192,29 +182,40 @@ module RuneBlog::REPL
192
182
  nil
193
183
  end
194
184
 
195
- def cmd_list_posts(arg)
185
+ def cmd_list_views(arg)
186
+ reset_output
196
187
  check_empty(arg)
188
+ @blog.views.each do |v|
189
+ v = bold(v) if v == @blog.view.name
190
+ outstr " #{v}\n"
191
+ end
192
+ @out
193
+ end
194
+
195
+ def cmd_list_posts(arg)
197
196
  reset_output
197
+ check_empty(arg)
198
198
  posts = @blog.posts # current view
199
- output bold(@blog.view.name) + ":"
199
+ str = @blog.view.name + ":\n"
200
+ output str
200
201
  if posts.empty?
201
202
  output! bold("No posts")
202
203
  else
203
- output_newline
204
- posts.each {|post| outstr " #{colored_slug(post)}\n" }
204
+ posts.each do |post|
205
+ outstr " #{colored_slug(post)}\n"
206
+ end
205
207
  end
206
208
  @out
207
209
  end
208
210
 
209
211
  def cmd_list_drafts(arg)
210
- check_empty(arg)
211
212
  reset_output
213
+ check_empty(arg)
212
214
  drafts = @blog.drafts # current view
213
215
  if drafts.empty?
214
216
  output! "No drafts"
215
217
  return @out
216
218
  else
217
- output_newline
218
219
  drafts.each do |draft|
219
220
  outstr " #{colored_slug(draft.sub(/.lt3$/, ""))}\n"
220
221
  end
data/lib/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  class RuneBlog
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
 
5
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  end
data/test/general.rb CHANGED
@@ -32,9 +32,9 @@ class TestREPL < Minitest::Test
32
32
  def test_002_cmd_version
33
33
  out = cmd_version(nil)
34
34
  assert out.is_a?(String), "Expected a string returned"
35
- lines = out.split("\n")[1]
35
+ lines = out
36
36
  assert lines =~ /\d+\.\d+\.\d+/m,
37
- "Couldn't find version number"
37
+ "Couldn't find version number; found #{out.inspect}"
38
38
  end
39
39
 
40
40
  def test_003_list_views!
@@ -54,14 +54,14 @@ class TestREPL < Minitest::Test
54
54
  out = cmd_list_drafts(nil)
55
55
  assert out.is_a?(String), "Expected a string returned"
56
56
  lines = out.split("\n").length
57
- assert lines == 11, "Expecting 11 lines; got #{show_lines(out)}"
57
+ assert lines == 10, "Expecting 10 lines; got #{show_lines(out)}"
58
58
  end
59
59
 
60
60
  def test_006_lsp!
61
61
  out = cmd_list_posts(nil)
62
62
  assert out.is_a?(String), "Expected a string returned; got: #{out.inspect}"
63
63
  lines = out.split("\n").length
64
- assert lines == 7, "Expecting 7 lines; got #{show_lines(out)}"
64
+ assert lines == 6, "Expecting 6 lines; got #{show_lines(out)}"
65
65
  end
66
66
 
67
67
  def test_007_parser
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.2
4
+ version: 0.1.3
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-11-14 00:00:00.000000000 Z
11
+ date: 2018-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext