runeblog 0.3.02 → 0.3.03

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: af242702c47c1cad260040a42b4fe58f5fb84e83934bfa80e0f12fd3e7083c9c
4
- data.tar.gz: 90b1d17454ce166e5c89b1c8ed6cc43f129a708a14200b94a1bb5c2a5a721a7b
3
+ metadata.gz: 981c7fd06d3616dd52825124cc99baf2822e45733c02d7d979750d95bb296a1a
4
+ data.tar.gz: 7662e51fbe7a7ac7986ef6c4f745a4d745774a1a36085a2ac666d1d96cc06a5d
5
5
  SHA512:
6
- metadata.gz: a70f36f01ebdfc94db5b6794b8975b876b0255b154d8393d87e7728f19010c478daaa93462cbb21aa0bee539c4d4a922640d8c92f7f3707538974d5cbe60f65d
7
- data.tar.gz: 50d5b646a4fa6e050f0aedb2789371c61fd5115ce35d03051b3ce690f113b47182782951ac8a6e7742bbf1316e7791fcccfd653d2d67911bf75b4bf3e62ae4a6
6
+ metadata.gz: a72de8c66f10ede4bec71970d46d3f1d48cb41546d8f600338cb8738d22419acc992ab9d88d3e5c8a6531d7f6b3a0b1e82bc80a12078032addaa6d2b5edb49cc
7
+ data.tar.gz: 556c8604bea8f8fbd42d78b8cfffcb8a8af183958698543d25969cd4d9511f986814b55488d98fe87ac81a5bea05dc51a058f7a0ce24f7a39271aa6e38697a30
@@ -2,7 +2,7 @@
2
2
  # 1 = enabled (implies installed)
3
3
  # x = excluded (not installed; does it even exist?)
4
4
 
5
- reddit 1 # autopost, embed thread after blog post
5
+ reddit 0 # autopost, embed thread after blog post
6
6
  facebook 0 # reader-like, reader post, autopost?
7
7
  twitter 0 # reader-tweet, reader-follow, autotweet?
8
8
 
@@ -2,7 +2,7 @@
2
2
  # 1 = enabled (implies installed)
3
3
  # x = excluded (not installed; does it even exist?)
4
4
 
5
- reddit 1 # autopost, embed thread after blog post
5
+ reddit 0 # autopost, embed thread after blog post
6
6
  facebook 0 # reader-like, reader post, autopost?
7
7
  twitter 0 # reader-tweet, reader-follow, autotweet?
8
8
 
@@ -14,14 +14,22 @@ module RuneBlog::Helpers
14
14
  exit
15
15
  end
16
16
 
17
- def read_features
17
+ def read_features(view = nil)
18
18
  hash = {}
19
- file = @root/self.view/"settings/features.txt"
19
+ if view.nil? # toplevel default
20
+ dir = @root/"data"
21
+ else
22
+ dir = @root/:views/self.view/:settings
23
+ end
24
+ file = dir/"features.txt"
20
25
  lines = File.readlines(file)
21
26
  lines.each do |line|
