diary 0.1.5 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,55 +0,0 @@
1
- module Diary
2
- class Site
3
- include Message
4
-
5
- def initialize(options = {})
6
- # Create directories
7
- create_dir 'templates'
8
- create_dir 'drafts'
9
- create_dir 'posts'
10
- create_dir 'pages'
11
- create_dir 'assets'
12
-
13
- # Create files
14
- create_file 'templates/index.html', '{{ yield }}'
15
- end
16
-
17
- def self.compile(force = false)
18
- unless (Post.all.size == 0) and (Page.all.size == 0)
19
- Post.all.each { |p| p.output(force) }
20
- Page.all.each { |p| p.output(force) }
21
- return self
22
- else
23
- puts "#{Error} Nothing to compile"
24
- end
25
- end
26
-
27
- def self.sync
28
- # TODO use rsync to sync over ftp
29
- end
30
-
31
- private
32
-
33
- def create_dir(path)
34
- unless File.exists?(path)
35
- FileUtils.mkdir_p(path)
36
-
37
- say Create, path
38
- else
39
- say Exist, path
40
- end
41
- end
42
-
43
- def create_file(path, content)
44
- unless File.exists?(path)
45
- f = File.new(path, "w+")
46
- f.puts(content)
47
- f.close
48
-
49
- say Create, path
50
- else
51
- say Exist, path
52
- end
53
- end
54
- end
55
- end
@@ -1,27 +0,0 @@
1
- module Diary
2
- module Template
3
- include Message
4
-
5
- def template
6
- File.new(template_lookup).tap do |file|
7
- say Invoke, file.path
8
- end
9
- end
10
-
11
- private
12
-
13
- def template_lookup
14
- template_names.each do |name|
15
- return template_path(name) if File.exists?(template_path(name))
16
- end
17
- end
18
-
19
- def template_path(name)
20
- File.join("templates", "#{name}.html")
21
- end
22
-
23
- def template_names
24
- [data.template, slug, self.class.name.downcase, 'index'].compact
25
- end
26
- end
27
- end
@@ -1,10 +0,0 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
- require 'shoulda'
4
-
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
- $LOAD_PATH.unshift(File.dirname(__FILE__))
7
- require 'diary'
8
-
9
- class Test::Unit::TestCase
10
- end
@@ -1,7 +0,0 @@
1
- require 'helper'
2
-
3
- class TestDiary < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
6
- end
7
- end