plate 0.5.0 → 0.5.1

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.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## Plate 0.5.1
2
+
3
+ * Updates to new post command line utility. Pass in a category and layout to a new post.
4
+
1
5
  ## Plate 0.5.0
2
6
 
3
7
  * Initial build, basic site generation, asset compilation and template handling.
data/README.md CHANGED
@@ -1,10 +1,12 @@
1
1
  # Plate
2
2
 
3
+ [![Build Status](https://secure.travis-ci.org/jdtornow/plate.png)](http://travis-ci.org/jdtornow/plate) [![Dependency Status](https://gemnasium.com/jdtornow/plate.png?travis)](https://gemnasium.com/jdtornow/plate)
4
+
3
5
  Plate is a super simple static site generator and blog engine. It takes a folder full of Markdown files and turns it into a site that you can host anywhere. The output is a plain old static HTML site. In addition to basic formatting with Markdown, Plate also supports generating asset files with CoffeeScript, Sass and others.
4
6
 
5
7
  ## Requirements
6
8
 
7
- * Ruby 1.8.7, 1.9.2 or 1.9.3
9
+ * Ruby 1.9.2 or 1.9.3
8
10
  * Bundler
9
11
 
10
12
  ## Installation
data/lib/plate/cli.rb CHANGED
@@ -29,9 +29,17 @@ module Plate
29
29
  opts = OptionParser.new do |opts|
30
30
  banner = "Usage: plate [command] [options]"
31
31
 
32
+ opts.on('--category [CATEGORY]', '-c', 'Pass in a category for creating a new post.') do |c|
33
+ options[:category] = c
34
+ end
35
+
32
36
  opts.on('--destination [PATH]', '-d', 'Set the destination directory for this build.') do |d|
33
37
  @destination = File.expand_path(d)
34
38
  end
39
+
40
+ opts.on('--layout [LAYOUT]', '-l', 'Pass in a layout for creating a new post.') do |l|
41
+ options[:layout] = l
42
+ end
35
43
 
36
44
  opts.on('--source [PATH]', '-s', 'Set the source directory for this build.') do |s|
37
45
  @source = File.expand_path(s)
@@ -176,8 +184,11 @@ module Plate
176
184
  title = args.size == 0 ? "" : args[0]
177
185
  slug = title.parameterize
178
186
  date = Time.now
187
+ category = options[:category] ? "\ncategory: #{options[:category]}" : ""
188
+ layout = options[:layout] ? "\nlayout: #{options[:layout]}" : ""
189
+
179
190
  filename = File.join(self.source, 'posts', date.strftime('%Y/%m'), "#{date.strftime('%Y-%m-%d')}-#{slug}.md")
180
- content = %Q(---\ntitle: "#{title}"\ndate: #{date.strftime('%Y-%m-%d %H:%M:%S')}\ntags: []\n\n# #{title}\n\n)
191
+ content = %Q(---\ntitle: "#{title}"\ndate: #{date.strftime('%Y-%m-%d %H:%M:%S')}#{category}#{layout}\ntags: []\n\n# #{title}\n\n)
181
192
 
182
193
  FileUtils.mkdir_p(File.dirname(filename))
183
194
  File.open(filename, 'w') { |f| f.write(content) }
data/lib/plate/page.rb CHANGED
@@ -233,6 +233,11 @@ module Plate
233
233
  self.id == other or self.relative_file == other
234
234
  end
235
235
 
236
+ # Compare two posts, by date.
237
+ def <=>(other)
238
+ self.path <=> other.path
239
+ end
240
+
236
241
  protected
237
242
  def apply_layout_to(content)
238
243
  return content unless Layout === self.layout
data/lib/plate/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Plate
2
- VERSION = "0.5.0" unless defined?(::Plate::VERSION)
2
+ VERSION = "0.5.1" unless defined?(::Plate::VERSION)
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-03-11 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70223080715580 !ruby/object:Gem::Requirement
16
+ requirement: &70156589437180 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70223080715580
24
+ version_requirements: *70156589437180
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: directory_watcher
27
- requirement: &70223080715200 !ruby/object:Gem::Requirement
27
+ requirement: &70156589436800 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70223080715200
35
+ version_requirements: *70156589436800
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: i18n
38
- requirement: &70223080714660 !ruby/object:Gem::Requirement
38
+ requirement: &70156589471840 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0.6'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70223080714660
46
+ version_requirements: *70156589471840
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
- requirement: &70223080714240 !ruby/object:Gem::Requirement
49
+ requirement: &70156589471420 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70223080714240
57
+ version_requirements: *70156589471420
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: redcarpet
60
- requirement: &70223080713700 !ruby/object:Gem::Requirement
60
+ requirement: &70156589470880 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '2'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70223080713700
68
+ version_requirements: *70156589470880
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: tilt
71
- requirement: &70223080713200 !ruby/object:Gem::Requirement
71
+ requirement: &70156589470380 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '1.3'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70223080713200
79
+ version_requirements: *70156589470380
80
80
  description: Plate is a simple Ruby-based static blogging engine.
81
81
  email:
82
82
  - john@johntornow.com