runeblog 0.1.21 → 0.1.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0b51fb60fbf5219684fc0eb45ccf6d600780fa2addd0beea7f01a54f87b44b5
4
- data.tar.gz: 62b44992b9a5031c788fe42b8e77c646b6c4b57dad113f776407388b88872185
3
+ metadata.gz: 8716711a8c779931fdca8f00224df63537d6adbf41be3acfbf12d60beb20e831
4
+ data.tar.gz: ca233f3853ffffac5abecaf290e80af0adaef2a8068db829082b3a0370cd5ada
5
5
  SHA512:
6
- metadata.gz: 967c83ccf90ffd8a9227c4f63567a5f8ad8d4b47dac4b11a22db133aa611751f2cb023547b68b1a47ff03e950f8cd9a6bcf6452d4dcf119104b882f0bf9eb832
7
- data.tar.gz: 471bf1ef0519b5f854a2b2beca701b54ba29d3993f07f634c8c9126a524ef08fde20f57c16d7c4c45ba3d3d5e0af809f02b8b9348850b0082eef6bfbc1b11b81
6
+ metadata.gz: c89faa0f8256de692605395c248cbace8a51726737949123792b89af330711919c0e7112d794abca51fa2307157ba39d38e315a79371eeff88a610885841765c
7
+ data.tar.gz: 3fce62a85c37ed183caa3d3bb734a706f9dd691c004243bf970a2ed3bb419c1b16aa0a521b70e213126b35e7cd6c24f8a086cac7985098ce3673c2749001214e
data/lib/global.rb CHANGED
@@ -39,7 +39,6 @@ def check_meta(meta, where = "")
39
39
  str << " num missing!\n" unless meta.num
40
40
  if str =~ /missing!/
41
41
  debug str
42
- exit
43
42
  raise str
44
43
  end
45
44
  end
data/lib/helpers-blog.rb CHANGED
@@ -40,7 +40,7 @@ module RuneBlog::Helpers
40
40
  dirs.map {|name| RuneBlog::View.new(name) }
41
41
  end
42
42
 
43
- def new_dotfile(root: "data", current_view: "no_default", editor: "vi")
43
+ def new_dotfile(root: "./.blog/data", current_view: "no_default", editor: "vi")
44
44
  raise BlogAlreadyExists if Dir.exist?(".blog")
45
45
  Dir.mkdir(".blog")
46
46
  x = OpenStruct.new
data/lib/post.rb CHANGED
@@ -33,16 +33,15 @@ class RuneBlog::Post
33
33
  end
34
34
 
35
35
  def create_post_subtree(viewname = nil)
36
- viewname ||= @blog.view.dir
37
- post_dir = viewname + "/" + @meta.slug
38
- create_dir(post_dir) rescue nil # FIXME?
39
- Dir.chdir(post_dir) do
40
- create_dir("assets") rescue nil
41
- system("cp body.txt index.html") # gahhh FIXME
42
- end
36
+ debug "=== create_post_subtree #{viewname.inspect} pwd = #{Dir.pwd}"
37
+ # We are INSIDE views/myview/000n-mytitle dir now - FIXME later? how did that happen?
38
+ create_dir("assets")
39
+ system("cp body.txt index.html") # gahhh FIXME
43
40
  end
44
41
 
45
42
  def write_metadata(meta)
43
+ debug "=== write_metadata:"
44
+ debug "-----\n#{meta.inspect}\n-----"
46
45
  fname2 = "metadata.txt"
47
46
  hash = meta.to_h
48
47
 
@@ -62,10 +61,12 @@ class RuneBlog::Post
62
61
  end
63
62
 
64
63
  def initialize
64
+ debug "=== Post#initialize"
65
65
  @blog = RuneBlog.blog || raise(NoBlogAccessor)
66
66
  end
67
67
 
68
68
  def self.create(title)
69
+ debug "=== Post.create #{title.inspect} pwd = #{Dir.pwd}"
69
70
  post = self.new
70
71
  post.new_metadata(title)
71
72
  post.create_draft
@@ -121,6 +122,7 @@ class RuneBlog::Post
121
122
  end
122
123
 
123
124
  def build
125
+ debug "=== build"
124
126
  views = @meta.views
125
127
  text = File.read(@draft)
126
128
  Livetext.parameters = [@blog, @meta]
@@ -135,9 +137,9 @@ class RuneBlog::Post
135
137
  meta.views.each do |view_name| # Create dir using slug (index.html, metadata?)
136
138
  vdir = "#{@blog.root}/views/#{view_name}/"
137
139
  dir = vdir + meta.slug + "/"
138
- create_dir(dir) rescue nil
140
+ create_dir(dir) unless Dir.exist?(dir)
139
141
  Dir.chdir(dir) do
140
- create_post_subtree
142
+ create_post_subtree(view_name) # unless existing??
141
143
  @blog.generate_index(view_name)
142
144
  end
143
145
  end
data/lib/publish.rb CHANGED
@@ -32,7 +32,7 @@ class RuneBlog::Publishing
32
32
  def no_files?(files)
33
33
  if files.empty?
34
34
  STDSCR.up
35
- puts "\n No files to publish"
35
+ puts fx("\n No files to publish", :bold)
36
36
  true
37
37
  else
38
38
  false
data/lib/runeblog.rb CHANGED
@@ -37,22 +37,16 @@ class RuneBlog
37
37
  include Helpers
38
38
 
39
39
  def self.create_new_blog(dir = ".blog/data")
40
- # puts "--- create_new_blog"
41
40
  raise ArgumentError unless dir.is_a?(String) && ! dir.empty?
42
41
  root_dir = Dir.pwd + "/" + dir
