runeblog 0.1.10 → 0.1.11

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
- SHA1:
3
- metadata.gz: 21d34358a671bd5d76eb77221154ff63e0097f92
4
- data.tar.gz: 6585054baeba0918d35409a3eb138762ab6ab670
2
+ SHA256:
3
+ metadata.gz: c8624c0cbf8355cc824d03ff97e2b60cd04e871bde7394731535e32504aa05ee
4
+ data.tar.gz: 0f5323f78c46f801000269eff914eb024d2f8539b44531822d779c1549581f95
5
5
  SHA512:
6
- metadata.gz: 62d64be14fb9b1eef47120d1c06c410eb97a3d4ee7c44c8ca70a3bb2424f84367312886e0b6cd100286e23a84089ce52968b43f2ab470bb686f508f909963d12
7
- data.tar.gz: 87a791aa34b235ebe3220a0f0d57950ddde4dfda73b14e937afff644b96d7e6dbb514c009bda2676176bf6731630a52a7aa96e2611104354f91728176efa0224
6
+ metadata.gz: 5cae9b867b30214856bb457b9cfc7d434691dc24aaeda63505d96c2377251e2280f28638dbd33360c762b41eb9d9ab8f6997170b9cea8db5921e8580e46347a9
7
+ data.tar.gz: 824f8c428bed47e17bd373f63c4a69644d80d13277083a738ec635bf7ace2b836d7d96beac1b6119e46c0a70e27d929a5c4e197699687f603794c5beab048c58
data/bin/blog CHANGED
@@ -20,7 +20,7 @@ end
20
20
 
21
21
  def mainloop
22
22
  print fx("blog> ", Red)
23
- cmd = STDSCR.gets
23
+ cmd = STDSCR.gets(history: @cmdhist)
24
24
  cmd_quit(nil) if cmd.nil? # ^D
25
25
  cmd.chomp!
26
26
  return if cmd.empty? # CR does nothing
@@ -56,6 +56,7 @@ end
56
56
 
57
57
  if cmd.nil? # REPL
58
58
  puts fx("\n RuneBlog", :bold), fx(" v #{RuneBlog::VERSION}\n", Red)
59
+ @cmdhist = []
59
60
  loop { mainloop }
60
61
  sleep 0.2
61
62
  system("tput clear")
data/lib/helpers-blog.rb CHANGED
@@ -20,6 +20,7 @@ module RuneBlog::Helpers
20
20
  rescue => err
21
21
  puts "Something hit the fan: #{err}" # CHANGE_FOR_CURSES?
22
22
  puts err.backtrace.join("\n") # CHANGE_FOR_CURSES?
23
+ puts "dir = #{Dir.pwd}"
23
24
  exit
24
25
  end
25
26
 
data/lib/helpers-repl.rb CHANGED
@@ -272,36 +272,25 @@ module RuneBlog::REPL
272
272
 
273
273
  ### find_asset
274
274
 
275
- # def find_asset(asset) # , views)
276
- # # STDERR.puts "repl find_asset: @meta = #{@meta.inspect}"
277
- # views = @meta.views
278
- # views.each do |view|
279
- # vdir = @config.viewdir(view)
280
- # post_dir = "#{vdir}#{@meta.slug}/assets/"
281
- # path = post_dir + asset
282
- # STDERR.puts " Seeking #{path}"
283
- # return path if File.exist?(path)
284
- # end
285
- # views.each do |view|
286
- # dir = @config.viewdir(view) + "/assets/"
287
- # path = dir + asset
288
- # STDERR.puts " Seeking #{path}"
289
- # return path if File.exist?(path)
290
- # end
291
- # top = @root + "/assets/"
292
- # path = top + asset
293
- # STDERR.puts " Seeking #{path}"
294
- # return path if File.exist?(path)
295
- #
296
- # return nil
297
- # end
298
- #
299
- # ### find_all_assets
300
- #
301
- # def find_all_assets(list, views)
302
- # # STDERR.puts "\n Called find_all_assets with #{list.inspect}"
303
- # list ||= []
304
- # list.each {|asset| puts "#{asset} => #{find_asset(asset, views)}" }
305
- # end
275
+ # FIXME is this per-post?
306
276
 
277
+ def find_asset(asset_name) # , views)
278
+ search_path = proc do |path|
279
+ full_path = path + asset_name
280
+ return full_path if File.exist?(full_path)
281
+ end
282
+ views = @meta.views
283
+ views.each do |view| search_path.call("#{view.dir}/#{@meta.slug}/assets/") end
284
+ views.each do |view| search_path.call(view.dir + "/assets/") end
285
+ search_path.call(@root + "/assets/", asset_name)
286
+ # If all fail... return nil
287
+ return nil
288
+ end
289
+
290
+ ### find_all_assets
291
+
292
+ def find_all_assets(list, views)
293
+ list ||= []
294
+ list.each {|asset| puts "#{asset} => #{find_asset(asset, views)}" }
295
+ end
307
296
  end
