runeblog 0.0.83 → 0.0.84
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/blog +3 -0
- data/lib/helpers-blog.rb +13 -19
- data/lib/repl.rb +1 -1
- data/lib/runeblog.rb +12 -8
- data/lib/version.rb +1 -1
- data/test/make_blog.rb +2 -2
- 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: 5c8bcdac0cac7185eae4df854af9578b88068e70
|
4
|
+
data.tar.gz: 45499a0fa575d8f2e491300e77ea9108f7eb5ca6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66ea3cf6ee070ce80f94e7ab99b4d55640394cfd57712c787fbd2409de44a0e74597d440e1cb3d91182188fcca0bffa9a519a2f8820ac668b8dba3beae2b37b7
|
7
|
+
data.tar.gz: edfabd8f929c33f09f2ea86a99e859db2d46e6ee72214fa43268ff0559049c94873ee6967f91fc65a317bd74a57911543d6b55a75907f230775ad60a7ee5f2e6
|
data/bin/blog
CHANGED
@@ -23,6 +23,8 @@ STDOUT.sync = true
|
|
23
23
|
|
24
24
|
cmd, arg = get_argv
|
25
25
|
|
26
|
+
system("tput smcup") # see: tput rmcup in cmd_quit
|
27
|
+
|
26
28
|
if ! RuneBlog.exist?
|
27
29
|
print "No blog found. Create new one? (y/n) "
|
28
30
|
resp = gets.chomp
|
@@ -59,3 +61,4 @@ else # one command
|
|
59
61
|
parse_cmd(ARGV.join(" "))
|
60
62
|
execute_command
|
61
63
|
end
|
64
|
+
|
data/lib/helpers-blog.rb
CHANGED
@@ -4,30 +4,19 @@ module RuneBlog::Helpers
|
|
4
4
|
lines = File.readlines(file).map(&:chomp)
|
5
5
|
obj = OpenStruct.new
|
6
6
|
lines.each do |line|
|
7
|
+
next if line == "\n" || line[0] == "#"
|
7
8
|
key, val = line.split(" ", 2)
|
8
9
|
key = key[0..-2] # remove colon
|
9
10
|
obj.send(key+"=", val)
|
10
11
|
end
|
11
12
|
return obj if syms.empty?
|
12
13
|
vals = []
|
13
|
-
syms.
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
puts err.backtrace
|
18
|
-
exit
|
19
|
-
end
|
20
|
-
|
21
|
-
def huh_read_config(file, *syms)
|
22
|
-
lines = File.readlines(file).map(&:chomp)
|
23
|
-
obj = OpenStruct.new
|
24
|
-
lines.each do |line|
|
25
|
-
key, val = line.split(" ", 2)
|
26
|
-
key = key[0..-2] # remove colon
|
27
|
-
obj.send(key+"=", val)
|
14
|
+
if syms.empty?
|
15
|
+
vals = obj.to_hash.values
|
16
|
+
else
|
17
|
+
syms.each {|sym| vals << obj.send(sym) }
|
28
18
|
end
|
29
|
-
|
30
|
-
obj
|
19
|
+
return vals
|
31
20
|
rescue => err
|
32
21
|
puts "Something hit the fan: #{err}"
|
33
22
|
puts err.backtrace
|
@@ -49,9 +38,11 @@ module RuneBlog::Helpers
|
|
49
38
|
end
|
50
39
|
|
51
40
|
def new_dotfile(root: "data", current_view: "no_default", editor: "vi")
|
41
|
+
raise "Blog already exists" if Dir.exist?(".blog")
|
42
|
+
Dir.mkdir(".blog")
|
52
43
|
x = OpenStruct.new
|
53
44
|
x.root, x.current_view, x.editor = root, current_view, editor
|
54
|
-
write_config(x, RuneBlog::
|
45
|
+
write_config(x, RuneBlog::DotDir + "/config")
|
55
46
|
end
|
56
47
|
|
57
48
|
def new_sequence
|
@@ -64,6 +55,9 @@ module RuneBlog::Helpers
|
|
64
55
|
dirs = Dir.entries(dir) - %w[. ..]
|
65
56
|
dirs.reject! {|x| ! File.directory?("#@root/views/#{x}") }
|
66
57
|
dirs
|
58
|
+
rescue
|
59
|
+
STDERR.puts "Can't find dir '#{dir}'"
|
60
|
+
exit
|
67
61
|
end
|
68
62
|
|
69
63
|
def find_src_slugs
|
@@ -74,7 +68,7 @@ module RuneBlog::Helpers
|
|
74
68
|
end
|
75
69
|
|
76
70
|
def create_dir(dir)
|
77
|
-
return if
|
71
|
+
return if Dir.exist?(dir) # && File.directory?(dir)
|
78
72
|
cmd = "mkdir -p #{dir} >/dev/null 2>&1"
|
79
73
|
result = system(cmd)
|
80
74
|
raise "Can't create #{dir}" unless result
|
data/lib/repl.rb
CHANGED
@@ -6,6 +6,7 @@ module RuneBlog::REPL
|
|
6
6
|
|
7
7
|
def cmd_quit(arg)
|
8
8
|
check_empty(arg)
|
9
|
+
system("tput rmcup")
|
9
10
|
abort "\n "
|
10
11
|
end
|
11
12
|
|
@@ -127,7 +128,6 @@ module RuneBlog::REPL
|
|
127
128
|
resp = yesno("Add deployment info now? ")
|
128
129
|
@blog.view.deployer = ask_deployment_info
|
129
130
|
write_config(@blog.view.deployer, @blog.view.dir + "/deploy") # change this?
|
130
|
-
# read_config(@blog.view.dir + "/deploy") # unnessary?
|
131
131
|
nil
|
132
132
|
rescue => err
|
133
133
|
error(err)
|
data/lib/runeblog.rb
CHANGED
@@ -13,7 +13,7 @@ require 'version'
|
|
13
13
|
|
14
14
|
class RuneBlog
|
15
15
|
|
16
|
-
|
16
|
+
DotDir = ".blog"
|
17
17
|
|
18
18
|
class << self
|
19
19
|
attr_accessor :blog
|
@@ -25,8 +25,8 @@ class RuneBlog
|
|
25
25
|
|
26
26
|
include Helpers
|
27
27
|
|
28
|
-
def self.create_new_blog(dir
|
29
|
-
new_dotfile(root: dir)
|
28
|
+
def self.create_new_blog(dir)
|
29
|
+
new_dotfile(root: Dir.pwd + "/" + dir)
|
30
30
|
create_dir(dir)
|
31
31
|
Dir.chdir(dir) do
|
32
32
|
create_dir("views")
|
@@ -34,6 +34,9 @@ class RuneBlog
|
|
34
34
|
create_dir("src")
|
35
35
|
new_sequence
|
36
36
|
end
|
37
|
+
rescue => err
|
38
|
+
puts "Can't create blog: '#{dir}' - #{err}"
|
39
|
+
puts err.backtrace
|
37
40
|
end
|
38
41
|
|
39
42
|
def initialize # assumes existing blog
|
@@ -41,7 +44,7 @@ class RuneBlog
|
|
41
44
|
# What views are there? Deployment, etc.
|
42
45
|
self.class.blog = self # Weird. Like a singleton - dumbass circular dependency?
|
43
46
|
@root, @view_name, @editor =
|
44
|
-
read_config(
|
47
|
+
read_config(DotDir + "/config", :root, :current_view, :editor)
|
45
48
|
@views = get_views
|
46
49
|
@view = str2view(@view_name)
|
47
50
|
@sequence = get_sequence
|
@@ -63,8 +66,7 @@ class RuneBlog
|
|
63
66
|
case arg
|
64
67
|
when RuneBlog::View
|
65
68
|
@view = arg
|
66
|
-
|
67
|
-
@view.read_config
|
69
|
+
@view.deployer = read_config(@view.dir + "/deploy")
|
68
70
|
when String
|
69
71
|
new_view = str2view(arg)
|
70
72
|
raise "Can't find view #{arg}" if new_view.nil?
|
@@ -89,7 +91,9 @@ class RuneBlog
|
|
89
91
|
end
|
90
92
|
|
91
93
|
def self.exist?
|
92
|
-
File.exist?(
|
94
|
+
File.exist?(DotDir) &&
|
95
|
+
File.directory?(DotDir) &&
|
96
|
+
File.exist?(DotDir + "/config")
|
93
97
|
end
|
94
98
|
|
95
99
|
def create_view(arg)
|
@@ -172,7 +176,7 @@ class RuneBlog
|
|
172
176
|
def change_view(view)
|
173
177
|
x = OpenStruct.new
|
174
178
|
x.root, x.current_view, x.editor = @root, view, @editor # dumb - FIXME later
|
175
|
-
write_config(x,
|
179
|
+
write_config(x, DotDir + "/config")
|
176
180
|
self.view = view # error checking?
|
177
181
|
end
|
178
182
|
|
data/lib/version.rb
CHANGED
data/test/make_blog.rb
CHANGED
@@ -16,8 +16,8 @@ def show_lines(text)
|
|
16
16
|
str
|
17
17
|
end
|
18
18
|
|
19
|
-
system("rm -rf
|
20
|
-
RuneBlog.create_new_blog(
|
19
|
+
system("rm -rf .blog")
|
20
|
+
RuneBlog.create_new_blog(".blog/data_test")
|
21
21
|
x = RuneBlog.new
|
22
22
|
x.create_view("alpha_view")
|
23
23
|
x.create_view("beta_view")
|
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.84
|
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-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: livetext
|