runeblog 0.0.60 → 0.0.61
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.
- checksums.yaml +4 -4
- data/data/VERSION +1 -1
- data/lib/repl.rb +20 -27
- data/lib/runeblog.rb +26 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca2648e3bcca270f74671363c314ad6fad4b9807
|
4
|
+
data.tar.gz: 36f7b4d7cb14e872848fb3348ee33f477718708c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdfe7950cd8d63d055216891a7dd4f260f92230af319bacb65b7483707750219cd603300a5ce990869c7d1a7f2ad0c0728970ae86b0276a481d62c2aeb0d5b4d
|
7
|
+
data.tar.gz: e6f3d5e7d4b31c059a835c4d52c9e73a5f83222f8cdbaa83d8203164cef576b2dc9a47f1f9c965e8e5f266ca2fe1585f0b2a117fb7837879a311669692bf0e10
|
data/data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
RuneBlog v 0.0.
|
1
|
+
RuneBlog v 0.0.61 2018-09-17
|
data/lib/repl.rb
CHANGED
@@ -21,13 +21,11 @@ module RuneBlog::REPL
|
|
21
21
|
def cmd_browse
|
22
22
|
reset_output
|
23
23
|
check_empty(arg)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
user, server, sroot, spath = *lines
|
30
|
-
url = "http://#{server}/#{spath}"
|
24
|
+
url = @blog.deployment_url
|
25
|
+
if url.nil?
|
26
|
+
output! "Deploy first."
|
27
|
+
return @out
|
28
|
+
end
|
31
29
|
result = system("open '#{url}'")
|
32
30
|
raise CantOpen, url unless result
|
33
31
|
nil
|
@@ -48,20 +46,10 @@ module RuneBlog::REPL
|
|
48
46
|
# TBD clunky FIXME
|
49
47
|
reset_output
|
50
48
|
check_empty(arg)
|
51
|
-
|
52
|
-
deployment = @blog.viewdir(@view) + "deploy"
|
53
|
-
check_file_exists(deployment)
|
54
|
-
|
55
|
-
lines = File.readlines(deployment).map {|x| x.chomp }
|
56
|
-
@deploy[@view] = lines
|
57
|
-
user, server, sroot, spath = *lines
|
58
|
-
vdir = @blog.viewdir(@view)
|
59
|
-
files = ["#{vdir}/index.html"]
|
60
|
-
files += Dir.entries(vdir).grep(/^\d\d\d\d/).map {|x| "#{vdir}/#{x}" }
|
61
|
-
files.reject! {|f| File.mtime(f) < File.mtime("#{vdir}/last_deployed") }
|
49
|
+
user, server, sroot, spath = *@deploy[@view]
|
62
50
|
if files.empty?
|
63
|
-
|
64
|
-
return
|
51
|
+
output! "No files to deploy"
|
52
|
+
return @out
|
65
53
|
end
|
66
54
|
|
67
55
|
output "Files:"
|
@@ -70,6 +58,7 @@ module RuneBlog::REPL
|
|
70
58
|
dir = "#{sroot}/#{spath}"
|
71
59
|
# FIXME - may or may not already exist
|
72
60
|
result = system("ssh root@#{server} mkdir #{dir}")
|
61
|
+
# ^ needs -c??
|
73
62
|
|
74
63
|
cmd = "scp -r #{files.join(' ')} root@#{server}:#{dir} >/dev/null 2>&1"
|
75
64
|
output! "Deploying #{files.size} files...\n"
|
@@ -87,7 +76,7 @@ module RuneBlog::REPL
|
|
87
76
|
reset_output
|
88
77
|
check_empty(arg)
|
89
78
|
puts
|
90
|
-
#
|
79
|
+
# Simplify this
|
91
80
|
files = Dir.entries("#@root/src/").grep /\d\d\d\d.*.lt3$/
|
92
81
|
files.map! {|f| File.basename(f) }
|
93
82
|
files = files.sort.reverse
|
@@ -142,7 +131,7 @@ module RuneBlog::REPL
|
|
142
131
|
def cmd_new_view(arg)
|
143
132
|
reset_output
|
144
133
|
arg ||= ask("New view: ") # check validity later
|
145
|
-
|
134
|
+
@blog.create_view(arg)
|
146
135
|
return nil
|
147
136
|
rescue => err
|
148
137
|
error(err)
|
@@ -171,11 +160,8 @@ module RuneBlog::REPL
|
|
171
160
|
|
172
161
|
def cmd_remove_post(arg, safe=true)
|
173
162
|
reset_output
|
174
|
-
# err = "'#{arg}' is not an integer"
|
175
163
|
id = get_integer(arg)
|
176
|
-
|
177
|
-
files = Find.find(@root).to_a
|
178
|
-
files = files.grep(/#{tag}-/)
|
164
|
+
files = @blog.files_by_id(id)
|
179
165
|
if files.empty?
|
180
166
|
output! "No such post found (#{id})"
|
181
167
|
return @out
|
@@ -184,7 +170,7 @@ module RuneBlog::REPL
|
|
184
170
|
if safe
|
185
171
|
output_newline
|
186
172
|
files.each {|f| outstr " #{f}\n" }
|
187
|
-
|
173
|
+
# puts @out # ??
|
188
174
|
reset_output
|
189
175
|
ques = "\n Delete?\n "
|
190
176
|
ques.sub!(/\?/, " all these?") if files.size > 1
|
@@ -321,6 +307,13 @@ module RuneBlog::REPL
|
|
321
307
|
@view = @blog.view # current view
|
322
308
|
@sequence = @blog.sequence
|
323
309
|
@root = @blog.root
|
310
|
+
@deploy ||= {}
|
311
|
+
@blog.views.each do |view|
|
312
|
+
deployment = @blog.viewdir(@view) + "deploy"
|
313
|
+
check_file_exists(deployment)
|
314
|
+
lines = File.readlines(deployment).map {|x| x.chomp }
|
315
|
+
@deploy[@view] = lines
|
316
|
+
end
|
324
317
|
@blog
|
325
318
|
rescue => err
|
326
319
|
error(err)
|
data/lib/runeblog.rb
CHANGED
@@ -3,16 +3,18 @@ require 'yaml'
|
|
3
3
|
require 'livetext'
|
4
4
|
|
5
5
|
class RuneBlog
|
6
|
-
VERSION = "0.0.
|
6
|
+
VERSION = "0.0.61"
|
7
7
|
|
8
8
|
Path = File.expand_path(File.join(File.dirname(__FILE__)))
|
9
9
|
DefaultData = Path + "/../data"
|
10
10
|
|
11
11
|
BlogHeaderPath = DefaultData + "/custom/blog_header.html"
|
12
12
|
BlogTrailerPath = DefaultData + "/custom/blog_trailer.html"
|
13
|
+
BlogTemplatePath = DefaultData + "/custom/blog_trailer.html"
|
13
14
|
|
14
15
|
BlogHeader = File.read(BlogHeaderPath) rescue "not found"
|
15
16
|
BlogTrailer = File.read(BlogTrailerPath) rescue "not found"
|
17
|
+
BlogTemplate = File.read(BlogTemplatePath) rescue "not found"
|
16
18
|
|
17
19
|
attr_reader :root, :views, :view, :sequence
|
18
20
|
attr_writer :view # FIXME
|
@@ -56,7 +58,7 @@ class RuneBlog
|
|
56
58
|
File.exist?(".blog")
|
57
59
|
end
|
58
60
|
|
59
|
-
def create_view(
|
61
|
+
def create_view(arg)
|
60
62
|
raise "view #{arg} already exists" if self.views.include?(arg)
|
61
63
|
|
62
64
|
dir = @root + "/views/" + arg + "/"
|
@@ -64,13 +66,34 @@ class RuneBlog
|
|
64
66
|
create_dir(dir + 'assets')
|
65
67
|
File.open(dir + "deploy", "w") { } # FIXME
|
66
68
|
|
67
|
-
# Something more like this? RuneBlog.new_view(arg)
|
68
69
|
File.write(dir + "custom/blog_header.html", RuneBlog::BlogHeader)
|
69
70
|
File.write(dir + "custom/blog_trailer.html", RuneBlog::BlogTrailer)
|
71
|
+
File.write(dir + "custom/post_template.html", RuneBlog::BlogTemplate)
|
70
72
|
File.write(dir + "last_deployed", "Initial creation")
|
71
73
|
self.views << arg
|
72
74
|
end
|
73
75
|
|
76
|
+
def deployment_url
|
77
|
+
return nil unless @deploy[@view]
|
78
|
+
lines = @deploy[@view]
|
79
|
+
user, server, sroot, spath = *@deploy[@view]
|
80
|
+
url = "http://#{server}/#{spath}"
|
81
|
+
end
|
82
|
+
|
83
|
+
def view_files
|
84
|
+
vdir = @blog.viewdir(@view)
|
85
|
+
# meh
|
86
|
+
files = ["#{vdir}/index.html"]
|
87
|
+
files += Dir.entries(vdir).grep(/^\d\d\d\d/).map {|x| "#{vdir}/#{x}" }
|
88
|
+
files.reject! {|f| File.mtime(f) < File.mtime("#{vdir}/last_deployed") }
|
89
|
+
end
|
90
|
+
|
91
|
+
def files_by_id(id)
|
92
|
+
files = Find.find(@root).to_a
|
93
|
+
tag = "#{'%04d' % id}"
|
94
|
+
files.grep(/#{tag}-/)
|
95
|
+
end
|
96
|
+
|
74
97
|
def create_new_post(title, view=nil)
|
75
98
|
view ||= @view
|
76
99
|
date = Time.now.strftime("%Y-%m-%d")
|
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.0.
|
4
|
+
version: 0.0.61
|
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-09-
|
11
|
+
date: 2018-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: livetext
|