retter 0.2.5 → 1.0.0.pre
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 +7 -0
- data/.gitignore +15 -11
- data/.travis.yml +4 -2
- data/ChangeLog.md +11 -5
- data/Gemfile +4 -1
- data/LICENSE.txt +22 -0
- data/README.md +163 -246
- data/Rakefile +25 -5
- data/bin/retter +2 -22
- data/lib/retter.rb +57 -43
- data/lib/retter/cli.rb +46 -0
- data/lib/retter/cli/edit.rb +33 -0
- data/lib/retter/cli/hooks.rb +46 -0
- data/lib/retter/cli/list.rb +15 -0
- data/lib/retter/cli/new.rb +20 -0
- data/lib/retter/cli/preview.rb +9 -0
- data/lib/retter/cli/publish.rb +22 -0
- data/lib/retter/deprecated.rb +160 -0
- data/lib/retter/entry.rb +31 -106
- data/lib/retter/entry/article.rb +36 -0
- data/lib/retter/entry/find_methods.rb +38 -0
- data/lib/retter/entry/model_base.rb +10 -0
- data/lib/retter/entry/pagination.rb +23 -0
- data/lib/retter/entry/sort_methods.rb +7 -0
- data/lib/retter/entry/utils.rb +12 -0
- data/lib/retter/initializing.rb +45 -0
- data/lib/retter/repository.rb +99 -12
- data/lib/retter/retterfile.rb +67 -0
- data/lib/retter/retterfile/context.rb +57 -0
- data/lib/retter/static_site.rb +34 -0
- data/lib/retter/static_site/app.rb +13 -0
- data/lib/retter/static_site/app/application.rb +94 -0
- data/lib/retter/{generator/skel/entries → static_site/app/assets/images}/.gitkeep +0 -0
- data/lib/retter/{generator/skel → static_site/app/assets}/images/orange/bg_body.jpg +0 -0
- data/lib/retter/{generator/skel → static_site/app/assets}/images/orange/bg_entry.jpg +0 -0
- data/lib/retter/{generator/skel → static_site/app/assets}/images/orange/bg_header.png +0 -0
- data/lib/retter/{generator/skel → static_site/app/assets}/images/orange/ic_li01.gif +0 -0
- data/lib/retter/{generator/skel/images → static_site/app/assets/javascripts}/.gitkeep +0 -0
- data/lib/retter/static_site/app/assets/stylesheets/application.css.scss +3 -0
- data/lib/retter/{generator/skel/stylesheets/base.css → static_site/app/assets/stylesheets/base.css.scss} +0 -0
- data/lib/retter/{generator/skel/stylesheets/pygments.css → static_site/app/assets/stylesheets/highlight.css.scss} +0 -0
- data/lib/retter/static_site/app/assets/stylesheets/orange.css.scss +262 -0
- data/lib/retter/static_site/app/assets/stylesheets/retter.css.scss +198 -0
- data/lib/retter/static_site/app/config.ru +7 -0
- data/lib/retter/static_site/app/controllers.rb +113 -0
- data/lib/retter/static_site/app/helpers.rb +36 -0
- data/lib/retter/{generator/skel/layouts/profile.html.haml → static_site/app/templates/about/show.html.haml} +0 -0
- data/lib/retter/static_site/app/templates/entries/articles/show.html.haml +7 -0
- data/lib/retter/static_site/app/templates/entries/index.html.haml +13 -0
- data/lib/retter/static_site/app/templates/entries/index.rss.haml +24 -0
- data/lib/retter/static_site/app/templates/entries/show.html.haml +11 -0
- data/lib/retter/static_site/app/templates/index/show.html.haml +14 -0
- data/lib/retter/static_site/app/templates/layouts/application.html.haml +34 -0
- data/lib/retter/static_site/builder.rb +106 -0
- data/lib/retter/static_site/cli.rb +25 -0
- data/lib/retter/static_site/cli/build.rb +85 -0
- data/lib/retter/static_site/cli/edit.rb +17 -0
- data/lib/retter/static_site/cli/migrate.rb +93 -0
- data/lib/retter/static_site/cli/new.rb +50 -0
- data/lib/retter/static_site/cli/preview.rb +66 -0
- data/lib/retter/static_site/markdown.rb +25 -0
- data/lib/retter/static_site/markdown/code_ray_renderer.rb +13 -0
- data/lib/retter/static_site/markdown/pygments_renderer.rb +18 -0
- data/lib/retter/static_site/markdown_entry.rb +111 -0
- data/lib/retter/static_site/monkey/sprockets_task.rb +10 -0
- data/lib/retter/version.rb +1 -1
- data/retter.gemspec +59 -43
- data/skel/.gitignore +2 -0
- data/skel/Retterfile +16 -0
- data/skel/config.ru +22 -0
- data/{lib/retter/generator/skel/javascripts → skel/retters}/.gitkeep +0 -0
- data/skel/retters/today.md +3 -0
- data/spec/cli/build_spec.rb +87 -0
- data/spec/cli/edit_spec.rb +76 -0
- data/spec/cli/invocation_spec.rb +19 -0
- data/spec/cli/list_spec.rb +64 -0
- data/spec/cli/migrate_spec.rb +65 -0
- data/spec/cli/new_spec.rb +30 -0
- data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/.gitignore +0 -0
- data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/Retterfile +6 -3
- data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/config.ru +0 -0
- data/{lib/retter/generator/skel/retters/.gitkeep → spec/fixtures/sites/site-0.2.5/entries.html} +0 -0
- data/spec/fixtures/sites/site-0.2.5/entries.rss +0 -0
- data/spec/fixtures/sites/site-0.2.5/entries/.gitkeep +0 -0
- data/spec/fixtures/sites/site-0.2.5/images/.gitkeep +0 -0
- data/spec/fixtures/sites/site-0.2.5/images/orange/bg_body.jpg +0 -0
- data/spec/fixtures/sites/site-0.2.5/images/orange/bg_entry.jpg +0 -0
- data/spec/fixtures/sites/site-0.2.5/images/orange/bg_header.png +0 -0
- data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/index.html +0 -0
- data/spec/fixtures/sites/site-0.2.5/javascripts/.gitkeep +0 -0
- data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/layouts/article.html.haml +0 -0
- data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/layouts/entries.html.haml +0 -0
- data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/layouts/entry.html.haml +0 -0
- data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/layouts/index.html.haml +0 -0
- data/spec/fixtures/sites/site-0.2.5/layouts/profile.html.haml +7 -0
- data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/layouts/retter.html.haml +0 -0
- data/spec/fixtures/sites/site-0.2.5/profile.html +0 -0
- data/spec/fixtures/sites/site-0.2.5/retters/.gitkeep +0 -0
- data/spec/fixtures/sites/site-0.2.5/stylesheets/base.css +22 -0
- data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/stylesheets/orange.css +0 -0
- data/spec/fixtures/sites/site-0.2.5/stylesheets/pygments.css +288 -0
- data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/stylesheets/retter.css +0 -0
- data/spec/retter/deprecated_spec.rb +106 -0
- data/spec/retter/initializing_spec.rb +86 -0
- data/spec/retter/retterfile_spec.rb +32 -0
- data/spec/spec_helper.rb +38 -27
- data/spec/support/example_helper.rb +46 -0
- data/spec/support/matchers.rb +14 -0
- data/spec/support/test_site.rb +59 -0
- metadata +329 -236
- data/lib/retter/binder.rb +0 -50
- data/lib/retter/command.rb +0 -192
- data/lib/retter/config.rb +0 -96
- data/lib/retter/configurable.rb +0 -26
- data/lib/retter/entries.rb +0 -115
- data/lib/retter/generator.rb +0 -7
- data/lib/retter/generator/base.rb +0 -65
- data/lib/retter/generator/creator.rb +0 -34
- data/lib/retter/generator/skel/Gemfile +0 -5
- data/lib/retter/markdown.rb +0 -31
- data/lib/retter/markdown/code_ray_renderer.rb +0 -11
- data/lib/retter/markdown/pygments_renderer.rb +0 -16
- data/lib/retter/page.rb +0 -43
- data/lib/retter/page/article.rb +0 -54
- data/lib/retter/page/base.rb +0 -97
- data/lib/retter/page/entries.rb +0 -17
- data/lib/retter/page/entry.rb +0 -46
- data/lib/retter/page/feed.rb +0 -63
- data/lib/retter/page/index.rb +0 -17
- data/lib/retter/page/profile.rb +0 -17
- data/lib/retter/page/view_helper.rb +0 -66
- data/lib/retter/preprint.rb +0 -34
- data/spec/command/callback_spec.rb +0 -27
- data/spec/command/clean_spec.rb +0 -20
- data/spec/command/commit_spec.rb +0 -40
- data/spec/command/edit_spec.rb +0 -119
- data/spec/command/list_spec.rb +0 -42
- data/spec/command/open_spec.rb +0 -12
- data/spec/command/preview_spec.rb +0 -40
- data/spec/command/rebind_spec.rb +0 -276
- data/spec/support/example_group_helper.rb +0 -98
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: e5a35a925b18fdede4441fe753ba47a06a576a78
|
|
4
|
+
data.tar.gz: 2ec0f7f3ce3143dfbe532264f328fac939f423e2
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 505c3dae115d8c47f19f024a43cfddb2aa6bd24d743c5f5c1b9f5c49a778222ddbe4ddb08b1e760411eefe1f3c9f4c642b23776c95688fa71f1536eecc56416b
|
|
7
|
+
data.tar.gz: 9616fe4ee95045645f2550423c2f19e5d5e033ae8f01420551f6a053f8ddae4573302649ac18ec99e042f36989f0061025b62d3fca202a393aa8fa549f0ed676
|
data/.gitignore
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
*.gem
|
|
2
|
+
*.rbc
|
|
2
3
|
.bundle
|
|
4
|
+
.config
|
|
5
|
+
.yardoc
|
|
6
|
+
.rspec
|
|
3
7
|
Gemfile.lock
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
.rvmrc
|
|
7
|
-
.rbenv-version
|
|
8
|
-
lib/generator/skel/.gitignore
|
|
9
|
-
lib/generator/skel/.preview.html
|
|
10
|
-
lib/generator/skel/retters/*.md
|
|
11
|
-
lib/generator/skel/entries.*
|
|
12
|
-
lib/generator/skel/entries/*.html
|
|
13
|
-
lib/generator/skel/vendor
|
|
14
|
-
.DS_Store
|
|
8
|
+
InstalledFiles
|
|
9
|
+
_yardoc
|
|
15
10
|
coverage
|
|
11
|
+
doc/
|
|
12
|
+
lib/bundler/man
|
|
13
|
+
pkg
|
|
14
|
+
rdoc
|
|
15
|
+
spec/reports
|
|
16
|
+
test/tmp
|
|
17
|
+
test/version_tmp
|
|
18
|
+
tmp
|
|
19
|
+
tags
|
data/.travis.yml
CHANGED
data/ChangeLog.md
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
# 1.0.0
|
|
2
|
+
|
|
3
|
+
* Many API changes.
|
|
4
|
+
* Directory structure is changed (See README.md).
|
|
5
|
+
* Some commands are deprecated: `rebind`, `bind` and `open`.
|
|
6
|
+
* Some commands are removed: `commit`, `home`, `usage` and `clean`.
|
|
7
|
+
* Many command options are removed.
|
|
8
|
+
* New commands are added: `build`, `preview` and `publish`.
|
|
9
|
+
* Migration command `migrate` is added.
|
|
10
|
+
|
|
1
11
|
# 0.2.3
|
|
2
12
|
|
|
3
13
|
## clean sub command
|
|
4
14
|
|
|
5
|
-
clean sub command wraps cache clear method.
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
retter clean
|
|
9
|
-
```
|
|
15
|
+
`clean` sub command wraps cache clear method.
|
|
10
16
|
|
|
11
17
|
# 0.2.2
|
|
12
18
|
|
data/Gemfile
CHANGED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2014 hibariya
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
|
@@ -1,317 +1,234 @@
|
|
|
1
|
-
# RETTER -
|
|
1
|
+
# RETTER - A diary workflow for shell users. [](https://drone.io/github.com/hibariya/retter/latest)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Required
|
|
4
4
|
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* だいたいどこでも動作します(Heroku, GitHub Pages, Dropbox などで、静的HTMLまたはRackアプリとして)
|
|
9
|
-
* RSSフィードを吐きます
|
|
10
|
-
* トラックバック、**コメント**などの機能は外部のサービスを使う必要があります
|
|
11
|
-
* コールバックを設定することでさらに手数を減らすことができます
|
|
5
|
+
* Ruby-1.9.1 or later
|
|
6
|
+
* $EDITOR variable
|
|
7
|
+
* $BROWSER variable
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
## Quick Start
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
~~~~
|
|
26
|
-
$ retter new my_sweet_diary
|
|
27
|
-
~~~~
|
|
28
|
-
|
|
29
|
-
**Quick settings:**
|
|
30
|
-
|
|
31
|
-
~~~~
|
|
32
|
-
$ export EDITOR=vim
|
|
33
|
-
$ export RETTER_HOME=`pwd`/my_sweet_diary
|
|
34
|
-
~~~~
|
|
35
|
-
|
|
36
|
-
**Writing article:**
|
|
37
|
-
|
|
38
|
-
~~~~
|
|
39
|
-
$ retter
|
|
40
|
-
~~~~
|
|
41
|
-
|
|
42
|
-
`retter` opens `$EDITOR`. Write an article with Markdown.
|
|
43
|
-
|
|
44
|
-
**Preview:**
|
|
45
|
-
|
|
46
|
-
~~~~
|
|
47
|
-
$ retter preview
|
|
48
|
-
~~~~
|
|
49
|
-
|
|
50
|
-
`preview` opens the draft article by your default browser.
|
|
51
|
-
|
|
52
|
-
**Generate HTML:**
|
|
53
|
-
|
|
54
|
-
~~~~
|
|
55
|
-
$ retter rebind
|
|
56
|
-
~~~~
|
|
57
|
-
|
|
58
|
-
`bind` and `rebind` binds the draft article. And re-generates actual html web pages. All html pages will be overwritten.
|
|
59
|
-
|
|
60
|
-
**Browse offline:**
|
|
61
|
-
|
|
62
|
-
~~~~
|
|
63
|
-
$ retter open
|
|
64
|
-
~~~~
|
|
11
|
+
```
|
|
12
|
+
$ gem install retter
|
|
13
|
+
$ retter new my-diary # Create a new site named `my-sweet-diary'.
|
|
14
|
+
$ cd my-diary
|
|
15
|
+
$ retter edit # Write a first article w/ $EDITOR.
|
|
16
|
+
$ retter preview # Open an article you write w/ $BROWSER.
|
|
17
|
+
$ retter build # Generate static html files on publish branch (default: master).
|
|
18
|
+
$ git remote add origin git@github.com:USERNAME/USERNAME.github.io.git
|
|
19
|
+
$ git push origin master # Publish static html files on GitHub pages.
|
|
20
|
+
```
|
|
65
21
|
|
|
66
|
-
|
|
22
|
+
## List, edit and preview
|
|
67
23
|
|
|
68
|
-
|
|
24
|
+
`retter list` lists all articles.
|
|
69
25
|
|
|
70
|
-
|
|
26
|
+
```
|
|
71
27
|
$ retter list
|
|
72
|
-
[e0]
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
~~~~
|
|
79
|
-
$ retter edit e0
|
|
80
|
-
... abbr ...
|
|
81
|
-
$ retter preview e0
|
|
82
|
-
~~~~
|
|
83
|
-
|
|
84
|
-
**How to Deploy**
|
|
85
|
-
|
|
86
|
-
examle:
|
|
87
|
-
|
|
88
|
-
~~~~
|
|
89
|
-
$ cd $RETTER_HOME
|
|
90
|
-
$ git add .
|
|
91
|
-
$ git commit -m 'Entry written'
|
|
92
|
-
$ git push [your_git_remote] master
|
|
93
|
-
~~~~
|
|
94
|
-
|
|
95
|
-
To publish, use the git command. Or, upload the file to your server.
|
|
28
|
+
[e0] 2014-01-11
|
|
29
|
+
First article
|
|
30
|
+
Second article
|
|
31
|
+
[e1] 2014-01-13
|
|
32
|
+
Third article
|
|
33
|
+
```
|
|
96
34
|
|
|
97
|
-
|
|
35
|
+
`retter edit [KEYWORD]` opens a source with $EDITOR.
|
|
98
36
|
|
|
99
|
-
|
|
37
|
+
```
|
|
38
|
+
$ retter edit e1 # Editing source on 2014-01-13.
|
|
39
|
+
$ retter edit 2014-01-11 # Editing source on 2014-01-11.
|
|
40
|
+
$ retter edit # Editing source on Date.today.
|
|
41
|
+
```
|
|
100
42
|
|
|
101
|
-
|
|
43
|
+
### Edit and preview (with livereload)
|
|
102
44
|
|
|
103
|
-
|
|
45
|
+
To preview, run `retter preview`.
|
|
104
46
|
|
|
105
|
-
|
|
47
|
+
```
|
|
48
|
+
$ retter edit # Edit and save
|
|
49
|
+
$ retter preview # Invoke preview server and open last edited article with $BROWSER.
|
|
50
|
+
```
|
|
106
51
|
|
|
107
|
-
|
|
108
|
-
$ echo "export RETTER_HOME=/path/to/my_sweet_diary" >> ~/.bash_profile
|
|
109
|
-
$ . ~/.bash_profile
|
|
110
|
-
~~~~
|
|
52
|
+
`retter preview` detects file updates automatically.
|
|
111
53
|
|
|
112
|
-
|
|
54
|
+
In other shell:
|
|
113
55
|
|
|
114
|
-
|
|
115
|
-
$
|
|
116
|
-
|
|
117
|
-
|
|
56
|
+
```
|
|
57
|
+
$ retter edit # Edit and save
|
|
58
|
+
# And $BROWSER will reload automatically.
|
|
59
|
+
```
|
|
118
60
|
|
|
119
|
-
|
|
61
|
+
## $RETTER_ROOT variable
|
|
120
62
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
$ retter home # Open a new shell at $RETTER_HOME
|
|
124
|
-
(retter) git push [remote] [branch] # heroku, github pages, etc..
|
|
125
|
-
~~~~
|
|
63
|
+
You can use all retter commands everywhere if you set `$RETTER_ROOT` variable.
|
|
64
|
+
So, if `$RETTER_ROOT` is set, `retter edit` and `cd $RETTER_ROOT && retter edit` are same.
|
|
126
65
|
|
|
127
|
-
|
|
66
|
+
**`$RETTER_HOME` variable is deprecated.** Please use `$RETTER_ROOT`.
|
|
128
67
|
|
|
129
|
-
|
|
68
|
+
## Configure with $RETTER_ROOT/Retterfile
|
|
130
69
|
|
|
131
|
-
|
|
132
|
-
$ retter edit 20110101 # edit
|
|
133
|
-
$ retter preview 20110101 # preview
|
|
134
|
-
~~~~
|
|
70
|
+
Retterfile is the configuration file for your site.
|
|
135
71
|
|
|
136
|
-
|
|
72
|
+
Default configuration is below:
|
|
137
73
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
74
|
+
```ruby
|
|
75
|
+
configure api_revision: 1 do |config|
|
|
76
|
+
# Website's root URL, title, description and author. URL is needed by feed generator.
|
|
77
|
+
config.url = 'http://retter.example.com/'
|
|
78
|
+
config.title = 'my-diary'
|
|
79
|
+
config.description = 'my first diary'
|
|
80
|
+
config.author = 'hibariya'
|
|
81
|
+
|
|
82
|
+
# Processing for `retter publish` command.
|
|
83
|
+
config.publisher do
|
|
84
|
+
# Uncomment it if you want to do `cd $RETTER_ROOT && git push origin master` via `retter publish`.
|
|
85
|
+
# run 'git push origin master'
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
```
|
|
142
89
|
|
|
143
|
-
|
|
144
|
-
$ retter edit 3.days.ago
|
|
145
|
-
$ retter edit 3.days.since
|
|
146
|
-
$ retter edit 1.week.ago
|
|
147
|
-
$ retter edit 3.weeks.ago
|
|
148
|
-
$ retter edit 3.months.ago
|
|
149
|
-
$ retter edit 3.years.ago
|
|
150
|
-
~~~~
|
|
90
|
+
### Hooks
|
|
151
91
|
|
|
152
|
-
|
|
92
|
+
Hooks will be invoked after running commands.
|
|
153
93
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
94
|
+
```ruby
|
|
95
|
+
# Print `Well done :)` after running `retter edit`.
|
|
96
|
+
config.after :edit do
|
|
97
|
+
puts 'Well done :)'
|
|
98
|
+
end
|
|
159
99
|
|
|
160
|
-
#
|
|
100
|
+
# Ask invoking `retter publish` after running `retter build`.
|
|
101
|
+
config.after :build do
|
|
102
|
+
invoke :publish if yes?('Publish now? [yes/no]')
|
|
103
|
+
end
|
|
104
|
+
```
|
|
161
105
|
|
|
162
|
-
|
|
106
|
+
## Markdown structure
|
|
163
107
|
|
|
164
|
-
|
|
108
|
+
Following markdown file includes two articles.
|
|
165
109
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
~~~~
|
|
110
|
+
```
|
|
111
|
+
# First article
|
|
169
112
|
|
|
170
|
-
|
|
113
|
+
Hi, first article.
|
|
171
114
|
|
|
172
|
-
|
|
115
|
+
# Second article
|
|
173
116
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
ident = ARGV.pop || 'today'
|
|
177
|
-
preview ident if yes?("Preview now? [yes/no]")
|
|
178
|
-
end
|
|
179
|
-
~~~~
|
|
117
|
+
Hi, second article.
|
|
118
|
+
```
|
|
180
119
|
|
|
181
|
-
|
|
120
|
+
Header equal to h1 means start of an article. Like below:
|
|
182
121
|
|
|
183
|
-
|
|
122
|
+
```
|
|
123
|
+
+-- An Entry (A file) --+
|
|
124
|
+
|+-- An article -------+|
|
|
125
|
+
|| # First article ||
|
|
126
|
+
|| ||
|
|
127
|
+
|| Hi, first article. ||
|
|
128
|
+
|+---------------------+|
|
|
129
|
+
|+-- An article -------+|
|
|
130
|
+
|| # Second article ||
|
|
131
|
+
|| ||
|
|
132
|
+
|| Hi, second article. ||
|
|
133
|
+
|+---------------------+|
|
|
134
|
+
+-----------------------+
|
|
135
|
+
```
|
|
184
136
|
|
|
185
|
-
|
|
186
|
-
after :rebind, :commit # git commit
|
|
137
|
+
Each article have its own URL.
|
|
187
138
|
|
|
188
|
-
|
|
189
|
-
system "cd #{config.retter_home}"
|
|
190
|
-
system 'git push origin master'
|
|
191
|
-
end
|
|
192
|
-
~~~~
|
|
139
|
+
## Directory structure
|
|
193
140
|
|
|
194
|
-
|
|
141
|
+
```
|
|
142
|
+
$RETTER_ROOT
|
|
143
|
+
Retterfile
|
|
144
|
+
source
|
|
145
|
+
assets # Asset files (stylesheets, javascripts, images and so on).
|
|
146
|
+
retters # Article markdown files.
|
|
147
|
+
templates # Templates for static site.
|
|
148
|
+
tmp # Temporary files (caches, etc).
|
|
149
|
+
```
|
|
195
150
|
|
|
196
|
-
|
|
151
|
+
## Extract source branch
|
|
197
152
|
|
|
198
|
-
|
|
153
|
+
You can move all files (except public files) to `source` branch.
|
|
199
154
|
|
|
200
|
-
|
|
155
|
+
Migration example is below:
|
|
201
156
|
|
|
202
|
-
|
|
203
|
-
$
|
|
204
|
-
|
|
157
|
+
```
|
|
158
|
+
$ cd $RETTER_ROOT
|
|
159
|
+
$ git checkout -b source
|
|
160
|
+
$ git rm -r assets entries *.{html,rss} # Removing public files from source branch
|
|
161
|
+
$ git commit -m 'Remove all public files'
|
|
162
|
+
|
|
163
|
+
$ git checkout master
|
|
164
|
+
$ git rm -r Retterfile source # Removing source files from master branch
|
|
165
|
+
$ git commit -m 'Remove all source files'
|
|
166
|
+
```
|
|
205
167
|
|
|
206
|
-
|
|
168
|
+
## Install DISQUS (Comment service)
|
|
207
169
|
|
|
208
|
-
|
|
170
|
+
### Prepare
|
|
209
171
|
|
|
210
172
|
1. Create DISQUS Account
|
|
211
173
|
2. Add new site for retter
|
|
212
174
|
|
|
213
|
-
|
|
175
|
+
### Install
|
|
214
176
|
|
|
215
177
|
First, Add your `disqus_shortname` to Retterfile.
|
|
216
178
|
|
|
217
179
|
in Retterfile
|
|
218
180
|
|
|
219
|
-
~~~~ruby
|
|
220
|
-
disqus_shortname 'your_disqus_shortname'
|
|
221
|
-
~~~~
|
|
222
|
-
|
|
223
|
-
Second, Edit templete and paste `render_disqus_comment_form`.
|
|
224
|
-
|
|
225
|
-
in layouts/article.html.haml
|
|
226
|
-
|
|
227
|
-
~~~~haml
|
|
228
|
-
-# abbrev
|
|
229
|
-
#comments= render_disqus_comment_form
|
|
230
|
-
-# abbrev
|
|
231
|
-
~~~~
|
|
232
|
-
|
|
233
|
-
# Code Highlight
|
|
234
|
-
|
|
235
|
-
Pygments is available.
|
|
236
|
-
To use, add a following line to Retterfile.
|
|
237
|
-
|
|
238
181
|
```ruby
|
|
239
|
-
|
|
182
|
+
config.disqus_shortname = 'your_disqus_shortname'
|
|
240
183
|
```
|
|
241
184
|
|
|
242
|
-
|
|
185
|
+
Second, Edit templete and inject `= render_disqus_comment_form`.
|
|
243
186
|
|
|
244
|
-
|
|
187
|
+
in source/templates/entries/articles/show.html.haml
|
|
245
188
|
|
|
189
|
+
```haml
|
|
190
|
+
-# snip
|
|
191
|
+
#comments= render_disqus_comment_form
|
|
192
|
+
-# snip
|
|
246
193
|
```
|
|
247
|
-
$ retter clean
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
# Built-in themes
|
|
251
|
-
|
|
252
|
-
Retter has some themes.
|
|
253
|
-
You can switch the theme by replacing stylesheet.
|
|
254
|
-
|
|
255
|
-
## Default
|
|
256
|
-
|
|
257
|
-
~~~~haml
|
|
258
|
-
%link{href: '/stylesheets/default.css', media: 'screen', rel: 'stylesheet', type: 'text/css'}
|
|
259
|
-
~~~~
|
|
260
|
-
|
|
261
|
-

|
|
262
|
-
|
|
263
|
-
## Orange
|
|
264
|
-
|
|
265
|
-
~~~~haml
|
|
266
|
-
%link{href: '/stylesheets/orange.css', media: 'screen', rel: 'stylesheet', type: 'text/css'}
|
|
267
|
-
~~~~
|
|
268
|
-
|
|
269
|
-

|
|
270
|
-
|
|
271
|
-
# HTML Layout
|
|
272
194
|
|
|
273
|
-
|
|
195
|
+
## Migrate from Retter-0.2.5 or earlier
|
|
274
196
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|-- article.html.haml # Article page
|
|
278
|
-
|-- entries.html.haml # Entries list page
|
|
279
|
-
|-- entry.html.haml # Entry (by day) page
|
|
280
|
-
|-- index.html.haml # Front page
|
|
281
|
-
|-- profile.html.haml # Profile page
|
|
282
|
-
`-- retter.html.haml # Basic layout
|
|
283
|
-
~~~~
|
|
197
|
+
They're incompatible with retter-1.0.0.
|
|
198
|
+
Please migrate via `retter migrate`, or create new site.
|
|
284
199
|
|
|
285
|
-
|
|
200
|
+
### Migrate command
|
|
286
201
|
|
|
287
|
-
|
|
202
|
+
`retter migrate` attempts to migrate to new version.
|
|
288
203
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
# skip all pages
|
|
297
|
-
allow_binding :none
|
|
298
|
-
|
|
299
|
-
# allow only entries.html and feed.html
|
|
300
|
-
allow_binding [:entries, :feed]
|
|
204
|
+
```
|
|
205
|
+
$ cd $RETTER_ROOT
|
|
206
|
+
$ retter migrate
|
|
207
|
+
$ git add -A
|
|
208
|
+
$ git add -u
|
|
209
|
+
$ git commit -m 'Migrated'
|
|
210
|
+
$ retter build
|
|
301
211
|
```
|
|
302
212
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
If you want change the template engine, remove existing template and create new template (e.g. retter.html.haml to retter.html.erb).
|
|
306
|
-
|
|
307
|
-
# LICENSE
|
|
213
|
+
You probably get many warnings, and migration command can't fix it.
|
|
214
|
+
Anyway, at least, it will be compatible.
|
|
308
215
|
|
|
309
|
-
|
|
216
|
+
### Migrate only articles (RECOMMENDED)
|
|
310
217
|
|
|
311
|
-
|
|
218
|
+
If you can't migrate with `retter migrate`, you may want to migrate only articles. Like below.
|
|
312
219
|
|
|
313
|
-
|
|
220
|
+
```
|
|
221
|
+
$ cd $RETTER_ROOT/../
|
|
222
|
+
$ mv [site-name] old-[site-name]
|
|
223
|
+
$ retter new [site-name]
|
|
224
|
+
$ mv old-[site-name]/retters/* [site-name]/source/retters/
|
|
225
|
+
$ # migrate git repository, and so on...
|
|
226
|
+
```
|
|
314
227
|
|
|
315
|
-
|
|
228
|
+
## Contributing
|
|
316
229
|
|
|
317
|
-
|
|
230
|
+
1. Fork it ( https://github.com/hibariya/retter/fork )
|
|
231
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
232
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
233
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
234
|
+
5. Create new Pull Request
|