runeblog 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/data/VERSION +1 -1
  3. data/lib/runeblog.rb +27 -21
  4. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6850c3b1c5048a79ad24094adfd0b138ab87f09
4
- data.tar.gz: 0fa28fc42c267a939c4b90b1a9e15ac89fbb4d92
3
+ metadata.gz: 35cd3bc45d63b45e744878d45dab9423d7a634e1
4
+ data.tar.gz: 31b0ec4d3168c9c7a69aa24fa9f7962b5f848ce0
5
5
  SHA512:
6
- metadata.gz: f02f50ce9559bfd17fb74d632c81855317d7b77b9fb0f5e29e48cd03c5546b2b16315765618f923d4daa85765caf90d77c53dbf8d281e719499baa6ceaaf842e
7
- data.tar.gz: 43f5410597ee6f2e2046b2cf7b669432e09c1aa48be1c4a3063a9e2a68480cde974eadfe7a51a93ed2f1b207dbca3b6201884f442be85ae8fe79c03dca777170
6
+ metadata.gz: 597ff3b26850ad4b4d329dfdd6e1cad31fe7636fbcef0f8a42af92cbae2072e802207f094d84084b5ea12923e2f9d44dd5dcd1c580b3d8839b19e2f927c4a06f
7
+ data.tar.gz: cde7e7c1eec5f05ea3a1acb2adf6646e0ac60995a81dc6637e7ce1a79e6577721b3852608383e68ab460c24569bea7bd7d9caa2888d5efbe938ef8d5226b3bda
data/data/VERSION CHANGED
@@ -1 +1 @@
1
- RuneBlog v 0.0.20 2017-05-07
1
+ RuneBlog v 0.0.21 2017-05-08
data/lib/runeblog.rb CHANGED
@@ -1,5 +1,6 @@
1
+
1
2
  class RuneBlog
2
- VERSION = "0.0.20"
3
+ VERSION = "0.0.21"
3
4
 
4
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
5
6
  DefaultData = Path + "/../data"
@@ -59,11 +60,15 @@ end
59
60
 
60
61
  def new_blog!
61
62
  unless File.exist?(".blog")
62
- yn = ask(red(" No .blog found. Create new blog?"))
63
+ yn = ask(red(" No .blog found. Create new blog? "))
63
64
  if yn.upcase == "Y"
64
65
  #-- what if data already exists?
65
66
  system("cp -r #{RuneBlog::DefaultData} .")
66
- File.open(".blog", "w") {|f| f.puts "data" }
67
+ File.open(".blog", "w") do |f|
68
+ f.puts "data"
69
+ f.puts "no_default"
70
+ end
71
+ system("echo Created #{Time.now} >>data/VERSION")
67
72
  end
68
73
  end
69
74
  end
@@ -87,23 +92,20 @@ end
87
92
  ### read_config
88
93
 
89
94
  def read_config
95
+ cfg_file = ".blog"
90
96
  @config = OpenStruct.new
91
97
  # What views are there? Deployment, etc.
92
98
  # Crude - FIXME later
93
- root = File.readlines(".blog").first.chomp rescue "myblog"
99
+ new_blog! unless File.exist?(cfg_file)
100
+
101
+ lines = File.readlines(cfg_file).map {|x| x.chomp }
102
+ root = lines[0]
103
+ @view ||= lines[1]
94
104
  dirs = Dir.entries("#{root}/views/") - %w[. ..]
95
105
  dirs.reject! {|x| ! File.directory?("#{root}/views/#{x}") }
96
106
  @config.root = root
97
107
  @config.views = dirs
98
108
  @config.sequence = File.read(root + "/sequence").to_i
99
- rescue => err
100
- if root != "myblog"
101
- raise err
102
- end
103
-
104
- new_blog!
105
- STDERR.puts "Created. Now run again."
106
- exit
107
109
  end
108
110
 
109
111
  ### create_empty_post
@@ -114,10 +116,9 @@ def create_empty_post
114
116
 
115
117
  .liveblog_version
116
118
 
117
- .title #{@title}
118
- .pubdate #{@date}
119
- .categories elixir ruby
120
- .views computing
119
+ .title #@title
120
+ .pubdate #@date
121
+ .views #@view
121
122
 
122
123
  Teaser goes here.
123
124
  .readmore
@@ -140,9 +141,10 @@ end
140
141
 
141
142
  def process_post(file)
142
143
  @main ||= Livetext.new
144
+ @main.main.output = File.new("/tmp/WHOA","w")
143
145
  puts " Processing: #{Dir.pwd} :: #{file}"
144
- path = @config.root + "/src/#{file}"
145
- @meta = @main.process_file(file)
146
+ path = @config.root + "/src/#{file}"
147
+ @meta = @main.process_file(path)
146
148
  @meta.slug = make_slug(@meta.title, @config.sequence)
147
149
  @meta.slug = file.sub(/.lt3$/, "")
148
150
  @meta
@@ -152,7 +154,8 @@ end
152
154
 
153
155
  def reload_post(file)
154
156
  @main ||= Livetext.new
155
- @meta = process_post("#{@config.root}/src/#{file}")
157
+ @main.main.output = File.new("/tmp/WHOA","w")
158
+ @meta = process_post(file)
156
159
  @meta.slug = file.sub(/.lt3$/, "")
157
160
  @meta
158
161
  end
@@ -196,10 +199,12 @@ end
196
199
  ### link_post_view
197
200
 
198
201
  def link_post_view(view)
199
- p @meta
200
202
  # Create dir using slug (index.html, metadata?)
201
203
  vdir = "#{@config.root}/views/#{view}"
204
+ p "vdir = #{vdir}"
202
205
  dir = "#{vdir}/#{@meta.slug}"
206
+ p "dir = #{dir}"
207
+ p "cwd = #{Dir.pwd}"
203
208
  cmd = "mkdir -p #{dir}" #-- FIXME what if this exists??
204
209
  puts " Running: #{cmd}"
205
210
  system(cmd)
@@ -328,7 +333,8 @@ def new_post
328
333
 
329
334
  file = create_empty_post
330
335
  edit_post(file)
331
- process_post(file)
336
+ # file = @config.root + "/src/" + file
337
+ process_post(file) #- FIXME handle each view
332
338
  if publish?
333
339
  link_post(@meta)
334
340
  publish_post
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.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-07 00:00:00.000000000 Z
11
+ date: 2017-05-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A blog system based on Ruby and Livetext
14
14
  email: rubyhacker@gmail.com
@@ -48,8 +48,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
48
48
  version: '0'
49
49
  requirements: []
50
50
  rubyforge_project:
51
- rubygems_version: 2.2.2
51
+ rubygems_version: 2.4.2
52
52
  signing_key:
53
53
  specification_version: 4
54
54
  summary: A command-line blogging system
55
55
  test_files: []
56
+ has_rdoc: