octopress 3.0.0.alpha8 → 3.0.0.rc.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.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/.travis.yml +5 -0
- data/README.md +130 -27
- data/lib/octopress.rb +8 -2
- data/lib/octopress/command.rb +3 -0
- data/lib/octopress/commands/build.rb +1 -4
- data/lib/octopress/commands/doctor.rb +3 -7
- data/lib/octopress/commands/helpers.rb +8 -3
- data/lib/octopress/commands/init.rb +15 -0
- data/lib/octopress/commands/new.rb +25 -22
- data/lib/octopress/commands/publish.rb +3 -1
- data/lib/octopress/commands/serve.rb +4 -7
- data/lib/octopress/configuration.rb +20 -12
- data/lib/octopress/draft.rb +39 -8
- data/lib/octopress/{core_ext.rb → ext/hash.rb} +0 -0
- data/lib/octopress/ext/titlecase.rb +37 -0
- data/lib/octopress/page.rb +49 -33
- data/lib/octopress/post.rb +17 -16
- data/lib/octopress/scaffold.rb +26 -0
- data/lib/octopress/version.rb +1 -1
- data/octopress.gemspec +1 -1
- data/scaffold/_octopress.yml +11 -0
- data/scaffold/_templates/page +6 -0
- data/scaffold/_templates/post +6 -0
- data/test/expected/_drafts/stupid-idea.markdown +6 -0
- data/test/expected/_layouts/page.html +1 -0
- data/test/expected/_layouts/post.html +1 -0
- data/test/expected/_octopress.yml +11 -0
- data/test/expected/_posts/2014-03-11-idea.markdown +6 -0
- data/test/expected/_posts/2014-03-12-awesome-stuff.markdown +6 -0
- data/test/expected/_posts/2014-03-13-awesome.markdown +6 -0
- data/test/expected/_site/2014/03/11/idea.html +1 -0
- data/test/expected/_site/2014/03/12/awesome-stuff.html +1 -0
- data/test/expected/_site/2014/03/13/awesome.html +1 -0
- data/test/expected/_site/awesome-page.html +1 -0
- data/test/expected/_site/cool-page.html +1 -0
- data/test/expected/_site/index.html +0 -0
- data/test/expected/_site/okay-page/index.html +1 -0
- data/test/expected/_templates/page +6 -0
- data/test/expected/_templates/post +6 -0
- data/test/expected/awesome-page.html +5 -0
- data/test/expected/cool-page.html +5 -0
- data/test/expected/index.html +0 -0
- data/test/expected/okay-page/index.html +5 -0
- data/test/test.rb +100 -0
- data/test/test_suite.rb +107 -0
- metadata +57 -10
- data/docs/_octopress.yml +0 -1
- data/docs/index.html +0 -1
- data/lib/octopress/commands/docs.rb +0 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 787005c08bc0ed8ae3f2eefcf5b38ea90b372b20
|
4
|
+
data.tar.gz: 8824a64b418e2eb02a19bdef317ce9040a406628
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccec315c07272d23b79a08a48309e92aa8781f7dbca95f15c7985ded4c3e6794e08ff2eab110d32978856442d817c6ea235de5f1bb1d67874f390540668f0724
|
7
|
+
data.tar.gz: 9fb4b0328393f5880217ff015ae256149afdf0a9f8d666929d43fbb86abde7940b1603ab26b59f5930c0fb6f1cf518ccc307713a9929d022508df051d83c4cfe
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -17,53 +17,156 @@ Or install it yourself as:
|
|
17
17
|
|
18
18
|
$ gem install octopress
|
19
19
|
|
20
|
-
## Usage
|
20
|
+
## Basic Usage
|
21
21
|
|
22
|
-
|
22
|
+
Here are the commands for Octopress.
|
23
23
|
|
24
|
-
|
24
|
+
| Option | Description |
|
25
|
+
|:--------------------------------|:------------------------------------------|
|
26
|
+
| `octopress init <PATH>` | Adds Octopress scaffolding to your site |
|
27
|
+
| `octopress new post <TITLE>` | Add a new post to your site |
|
28
|
+
| `octopress new page <PATH>` | Add a new page to your site |
|
29
|
+
| `octopress new draft <TITLE>` | Add a new draft post to your site |
|
30
|
+
| `octopress publish <PATH>` | Publish a draft from _drafts to _posts |
|
31
|
+
| `octopress new <PATH>` | works just like `jekyll new` |
|
32
|
+
| `octopress build` | works just like `jekyll build` |
|
33
|
+
| `octopress serve` | works just like `jekyll serve` |
|
34
|
+
| `octopress doctor` | works just like `jekyll doctor` |
|
25
35
|
|
26
|
-
|
27
|
-
|
36
|
+
Run `octopress [command] --help` to learn more about any command and see its options.
|
37
|
+
|
38
|
+
### Deployment
|
39
|
+
|
40
|
+
You can deploy your Octopress or Jeklly blog via git, rsync or Amazon S3. The deployment system ships with the [octopress-deploy][] gem which extends the Octopress CLI with the `deploy` command.
|
41
|
+
|
42
|
+
[octopress-deploy]: https://github.com/octopress/deploy
|
43
|
+
|
44
|
+
## Configuration
|
45
|
+
|
46
|
+
Octopress reads its configurations from `_octopress.yml`. Here's what the configuration looks like by default.
|
47
|
+
|
48
|
+
```yaml
|
49
|
+
# Default extension for new posts and pages
|
50
|
+
post_ext: markdown
|
51
|
+
page_ext: html
|
52
|
+
|
53
|
+
# Default templates for posts and pages
|
54
|
+
# Found in _templates/
|
55
|
+
post_layout: post
|
56
|
+
page_layout: page
|
57
|
+
|
58
|
+
# Format titles with titlecase?
|
59
|
+
titlecase: true
|
28
60
|
```
|
29
61
|
|
30
|
-
|
62
|
+
## Commands
|
63
|
+
|
64
|
+
### Init
|
65
|
+
|
66
|
+
|
67
|
+
```sh
|
68
|
+
octopress init <PATH> [options]
|
69
|
+
```
|
70
|
+
|
71
|
+
This will copy Octopress's scaffolding into the specified directory. Use the `--force` option to overwrite existing files. The scaffolding is pretty simple:
|
72
|
+
|
73
|
+
```
|
74
|
+
_octopress.yml
|
75
|
+
_templates/
|
76
|
+
post
|
77
|
+
page
|
78
|
+
```
|
79
|
+
|
80
|
+
### New Post
|
81
|
+
|
82
|
+
This automates the creation of a new post.
|
31
83
|
|
32
84
|
```bash
|
33
|
-
$ octopress new post
|
85
|
+
$ octopress new post "My Title"
|
86
|
+
```
|
87
|
+
|
88
|
+
This will create a new file at `_posts/YYYY-MM-DD-my-title.markdown` with the following YAML front-matter already added.
|
89
|
+
|
90
|
+
```
|
91
|
+
layout: post
|
92
|
+
title: "My Title"
|
93
|
+
date: YYYY-MM-DDTHH:MM:SS-00:00
|
34
94
|
```
|
35
95
|
|
36
96
|
"Ok, great? What else can I do?" Great question! Check out these other options:
|
37
97
|
|
38
|
-
| Option
|
39
|
-
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
| `
|
44
|
-
|
98
|
+
| Option | Description |
|
99
|
+
|:---------------------|:----------------------------------------|
|
100
|
+
| `--template PATH` | Use a template from <path> |
|
101
|
+
| `--date DATE` | The date for the post. Should be parseable by [Time#parse](http://ruby-doc.org/stdlib-2.1.0/libdoc/time/rdoc/Time.html#method-i-parse) |
|
102
|
+
| `--slug SLUG` | Slug for the new post. |
|
103
|
+
| `--force` | Overwrite exsiting file. |
|
104
|
+
|
105
|
+
### New Page
|
106
|
+
|
107
|
+
```sh
|
108
|
+
$ octopress new page some-page # ./some-page.html
|
109
|
+
$ octopress new page docs/ # ./docs/index.html
|
110
|
+
$ octopress new page about.html # ./about.html
|
111
|
+
```
|
45
112
|
|
46
|
-
|
113
|
+
| Option | Description |
|
114
|
+
|:---------------------|:----------------------------------------|
|
115
|
+
| `--template PATH` | Use a template from <path> |
|
116
|
+
| `--title TITLE` | The title of the new page |
|
117
|
+
| `--date DATE` | The date for the page. Should be parseable by [Time#parse](http://ruby-doc.org/stdlib-2.1.0/libdoc/time/rdoc/Time.html#method-i-parse) |
|
118
|
+
| `--force` | Overwrite exsiting file. |
|
119
|
+
|
120
|
+
### New Draft
|
47
121
|
|
48
122
|
```bash
|
49
|
-
$ octopress new
|
123
|
+
$ octopress new draft "My Title"
|
50
124
|
```
|
51
125
|
|
52
|
-
|
53
|
-
|:-------------|:---------|:------------|
|
54
|
-
| `title` | `String` | The title of the new page |
|
55
|
-
| `date` | `String` | The date for the page. Should be parseable by [Time#parse](http://ruby-doc.org/stdlib-2.1.0/libdoc/time/rdoc/Time.html#method-i-parse) |
|
56
|
-
| `path` | `String` | The path at which the new page should be generated. |
|
126
|
+
This will create a new post in your `_drafts` directory.
|
57
127
|
|
58
|
-
|
128
|
+
| Option | Description |
|
129
|
+
|:-------------------|:------------------------------------------|
|
130
|
+
| `--template PATH` | Use a template from <path> |
|
131
|
+
| `--date DATE` | The date for the draft. Should be parseable by [Time#parse](http://ruby-doc.org/stdlib-2.1.0/libdoc/time/rdoc/Time.html#method-i-parse) (defaults to Time.now) |
|
132
|
+
| `--slug SLUG` | The slug for the new post. |
|
133
|
+
| `--force` | Overwrite exsiting file. |
|
59
134
|
|
60
|
-
|
135
|
+
### Publish draft
|
61
136
|
|
62
|
-
|
63
|
-
|
64
|
-
|
137
|
+
```bash
|
138
|
+
$ octopress publish _drafts/some-post.md
|
139
|
+
```
|
65
140
|
|
66
|
-
|
141
|
+
This will move your draft to the `_posts` directory and rename the file with the proper date.
|
142
|
+
|
143
|
+
| Option | Description |
|
144
|
+
|:-------------------|:------------------------------------------|
|
145
|
+
| `--date DATE` | The date for the post. Should be parseable by [Time#parse](http://ruby-doc.org/stdlib-2.1.0/libdoc/time/rdoc/Time.html#method-i-parse) |
|
146
|
+
| `--slug SLUG` | Change the slug for the new post. |
|
147
|
+
| `--force` | Overwrite exsiting file. |
|
148
|
+
```
|
149
|
+
|
150
|
+
When publishing a draft, the new post will use the draft's date. Pass the option `--date now` to the publish command to set the new post date from your system clock. As usual, you can pass any compatible date string as well.
|
151
|
+
|
152
|
+
### Templates for Posts and pages
|
153
|
+
|
154
|
+
Octopress post and page templates look like this.
|
155
|
+
|
156
|
+
```html
|
157
|
+
---
|
158
|
+
layout: {{ layout }}
|
159
|
+
title: {{ title }}
|
160
|
+
date: {{ date }}
|
161
|
+
---
|
162
|
+
|
163
|
+
```
|
164
|
+
|
165
|
+
The YAML variables will be replaced with the correct content when you create a page or post. To modify this template create a `_templates/post` file and change it as you wish. You can add additional YAML front-matter or content, and you can even create multiple templates. Choose a custom template when creating a new post or page like this.
|
166
|
+
|
167
|
+
```sh
|
168
|
+
octopress new post --template _templates/linkpost
|
169
|
+
```
|
67
170
|
|
68
171
|
## Contributing
|
69
172
|
|
data/lib/octopress.rb
CHANGED
@@ -1,20 +1,22 @@
|
|
1
1
|
require 'mercenary'
|
2
2
|
|
3
3
|
module Octopress
|
4
|
-
require 'octopress/
|
4
|
+
require 'octopress/ext/hash'
|
5
|
+
require 'octopress/ext/titlecase'
|
5
6
|
require 'octopress/configuration'
|
6
7
|
require 'octopress/command'
|
7
8
|
require 'octopress/version'
|
8
9
|
require 'octopress/commands/new'
|
10
|
+
require 'octopress/commands/init'
|
9
11
|
require 'octopress/commands/publish'
|
10
12
|
require 'octopress/commands/build'
|
11
13
|
require 'octopress/commands/serve'
|
12
14
|
require 'octopress/commands/doctor'
|
13
|
-
require 'octopress/commands/docs'
|
14
15
|
|
15
16
|
autoload :Page, 'octopress/page'
|
16
17
|
autoload :Post, 'octopress/post'
|
17
18
|
autoload :Draft, 'octopress/draft'
|
19
|
+
autoload :Scaffold, 'octopress/scaffold'
|
18
20
|
|
19
21
|
BLESSED_GEMS = %w[
|
20
22
|
octopress-deploy
|
@@ -31,6 +33,10 @@ module Octopress
|
|
31
33
|
@config ||= Configuration.config(options)
|
32
34
|
end
|
33
35
|
|
36
|
+
def self.expand_gem_path(dir='')
|
37
|
+
File.expand_path(File.join(File.dirname(__FILE__), '../', dir))
|
38
|
+
end
|
39
|
+
|
34
40
|
def self.require_blessed_gems
|
35
41
|
BLESSED_GEMS.each do |gem|
|
36
42
|
begin
|
data/lib/octopress/command.rb
CHANGED
@@ -1,11 +1,8 @@
|
|
1
|
-
require 'jekyll'
|
2
|
-
require File.expand_path('helpers', File.dirname(__FILE__))
|
3
|
-
|
4
1
|
module Octopress
|
5
2
|
class Build < Command
|
6
3
|
def self.init_with_program(p)
|
7
4
|
p.command(:build) do |c|
|
8
|
-
c.syntax '
|
5
|
+
c.syntax 'build [options]'
|
9
6
|
c.description 'Build your site'
|
10
7
|
CommandHelpers.add_build_options(c)
|
11
8
|
|
@@ -1,21 +1,17 @@
|
|
1
|
-
require 'jekyll'
|
2
|
-
require File.expand_path('helpers', File.dirname(__FILE__))
|
3
|
-
|
4
1
|
module Octopress
|
5
2
|
class Doctor < Command
|
6
3
|
def self.init_with_program(p)
|
7
4
|
p.command(:doctor) do |c|
|
8
5
|
c.alias(:hyde)
|
9
6
|
|
10
|
-
c.syntax '
|
7
|
+
c.syntax 'doctor'
|
11
8
|
c.description 'Search site and print specific deprecation warnings'
|
12
|
-
|
13
|
-
c.option 'config', '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
|
9
|
+
CommandHelpers.add_common_options c
|
14
10
|
|
15
11
|
c.action do |args, options|
|
16
12
|
options = CommandHelpers.normalize_options(options)
|
17
13
|
options = Jekyll.configuration(options.to_symbol_keys)
|
18
|
-
|
14
|
+
Jekyll::Commands::Doctor.process(options)
|
19
15
|
end
|
20
16
|
end
|
21
17
|
end
|
@@ -18,10 +18,15 @@ module Octopress
|
|
18
18
|
options
|
19
19
|
end
|
20
20
|
|
21
|
+
def self.add_page_options(c)
|
22
|
+
c.option 'template', '--template PATH', "New #{c.name.to_s} from a template."
|
23
|
+
c.option 'date', '--date DATE', "Use 'now' or a String that is parseable by Time#parse. (default: Time.now.iso8601)"
|
24
|
+
c.option 'force', '--force', 'Overwrite file if it already exists'
|
25
|
+
end
|
26
|
+
|
21
27
|
def self.add_common_options(c)
|
22
|
-
c.option '
|
23
|
-
c.option '
|
24
|
-
c.option 'force', '--force', 'Force creation even if PATH already exists'
|
28
|
+
c.option 'config', '--config <CONFIG_FILE>[,CONFIG_FILE2,...]', Array, 'Custom Jekyll configuration file'
|
29
|
+
c.option 'octopress-config', '--octopress-config <CONFIG_FILE>', 'Custom Octopress configuration file'
|
25
30
|
end
|
26
31
|
end
|
27
32
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Octopress
|
2
|
+
class Init < Command
|
3
|
+
def self.init_with_program(p)
|
4
|
+
p.command(:init) do |c|
|
5
|
+
c.syntax 'init <PATH> [options]'
|
6
|
+
c.description "Add Octopress's default scaffolding to your site."
|
7
|
+
c.option 'force', '--force', 'Overwrite files if they already exist.'
|
8
|
+
|
9
|
+
c.action do |args, options|
|
10
|
+
Scaffold.new(args, options).write
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,51 +1,54 @@
|
|
1
|
-
require 'jekyll'
|
2
|
-
|
3
1
|
module Octopress
|
4
2
|
class New < Command
|
5
3
|
def self.init_with_program(p)
|
6
4
|
p.command(:new) do |c|
|
7
5
|
c.syntax 'new <PATH>'
|
8
|
-
c.description 'Creates a new Jekyll site scaffold in path'
|
9
|
-
c.option 'force', '--force', 'Force creation even if path already exists'
|
10
|
-
c.option 'blank', '--blank', 'Creates scaffolding but with empty files'
|
6
|
+
c.description 'Creates a new Jekyll site scaffold in path.'
|
7
|
+
c.option 'force', '--force', 'Force creation even if path already exists.'
|
8
|
+
c.option 'blank', '--blank', 'Creates scaffolding but with empty files.'
|
11
9
|
|
12
10
|
c.action do |args, options|
|
13
11
|
if args.empty?
|
14
12
|
c.logger.error "You must specify a path."
|
15
13
|
else
|
16
|
-
|
14
|
+
Jekyll::Commands::New.process(args, options.to_symbol_keys)
|
17
15
|
end
|
18
16
|
end
|
19
17
|
|
20
|
-
c.command(:page) do |
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
CommandHelpers.
|
18
|
+
c.command(:page) do |c|
|
19
|
+
c.syntax 'page <PATH> [options]'
|
20
|
+
c.description 'Add a new page to your Jekyll site.'
|
21
|
+
c.option 'title', '--title TITLE', 'String to be added as the title in the YAML front-matter.'
|
22
|
+
CommandHelpers.add_page_options c
|
23
|
+
CommandHelpers.add_common_options c
|
25
24
|
|
26
|
-
|
25
|
+
c.action do |args, options|
|
27
26
|
options['path'] = args.first
|
28
27
|
Page.new(options).write
|
29
28
|
end
|
30
29
|
end
|
31
30
|
|
32
|
-
c.command(:post) do |
|
33
|
-
|
34
|
-
|
35
|
-
CommandHelpers.
|
31
|
+
c.command(:post) do |c|
|
32
|
+
c.syntax 'post <TITLE> [options]'
|
33
|
+
c.description 'Add a new post to your Jekyll site.'
|
34
|
+
CommandHelpers.add_page_options c
|
35
|
+
c.option 'slug', '--slug SLUG', 'Use this slug in filename instead of sluggified post title.'
|
36
|
+
CommandHelpers.add_common_options c
|
36
37
|
|
37
|
-
|
38
|
+
c.action do |args, options|
|
38
39
|
options['title'] = args.first
|
39
40
|
Post.new(options).write
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
43
|
-
c.command(:draft) do |
|
44
|
-
|
45
|
-
|
46
|
-
CommandHelpers.
|
44
|
+
c.command(:draft) do |c|
|
45
|
+
c.syntax 'draft <TITLE> [options]'
|
46
|
+
c.description 'Add a new draft post to your Jekyll site.'
|
47
|
+
CommandHelpers.add_page_options c
|
48
|
+
c.option 'slug', '--slug SLUG', 'Use this slug in filename instead of sluggified post title.'
|
49
|
+
CommandHelpers.add_common_options c
|
47
50
|
|
48
|
-
|
51
|
+
c.action do |args, options|
|
49
52
|
options['title'] = args.first
|
50
53
|
Draft.new(options).write
|
51
54
|
end
|
@@ -2,9 +2,11 @@ module Octopress
|
|
2
2
|
class Publish < Command
|
3
3
|
def self.init_with_program(p)
|
4
4
|
p.command(:publish) do |c|
|
5
|
-
c.syntax '
|
5
|
+
c.syntax 'publish <PATH> [options]'
|
6
6
|
c.description 'Convert a draft to a normal published post.'
|
7
7
|
c.option 'date', '--date DATE', 'String that is parseable by Time#parse. (default: Time.now.iso8601)'
|
8
|
+
c.option 'force', '--force', 'Overwrite file if it already exists'
|
9
|
+
CommandHelpers.add_common_options c
|
8
10
|
|
9
11
|
c.action do |args, options|
|
10
12
|
abort "You must specify a path." if args.empty?
|
@@ -1,13 +1,10 @@
|
|
1
|
-
require 'jekyll'
|
2
|
-
require File.expand_path('helpers', File.dirname(__FILE__))
|
3
|
-
|
4
1
|
module Octopress
|
5
2
|
class Serve < Command
|
6
3
|
def self.init_with_program(p)
|
7
4
|
p.command(:serve) do |c|
|
8
5
|
c.alias(:server)
|
9
6
|
|
10
|
-
c.syntax '
|
7
|
+
c.syntax 'serve [options]'
|
11
8
|
c.description 'Serve your site locally'
|
12
9
|
|
13
10
|
CommandHelpers.add_build_options(c)
|
@@ -22,9 +19,9 @@ module Octopress
|
|
22
19
|
|
23
20
|
options.default :serving => true
|
24
21
|
options = CommandHelpers.normalize_options(options)
|
25
|
-
options =
|
26
|
-
|
27
|
-
|
22
|
+
options = Jekyll.configuration(options.to_symbol_keys)
|
23
|
+
Jekyll::Commands::Build.process(options)
|
24
|
+
Jekyll::Commands::Serve.process(options)
|
28
25
|
end
|
29
26
|
end
|
30
27
|
end
|