data/lib/publish.rb CHANGED
@@ -26,7 +26,7 @@ class RuneBlog::Publishing
26
26
  end
27
27
 
28
28
  def url
29
- url = "#{protocol}://#{@server}/#{@path}"
29
+ url = "#@proto://#@server/#@path"
30
30
  end
31
31
 
32
32
  def publish(files)
data/lib/repl.rb CHANGED
@@ -69,37 +69,41 @@ module RuneBlog::REPL
69
69
  end
70
70
 
71
71
  def cmd_publish(arg) # FIXME non-string return expected in caller?
72
+ puts
72
73
  reset_output
73
74
  check_empty(arg)
74
75
  unless @blog.view.can_publish?
76
+ puts "Can't publish without entries in #{@blog.view.name}/publish"
75
77
  output! "Can't publish without entries in #{@blog.view.name}/publish"
76
- return [true, @out]
77
- end
78
- @blog.view.publish
79
- user, server, sroot, spath = *@publish[@blog.view]
80
- if files.empty? # FIXME baloney
81
- output! "No files to publish"
82
- return [true, @out]
78
+ return [false, @out]
83
79
  end
84
-
85
- output "Files:"
86
- files.each {|f| output " #{f}\n" }
87
- output_newline
88
- dir = "#{sroot}/#{spath}"
89
- # FIXME - may or may not already exist
90
- result = system("ssh root@#{server} mkdir -p #{dir}")
91
-
92
- cmd = "scp -r #{files.join(' ')} root@#{server}:#{dir} >/dev/null 2>&1"
93
- output! "Publishing #{files.size} files...\n"
94
- result = system(cmd)
95
- raise PublishError unless result
80
+ RubyText.spinner { @blog.view.publish }
81
+ # user, server, sroot, spath = *@publish[@blog.view]
82
+ # if files.empty? # FIXME baloney
83
+ # output! "No files to publish"
84
+ # return [true, @out]
85
+ # end
86
+
87
+ # output "Files:"
88
+ # files.each {|f| output " #{f}\n" }
89
+ # output_newline
90
+ # dir = "#{sroot}/#{spath}"
91
+ # # FIXME - may or may not already exist
92
+ # result = system("ssh root@#{server} mkdir -p #{dir}")
93
+ #
94
+ # cmd = "scp -r #{files.join(' ')} root@#{server}:#{dir} >/dev/null 2>&1"
95
+ # output! "Publishing #{files.size} files...\n"
96
+ # result = system(cmd)
97
+ # raise PublishError unless result
96
98
 
97
99
  dump(files, "#{vdir}/last_published")
100
+ puts " ...finished"
98
101
  output! "...finished.\n"
99
- return [true, @out]
102
+ return [false, @out]
100
103
  end
101
104
 
102
105
  def cmd_rebuild(arg)
106
+ debug "Starting cmd_rebuild..."
103
107
  reset_output
104
108
  check_empty(arg)
105
109
  puts # CHANGE_FOR_CURSES?
@@ -201,7 +205,6 @@ module RuneBlog::REPL
201
205
  check_empty(arg)
202
206
  puts
203
207
  @blog.views.each do |v|
204
- debug "v = #{v.inspect}"
205
208
  v = v.to_s
206
209
  v = fx(v, :bold) if v == @blog.view.name
207
210
  print " "
data/lib/runeblog.rb CHANGED
@@ -298,6 +298,7 @@ class RuneBlog
298
298
  end
299
299
 
300
300
  def rebuild_post(file)
301
+ debug "Called rebuild_post(#{file.inspect})"
301
302
  raise ArgumentError unless file.is_a?(String)
302
303
  @meta = process_post(file)
303
304
  @meta.views.each do |view|
@@ -350,6 +351,7 @@ class RuneBlog
350
351
  end
351
352
 
352
353
  def make_slug(title, postnum = nil)
354
+ debug "title = #{title.inspect} (#{title.class})"
353
355
  raise ArgumentError unless title.is_a?(String)
354
356
  postnum ||= self.next_sequence
355
357
  num = '%04d' % postnum # FIXME can do better
data/lib/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  class RuneBlog
3
- VERSION = "0.1.10"
3
+ VERSION = "0.1.11"
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.10
4
+ version: 0.1.11
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-19 00:00:00.000000000 Z
11
+ date: 2018-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  version: '0'
75
75
  requirements: []
76
76
  rubyforge_project:
77
- rubygems_version: 2.2.2
77
+ rubygems_version: 2.7.7
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: A command-line blogging system