43
- # puts "--- create: dir = #{dir} pwd = #{Dir.pwd} DotDir = #{DotDir} root_dir = #{root_dir}"
44
42
  raise BlogAlreadyExists if Dir.exist?(root_dir)
45
- # puts "--- new dotfile"
46
- new_dotfile(root: dir, current_view: "test_view")
47
- # puts "--- create #{dir}"
43
+ new_dotfile(root: root_dir, current_view: "test_view")
48
44
  create_dir(dir)
49
45
  Dir.chdir(dir) do
50
- # puts "--- in chdir: pwd = #{Dir.pwd}"
51
46
  create_dir("views")
52
47
  create_dir("assets")
53
48
  create_dir("src")
54
49
  new_sequence
55
- # puts "==== CREATED BLOG ==="
56
50
  end
57
51
  blog = self.new
58
52
  blog.create_view("test_view")
@@ -67,7 +61,6 @@ class RuneBlog
67
61
  self.class.blog = self # Weird. Like a singleton - dumbass circular dependency?
68
62
  @root, @view_name, @editor =
69
63
  read_config(ConfigFile, :root, :current_view, :editor)
70
- # puts "=== init root = #@root"
71
64
  @views = get_views
72
65
  @view = str2view(@view_name)
73
66
  @sequence = get_sequence
@@ -109,7 +102,6 @@ class RuneBlog
109
102
 
110
103
  def next_sequence
111
104
  @sequence += 1
112
- # debug "seq = #@sequence caller = #{caller.join("\n")}"
113
105
  dump(@sequence, "#@root/sequence")
114
106
  @sequence
115
107
  end
@@ -126,6 +118,7 @@ class RuneBlog
126
118
  end
127
119
 
128
120
  def create_view(arg)
121
+ debug "=== create_view #{arg.inspect}"
129
122
  raise ArgumentError unless arg.is_a?(String) && ! arg.empty?
130
123
  names = self.views.map(&:to_s)
131
124
  raise ViewAlreadyExists(arg) if names.include?(arg)
@@ -137,14 +130,12 @@ class RuneBlog
137
130
  Dir.chdir(dir)
138
131
  x = RuneBlog::Default
139
132
  create_dir('custom')
140
- puts "=== create_view - created 'custom'"
141
133
  create_dir('assets')
142
134
  # FIXME dump method??
143
135
  pub = "user: xxx\nserver: xxx\ndocroot: xxx\npath: xxx\nproto: xxx\n"
144
136
  dump(pub, "publish") # FIXME publish
145
137
  dump(x::BlogHeader, "custom/blog_header.html")
146
138
  dump(x::BlogTrailer, "custom/blog_trailer.html")
147
- # dump(x::PostTemplate, "custom/post_template.html")
148
139
  dump("Initial creation", "last_published")
149
140
  Dir.chdir(up)
150
141
  @views << RuneBlog::View.new(arg)
@@ -175,9 +166,12 @@ puts "=== create_view - created 'custom'"
175
166
  end
176
167
 
177
168
  def create_new_post(title, testing = false)
169
+ save = Dir.pwd
170
+ Dir.chdir(self.view.dir)
178
171
  post = Post.create(title)
179
172
  post.edit unless testing
180
173
  meta = post.build
174
+ Dir.chdir(save)
181
175
  meta.num
182
176
  rescue => err
183
177
  puts err
@@ -185,6 +179,7 @@ puts "=== create_view - created 'custom'"
185
179
  end
186
180
 
187
181
  def edit_initial_post(file, testing = false)
182
+ debug "=== edit_initial_post #{file.inspect} => #{sourcefile}"
188
183
  sourcefile = "#@root/src/#{file}"
189
184
  result = system("#@editor #{sourcefile} +8") unless testing
190
185
  raise EditorProblem(sourcefile) unless result
@@ -213,6 +208,7 @@ puts "=== create_view - created 'custom'"
213
208
  end
214
209
 
215
210
  def process_post(file)
211
+ debug "=== process_post #{file.inspect}"
216
212
  raise ArgumentError unless file.is_a?(String)
217
213
  path = @root + "/src/#{file}"
218
214
  raise FileNotFound(path) unless File.exist?(path)
@@ -231,6 +227,7 @@ puts "=== create_view - created 'custom'"
231
227
  end
232
228
 
233
229
  def generate_index(view)
230
+ debug "=== generate_index view = #{view.inspect}"
234
231
  raise ArgumentError unless view.is_a?(String) || view.is_a?(RuneBlog::View)
235
232
  # Gather all posts, create list
236
233
  vdir = "#@root/views/#{view}"
@@ -259,6 +256,7 @@ puts "=== create_view - created 'custom'"
259
256
  end
260
257
  meta # block return
261
258
  end
259
+
262
260
  File.open("#{vdir}/index.html", "w") do |f|
263
261
  f.puts @bloghead
264
262
  posts.each {|post| f.puts index_entry(view, post) }
@@ -274,8 +272,8 @@ puts "=== create_view - created 'custom'"
274
272
  end
275
273
 
276
274
  def index_entry(view, meta)
275
+ debug "=== index_entry #{view.to_s.inspect} #{meta.num} #{meta.title.inspect}"
277
276
  check_meta(meta, "index_entry1")
278
- # debug "\nindex_entry: meta = #{meta.inspect}"
279
277
  raise ArgumentError unless view.is_a?(String) || view.is_a?(RuneBlog::View)
280
278
  check_meta(meta, "index_entry2")
281
279
  self.make_slug(meta) # RuneBlog#index_entry
@@ -1,6 +1,6 @@
1
1
 
2
2
  class RuneBlog
3
- VERSION = "0.1.21"
3
+ VERSION = "0.1.22"
4
4
 
5
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  end
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.21
4
+ version: 0.1.22
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-12-28 00:00:00.000000000 Z
11
+ date: 2018-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext