runeblog 0.0.45 → 0.0.48

Sign up to get free protection for your applications and to get access to all the features.
data/lib/runeblog.rb CHANGED
@@ -3,23 +3,35 @@ require 'yaml'
3
3
  require 'livetext'
4
4
 
5
5
  class RuneBlog
6
- VERSION = "0.0.45"
6
+ VERSION = "0.0.48"
7
7
 
8
8
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
9
9
  DefaultData = Path + "/../data"
10
10
 
11
- BlogHeader = File.read(DefaultData + "/custom/blog_header.html") rescue "not found"
12
- BlogTrailer = File.read(DefaultData + "/custom/blog_trailer.html") rescue "not found"
13
- end
11
+ BlogHeaderPath = DefaultData + "/custom/blog_header.html"
12
+ BlogTrailerPath = DefaultData + "/custom/blog_trailer.html"
13
+
14
+ BlogHeader = File.read(BlogHeaderPath) rescue "not found"
15
+ BlogTrailer = File.read(BlogTrailerPath) rescue "not found"
14
16
 
15
- class RuneBlog::Config
16
17
  attr_reader :root, :views, :view, :sequence
17
18
  attr_writer :view # FIXME
18
19
 
19
- def initialize(cfg_file = ".blog")
20
+ def self.create_new_blog
21
+ #-- what if data already exists?
22
+ result = system("cp -r #{RuneBlog::DefaultData} .")
23
+ raise "Error copying default data" unless result
24
+
25
+ File.open(".blog", "w") do |f|
26
+ f.puts "data"
27
+ f.puts "no_default"
28
+ end
29
+ File.open("data/VERSION", "a") {|f| f.puts "\nBlog created: " + Time.now.to_s }
30
+ end
31
+
32
+ def initialize(cfg_file = ".blog") # assumes existing blog
20
33
  # What views are there? Deployment, etc.
21
34
  # Crude - FIXME later
22
- new_blog! unless File.exist?(cfg_file)
23
35
 
24
36
  lines = File.readlines(cfg_file).map {|x| x.chomp }
25
37
  @root = lines[0]
@@ -41,5 +53,30 @@ class RuneBlog::Config
41
53
  @root + "/views/#{v}/"
42
54
  end
43
55
 
44
- end
56
+ def self.exist?
57
+ File.exist?(".blog")
58
+ end
45
59
 
60
+ # def self.create_new_post(title, date, view)
61
+ # @template = <<-EOS
62
+ # .mixin liveblog
63
+ #
64
+ # .title #{title}
65
+ # .pubdate #{date}
66
+ # .views #{view}
67
+ #
68
+ # .teaser
69
+ # Teaser goes here.
70
+ # .end
71
+ # Remainder of post goes here.
72
+ # EOS
73
+ #
74
+ # @slug = make_slug(title)
75
+ # @fname = @slug + ".lt3"
76
+ # File.open("#@root/src/#@fname", "w") {|f| f.puts @template }
77
+ # @fname
78
+ # rescue => err
79
+ # error(err, __LINE__, __FILE__)
80
+ # end
81
+
82
+ 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.0.45
4
+ version: 0.0.48
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-08-27 00:00:00.000000000 Z
11
+ date: 2018-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext
@@ -45,8 +45,12 @@ files:
45
45
  - data/views/_default/custom/blog_header.html
46
46
  - data/views/_default/custom/blog_trailer.html
47
47
  - data/views/_default/custom/post_template.html
48
+ - data/views/_default/deploy
48
49
  - data/views/_default/last_deployed
49
50
  - lib/blogcmds.rb
51
+ - lib/newruneblog.rb
52
+ - lib/oldrepl.rb
53
+ - lib/oldruneblog.rb
50
54
  - lib/repl.rb
51
55
  - lib/runeblog.rb
52
56
  - runeblog.gemspec