runeblog 0.2.56 → 0.2.57
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/blog +52 -4
- data/lib/runeblog_version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bef2ece4e81cf77b6418ee5eec97c79a2bcffe8917da084759c96a079e84de7
|
4
|
+
data.tar.gz: 4f55658cc1592fb4af748286027c2b504160cd2c61a1c23e5260aa94e6ba1a22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
data/lib/runeblog_version.rb
CHANGED