runeblog 0.0.74 → 0.0.75

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
  SHA1:
3
- metadata.gz: 17a13b9ee6fc708cd9ff07fb2a47c0766f3c9480
4
- data.tar.gz: 5f44f9d028f5d9c1a6d17e3a91df6108a50c97ec
3
+ metadata.gz: a4f022029eff4356a8b19be4c514270df9ef66c8
4
+ data.tar.gz: 5d0de42753a94a46d2c0e39618cca82520eb205d
5
5
  SHA512:
6
- metadata.gz: d0c8fc2fa446cb59168bbbc5dfbf632169a2324ead513603abd810ae7985843853c8a14422803073e868bc4bf0909023199264617fe54fbc9ec273f6c7ed618d
7
- data.tar.gz: c4a0bb0d1d47a4bd67801755544af8d1b85701793119957c920f3170746a1f5a0397228d90168c95a894010bae6f69e6426183a9eb3fb89eee563cc514091e51
6
+ metadata.gz: d5b401630040d46ee91d26a5a36be07afcbf5ccf40e6efae2ceb9aaff09bbe0420b220c0c2325a7ce8e1987dfd3c95c058bedfd283d11c1079409cc3110d572c
7
+ data.tar.gz: b7e4c67b79cd72d8bcd180a6b9bef1813c3b14c5c8047ea6d7f9b25f8c7aa6edba7fb122c6070d04e46b0914727713a0b643964af3a41101b82b288fabcf5527
data/data/VERSION CHANGED
@@ -1 +1 @@
1
- RuneBlog v 0.0.74 2018-10-02
1
+ RuneBlog v 0.0.75 2018-10-02
data/lib/post.rb CHANGED
@@ -72,7 +72,7 @@ class RuneBlog::Post
72
72
  File.write("metadata.yaml", @meta.to_yaml)
73
73
  File.write("teaser.txt", @meta.teaser)
74
74
  File.write("remainder.txt", @meta.remainder)
75
- template = File.read(vdir + "/custom/post_template.html")
75
+ template = File.read(@blog.root + "/_default/custom/post_template.html")
76
76
  text = interpolate(template)
77
77
  File.write("index.html", text)
78
78
  end
data/lib/runeblog.rb CHANGED
@@ -28,16 +28,21 @@ class RuneBlog
28
28
  attr_reader :root, :views, :sequence
29
29
  attr_accessor :view # overridden
30
30
 
31
- def self.create_new_blog
32
- #-- what if data already exists?
33
- result = system("cp -r #{RuneBlog::DefaultData} .")
34
- raise "Error copying default data" unless result
35
-
36
- File.open(".blog", "w") do |f|
37
- f.puts "data"
38
- f.puts "no_default"
31
+ def self.create_new_blog(dir = "data")
32
+ File.write(".blog", "#{dir}\nno_default\n")
33
+ # .blog lives above the entire subtree
34
+ Dir.mkdir(dir) #-- what if dir already exists?
35
+ Dir.chdir(dir) do
36
+ create_dir("views")
37
+ create_dir("assets")
38
+ create_dir("src")
39
+ File.write("sequence", 0)
40
+
41
+ result = system("cp -r #{RuneBlog::DefaultData} .")
42
+ raise "Error copying default data" unless result
43
+
44
+ File.write("VERSION", "#{RuneBlog::VERSION}\nBlog created: " + Time.now.to_s )
39
45
  end
40
- File.open("data/VERSION", "a") {|f| f.puts "\nBlog created: " + Time.now.to_s }
41
46
  end
42
47
 
43
48
  def get_config(file)
@@ -100,11 +105,11 @@ class RuneBlog
100
105
  names = self.views.map(&:to_s)
101
106
  raise "view #{arg} already exists" if names.include?(arg)
102
107
 
103
- dir = @root + "/views/" + arg + "/"
108
+ dir = "#@root/views/#{arg}/"
109
+ create_dir(dir)
104
110
  create_dir(dir + 'custom')
105
111
  create_dir(dir + 'assets')
