runeblog 0.0.90 → 0.0.91
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/runeblog.rb +26 -8
- data/lib/version.rb +1 -1
- 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: f2ff1adf77bd4d84b2abc678661e31fb63171e6e
|
4
|
+
data.tar.gz: 19347aaaeb617a47eb3466c0860bd9eda2110b38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04449624f1a73aa9ea968c144417884336fec5803905b0071c46a190a7ccd4f2f04b93c7b732c23db73044c0ac5f57c236ae1249c96a31ef1eba0ec145044c49
|
7
|
+
data.tar.gz: b70c923bed20854a310a3bc43ff3026e1050022868f8b69d36d6e859165c4fed1237832cdae5a1d1fecdd71207380945ebc6bce7594a1eb2a027911aba4d2087
|
data/lib/runeblog.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'find'
|
2
|
-
require 'yaml' # get rid of YAML later
|
2
|
+
# require 'yaml' # get rid of YAML later
|
3
3
|
require 'livetext'
|
4
4
|
require 'skeleton'
|
5
5
|
require 'helpers-blog'
|
@@ -9,6 +9,16 @@ require 'deploy'
|
|
9
9
|
require 'post'
|
10
10
|
require 'version'
|
11
11
|
|
12
|
+
def make_exception(sym, str)
|
13
|
+
Object.const_set(sym, StandardError.dup)
|
14
|
+
define_method(sym) do |*args|
|
15
|
+
msg = str
|
16
|
+
args.each.with_index {|arg, i| msg.sub!("$#{i+1}", arg) }
|
17
|
+
Object.class_eval(sym.to_s).new(msg)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
12
22
|
###
|
13
23
|
|
14
24
|
class RuneBlog
|
@@ -16,6 +26,13 @@ class RuneBlog
|
|
16
26
|
DotDir = ".blog"
|
17
27
|
ConfigFile = "#{DotDir}/config"
|
18
28
|
|
29
|
+
make_exception(:FileNotFound, "File $1 was not found")
|
30
|
+
make_exception(:BlogAlreadyExists, "Blog $1 already exists")
|
31
|
+
make_exception(:CantAssignView, "$1 is not a view")
|
32
|
+
make_exception(:ViewAlreadyExists, "View $1 already exists")
|
33
|
+
make_exception(:EditorProblem, "Could not edit $1")
|
34
|
+
make_exception(:NoSuchView, "No such view: $1")
|
35
|
+
|
19
36
|
class << self
|
20
37
|
attr_accessor :blog
|
21
38
|
include Helpers
|
@@ -29,7 +46,7 @@ class RuneBlog
|
|
29
46
|
def self.create_new_blog(dir = ".blog")
|
30
47
|
raise ArgumentError unless dir.is_a?(String) && ! dir.empty?
|
31
48
|
root_dir = Dir.pwd + "/" + dir
|
32
|
-
raise
|
49
|
+
raise BlogAlreadyExists if Dir.exist?(root_dir)
|
33
50
|
new_dotfile(root: root_dir, current_view: "test_view")
|
34
51
|
create_dir(dir)
|
35
52
|
Dir.chdir(dir) do
|
@@ -78,11 +95,11 @@ class RuneBlog
|
|
78
95
|
@view.deployer = read_config(@view.dir + "/deploy")
|
79
96
|
when String
|
80
97
|
new_view = str2view(arg)
|
81
|
-
raise
|
98
|
+
raise NoSuchView(arg) if new_view.nil?
|
82
99
|
@view = new_view
|
83
100
|
@view.deployer = read_config(@view.dir + "/deploy")
|
84
101
|
else
|
85
|
-
raise
|
102
|
+
raise CantAssignView(arg.class.to_s)
|
86
103
|
end
|
87
104
|
end
|
88
105
|
|
@@ -109,10 +126,10 @@ class RuneBlog
|
|
109
126
|
def create_view(arg)
|
110
127
|
raise ArgumentError unless arg.is_a?(String) && ! arg.empty?
|
111
128
|
names = self.views.map(&:to_s)
|
112
|
-
raise
|
129
|
+
raise ViewAlreadyExists(arg) if names.include?(arg)
|
113
130
|
|
114
131
|
dir = "#@root/views/#{arg}/"
|
115
|
-
raise "Can't happen: #{
|
132
|
+
raise "Can't happen: #{dir} exists already" if Dir.exist?(dir)
|
116
133
|
create_dir(dir)
|
117
134
|
up = Dir.pwd
|
118
135
|
Dir.chdir(dir)
|
@@ -166,8 +183,9 @@ class RuneBlog
|
|
166
183
|
end
|
167
184
|
|
168
185
|
def edit_initial_post(file)
|
169
|
-
|
170
|
-
|
186
|
+
sourcefile "#@root/src/#{file}"
|
187
|
+
result = system("#@editor #{sourcefile} +8")
|
188
|
+
raise EditorProblem(sourcefile) unless result
|
171
189
|
nil
|
172
190
|
rescue => err
|
173
191
|
error(err)
|
data/lib/version.rb
CHANGED
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.91
|
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-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: livetext
|