runeblog 0.0.59 → 0.0.60

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/data/VERSION +1 -1
  3. data/lib/repl.rb +19 -24
  4. data/lib/runeblog.rb +11 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5ef2b59f2ea5d65799fce9e0d24bcb4038afa10
4
- data.tar.gz: b643c98e0d6c8da57e0acd72f41029b7ea147c77
3
+ metadata.gz: 4d6b3da20e1b95cba305221ed0663dc6d9f609ff
4
+ data.tar.gz: 9baf807dca0a68940b7222ef4ad856e36b18d9f3
5
5
  SHA512:
6
- metadata.gz: 113d0e271a81cd8f0d7021d66806bffcfcdedac95526ed7795ce056a47fb94c049d1b1eafcdcc9fad3f917f33d166d004bd58c09c3b05c32ab91bd178c2a29ee
7
- data.tar.gz: 6f96ad2f2cc7826c52afb7e8ec946f355f0a7ad35b7853e4abdd8d4ea2ab0aa14c99dc729cad888a4e18df6daf9f970af14d43f1687a4987d94f5f2f29ce8ebc
6
+ metadata.gz: 9f695ac8508c5419e55326fc403192cb6f677212d988a39ce96c10e79f6913ae5d05504a6c089ed8684578372f93db385af708a8ebcc68cec66ff97f8302cfe1
7
+ data.tar.gz: 5d2126e6ae125f9afa1dbce47ba0979302e49568561a3815d751d04e04a33ef256722a9f5a2c7cd75421617bd0cf4c4d0a8db8065dbf311ebd7a362ef7a74a72
data/data/VERSION CHANGED
@@ -1 +1 @@
1
- RuneBlog v 0.0.59 2018-09-16
1
+ RuneBlog v 0.0.60 2018-09-16
data/lib/repl.rb CHANGED
@@ -24,6 +24,7 @@ module RuneBlog::REPL
24
24
  @deploy ||= {}
25
25
  return puts red("\n Deploy first.") unless @deploy[@view]
26
26
 
27
+ # Simlify this
27
28
  lines = @deploy[@view]
28
29
  user, server, sroot, spath = *lines
29
30
  url = "http://#{server}/#{spath}"
@@ -86,6 +87,7 @@ module RuneBlog::REPL
86
87
  reset_output
87
88
  check_empty(arg)
88
89
  puts
90
+ # Simlify this
89
91
  files = Dir.entries("#@root/src/").grep /\d\d\d\d.*.lt3$/
90
92
  files.map! {|f| File.basename(f) }
91
93
  files = files.sort.reverse
@@ -119,6 +121,7 @@ module RuneBlog::REPL
119
121
 
120
122
  def cmd_change_view(arg)
121
123
  reset_output
124
+ # Simlify this
122
125
  if arg.nil?
123
126
  output "#{@blog.view}"
124
127
  return @out
@@ -148,7 +151,6 @@ module RuneBlog::REPL
148
151
  def cmd_new_post(arg)
149
152
  reset_output
150
153
  check_empty(arg)
151
- # open_blog unless @blog # duh?
152
154
  @title = ask("Title: ")
153
155
  @blog.create_new_post(@title)
154
156
  return nil
@@ -169,7 +171,7 @@ module RuneBlog::REPL
169
171
 
170
172
  def cmd_remove_post(arg, safe=true)
171
173
  reset_output
172
- err = "'#{arg}' is not an integer"
174
+ # err = "'#{arg}' is not an integer"
173
175
  id = get_integer(arg)
174
176
  tag = "#{'%04d' % id}"
175
177
  files = Find.find(@root).to_a
@@ -214,6 +216,7 @@ module RuneBlog::REPL
214
216
  def cmd_edit_post(arg)
215
217
  reset_output
216
218
  id = get_integer(arg)
219
+ # Simlify this
217
220
  tag = "#{'%04d' % id}"
218
221
  files = Find.find(@root+"/src").to_a
219
222
  files = files.grep(/#{tag}-/)
@@ -234,16 +237,12 @@ module RuneBlog::REPL
234
237
  def cmd_list_posts(arg)
235
238
  check_empty(arg)
236
239
  reset_output
237
- @view = @blog.view
238
- dir = @blog.viewdir(@view)
239
- Dir.chdir(dir) do
240
- posts = Dir.entries(".").grep(/^0.*/)
241
- output @view + ":\n"
242
- if posts.empty?
243
- output! "No posts\n"
244
- else
245
- posts.each {|post| outstr " #{colored_slug(post)}\n" }
246
- end
240
+ posts = @blog.posts # current view
241
+ output @view + ":\n"
242
+ if posts.empty?
243
+ output! "No posts\n"
244
+ else
245
+ posts.each {|post| outstr " #{colored_slug(post)}\n" }
247
246
  end
248
247
  @out
249
248
  rescue => err
@@ -253,18 +252,14 @@ module RuneBlog::REPL
253
252
  def cmd_list_drafts(arg)
254
253
  check_empty(arg)
255
254
  reset_output
256
- dir = "#@root/src"
257
- Dir.chdir(dir) do
258
- posts = Dir.entries(".").grep(/^0.*.lt3/)
259
- output_newline
260
- if posts.empty?
261
- output! "No posts"
262
- return @out
263
- else
264
- posts.each do |post|
265
- str = " #{colored_slug(post.sub(/.lt3$/, ""))}\n"
266
- outstr str
267
- end
255
+ output_newline
256
+ drafts = @blog.drafts # current view
257
+ if drafts.empty?
258
+ output! "No drafts"
259
+ return @out
260
+ else
261
+ drafts.each do |draft|
262
+ outstr " #{colored_slug(draft.sub(/.lt3$/, ""))}\n"
268
263
  end
269
264
  end
270
265
  @out
data/lib/runeblog.rb CHANGED
@@ -3,7 +3,7 @@ require 'yaml'
3
3
  require 'livetext'
4
4
 
5
5
  class RuneBlog
6
- VERSION = "0.0.59"
6
+ VERSION = "0.0.60"
7
7
 
8
8
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
9
9
  DefaultData = Path + "/../data"
@@ -105,6 +105,16 @@ EOS
105
105
  error(err)
106
106
  end
107
107
 
108
+ def posts
109
+ dir = self.viewdir(@view)
110
+ posts = Dir.entries(dir).grep(/^0.*/)
111
+ end
112
+
113
+ def drafts
114
+ dir = "#@root/src"
115
+ drafts = Dir.entries(dir).grep(/^0.*.lt3/)
116
+ end
117
+
108
118
  def process_post(file)
109
119
  @main ||= Livetext.new
110
120
  @main.main.output = File.new("/tmp/WHOA","w")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runeblog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.59
4
+ version: 0.0.60
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton