runeblog 0.1.84 → 0.1.85
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/helpers-blog.rb +17 -3
- data/lib/liveblog.rb +6 -1
- data/lib/post.rb +1 -0
- data/lib/runeblog.rb +36 -19
- data/lib/runeblog_version.rb +1 -1
- data/test/make_blog.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb6100ad69994f06dcb9d75dcef71d5f485f56119725efb419607c3ca5521b89
|
4
|
+
data.tar.gz: 025a5cc03d7203cd32db22c2bb283c3db7ad6aa1eb4b110ec5f1613bb5740fe9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b89cca81ab11b4a2b7ea4694cb0f9c6f875f0691629a7eb14daa4ce3dc6b77b167db71eb5be3abc4777da3940ccc62a250d513119cebe775f6af09bea50c781d
|
7
|
+
data.tar.gz: 7b495793aeb39e03d7ca07002c66fcf309d330fe877b712ceaa524cd7e09d8da25dae2d9fcfd64ba014aa291fc177981b254fc0d5063047142b38d65741ad43c
|
data/lib/helpers-blog.rb
CHANGED
@@ -65,6 +65,17 @@ module RuneBlog::Helpers
|
|
65
65
|
vals
|
66
66
|
end
|
67
67
|
|
68
|
+
def put_config(root:, view:"test_view", editor: "/bin/vim")
|
69
|
+
Dir.mkdir(root) unless Dir.exist?(root)
|
70
|
+
Dir.chdir(root) do
|
71
|
+
File.open("config", "w") do |cfg|
|
72
|
+
cfg.puts "root: #{root}"
|
73
|
+
cfg.puts "current_view: #{view}"
|
74
|
+
cfg.puts "editor: #{editor}"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
68
79
|
def write_config(obj, file)
|
69
80
|
hash = obj.to_h
|
70
81
|
# Dir.chdir(::Home)
|
@@ -86,9 +97,10 @@ module RuneBlog::Helpers
|
|
86
97
|
# end
|
87
98
|
end
|
88
99
|
|
89
|
-
def new_dotfile(root: "
|
90
|
-
|
91
|
-
|
100
|
+
def new_dotfile(root: ".blogs", current_view: "test_view", editor: "vi")
|
101
|
+
# raise BlogAlreadyExists if Dir.exist?(".blogs")
|
102
|
+
# Dir.mkdir(".blogs")
|
103
|
+
root = Dir.pwd + "/" + root
|
92
104
|
x = OpenStruct.new
|
93
105
|
x.root, x.current_view, x.editor = root, current_view, editor
|
94
106
|
write_config(x, ".blogs/" + RuneBlog::ConfigFile)
|
@@ -101,8 +113,10 @@ module RuneBlog::Helpers
|
|
101
113
|
end
|
102
114
|
|
103
115
|
def subdirs(dir)
|
116
|
+
STDERR.puts "== SUB dir = #{dir}"
|
104
117
|
verify(Dir.exist?(dir) => "Directory #{dir} not found")
|
105
118
|
dirs = Dir.entries(dir) - %w[. ..]
|
119
|
+
STDERR.puts "== SUB dirs = #{dirs.inspect}"
|
106
120
|
dirs.reject! {|x| ! File.directory?("#@root/views/#{x}") }
|
107
121
|
dirs
|
108
122
|
end
|
data/lib/liveblog.rb
CHANGED
@@ -20,7 +20,11 @@ STDERR.reopen(errfile)
|
|
20
20
|
=end
|
21
21
|
|
22
22
|
def init_liveblog # FIXME - a lot of this logic sucks
|
23
|
-
|
23
|
+
here = Dir.pwd
|
24
|
+
dir = here
|
25
|
+
loop { dir = Dir.pwd; break if File.exist?("config"); Dir.chdir("..") }
|
26
|
+
Dir.chdir(here)
|
27
|
+
@blog = $_blog = RuneBlog.new(dir)
|
24
28
|
@root = @blog.root
|
25
29
|
@view = @blog.view
|
26
30
|
@view_name = @blog.view.name
|
@@ -236,6 +240,7 @@ def finalize
|
|
236
240
|
@slug = @blog.make_slug(@meta)
|
237
241
|
slug_dir = @slug
|
238
242
|
@postdir = @blog.view.dir + "/posts/#{slug_dir}"
|
243
|
+
STDERR.puts "--- finalize: pwd = #{Dir.pwd} postdir = #@postdir"
|
239
244
|
write_post
|
240
245
|
@meta
|
241
246
|
end
|
data/lib/post.rb
CHANGED
data/lib/runeblog.rb
CHANGED
@@ -41,40 +41,54 @@ class RuneBlog
|
|
41
41
|
|
42
42
|
include Helpers
|
43
43
|
|
44
|
-
def self.create_new_blog_repo(
|
44
|
+
def self.create_new_blog_repo(dir = ".blogs")
|
45
45
|
raise ArgumentError unless dir.is_a?(String) && ! dir.empty?
|
46
46
|
root_dir = Dir.pwd + "/" + dir
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
self.create(dir)
|
48
|
+
rescue => err
|
49
|
+
puts "Can't create blog repo: '#{dir}' - #{err}"
|
50
|
+
puts err.backtrace.join("\n")
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.create(root = ".blogs")
|
54
|
+
# Crude - FIXME later - # What views are there? Publishing, etc.
|
55
|
+
self.blog = self # Weird. Like a singleton - dumbass circular dependency?
|
56
|
+
$_blog = self # Dumber still?
|
57
|
+
root = Dir.pwd + "/" + root
|
58
|
+
raise BlogRepoAlreadyExists if Dir.exist?(root)
|
59
|
+
create_dir(root)
|
60
|
+
Dir.chdir(root) do
|
51
61
|
create_dir("drafts")
|
52
62
|
create_dir("views")
|
53
63
|
#? create_dir("assets")
|
54
64
|
new_sequence
|
55
65
|
end
|
56
|
-
|
57
|
-
blog.
|
58
|
-
|
59
|
-
|
60
|
-
|
66
|
+
put_config(root: root)
|
67
|
+
@blog = self.new(root)
|
68
|
+
@blog.create_view("test_view")
|
69
|
+
@blog
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.open(root = ".blogs")
|
73
|
+
# Crude - FIXME later - # What views are there? Publishing, etc.
|
74
|
+
self.blog = self # Weird. Like a singleton - dumbass circular dependency?
|
75
|
+
$_blog = self # Dumber still?
|
76
|
+
root = Dir.pwd + "/" + root
|
77
|
+
blog = self.new(root)
|
61
78
|
end
|
62
79
|
|
63
|
-
def initialize(
|
80
|
+
def initialize(root_dir = ".blogs") # always assumes existing blog
|
64
81
|
# Crude - FIXME later - # What views are there? Publishing, etc.
|
65
82
|
self.class.blog = self # Weird. Like a singleton - dumbass circular dependency?
|
66
83
|
$_blog = self # Dumber still?
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
end
|
72
|
-
file = dir.empty? ? ConfigFile : dir + "/" + ConfigFile
|
84
|
+
|
85
|
+
@root = root_dir
|
86
|
+
file = @root + "/" + ConfigFile
|
87
|
+
STDERR.puts "--- init: file = #{file}"
|
73
88
|
errmsg = "No config file! file = #{file.inspect} dir = #{Dir.pwd}"
|
74
89
|
raise errmsg unless File.exist?(file)
|
75
|
-
# Hmm. current_view doesn't belong?
|
76
|
-
@root, @view_name, @editor = read_config(file, :root, :current_view, :editor)
|
77
90
|
|
91
|
+
@root, @view_name, @editor = read_config(file, :root, :current_view, :editor)
|
78
92
|
md = Dir.pwd.match(%r[.*/views/(.*?)/])
|
79
93
|
@view_name = md[1] if md
|
80
94
|
@views = get_views
|
@@ -348,6 +362,8 @@ class RuneBlog
|
|
348
362
|
raise "No .views call!" if view_line.size < 1
|
349
363
|
view_line = view_line.first
|
350
364
|
views = view_line[7..-1].split
|
365
|
+
STDERR.puts "--- gv: #{views.inspect}"
|
366
|
+
views
|
351
367
|
end
|
352
368
|
|
353
369
|
# Remember: A post in multiple views will trigger multiple
|
@@ -393,6 +409,7 @@ class RuneBlog
|
|
393
409
|
copy(lt3, staging)
|
394
410
|
html = noext[5..-1]
|
395
411
|
Dir.chdir(staging) do
|
412
|
+
STDERR.puts "--- gp: pwd = #{Dir.pwd} draft = #{draft} html = #{html}"
|
396
413
|
livetext draft, html
|
397
414
|
# link to POST??
|
398
415
|
copy html, "../remote"
|
data/lib/runeblog_version.rb
CHANGED
data/test/make_blog.rb
CHANGED
@@ -38,14 +38,14 @@ end
|
|
38
38
|
puts
|
39
39
|
|
40
40
|
system("rm -rf .blogs")
|
41
|
-
RuneBlog.create_new_blog_repo(
|
42
|
-
x = RuneBlog.new
|
41
|
+
RuneBlog.create_new_blog_repo(".blogs")
|
42
|
+
x = RuneBlog.new(".blogs")
|
43
43
|
|
44
44
|
x.create_view("around_austin") # FIXME remember view title!
|
45
45
|
|
46
46
|
# Hack:
|
47
47
|
if File.exist?("publish")
|
48
|
-
system("cp publish .blogs/
|
48
|
+
system("cp publish .blogs/views/around_austin/publish")
|
49
49
|
end
|
50
50
|
|
51
51
|
x.create_view("computing")
|
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.85
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hal Fulton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: livetext
|