runeblog 0.2.80 → 0.2.81

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: 191d3a95d939a6d6aaa195feedc1277822b5a0b25d2b853a4a69d954eb675c65
4
- data.tar.gz: 9246a5ac4bddff5c4ce2a35eb5610fb6e64d2fb5cad8af21b68178d5ecb71a52
3
+ metadata.gz: d15f5bd6b7e8b87c3de63a77516dee2c6f57134a2a3c5b51db502aad0aaa3181
4
+ data.tar.gz: ff84de0a2c007a9f75f38295ea6bbcd7dcdcb3b3963294b7c74c2dd79cfbb8c4
5
5
  SHA512:
6
- metadata.gz: 65741de79f64c2f1c3411b19a54537f2123b372cdd8176fba23f1d98f5f6c05f45a6c3671bef848addcdd2f51e4d8fdeaade11d27b8faadc544c77a35d2c1523
7
- data.tar.gz: 831f44314a5ce756e2218903c272db96a6317bf06ba33bca8b91ebb3fa5babfed2becf4ff8eb8b4b126da53c7cae7e12671e08da686c71f0fad04bf0e7e7becc
6
+ metadata.gz: ef4cfbb271c5711f0a55f771bed52e9d59327ffdccdc4eadda5eab8b9438c043224aeac21a766aa63dd0638887cfc3d16fd9eac0bf647a698b091cd282b330ca
7
+ data.tar.gz: 4de4e96e9f22e523c48d512267a0bd51fbdb3ed6aecf61b8724aa98cab92e7988fc151d5e9ca8cf27fe1ca926758e7e4236c57f4e288bde334abfe9de5c61915
data/bin/blog CHANGED
@@ -37,6 +37,7 @@ def get_started
37
37
  edit_file(fname)
38
38
  end
39
39
  # Now create a custom global.lt3
40
+ @blog._generate_global
40
41
  sleep 1
41
42
  noview = true
42
43
  puts fx("\n Quick setup complete!", :bold)
@@ -46,6 +47,7 @@ def get_started
46
47
  sleep 1
47
48
  puts "\n View #{@blog.view} created!\n "
48
49
  end
50
+ system("cp #@root/data/global.lt3 #@root/views/#{@blog.view}/themes/standard/")
49
51
  end
50
52
 
51
53
  sleep 0.5
@@ -140,7 +142,9 @@ home = ENV['HOME']
140
142
 
141
143
  RubyText.start(:_echo, :keypad, scroll: true, log: "binblog.txt", fg: @fg, bg: @bg)
142
144
 
143
- if ! RuneBlog.exist?
145
+ if RuneBlog.exist?
146
+ @blog = RuneBlog.new
147
+ else
144
148
  if yesno("No blog repo found. Create new one?")
145
149
  RuneBlog.create_new_blog_repo
146
150
  @blog = RuneBlog.new
data/data/global.lt3 ADDED
@@ -0,0 +1,35 @@
1
+ . --------------------------------------------------
2
+ . Global settings are stored here in the form
3
+ . <variable> <value>
4
+ . --------------------------------------------------
5
+
6
+ .variables
7
+ author AUTHOR
8
+ blog VIEW_TITLE
9
+ blog.desc VIEW_SUBTITLE
10
+ site SITE
11
+
12
+ host http://SITE
13
+ charset CHARSET
14
+ url http://SITE
15
+ locale LOCALE
16
+
17
+ font.family FONT
18
+
19
+ post.title.color #010101
20
+ post.title.size 28px
21
+
22
+ post.text.color #0101a1
23
+ post.text.size 22px
24
+
25
+ post.date.color #9a9a9a
26
+ post.date.size 15px
27
+
28
+
29
+ publish.user root
30
+ publish.server SITE
31
+ publish.docroot /var/www/
32
+ publish.path VIEW_NAME
33
+ publish.proto http
34
+ .end
35
+
data/data/universal.lt3 CHANGED
@@ -7,6 +7,7 @@
7
7
  . --------------------------------------------------