22
- char, line = line[0], line[1..-1].chomp
23
- name = line.strip
24
- hash[name] = (char != "-")
27
+ line = line.strip
28
+ line.sub!(/ #.*/, "") # trailing
29
+ next if line =~ /^ *#/ # leading
30
+ next if line.empty?
31
+ name, status = line.split
32
+ hash[name] = (status == "1") # enabled
25
33
  end
26
34
  @features = hash
27
35
  end
@@ -39,15 +47,9 @@ module RuneBlog::Helpers
39
47
 
40
48
  def copy_data(tag, dest)
41
49
  data = RuneBlog::Path + "/../data" # files kept inside gem
42
- extra = RuneBlog::Path + "/../config" # files kept inside gem
43
- # FIXME names are confusing
44
- case tag
45
- when :config
46
- files = %w[ROOT VIEW EDITOR universal.lt3 global.lt3]
47
- files.each {|file| copy(data + "/" + file, dest) }
48
- when :extra # FIXME remove later
49
- # copy!(extra, dest)
50
- end
50
+ # FIXME tag no longer used
51
+ files = %w[ROOT VIEW EDITOR universal.lt3 global.lt3 features.txt]
52
+ files.each {|file| copy(data + "/" + file, dest) unless File.exist?(dest/file) }
51
53
  end
52
54
 
53
55
  def read_vars(file)
@@ -72,7 +72,7 @@ def post_trailer
72
72
  tags = _var("post.tags")
73
73
  taglist = tags.empty? ? "" : "Tags: #{tags}"
74
74
 
75
- reddit_enabled = @blog.features["reddit"] rescue nil
75
+ reddit_enabled = @blog.features["reddit"]
76
76
  reddit_txt = ""
77
77
  if reddit_enabled
78
78
  vdir = @blog.root/:views/@blog.view
@@ -110,7 +110,7 @@ def faq
110
110
  _out %[&nbsp;<a data-toggle="collapse" href="##{id}" role="button" aria-expanded="false" aria-controls="collapseExample"><font size=+3>&#8964;</font></a>]
111
111
  _out %[&nbsp;<b>#{ques}</b>]
112
112
  _out %[<div class="collapse" id="#{id}"><br><font size=+1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#{ans}</font></div>\n]
113
- _out "<br>" unless @faq_count == 1
113
+ _out "<br>" # unless @faq_count == 1
114
114
  _optional_blank_line
115
115
  end
116
116
 
@@ -122,6 +122,7 @@ class RuneBlog
122
122
  @root = Dir.pwd/root_rel
123
123
  write_repo_config(root: @root) # ?? FIXME
124
124
  get_repo_config
125
+ read_features # top level
125
126
  @views = retrieve_views
126
127
  self.view = File.read(@root/"data/VIEW").chomp
127
128
  md = Dir.pwd.match(%r[.*/views/(.*?)/])
@@ -294,11 +295,13 @@ class RuneBlog
294
295
  @view = nil
295
296
  when RuneBlog::View
296
297
  @view = arg
298
+ read_features(@view)
297
299
  _set_publisher
298
300
  when String
299
301
  new_view = str2view(arg)
300
302
  raise NoSuchView(arg) if new_view.nil?
301
303
  @view = new_view
304
+ read_features(@view)
302
305
  _set_publisher
303
306
  else
304
307
  raise CantAssignView(arg.class.to_s)
@@ -3,7 +3,7 @@ if !defined?(RuneBlog::Path)
3
3
  # if ! (Object.constants.include?(:RuneBlog) && RuneBlog.constants.include?(:Path))
4
4
 
5
5
  class RuneBlog
6
- VERSION = "0.3.02"
6
+ VERSION = "0.3.03"
7
7
 
8
8
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
9
9
  Path = File.dirname(path)
@@ -31,7 +31,7 @@ end
31
31
  @fake_date = Date.today - 20
32
32
 
33
33
  def make_post(x, title, teaser, body, views=[])
34
- debug " make_post #{bold(title)}"
34
+ debug " make_post #{bold(title)}"
35
35
  pubdate = @fake_date.strftime("%Y-%m-%d")
36
36
  @fake_date += (rand(2) + 1)
37
37
  x.create_new_post(title, true, teaser: teaser, body: body, views: views,
@@ -53,8 +53,8 @@ puts
53
53
  debug bold("Generating test blog...")
54
54
 
55
55
  system("rm -rf .blogs")
56
- RuneBlog.create_new_blog_repo(".blogs")
57
- x = RuneBlog.new(".blogs")
56
+ RuneBlog.create_new_blog_repo # (".blogs")
57
+ x = RuneBlog.new # (".blogs")
58
58
 
59
59
  debug("create_view: #{bold('around_austin')}")
60
60
  x.create_view("around_austin") # FIXME remember view title!
@@ -72,7 +72,7 @@ File.open(vfile, "w") {|f| f.puts vars }
72
72
 
73
73
  ####
74
74
 
75
- debug("-- change_view: #{bold('around_austin')}")
75
+ debug("change_view: #{bold('around_austin')}")
76
76
  x.change_view("around_austin") # 1 2 7 8 9
77
77
 
78
78
  make_post(x, "What's at Stubbs...", <<-EXCERPT, <<-BODY)
@@ -142,11 +142,10 @@ But I first heard of them
142
142
  in 2005.
143
143
  BODY
144
144
 
145
- debug
146
- debug "** generate_index #{bold("around_austin")}"
145
+ debug "generate_index #{bold("around_austin")}"
147
146
  x.generate_index("around_austin")
148
147
 
149
- debug("** generate_view: #{bold('around_austin')}")
148
+ debug("generate_view: #{bold('around_austin')}")
150
149
  x.generate_view("around_austin")
151
150
 
152
151
  debug bold("...finished.\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.3.02
4
+ version: 0.3.03
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton