runeblog 0.0.84 → 0.0.85

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: 5c8bcdac0cac7185eae4df854af9578b88068e70
4
- data.tar.gz: 45499a0fa575d8f2e491300e77ea9108f7eb5ca6
3
+ metadata.gz: 08c941c930b749a00a51599199cf83f8d072d736
4
+ data.tar.gz: 341352d2e1678bc543a502b7b8abce7d32e7b0cd
5
5
  SHA512:
6
- metadata.gz: 66ea3cf6ee070ce80f94e7ab99b4d55640394cfd57712c787fbd2409de44a0e74597d440e1cb3d91182188fcca0bffa9a519a2f8820ac668b8dba3beae2b37b7
7
- data.tar.gz: edfabd8f929c33f09f2ea86a99e859db2d46e6ee72214fa43268ff0559049c94873ee6967f91fc65a317bd74a57911543d6b55a75907f230775ad60a7ee5f2e6
6
+ metadata.gz: 9faa908cc4cda8fc8c5371378d44ddae7e0d71ba978f2cb392130763e688d3c0c5c73fc4f51a513e236edcb168fcd3124b3b25ba28c34a3372cd945a01a5fa14
7
+ data.tar.gz: 6422b5a0347c8ed089a20af0987a963f34221d738e6cf01f7d8be12c0733cdc08bd258f368c42c4d8345f0aa74de548f379dd28cf9e1d30a4d555217c18b5baa
data/lib/deploy.rb CHANGED
@@ -39,7 +39,7 @@ class RuneBlog::Deployment
39
39
  result = system(cmd)
40
40
  raise "Problem occurred in deployment" unless result
41
41
 
42
- File.write("#{@blog.view.dir}/last_deployed", files)
42
+ dump(files, "#{@blog.view.dir}/last_deployed")
43
43
  output! "...finished.\n"
44
44
  @out
45
45
  end
data/lib/helpers-blog.rb CHANGED
@@ -46,9 +46,9 @@ module RuneBlog::Helpers
46
46
  end
47
47
 
48
48
  def new_sequence
49
- File.write("sequence", 0)
50
- File.write("VERSION", "#{RuneBlog::VERSION}\n" +
51
- "Blog created: " + Time.now.to_s)
49
+ dump(0, "sequence")
50
+ version_info = "#{RuneBlog::VERSION}\nBlog created: #{Time.now.to_s}"
51
+ dump(version_info, "VERSION")
52
52
  end
53
53
 
54
54
  def subdirs(dir)
@@ -85,4 +85,8 @@ module RuneBlog::Helpers
85
85
  puts err.backtrace
86
86
  end
87
87
 
88
+ def dump(obj, name)
89
+ File.write(name, obj)
90
+ end
91
+
88
92
  end
data/lib/post.rb CHANGED
@@ -25,7 +25,7 @@ class RuneBlog::Post
25
25
  @meta = meta
26
26
  html = interpolate(template)
27
27
  @draft = "#{@blog.root}/src/#@slug.lt3"
28
- File.write(@draft, html)
28
+ dump(html, @draft)
29
29
  end
30
30
 
31
31
  def edit
@@ -61,12 +61,12 @@ class RuneBlog::Post
61
61
 
62
62
  def create_post_subtree(vdir)
63
63
  create_dir("assets")
64
- File.write("metadata.yaml", @meta.to_yaml)
65
- File.write("teaser.txt", @meta.teaser)
66
- File.write("remainder.txt", @meta.remainder)
67
- template = RuneBlog::Default::TeaserTemplate
64
+ dump(@meta.to_yaml, "metadata.yaml")
65
+ dump(@meta.teaser, "teaser.txt")
66
+ dump(@meta.remainder, "remainder.txt")
67
+ template = RuneBlog::Default::TeaserTemplate # FIXME template into custom dir?
68
68
  text = interpolate(template)
69
- File.write("index.html", text)
69
+ dump(text, "index.html") # FIXME write_index ?
70
70
  end
71
71
 
72
72
  def make_slug(postnum = nil)
data/lib/repl.rb CHANGED
@@ -66,7 +66,7 @@ module RuneBlog::REPL
66
66
  result = system(cmd)
67
67
  raise "Problem occurred in deployment" unless result
68
68
 
69
- File.write("#{vdir}/last_deployed", files)
69
+ dump(files, "#{vdir}/last_deployed")
70
70
  output! "...finished.\n"
71
71
  @out
72
72
  rescue => err
data/lib/runeblog.rb CHANGED
@@ -14,6 +14,7 @@ require 'version'
14
14
  class RuneBlog
15
15
 
16
16
  DotDir = ".blog"
17
+ ConfigFile = "#{DotDir}/config"
17
18
 
18
19
  class << self
19
20
  attr_accessor :blog
@@ -44,7 +45,7 @@ class RuneBlog
44
45
  # What views are there? Deployment, etc.
45
46
  self.class.blog = self # Weird. Like a singleton - dumbass circular dependency?
46
47
  @root, @view_name, @editor =
47
- read_config(DotDir + "/config", :root, :current_view, :editor)
48
+ read_config(ConfigFile, :root, :current_view, :editor)
48
49
  @views = get_views
49
50
  @view = str2view(@view_name)
50
51
  @sequence = get_sequence
@@ -82,18 +83,17 @@ class RuneBlog
82
83
  end
83
84
 
84
85
  def next_sequence
85
- File.write("#@root/sequence", @sequence += 1)
86
+ dump(@sequence += 1, "#@root/sequence")
86
87
  @sequence
87
88
  end
88
89
 
89
- def viewdir(v)
90
+ def viewdir(v = nil)
91
+ v ||= @view
90
92
  @root + "/views/#{v}/"
91
93
  end
92
94
 
93
95
  def self.exist?
94
- File.exist?(DotDir) &&
95
- File.directory?(DotDir) &&
96
- File.exist?(DotDir + "/config")
96
+ Dir.exist?(DotDir) && File.exist?(ConfigFile)
97
97
  end
98
98
 
99
99
  def create_view(arg)
@@ -104,17 +104,15 @@ class RuneBlog
104
104
  create_dir(dir)
105
105
  up = Dir.pwd
106
106
  Dir.chdir(dir)
107
+ x = RuneBlog::Default
107
108
  create_dir('custom')
108
109
  create_dir('assets')
109
- File.write("deploy", "")
110
- File.write("custom/blog_header.html",
111
- RuneBlog::Default::BlogHeader)
112
- File.write("custom/blog_trailer.html",
113
- RuneBlog::Default::BlogTrailer)
114
- File.write("custom/post_template.html",
115
- RuneBlog::Default::PostTemplate)
116
- File.write("last_deployed",
117
- "Initial creation")
110
+ # FIXME dump method??
111
+ dump("", "deploy")
112
+ dump(x::BlogHeader, "custom/blog_header.html")
113
+ dump(x::BlogTrailer, "custom/blog_trailer.html")
114
+ dump(x::PostTemplate, "custom/post_template.html")
115
+ dump("Initial creation", "last_deployed")
118
116
  Dir.chdir(up)
119
117
  @views << RuneBlog::View.new(arg)
120
118
  end
@@ -127,10 +125,9 @@ class RuneBlog
127
125
  end
128
126
 
129
127
  def view_files
130
- vdir = @blog.viewdir(@view)
131
- # meh
128
+ vdir = @blog.viewdir
132
129
  files = ["#{vdir}/index.html"]
133
- files += Dir.entries(vdir).grep(/^\d{4}/).map {|x| "#{vdir}/#{x}" }
130
+ files += posts.map {|x| "#{vdir}/#{x}" }
134
131
  # Huh?
135
132
  files.reject! {|f| File.mtime(f) < File.mtime("#{vdir}/last_deployed") }
136
133
  end
@@ -207,10 +204,13 @@ class RuneBlog
207
204
  vdir = self.viewdir(view)
208
205
  dir = vdir + @meta.slug + "/"
209
206
  create_dir(dir + "assets")
210
- File.write("#{dir}/metadata.yaml", @meta.to_yaml)
211
- template = File.read(vdir + "custom/post_template.html")
212
- post = interpolate(template)
213
- File.write(dir + "index.html", post)
207
+ Dir.chdir(dir) do
208
+ dump(@meta.to_yaml, "metadata.yaml")
209
+ # FIXME make get_post_template method
210
+ template = File.read("#{vdir}/custom/post_template.html")
211
+ post = interpolate(template)
212
+ dump(post, "index.html")
213
+ end
214
214
  generate_index(view)
215
215
  rescue => err
216
216
  error(err)
data/lib/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  class RuneBlog
3
- VERSION = "0.0.84"
3
+ VERSION = "0.0.85"
4
4
 
5
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  end
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.84
4
+ version: 0.0.85
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton