runeblog 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/blog +18 -3
- data/lib/global.rb +4 -0
- data/lib/helpers-repl.rb +54 -16
- data/lib/repl.rb +4 -0
- data/lib/runeblog.rb +2 -1
- data/lib/version.rb +1 -1
- data/lib/view.rb +10 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: aef7d403afc6196d75ad2f03efd4cd17f20e9e3afe553719caf8ea9417d27470
|
4
|
+
data.tar.gz: ee65d44e639ff13c4817fec44df9899d0f38fb234fbcc6d4e8e19bfbb25f5284
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dd26d351a24e5b558fb897fb7cc818d370a01688c7eba89e9296bf763e31c6faa57ab42342306bb5ddbb349b0744460f590fd7ba74c4da3b830aeab5d861785
|
7
|
+
data.tar.gz: 255a1a568efaf58bd4ebe8f8ed47a58244d59cc0d5d5c849c240698ca048a4265688322360f16ef158de5c6ec5fc5f0f43d5066e72fff88414244207813c8087
|
data/bin/blog
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
# $LOAD_PATH << "./lib"
|
4
4
|
|
5
|
+
require 'global'
|
6
|
+
require 'rubytext' if curses?
|
5
7
|
require 'readline'
|
6
8
|
|
7
9
|
require 'repl'
|
8
10
|
|
9
|
-
trap("INT") { }
|
11
|
+
# trap("INT") { }
|
10
12
|
|
11
13
|
include RuneBlog::REPL
|
12
14
|
|
@@ -34,7 +36,12 @@ if ! RuneBlog.exist?
|
|
34
36
|
end
|
35
37
|
|
36
38
|
def mainloop
|
37
|
-
|
39
|
+
if curses?
|
40
|
+
print red("blog> ")
|
41
|
+
cmd = gets
|
42
|
+
else
|
43
|
+
cmd = Readline.readline(red("\nblog> "), true)
|
44
|
+
end
|
38
45
|
cmd_quit(nil) if cmd.nil? # ^D
|
39
46
|
cmd.chomp!
|
40
47
|
return if cmd.empty? # CR does nothing
|
@@ -45,6 +52,14 @@ rescue => err
|
|
45
52
|
puts err
|
46
53
|
end
|
47
54
|
|
55
|
+
|
56
|
+
puts curses?
|
57
|
+
sleep 6
|
58
|
+
|
59
|
+
if curses?
|
60
|
+
RubyText.start(:echo, :noraw, log: "debug.out")
|
61
|
+
end
|
62
|
+
|
48
63
|
@blog = RuneBlog.new
|
49
64
|
|
50
65
|
if cmd.nil? # REPL
|
data/lib/global.rb
CHANGED
data/lib/helpers-repl.rb
CHANGED
@@ -6,7 +6,61 @@ make_exception(:CantDelete, "Can't open '$1'")
|
|
6
6
|
make_exception(:InternalError, "Glitch: $1 got arg '$2'")
|
7
7
|
make_exception(:CantCopy, "Can't copy $1 to $2")
|
8
8
|
|
9
|
+
module WithANSI
|
10
|
+
def clear
|
11
|
+
puts "\e[H\e[2J" # clear screen # CHANGE_FOR_CURSES?
|
12
|
+
end
|
13
|
+
|
14
|
+
def red(text)
|
15
|
+
"\e[31m#{text}\e[0m" # CHANGE_FOR_CURSES?
|
16
|
+
end
|
17
|
+
|
18
|
+
def blue(text)
|
19
|
+
"\e[34m#{text}\e[0m" # CHANGE_FOR_CURSES?
|
20
|
+
end
|
21
|
+
|
22
|
+
def bold(str)
|
23
|
+
"\e[1m#{str}\e[22m" # CHANGE_FOR_CURSES?
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
module NoANSI
|
29
|
+
|
30
|
+
def gets
|
31
|
+
str = ""
|
32
|
+
loop do
|
33
|
+
ch = ::STDSCR.getch
|
34
|
+
if ch == 10
|
35
|
+
# puts "\n\n "
|
36
|
+
break
|
37
|
+
end
|
38
|
+
str << ch
|
39
|
+
end
|
40
|
+
str
|
41
|
+
end
|
42
|
+
|
43
|
+
def clear
|
44
|
+
# puts "\e[H\e[2J" # clear screen # CHANGE_FOR_CURSES?
|
45
|
+
end
|
46
|
+
|
47
|
+
def red(text)
|
48
|
+
text
|
49
|
+
end
|
50
|
+
|
51
|
+
def blue(text)
|
52
|
+
text
|
53
|
+
end
|
54
|
+
|
55
|
+
def bold(str)
|
56
|
+
str
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
|
9
61
|
module RuneBlog::REPL
|
62
|
+
include curses? ? NoANSI : WithANSI
|
63
|
+
|
10
64
|
Patterns =
|
11
65
|
{"help" => :cmd_help,
|
12
66
|
"h" => :cmd_help,
|
@@ -160,22 +214,6 @@ module RuneBlog::REPL
|
|
160
214
|
end
|
161
215
|
end
|
162
216
|
|
163
|
-
def clear
|
164
|
-
puts "\e[H\e[2J" # clear screen # CHANGE_FOR_CURSES?
|
165
|
-
end
|
166
|
-
|
167
|
-
def red(text)
|
168
|
-
"\e[31m#{text}\e[0m" # CHANGE_FOR_CURSES?
|
169
|
-
end
|
170
|
-
|
171
|
-
def blue(text)
|
172
|
-
"\e[34m#{text}\e[0m" # CHANGE_FOR_CURSES?
|
173
|
-
end
|
174
|
-
|
175
|
-
def bold(str)
|
176
|
-
"\e[1m#{str}\e[22m" # CHANGE_FOR_CURSES?
|
177
|
-
end
|
178
|
-
|
179
217
|
def colored_slug(slug)
|
180
218
|
red(slug[0..3])+blue(slug[4..-1]) # CHANGE_FOR_CURSES?
|
181
219
|
end
|
data/lib/repl.rb
CHANGED
@@ -57,6 +57,10 @@ module RuneBlog::REPL
|
|
57
57
|
def cmd_publish(arg) # FIXME non-string return expected in caller?
|
58
58
|
reset_output
|
59
59
|
check_empty(arg)
|
60
|
+
unless @blog.view.can_publish?
|
61
|
+
output! "Can't publish without entries in #{@blog.view}/publish"
|
62
|
+
return @out
|
63
|
+
end
|
60
64
|
@blog.view.publish
|
61
65
|
user, server, sroot, spath = *@publish[@blog.view]
|
62
66
|
if files.empty? # FIXME baloney
|
data/lib/runeblog.rb
CHANGED
@@ -130,7 +130,8 @@ class RuneBlog
|
|
130
130
|
create_dir('custom')
|
131
131
|
create_dir('assets')
|
132
132
|
# FIXME dump method??
|
133
|
-
|
133
|
+
pub = "user: xxx\nserver: xxx\ndocroot: xxx\npath: xxx\nproto: xxx\n"
|
134
|
+
dump(pub, "publish") # FIXME publish
|
134
135
|
dump(x::BlogHeader, "custom/blog_header.html")
|
135
136
|
dump(x::BlogTrailer, "custom/blog_trailer.html")
|
136
137
|
dump(x::PostTemplate, "custom/post_template.html")
|
data/lib/version.rb
CHANGED
data/lib/view.rb
CHANGED
@@ -11,8 +11,12 @@ class RuneBlog::View
|
|
11
11
|
raise NoBlogAccessor if RuneBlog.blog.nil?
|
12
12
|
@blog = RuneBlog.blog
|
13
13
|
@name = name
|
14
|
-
|
15
|
-
|
14
|
+
@can_publish = false
|
15
|
+
pub_file = @blog.root + "/views/#@name/publish"
|
16
|
+
unless File.size(pub_file) == 0
|
17
|
+
@publisher = RuneBlog::Publishing.new(read_config(pub_file))
|
18
|
+
@can_publish = true
|
19
|
+
end
|
16
20
|
end
|
17
21
|
|
18
22
|
def dir
|
@@ -36,6 +40,10 @@ class RuneBlog::View
|
|
36
40
|
files
|
37
41
|
end
|
38
42
|
|
43
|
+
def can_publish?
|
44
|
+
@can_publish
|
45
|
+
end
|
46
|
+
|
39
47
|
def publish
|
40
48
|
# ?? @blog.view.publisher.publish
|
41
49
|
# output "Files:"
|
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.
|
4
|
+
version: 0.1.2
|
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-
|
11
|
+
date: 2018-11-14 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.
|
77
|
+
rubygems_version: 2.7.7
|
78
78
|
signing_key:
|
79
79
|
specification_version: 4
|
80
80
|
summary: A command-line blogging system
|