106
- File.open(dir + "deploy", "w") { } # FIXME
107
-
112
+ File.write(dir + "deploy", "")
108
113
  File.write(dir + "custom/blog_header.html", RuneBlog::BlogHeader)
109
114
  File.write(dir + "custom/blog_trailer.html", RuneBlog::BlogTrailer)
110
115
  File.write(dir + "custom/post_template.html", RuneBlog::PostTemplate)
@@ -151,6 +156,7 @@ class RuneBlog
151
156
  post.publish
152
157
  post.num
153
158
  rescue => err
159
+ p :ERROR
154
160
  puts err # error(err)
155
161
  end
156
162
 
@@ -288,6 +294,8 @@ class RuneBlog
288
294
  dirs = Dir.entries(dir) - %w[. ..]
289
295
  dirs.reject! {|x| ! File.directory?("#@root/views/#{x}") }
290
296
  dirs
297
+ rescue => err
298
+ p err
291
299
  end
292
300
 
293
301
  def find_src_slugs
data/lib/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  class RuneBlog
3
- VERSION = "0.0.74"
3
+ VERSION = "0.0.75"
4
4
 
5
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  end
data/test/repl.rb CHANGED
@@ -7,10 +7,46 @@ require 'lib/repl'
7
7
  class TestREPL < Minitest::Test
8
8
  include RuneBlog::REPL
9
9
 
10
+ def make_post(x, title)
11
+ meta = OpenStruct.new
12
+ meta.title = title
13
+ num = x.create_new_post(meta, true)
14
+ end
15
+
16
+ def show_lines(text)
17
+ lines = text.split("\n")
18
+ str = "#{lines.size} lines\n"
19
+ lines.each {|line| str << " #{line.inspect}\n" }
20
+ str
21
+ end
22
+
10
23
  def setup
11
24
  system("rm -rf data_test")
12
- system("tar xvf data_test.tar 2>/dev/null")
13
- @blog = RuneBlog.new
25
+ # system("tar xvf data_test.tar 2>/dev/null")
26
+ RuneBlog.create_new_blog(Dir.pwd + "/data_test")
27
+ x = RuneBlog.new
28
+ x.create_view("alpha_view")
29
+ x.create_view("beta_view")
30
+ x.create_view("gamma_view")
31
+
32
+ x.change_view("alpha_view") # 1 2 7 8 9
33
+ make_post(x, "Post number 1")
34
+ make_post(x, "Post number 2")
35
+ x.change_view("beta_view") # 3 5 6
36
+ make_post(x, "Post number 3")
37
+ x.change_view("gamma_view") # 4 10
38
+ make_post(x, "Post number 4")
39
+ x.change_view("beta_view")
40
+ make_post(x, "Post number 5")
41
+ make_post(x, "Post number 6")
42
+ x.change_view("alpha_view")
43
+ make_post(x, "Post number 7")
44
+ make_post(x, "Post number 8")
45
+ make_post(x, "Post number 9")
46
+ x.change_view("gamma_view")
47
+ make_post(x, "Post number 10")
48
+ x.change_view("alpha_view")
49
+ @blog = x
14
50
  end
15
51
 
16
52
  # Note: "Bang" methods depend on the data_test subtree
@@ -47,14 +83,14 @@ class TestREPL < Minitest::Test
47
83
  out = cmd_list_drafts(nil)
48
84
  assert out.is_a?(String), "Expected a string returned"
49
85
  lines = out.split("\n").length
50
- assert lines == 7, "Expecting more lines; got: #{out.inspect}"
86
+ assert lines == 11, "Expecting 11 lines; got #{show_lines(out)}"
51
87
  end
52
88
 
53
89
  def test_006_lsp!
54
90
  out = cmd_list_posts(nil)
55
91
  assert out.is_a?(String), "Expected a string returned; got: #{out.inspect}"
56
92
  lines = out.split("\n").length
57
- assert lines == 6, "Expecting more lines; got: #{out.inspect}"
93
+ assert lines == 7, "Expecting 7 lines; got #{show_lines(out)}"
58
94
  end
59
95
 
60
96
  def test_007_parser
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.0.74
4
+ version: 0.0.75
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton