jekyll-compose 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll-compose.rb +12 -0
- data/lib/{jekyll/compose → jekyll-compose}/version.rb +1 -1
- data/lib/jekyll/commands/draft.rb +10 -10
- data/lib/jekyll/commands/post.rb +5 -5
- data/lib/jekyll/commands/publish.rb +13 -11
- metadata +9 -9
- data/lib/jekyll/compose.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e03c15157254e0feae330dd9cb474290f59264b7
|
4
|
+
data.tar.gz: 932af0b45c76a9f3a14dc58bfe240df4af47ae55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88782ba853339b97e59489f88bd615f4b862a879b08475518984ff1459d3760b31a84fdec8ab71e472920038ca468f97e0b57f9b8bb556d064d445756c49b922
|
7
|
+
data.tar.gz: dd0601beaea3745d4ea703c9393ca40c360b4fb1c79350df26d45a64f9097687c6c634ad17223f55cf91144f759d168989d9435114ed57e0caa9764aea53b7c8
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "jekyll-compose/version"
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module Compose
|
5
|
+
DEFAULT_TYPE = "md"
|
6
|
+
DEFAULT_LAYOUT = "post"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
%w{draft post publish}.each do |file|
|
11
|
+
require File.expand_path("jekyll/commands/#{file}.rb", File.dirname(__FILE__))
|
12
|
+
end
|
@@ -16,11 +16,11 @@ module Jekyll
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def self.process(args, options = {})
|
19
|
+
def self.process(args = [], options = {})
|
20
20
|
raise ArgumentError.new('You must specify a name.') if args.empty?
|
21
|
-
|
22
|
-
type = options["type"]
|
23
|
-
layout = options["layout"]
|
21
|
+
|
22
|
+
type = options["type"] || Jekyll::Compose::DEFAULT_TYPE
|
23
|
+
layout = options["layout"] || Jekyll::Compose::DEFAULT_LAYOUT
|
24
24
|
|
25
25
|
title = args.shift
|
26
26
|
name = title.gsub(' ', '-').downcase
|
@@ -34,19 +34,19 @@ module Jekyll
|
|
34
34
|
end
|
35
35
|
|
36
36
|
puts "New draft created at ./#{draft_path}.\n"
|
37
|
-
end
|
37
|
+
end
|
38
38
|
# Internal: Gets the filename of the draft to be created
|
39
39
|
#
|
40
40
|
# Returns the filename of the draft, as a String
|
41
|
-
def self.draft_name(name, ext=
|
41
|
+
def self.draft_name(name, ext=Jekyll::Compose::DEFAULT_TYPE)
|
42
42
|
"_drafts/#{name}.#{ext}"
|
43
43
|
end
|
44
44
|
|
45
45
|
def self.front_matter(layout, title)
|
46
|
-
|
47
|
-
layout
|
48
|
-
title
|
49
|
-
|
46
|
+
{
|
47
|
+
"layout" => layout,
|
48
|
+
"title" => title,
|
49
|
+
}.to_yaml + "\n---\n"
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
data/lib/jekyll/commands/post.rb
CHANGED
@@ -17,11 +17,11 @@ module Jekyll
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
def self.process(args, options = {})
|
20
|
+
def self.process(args = [], options = {})
|
21
21
|
raise ArgumentError.new('You must specify a name.') if args.empty?
|
22
|
-
|
23
|
-
type = options["type"]
|
24
|
-
layout = options["layout"]
|
22
|
+
|
23
|
+
type = options["type"] || Jekyll::Compose::DEFAULT_TYPE
|
24
|
+
layout = options["layout"] || Jekyll::Compose::DEFAULT_LAYOUT
|
25
25
|
|
26
26
|
date = options["date"].nil? ? Time.now : DateTime.parse(options["date"])
|
27
27
|
|
@@ -37,7 +37,7 @@ module Jekyll
|
|
37
37
|
end
|
38
38
|
|
39
39
|
puts "New post created at ./#{post_path}.\n"
|
40
|
-
end
|
40
|
+
end
|
41
41
|
# Internal: Gets the filename of the draft to be created
|
42
42
|
#
|
43
43
|
# Returns the filename of the draft, as a String
|
@@ -3,7 +3,7 @@ module Jekyll
|
|
3
3
|
class Publish < Command
|
4
4
|
def self.init_with_program(prog)
|
5
5
|
prog.command(:publish) do |c|
|
6
|
-
c.syntax 'publish
|
6
|
+
c.syntax 'publish DRAFT_PATH'
|
7
7
|
c.description 'Moves a draft into the _posts directory and sets the date'
|
8
8
|
|
9
9
|
c.option 'date', '-d DATE', '--date DATE', 'Specify the post date'
|
@@ -14,17 +14,19 @@ module Jekyll
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
def self.process(args, options = {})
|
18
|
-
raise ArgumentError.new('You must specify a
|
19
|
-
|
17
|
+
def self.process(args = [], options = {})
|
18
|
+
raise ArgumentError.new('You must specify a draft path.') if args.empty?
|
19
|
+
|
20
20
|
date = options["date"].nil? ? Date.today : Date.parse(options["date"])
|
21
|
-
|
21
|
+
draft_path = args.shift
|
22
|
+
|
23
|
+
raise ArgumentError.new("There was no draft found at '#{draft_path}'.") unless File.exist? draft_path
|
22
24
|
|
23
|
-
post_path = post_name(date,
|
24
|
-
FileUtils.mv(
|
25
|
+
post_path = post_name(date, draft_name(draft_path))
|
26
|
+
FileUtils.mv(draft_path, post_path)
|
25
27
|
|
26
|
-
puts "Draft #{
|
27
|
-
end
|
28
|
+
puts "Draft #{draft_path} was published to ./#{post_path}"
|
29
|
+
end
|
28
30
|
|
29
31
|
# Internal: Gets the filename of the post to be created
|
30
32
|
#
|
@@ -33,8 +35,8 @@ module Jekyll
|
|
33
35
|
"_posts/#{date.strftime('%Y-%m-%d')}-#{name}"
|
34
36
|
end
|
35
37
|
|
36
|
-
def self.draft_name(
|
37
|
-
|
38
|
+
def self.draft_name(path)
|
39
|
+
File.basename(path)
|
38
40
|
end
|
39
41
|
|
40
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-compose
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Parker Moore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -53,19 +53,19 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
61
|
+
version: '3.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
68
|
+
version: '3.0'
|
69
69
|
description: Streamline your writing in Jekyll with these commands.
|
70
70
|
email:
|
71
71
|
- parkrmoore@gmail.com
|
@@ -73,11 +73,11 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
+
- lib/jekyll-compose.rb
|
77
|
+
- lib/jekyll-compose/version.rb
|
76
78
|
- lib/jekyll/commands/draft.rb
|
77
79
|
- lib/jekyll/commands/post.rb
|
78
80
|
- lib/jekyll/commands/publish.rb
|
79
|
-
- lib/jekyll/compose.rb
|
80
|
-
- lib/jekyll/compose/version.rb
|
81
81
|
homepage: https://github.com/jekyll/jekyll-compose
|
82
82
|
licenses:
|
83
83
|
- MIT
|