runeblog 0.2.69 → 0.2.70
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/EDITOR +1 -0
- data/data/ROOT +1 -0
- data/data/VIEW +1 -0
- data/lib/helpers-blog.rb +13 -32
- data/lib/liveblog.rb +1 -1
- data/lib/repl.rb +1 -1
- data/lib/runeblog.rb +11 -25
- data/lib/runeblog_version.rb +1 -1
- data/runeblog.gemspec +2 -1
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0d49c8d62c0c29650322fcff89f90294b364bd631ab2c678e6fe79a5db478c3
|
4
|
+
data.tar.gz: e6c772a8d7cdb0a5032fee2a3ed09179a1eb6acc60278c443e40b96e8cb8d7f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecaacf45f6a89e49204df2ca539f17bd1635cf9cd346d2212c73de6e35aa459cbde02dfb6a1376b491e9290730af11e962e7f5c120b4d7f23cc8aa36f2a08fe9
|
7
|
+
data.tar.gz: c14a8482023fa93f8efa06d1f728f8d314028176f1ea003191a547a5795338fc6e4c4e232d0109e165dadf0ce50c329847d166e83d1dadba4d8d9d15f4680120
|
data/data/EDITOR
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
/usr/local/bin/vim
|
data/data/ROOT
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
/FULL/PATH/.blogs
|
data/data/VIEW
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
[no view]
|
data/lib/helpers-blog.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'runeblog_version'
|
2
2
|
require 'fileutils'
|
3
3
|
|
4
|
+
require 'pathmagic'
|
4
5
|
require 'xlate'
|
5
6
|
|
6
7
|
module RuneBlog::Helpers
|
@@ -19,46 +20,26 @@ module RuneBlog::Helpers
|
|
19
20
|
puts " Failed: #{cmd} - from #{caller[0]}" unless rc
|
20
21
|
end
|
21
22
|
|
22
|
-
def
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
lines.each do |line|
|
27
|
-
next if line == "\n" || line[0] == "#"
|
28
|
-
key, val = line.split(/: +/, 2)
|
29
|
-
obj.send(key+"=", val)
|
23
|
+
def copy_data(tag, dest)
|
24
|
+
data = RuneBlog::Path/"../data" # files kept inside gem
|
25
|
+
case tag
|
26
|
+
when :config; files = %w[ROOT VIEW EDITOR]
|
30
27
|
end
|
31
|
-
|
28
|
+
files.each {|file| copy(data/file, dest) }
|
29
|
+
end
|
32
30
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
39
|
-
return vals
|
31
|
+
def read_config
|
32
|
+
log!(enter: __method__, level: 3)
|
33
|
+
@editor = File.read("data/EDITOR").chomp
|
34
|
+
@current_view = File.read("data/VIEW").chomp
|
35
|
+
@root = File.read("data/EDITOR").chomp
|
40
36
|
rescue => err
|
41
|
-
puts "Can't read config
|
37
|
+
puts "Can't read config: #{err}"
|
42
38
|
puts err.backtrace.join("\n")
|
43
39
|
puts "dir = #{Dir.pwd}"
|
44
40
|
exit
|
45
41
|
end
|
46
42
|
|
47
|
-
def try_read_config(file, hash)
|
48
|
-
log!(enter: __method__, args: [file, hash], level: 3)
|
49
|
-
return hash.values unless File.exist?(file)
|
50
|
-
vals = read_config(file, *hash.keys)
|
51
|
-
vals
|
52
|
-
end
|
53
|
-
|
54
|
-
def write_config(obj, file)
|
55
|
-
log!(enter: __method__, args: [obj, file], level: 2)
|
56
|
-
hash = obj.to_h
|
57
|
-
File.open(file, "w") do |out|
|
58
|
-
hash.each_pair {|key, val| out.puts "#{key}: #{val}" }
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
43
|
def get_views # read from filesystem
|
63
44
|
log!(enter: __method__, level: 3)
|
64
45
|
dirs = subdirs("#@root/views/").sort
|
data/lib/liveblog.rb
CHANGED
@@ -11,7 +11,7 @@ require 'xlate'
|
|
11
11
|
def init_liveblog # FIXME - a lot of this logic sucks
|
12
12
|
here = Dir.pwd
|
13
13
|
dir = here
|
14
|
-
loop { dir = Dir.pwd; break if File.exist?("
|
14
|
+
loop { dir = Dir.pwd; break if File.exist?("data/ROOT"); Dir.chdir("..") }
|
15
15
|
Dir.chdir(here) # here??? or dir??
|
16
16
|
@blog = RuneBlog.new(dir)
|
17
17
|
@root = @blog.root
|
data/lib/repl.rb
CHANGED
data/lib/runeblog.rb
CHANGED
@@ -19,7 +19,6 @@ require 'pathmagic'
|
|
19
19
|
class RuneBlog
|
20
20
|
|
21
21
|
DotDir = ".blogs"
|
22
|
-
ConfigFile = "config"
|
23
22
|
Themes = RuneBlog::Path/"../themes"
|
24
23
|
|
25
24
|
make_exception(:FileNotFound, "File $1 was not found")
|
@@ -53,34 +52,25 @@ class RuneBlog
|
|
53
52
|
puts "Error: See #{out}"
|
54
53
|
end
|
55
54
|
|
56
|
-
def self.create_new_blog_repo(
|
57
|
-
log!(enter: __method__, args: [
|
58
|
-
raise ArgumentError unless
|
59
|
-
root_dir = Dir.pwd/
|
60
|
-
self.create(dir)
|
61
|
-
rescue => err
|
62
|
-
puts "Can't create blog repo: '#{dir}' - #{err}"
|
63
|
-
puts err.backtrace.join("\n")
|
64
|
-
end
|
65
|
-
|
66
|
-
def self.create(root = ".blogs")
|
67
|
-
log!(enter: __method__, args: [root], level: 1)
|
55
|
+
def self.create_new_blog_repo(root = ".blogs")
|
56
|
+
log!(enter: __method__, args: [root])
|
57
|
+
raise ArgumentError unless root.is_a?(String) && ! root.empty?
|
58
|
+
root_dir = Dir.pwd/root
|
68
59
|
# Crude - FIXME later - # What views are there? Publishing, etc.
|
69
60
|
self.blog = self # Weird. Like a singleton - dumbass circular dependency?
|
70
61
|
root = Dir.pwd/root
|
71
62
|
raise BlogRepoAlreadyExists if Dir.exist?(root)
|
72
63
|
create_dirs(root)
|
73
64
|
Dir.chdir(root) do
|
74
|
-
create_dirs(:drafts, :views, :posts)
|
65
|
+
create_dirs(:data, :drafts, :views, :posts)
|
66
|
+
copy_data(:config, "./data/")
|
75
67
|
new_sequence
|
76
68
|
end
|
77
|
-
x = OpenStruct.new
|
78
|
-
x.root, x.current_view, x.editor = root, "test_view", "/usr/bin/vim " # dumb - FIXME later
|
79
|
-
write_config(x, root/ConfigFile)
|
80
69
|
@blog = self.new(root)
|
81
70
|
@blog
|
82
71
|
rescue => err
|
83
|
-
|
72
|
+
puts "Can't create blog repo: '#{root}' - #{err}"
|
73
|
+
puts err.backtrace.join("\n")
|
84
74
|
end
|
85
75
|
|
86
76
|
def self.open(root = ".blogs")
|
@@ -99,11 +89,7 @@ class RuneBlog
|
|
99
89
|
self.class.blog = self # Weird. Like a singleton - dumbass circular dependency?
|
100
90
|
|
101
91
|
@root = root_dir
|
102
|
-
|
103
|
-
errmsg = "No config file! file = #{file.inspect} dir = #{Dir.pwd}"
|
104
|
-
raise errmsg unless File.exist?(file)
|
105
|
-
|
106
|
-
@root, @view_name, @editor = read_config(file, :root, :current_view, :editor)
|
92
|
+
read_config
|
107
93
|
md = Dir.pwd.match(%r[.*/views/(.*?)/])
|
108
94
|
@view_name = md[1] if md
|
109
95
|
@views = get_views
|
@@ -204,6 +190,7 @@ class RuneBlog
|
|
204
190
|
|
205
191
|
def view=(arg)
|
206
192
|
log!(enter: __method__, args: [arg], level: 2)
|
193
|
+
# FIXME should write VIEW file?
|
207
194
|
case arg
|
208
195
|
when RuneBlog::View
|
209
196
|
@view = arg
|
@@ -429,8 +416,7 @@ class RuneBlog
|
|
429
416
|
log!(enter: __method__, args: [view], level: 3)
|
430
417
|
raise ArgumentError unless view.is_a?(String) || view.is_a?(RuneBlog::View)
|
431
418
|
x = OpenStruct.new
|
432
|
-
|
433
|
-
write_config(x, @root/ConfigFile)
|
419
|
+
File.write(@root/"data/VIEW", view.to_s)
|
434
420
|
self.view = view # error checking?
|
435
421
|
end
|
436
422
|
|
data/lib/runeblog_version.rb
CHANGED
data/runeblog.gemspec
CHANGED
@@ -28,11 +28,12 @@ spec = Gem::Specification.new do |s|
|
|
28
28
|
# Files...
|
29
29
|
main = Find.find("bin").to_a +
|
30
30
|
Find.find("lib").to_a
|
31
|
+
data = Find.find("data").to_a
|
31
32
|
test = Find.find("test").to_a
|
32
33
|
misc = %w[./README.lt3 ./README.md ./runeblog.gemspec]
|
33
34
|
empty_view = Find.find("empty_view").to_a
|
34
35
|
|
35
|
-
s.files = main + misc + test + empty_view
|
36
|
+
s.files = main + misc + data + test + empty_view
|
36
37
|
s.homepage = 'https://github.com/Hal9000/runeblog'
|
37
38
|
s.license = "Ruby"
|
38
39
|
s.post_install_message = "\n Success! Run 'blog' command and type h for help.\n "
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: runeblog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.70
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hal Fulton
|
@@ -76,6 +76,9 @@ files:
|
|
76
76
|
- "./runeblog.gemspec"
|
77
77
|
- bin/blog
|
78
78
|
- bin/mkwidget
|
79
|
+
- data/EDITOR
|
80
|
+
- data/ROOT
|
81
|
+
- data/VIEW
|
79
82
|
- empty_view/assets/austin-pano.jpg
|
80
83
|
- empty_view/assets/sky2.jpg
|
81
84
|
- empty_view/remote/assets/GIT_IS_DUMB
|