runeblog 0.0.93 → 0.0.94
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/{skeleton.rb → global.rb} +4 -0
- data/lib/helpers-repl.rb +2 -1
- data/lib/post.rb +21 -25
- data/lib/repl.rb +1 -0
- data/lib/runeblog.rb +9 -9
- data/lib/version.rb +1 -1
- data/test/general.rb +2 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8720cc6cf31c380400565dcc8868cd9ac9f6d72
|
4
|
+
data.tar.gz: ca565aeecf8cd0532f2bdd415923fab0240400d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c923e9f2283b3bbd51852f421821243c526b98d880fd12b7061d8dcba41254d0b7bbfb1b43fadf8ff302d516bb68466f406a260b5969b0d0b0829e7da8e8224
|
7
|
+
data.tar.gz: 87c4b6432312db1c69bde589df6df01913829a4e7b54f6d064b6cc0ceaa5c8360176da304ad8e8602c9f482193dc13c8b5755017f15acb984d6c05f88748f08c
|
data/lib/helpers-repl.rb
CHANGED
@@ -32,6 +32,7 @@ module RuneBlog::REPL
|
|
32
32
|
"lsd" => :cmd_list_drafts,
|
33
33
|
|
34
34
|
"rm $postid" => :cmd_remove_post,
|
35
|
+
"undel $postid" => :cmd_undelete_post,
|
35
36
|
|
36
37
|
"kill >postid" => :cmd_kill,
|
37
38
|
|
@@ -179,7 +180,7 @@ module RuneBlog::REPL
|
|
179
180
|
|
180
181
|
def import(arg = nil)
|
181
182
|
# open_blog unless @blog
|
182
|
-
|
183
|
+
raise "Not implemented at present..."
|
183
184
|
arg = nil if arg == ""
|
184
185
|
arg ||= ask("Filename: ") # check validity later
|
185
186
|
name = arg
|
data/lib/post.rb
CHANGED
@@ -11,7 +11,7 @@ class RuneBlog::Post
|
|
11
11
|
|
12
12
|
def self.files(num, root)
|
13
13
|
files = Find.find(root).to_a
|
14
|
-
result = files.grep(/#{
|
14
|
+
result = files.grep(/#{prefix(num)}-/)
|
15
15
|
result
|
16
16
|
end
|
17
17
|
|
@@ -86,34 +86,30 @@ class RuneBlog::Post
|
|
86
86
|
|
87
87
|
def make_slug(postnum = nil)
|
88
88
|
postnum ||= @blog.next_sequence
|
89
|
-
num =
|
89
|
+
num = prefix(postnum) # FIXME can do better
|
90
90
|
slug = @title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
|
91
91
|
[postnum, "#{num}-#{slug}"]
|
92
92
|
end
|
93
93
|
|
94
|
-
def
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
hash.
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
fields.each do |fld|
|
114
|
-
f2.puts "#{fld}: #{hash[fld]}"
|
94
|
+
def write_metadata(meta)
|
95
|
+
fname2 = "metadata.txt"
|
96
|
+
hash = meta.to_h
|
97
|
+
|
98
|
+
File.write("teaser.txt", hash[:teaser])
|
99
|
+
File.write("body.txt", hash[:body])
|
100
|
+
hash.delete(:teaser)
|
101
|
+
hash.delete(:body)
|
102
|
+
|
103
|
+
hash[:views] = hash[:views].join(" ")
|
104
|
+
hash[:tags] = hash[:tags].join(" ")
|
105
|
+
|
106
|
+
fields = [:title, :date, :pubdate, :views, :tags]
|
107
|
+
|
108
|
+
f2 = File.new(fname2, "w")
|
109
|
+
fields.each do |fld|
|
110
|
+
f2.puts "#{fld}: #{hash[fld]}"
|
111
|
+
end
|
112
|
+
f2.close
|
115
113
|
end
|
116
|
-
f2.close
|
117
|
-
end
|
118
114
|
|
119
115
|
end
|
data/lib/repl.rb
CHANGED
@@ -274,6 +274,7 @@ module RuneBlog::REPL
|
|
274
274
|
|
275
275
|
#{red('rm ID ')} Remove a post
|
276
276
|
#{red('kill ID ID ID... ')} Remove multiple posts
|
277
|
+
#{red('undelete ID ')} Undelete a post
|
277
278
|
#{red('edit ID ')} Edit a post
|
278
279
|
|
279
280
|
#{red('preview ')} Look at current (local) view in browser
|
data/lib/runeblog.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'find'
|
2
2
|
require 'livetext'
|
3
|
-
require '
|
3
|
+
require 'global'
|
4
4
|
require 'helpers-blog'
|
5
5
|
require 'default'
|
6
6
|
require 'view'
|
@@ -158,7 +158,7 @@ class RuneBlog
|
|
158
158
|
def files_by_id(id) # FIXME get rid of this later
|
159
159
|
raise ArgumentError unless id.is_a?(Integer)
|
160
160
|
files = Find.find(self.view.dir).to_a
|
161
|
-
tag =
|
161
|
+
tag = prefix(id)
|
162
162
|
result = files.grep(/#{tag}-/)
|
163
163
|
result
|
164
164
|
end
|
@@ -175,9 +175,9 @@ class RuneBlog
|
|
175
175
|
puts err # error(err)
|
176
176
|
end
|
177
177
|
|
178
|
-
def edit_initial_post(file)
|
179
|
-
sourcefile "#@root/src/#{file}"
|
180
|
-
result = system("#@editor #{sourcefile} +8")
|
178
|
+
def edit_initial_post(file, testing = false)
|
179
|
+
sourcefile = "#@root/src/#{file}"
|
180
|
+
result = system("#@editor #{sourcefile} +8") unless testing
|
181
181
|
raise EditorProblem(sourcefile) unless result
|
182
182
|
nil
|
183
183
|
rescue => err
|
@@ -314,8 +314,8 @@ class RuneBlog
|
|
314
314
|
|
315
315
|
def remove_post(num)
|
316
316
|
raise ArgumentError unless num.is_a?(Integer)
|
317
|
-
|
318
|
-
|
317
|
+
tag = prefix(num)
|
318
|
+
files = Find.find(self.view.dir).to_a
|
319
319
|
list = files.select {|x| File.directory?(x) and x =~ /#{tag}/ }
|
320
320
|
return nil if list.empty?
|
321
321
|
dest = list.map {|f| f.sub(/(?<num>\d{4}-)/, "_\\k<num>") }
|
@@ -330,7 +330,7 @@ class RuneBlog
|
|
330
330
|
def undelete_post(num)
|
331
331
|
raise ArgumentError unless num.is_a?(Integer)
|
332
332
|
files = Find.find("#@root/views/").to_a
|
333
|
-
tag =
|
333
|
+
tag = prefix(num)
|
334
334
|
list = files.select {|x| File.directory?(x) and x =~ /_#{tag}/ }
|
335
335
|
return nil if list.empty?
|
336
336
|
dest = list.map {|f| f.sub(/_(?<num>\d{4}-)/, "\\k<num>") }
|
@@ -344,7 +344,7 @@ class RuneBlog
|
|
344
344
|
|
345
345
|
def delete_draft(num)
|
346
346
|
raise ArgumentError unless num.is_a?(Integer)
|
347
|
-
tag =
|
347
|
+
tag = prefix(num)
|
348
348
|
system("rm -rf #@root/src/#{tag}-*")
|
349
349
|
end
|
350
350
|
|
data/lib/version.rb
CHANGED
data/test/general.rb
CHANGED
@@ -246,14 +246,10 @@ end # conditional tests
|
|
246
246
|
end
|
247
247
|
|
248
248
|
def test_023_exception_view_already_exists
|
249
|
-
assert_raises(ViewAlreadyExists) { @blog.
|
249
|
+
assert_raises(ViewAlreadyExists) { @blog.create_view('alpha_view') }
|
250
250
|
end
|
251
251
|
|
252
|
-
def
|
253
|
-
assert_raises(EditorProblem) { @blog.edit_initial_post(999) }
|
254
|
-
end
|
255
|
-
|
256
|
-
def xtest_025_exception_livetext_error # FIXME Doesn't work! Change Livetext
|
252
|
+
def xtest_024_exception_livetext_error # FIXME Doesn't work! Change Livetext
|
257
253
|
testfile = "testfile.lt3"
|
258
254
|
path = @blog.root + "/src/" + testfile
|
259
255
|
cmd = "echo .no_such_command > #{path}"
|
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.94
|
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-10-
|
11
|
+
date: 2018-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: livetext
|
@@ -43,12 +43,12 @@ files:
|
|
43
43
|
- bin/blog
|
44
44
|
- lib/default.rb
|
45
45
|
- lib/deploy.rb
|
46
|
+
- lib/global.rb
|
46
47
|
- lib/helpers-blog.rb
|
47
48
|
- lib/helpers-repl.rb
|
48
49
|
- lib/post.rb
|
49
50
|
- lib/repl.rb
|
50
51
|
- lib/runeblog.rb
|
51
|
-
- lib/skeleton.rb
|
52
52
|
- lib/version.rb
|
53
53
|
- lib/view.rb
|
54
54
|
- test/general.rb
|