8
8
  .nopara
9
9
 
10
+ .variables
10
11
  . Identity
11
12
  author Your name here
12
13
  site rubyhacker.com
@@ -17,3 +18,5 @@ font.family verdana
17
18
  . Details
18
19
  charset utf-8
19
20
  locale en_US
21
+
22
+ .end
data/lib/helpers-blog.rb CHANGED
@@ -33,17 +33,37 @@ module RuneBlog::Helpers
33
33
  def copy_data(tag, dest)
34
34
  data = RuneBlog::Path + "/../data" # files kept inside gem
35
35
  case tag
36
- when :config; files = %w[ROOT VIEW EDITOR universal.lt3]
36
+ when :config; files = %w[ROOT VIEW EDITOR universal.lt3 global.lt3]
37
37
  end
38
38
  files.each {|file| copy(data + "/" + file, dest) }
39
39
  end
40
40
 
41
+ def read_vars(file)
42
+ log!(enter: __method__, args: [file], level: 3)
43
+ lines = File.readlines(file).map(&:chomp)
44
+ hash = {}
45
+ skip = ["\n", "#", "."]
46
+ lines.each do |line|
47
+ line = line.strip
48
+ next if skip.include?(line[0])
49
+ key, val = line.split(" ", 2)
50
+ hash[key] = val
51
+ end
52
+ hash
53
+ rescue => err
54
+ puts "Can't read vars file '#{file}': #{err}"
55
+ puts err.backtrace.join("\n")
56
+ puts "dir = #{Dir.pwd}"
57
+ exit
58
+ end
59
+
41
60
  def read_config(file, *syms)
42
61
  log!(enter: __method__, args: [file, *syms], level: 3)
43
62
  lines = File.readlines(file).map(&:chomp)
44
63
  obj = ::OpenStruct.new
64
+ skip = ["\n", "#", "."]
45
65
  lines.each do |line|
46
- next if line == "\n" || line[0] == "#"
66
+ next if skip.include?(line[0])
47
67
  key, val = line.split(/: +/, 2)
48
68
  obj.send(key+"=", val)
49
69
  end
data/lib/runeblog.rb CHANGED
@@ -101,6 +101,18 @@ class RuneBlog
101
101
  @post_tags = []
102
102
  end
103
103
 
104
+ def _generate_global
105
+ vars = read_vars("#@root/data/universal.lt3")
106
+ global = File.read("#@root/data/global.lt3")
107
+ global.gsub!(/AUTHOR/, vars["author"])
108
+ global.gsub!(/SITE/, vars["site"])
109
+ global.gsub!(/FONT/, vars["font.family"])
110
+ global.gsub!(/CHARSET/, vars["charset"])
111
+ global.gsub!(/LOCALE/, vars["locale"])
112
+ File.write("#@root/data/global.lt3", global)
113
+ STDERR.puts "Remember: fix global.lt3"
114
+ end
115
+
104
116
  def _deploy_local(dir)
105
117
  log!(enter: __method__, args: [dir], level: 1)
106
118
  Dir.chdir(dir) do
@@ -2,7 +2,7 @@
2
2
  if ! (Object.constants.include?(:RuneBlog) && RuneBlog.constants.include?(:Path))
3
3
 
4
4
  class RuneBlog
5
- VERSION = "0.2.80"
5
+ VERSION = "0.2.81"
6
6
 
7
7
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
8
8
  Path = File.dirname(path)
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.2.80
4
+ version: 0.2.81
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-12 00:00:00.000000000 Z
11
+ date: 2019-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext
@@ -85,6 +85,7 @@ files:
85
85
  - data/EDITOR
86
86
  - data/ROOT
87
87
  - data/VIEW
88
+ - data/global.lt3
88
89
  - data/universal.lt3
89
90
  - empty_view/assets/austin-pano.jpg
90
91
  - empty_view/assets/sky2.jpg