runeblog 0.2.56 → 0.2.57

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/blog +52 -4
  3. data/lib/runeblog_version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ccac3f162a763826c1eeaed68d656887860601c83b52a5df2ff1f25a42e54687
4
- data.tar.gz: 275a5ec1d3b89937fdd95ea051ed17d9dfba8b4d05448d67cb32a688255a270b
3
+ metadata.gz: 4bef2ece4e81cf77b6418ee5eec97c79a2bcffe8917da084759c96a079e84de7
4
+ data.tar.gz: 4f55658cc1592fb4af748286027c2b504160cd2c61a1c23e5260aa94e6ba1a22
5
5
  SHA512:
6
- metadata.gz: 5c1d684ff80ad64969f68d5cb753d6785551a45c8887786d9071bb79b4b6fed360776355201294779f38417615946ab351b071e03ca2ec25fbe1b5aa8484cc44
7
- data.tar.gz: 568cddf381190b876596952f87824e45689cb9b13e0ac9e52128504af42f24d414bc151b962d7255d07cb26f8bf2c78c5f021247f98026baabe5bd6645eff549
6
+ metadata.gz: 2bc13f4c60be93ed5ecf215990b60140bb5c977a0bb130d06bd830b656d86c1103ab88a4e3037e108ef1502fd583ac816d0239040d50f06340eef48835fbd0d9
7
+ data.tar.gz: 5f2a2257355c259b769b6d2625bb8918fc4d538e416d38485a8a8fb0f649ad65ec5ac3af17f7701d76a1c472cee4aa1f7f5b626b9ff501a12383f27fbb480b24
data/bin/blog CHANGED
@@ -9,9 +9,6 @@ require 'repl'
9
9
 
10
10
  include RuneBlog::REPL
11
11
 
12
- errfile = File.new("stderr.out", "w")
13
- STDERR.reopen(errfile)
14
-
15
12
  def get_started
16
13
  puts
17
14
  puts fx(<<-TEXT, :bold)
@@ -35,7 +32,53 @@ rescue => err
35
32
  puts err
36
33
  end
37
34
 
38
- ###
35
+ def cmdline_preview
36
+ _need_view
37
+ local = @blog.view.local_index
38
+ result = system("open #{local}")
39
+ end
40
+
41
+ def cmdline_publish
42
+ abort "Nor implemented yet"
43
+ _need_view
44
+ end
45
+
46
+ def cmdline_browse
47
+ abort "Nor implemented yet"
48
+ _need_view
49
+ end
50
+
51
+ def _need_view
52
+ @view = ARGV[1]
53
+ abort "Need 'view' parameter" if @view.nil?
54
+ abort "No such view '#{view}'" unless @blog.view?(@view)
55
+ end
56
+
57
+ def cmdline_rebuild
58
+ _need_view
59
+ puts "Generating view..."
60
+ @blog.generate_view(@view)
61
+ puts "Generating index..."
62
+ @blog.generate_index(@view)
63
+ end
64
+
65
+ def handle_cmdline
66
+ cmd = ARGV[0]
67
+ @blog = RuneBlog.new
68
+ abort "No blog found" if @blog.nil?
69
+
70
+ case cmd
71
+ when "rebuild"; cmdline_rebuild
72
+ when "publish"; cmdline_publish
73
+ when "preview"; cmdline_preview
74
+ when "browse"; cmdline_browse
75
+ else
76
+ puts "Command '#{cmd}' is unknown"
77
+ end
78
+ exit
79
+ end
80
+
81
+ ### Main
39
82
 
40
83
  major, minor = RUBY_VERSION.split(".").values_at(0,1)
41
84
  ver = major.to_i*10 + minor.to_i
@@ -43,6 +86,11 @@ abort "Need Ruby 2.4 or greater" unless ver >= 24
43
86
 
44
87
  include RuneBlog::Helpers # for try_read_config
45
88
 
89
+ handle_cmdline unless ARGV.empty?
90
+
91
+ errfile = File.new("stderr.out", "w")
92
+ STDERR.reopen(errfile)
93
+
46
94
  # read a .rubytext file here?? Call it something else?
47
95
  home = ENV['HOME']
48
96
  @fg, @bg = try_read_config("#{home}/.rubytext", fg: Blue, bg: White)
@@ -2,7 +2,7 @@
2
2
  if ! (Object.constants.include?(:RuneBlog) && RuneBlog.constants.include?(:Path))
3
3
 
4
4
  class RuneBlog
5
- VERSION = "0.2.56"
5
+ VERSION = "0.2.57"
6
6
 
7
7
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
8
8
  Path = File.dirname(path)
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.2.56
4
+ version: 0.2.57
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton