runeblog 0.0.3 → 0.0.4

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/bin/blog +2 -0
  3. data/lib/runeblog.rb +106 -7
  4. metadata +2 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e996193cfee558fdab3b17b02e08f8ebe3b3c83d
4
- data.tar.gz: 805c6cd7fe27f5a5075b29f2bf9875447e72dea0
3
+ metadata.gz: 9e034983c00953cc01830126957980c035b5645a
4
+ data.tar.gz: 1506bb1d0896fa3b2edc428e72898cfe6ed6d4a0
5
5
  SHA512:
6
- metadata.gz: f6a9b605b46f8766b68f0cba4de92582691eb0c630e0c738566330061d911378f982bc0d3a7874f85077de172a8e4a689d7193b7faccd2759cd78ca176f53757
7
- data.tar.gz: daf50aae81d643a772eb82859c3ceae4b2d7bb55f54c9a3be6412213eac15d62beacb8ee06ac47df7e402a6981223854163a060fd273fbbd2f6b7da1cdfa1b64
6
+ metadata.gz: 58021c439a79d6bb733d4263b6784a549228db41ece7735e288a7fb90eb25b9021840ef4ac6d186fc2f0a51e693e8d8bde16cc7d765165fc57edab31502c6eae
7
+ data.tar.gz: 1dd2ff063a587ac27bc899d939d2fddfd9760e1012b5520b97b3535799145859b0deda655bf5780b814bf781f282a39843967e8702cb915ae1b36fad1a46fa00
data/bin/blog CHANGED
@@ -10,8 +10,10 @@ def execute_command
10
10
  when "q", "quit"; exit
11
11
  when "p", "post"; new_post
12
12
  when "new post"; new_post # same as above
13
+ when "list posts", "lsp"; list_posts
13
14
  when "new view"; new_view(@arg)
14
15
  when "lsv", "list views"; list_views
16
+ when "view", "v"; change_view(@arg)
15
17
  when "import post"; import(@arg)
16
18
  when "relink"; relink
17
19
  when "rebuild"; rebuild
data/lib/runeblog.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  class RuneBlog
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
 
5
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  end
@@ -82,13 +82,13 @@ def read_config
82
82
  @config.root = root
83
83
  @config.views = dirs
84
84
  @config.sequence = File.read(root + "/sequence").to_i
85
- rescue
86
- STDERR.puts "No config file found. Create a new blog?"
87
- resp = gets.chomp
88
- if resp.downcase == "y"
89
- blog_new!
90
- STDERR.puts "Created. Now run again."
85
+ rescue => err
86
+ if root != "myblog"
87
+ raise err
91
88
  end
89
+
90
+ new_blog!
91
+ STDERR.puts "Created. Now run again."
92
92
  exit
93
93
  end
94
94
 
@@ -252,6 +252,13 @@ def list_views
252
252
  puts @config.views
253
253
  end
254
254
 
255
+ ### change_view
256
+
257
+ def change_view(arg = nil)
258
+ raise "view #{arg} does not exist" unless @config.views.include?(arg)
259
+ @view = arg
260
+ end
261
+
255
262
  ### new_view
256
263
 
257
264
  def new_view(arg = nil)
@@ -262,6 +269,10 @@ def new_view(arg = nil)
262
269
  dir = @config.root + "/views/" + arg
263
270
  cmd = "mkdir -p #{dir}/custom"
264
271
  system(cmd)
272
+ File.write("#{dir}/custom/blog_header.html", RuneBlog::BlogHeader)
273
+ File.write("#{dir}/custom/blog_trailer.html", RuneBlog::BlogTrailer)
274
+ File.write("#{dir}/custom/post_header.html", RuneBlog::PostHeader)
275
+ File.write("#{dir}/custom/post_trailer.html", RuneBlog::PostTrailer)
265
276
  @config.views << arg
266
277
  end
267
278
 
@@ -302,3 +313,91 @@ def new_post
302
313
  end
303
314
  end
304
315
 
316
+ ### list_posts
317
+
318
+ def list_posts
319
+ system("ls -l #{@config.root}/views/#@view/")
320
+ end
321
+
322
+
323
+ ### templates
324
+
325
+ class RuneBlog
326
+
327
+ # Default BlogHeader: TITLE, IMAGE
328
+
329
+ BlogHeader = <<-EOF
330
+ <html>
331
+ <body background=speckle-texture-vector.jpg>
332
+
333
+ <title>TITLE</title>
334
+
335
+ <table>
336
+ <tr>
337
+ <td>
338
+ <img src=IMAGE.jpg width=400 height=300>
339
+ </td>
340
+ <td>
341
+ <h3>Yet another blog by Hal Fulton</h3>
342
+ <br>
343
+ <br>
344
+ <b>Note</b>: I can never find a blogging engine I like! <br>
345
+ For now, this will just be a set of static pages.
346
+ <br>
347
+ <br>
348
+ If you want to comment, just <a href=mailto:rubyhacker@gmail.com>email me</a>.
349
+ </td>
350
+ </tr>
351
+ </table>
352
+
353
+ <hr>
354
+ EOF
355
+
356
+ # Default BlogTrailer
357
+
358
+ BlogTrailer = <<-EOF
359
+ EOF
360
+
361
+ # Default PostHeader
362
+
363
+ PostHeader = <<-EOF
364
+ <html>
365
+
366
+ <script>
367
+ window.fbAsyncInit = function() {
368
+ FB.init({
369
+ appId : '1176481582378716',
370
+ xfbml : true,
371
+ version : 'v2.4'
372
+ });
373
+ };
374
+
375
+ (function(d, s, id){
376
+ var js, fjs = d.getElementsByTagName(s)[0];
377
+ if (d.getElementById(id)) {return;}
378
+ js = d.createElement(s); js.id = id;
379
+ js.src = "//connect.facebook.net/en_US/sdk.js";
380
+ fjs.parentNode.insertBefore(js, fjs);
381
+ }(document, 'script', 'facebook-jssdk'));
382
+ </script>
383
+
384
+ <body>
385
+ <div
386
+ class="fb-like"
387
+ data-share="true"
388
+ data-width="450"
389
+ data-show-faces="true">
390
+ </div>
391
+
392
+ <hr>
393
+ EOF
394
+
395
+ # Default PostTrailer: BACK, HOME
396
+
397
+ PostTrailer = <<-EOF
398
+ <hr>
399
+ <a href="http://rubyhacker.com/BACK" style="text-decoration: none">Back</a>
400
+ <a href="http://rubyhacker.com/HOME" style="text-decoration: none">Home</a>
401
+ EOF
402
+ end
403
+
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.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
@@ -42,9 +42,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
42
42
  version: '0'
43
43
  requirements: []
44
44
  rubyforge_project:
45
- rubygems_version: 2.4.2
45
+ rubygems_version: 2.2.2
46
46
  signing_key:
47
47
  specification_version: 4
48
48
  summary: A command-line blogging system
49
49
  test_files: []
50
- has_rdoc: