retter 0.2.5 → 1.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -11
  3. data/.travis.yml +4 -2
  4. data/ChangeLog.md +11 -5
  5. data/Gemfile +4 -1
  6. data/LICENSE.txt +22 -0
  7. data/README.md +163 -246
  8. data/Rakefile +25 -5
  9. data/bin/retter +2 -22
  10. data/lib/retter.rb +57 -43
  11. data/lib/retter/cli.rb +46 -0
  12. data/lib/retter/cli/edit.rb +33 -0
  13. data/lib/retter/cli/hooks.rb +46 -0
  14. data/lib/retter/cli/list.rb +15 -0
  15. data/lib/retter/cli/new.rb +20 -0
  16. data/lib/retter/cli/preview.rb +9 -0
  17. data/lib/retter/cli/publish.rb +22 -0
  18. data/lib/retter/deprecated.rb +160 -0
  19. data/lib/retter/entry.rb +31 -106
  20. data/lib/retter/entry/article.rb +36 -0
  21. data/lib/retter/entry/find_methods.rb +38 -0
  22. data/lib/retter/entry/model_base.rb +10 -0
  23. data/lib/retter/entry/pagination.rb +23 -0
  24. data/lib/retter/entry/sort_methods.rb +7 -0
  25. data/lib/retter/entry/utils.rb +12 -0
  26. data/lib/retter/initializing.rb +45 -0
  27. data/lib/retter/repository.rb +99 -12
  28. data/lib/retter/retterfile.rb +67 -0
  29. data/lib/retter/retterfile/context.rb +57 -0
  30. data/lib/retter/static_site.rb +34 -0
  31. data/lib/retter/static_site/app.rb +13 -0
  32. data/lib/retter/static_site/app/application.rb +94 -0
  33. data/lib/retter/{generator/skel/entries → static_site/app/assets/images}/.gitkeep +0 -0
  34. data/lib/retter/{generator/skel → static_site/app/assets}/images/orange/bg_body.jpg +0 -0
  35. data/lib/retter/{generator/skel → static_site/app/assets}/images/orange/bg_entry.jpg +0 -0
  36. data/lib/retter/{generator/skel → static_site/app/assets}/images/orange/bg_header.png +0 -0
  37. data/lib/retter/{generator/skel → static_site/app/assets}/images/orange/ic_li01.gif +0 -0
  38. data/lib/retter/{generator/skel/images → static_site/app/assets/javascripts}/.gitkeep +0 -0
  39. data/lib/retter/static_site/app/assets/stylesheets/application.css.scss +3 -0
  40. data/lib/retter/{generator/skel/stylesheets/base.css → static_site/app/assets/stylesheets/base.css.scss} +0 -0
  41. data/lib/retter/{generator/skel/stylesheets/pygments.css → static_site/app/assets/stylesheets/highlight.css.scss} +0 -0
  42. data/lib/retter/static_site/app/assets/stylesheets/orange.css.scss +262 -0
  43. data/lib/retter/static_site/app/assets/stylesheets/retter.css.scss +198 -0
  44. data/lib/retter/static_site/app/config.ru +7 -0
  45. data/lib/retter/static_site/app/controllers.rb +113 -0
  46. data/lib/retter/static_site/app/helpers.rb +36 -0
  47. data/lib/retter/{generator/skel/layouts/profile.html.haml → static_site/app/templates/about/show.html.haml} +0 -0
  48. data/lib/retter/static_site/app/templates/entries/articles/show.html.haml +7 -0
  49. data/lib/retter/static_site/app/templates/entries/index.html.haml +13 -0
  50. data/lib/retter/static_site/app/templates/entries/index.rss.haml +24 -0
  51. data/lib/retter/static_site/app/templates/entries/show.html.haml +11 -0
  52. data/lib/retter/static_site/app/templates/index/show.html.haml +14 -0
  53. data/lib/retter/static_site/app/templates/layouts/application.html.haml +34 -0
  54. data/lib/retter/static_site/builder.rb +106 -0
  55. data/lib/retter/static_site/cli.rb +25 -0
  56. data/lib/retter/static_site/cli/build.rb +85 -0
  57. data/lib/retter/static_site/cli/edit.rb +17 -0
  58. data/lib/retter/static_site/cli/migrate.rb +93 -0
  59. data/lib/retter/static_site/cli/new.rb +50 -0
  60. data/lib/retter/static_site/cli/preview.rb +66 -0
  61. data/lib/retter/static_site/markdown.rb +25 -0
  62. data/lib/retter/static_site/markdown/code_ray_renderer.rb +13 -0
  63. data/lib/retter/static_site/markdown/pygments_renderer.rb +18 -0
  64. data/lib/retter/static_site/markdown_entry.rb +111 -0
  65. data/lib/retter/static_site/monkey/sprockets_task.rb +10 -0
  66. data/lib/retter/version.rb +1 -1
  67. data/retter.gemspec +59 -43
  68. data/skel/.gitignore +2 -0
  69. data/skel/Retterfile +16 -0
  70. data/skel/config.ru +22 -0
  71. data/{lib/retter/generator/skel/javascripts → skel/retters}/.gitkeep +0 -0
  72. data/skel/retters/today.md +3 -0
  73. data/spec/cli/build_spec.rb +87 -0
  74. data/spec/cli/edit_spec.rb +76 -0
  75. data/spec/cli/invocation_spec.rb +19 -0
  76. data/spec/cli/list_spec.rb +64 -0
  77. data/spec/cli/migrate_spec.rb +65 -0
  78. data/spec/cli/new_spec.rb +30 -0
  79. data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/.gitignore +0 -0
  80. data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/Retterfile +6 -3
  81. data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/config.ru +0 -0
  82. data/{lib/retter/generator/skel/retters/.gitkeep → spec/fixtures/sites/site-0.2.5/entries.html} +0 -0
  83. data/spec/fixtures/sites/site-0.2.5/entries.rss +0 -0
  84. data/spec/fixtures/sites/site-0.2.5/entries/.gitkeep +0 -0
  85. data/spec/fixtures/sites/site-0.2.5/images/.gitkeep +0 -0
  86. data/spec/fixtures/sites/site-0.2.5/images/orange/bg_body.jpg +0 -0
  87. data/spec/fixtures/sites/site-0.2.5/images/orange/bg_entry.jpg +0 -0
  88. data/spec/fixtures/sites/site-0.2.5/images/orange/bg_header.png +0 -0
  89. data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/index.html +0 -0
  90. data/spec/fixtures/sites/site-0.2.5/javascripts/.gitkeep +0 -0
  91. data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/layouts/article.html.haml +0 -0
  92. data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/layouts/entries.html.haml +0 -0
  93. data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/layouts/entry.html.haml +0 -0
  94. data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/layouts/index.html.haml +0 -0
  95. data/spec/fixtures/sites/site-0.2.5/layouts/profile.html.haml +7 -0
  96. data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/layouts/retter.html.haml +0 -0
  97. data/spec/fixtures/sites/site-0.2.5/profile.html +0 -0
  98. data/spec/fixtures/sites/site-0.2.5/retters/.gitkeep +0 -0
  99. data/spec/fixtures/sites/site-0.2.5/stylesheets/base.css +22 -0
  100. data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/stylesheets/orange.css +0 -0
  101. data/spec/fixtures/sites/site-0.2.5/stylesheets/pygments.css +288 -0
  102. data/{lib/retter/generator/skel → spec/fixtures/sites/site-0.2.5}/stylesheets/retter.css +0 -0
  103. data/spec/retter/deprecated_spec.rb +106 -0
  104. data/spec/retter/initializing_spec.rb +86 -0
  105. data/spec/retter/retterfile_spec.rb +32 -0
  106. data/spec/spec_helper.rb +38 -27
  107. data/spec/support/example_helper.rb +46 -0
  108. data/spec/support/matchers.rb +14 -0
  109. data/spec/support/test_site.rb +59 -0
  110. metadata +329 -236
  111. data/lib/retter/binder.rb +0 -50
  112. data/lib/retter/command.rb +0 -192
  113. data/lib/retter/config.rb +0 -96
  114. data/lib/retter/configurable.rb +0 -26
  115. data/lib/retter/entries.rb +0 -115
  116. data/lib/retter/generator.rb +0 -7
  117. data/lib/retter/generator/base.rb +0 -65
  118. data/lib/retter/generator/creator.rb +0 -34
  119. data/lib/retter/generator/skel/Gemfile +0 -5
  120. data/lib/retter/markdown.rb +0 -31
  121. data/lib/retter/markdown/code_ray_renderer.rb +0 -11
  122. data/lib/retter/markdown/pygments_renderer.rb +0 -16
  123. data/lib/retter/page.rb +0 -43
  124. data/lib/retter/page/article.rb +0 -54
  125. data/lib/retter/page/base.rb +0 -97
  126. data/lib/retter/page/entries.rb +0 -17
  127. data/lib/retter/page/entry.rb +0 -46
  128. data/lib/retter/page/feed.rb +0 -63
  129. data/lib/retter/page/index.rb +0 -17
  130. data/lib/retter/page/profile.rb +0 -17
  131. data/lib/retter/page/view_helper.rb +0 -66
  132. data/lib/retter/preprint.rb +0 -34
  133. data/spec/command/callback_spec.rb +0 -27
  134. data/spec/command/clean_spec.rb +0 -20
  135. data/spec/command/commit_spec.rb +0 -40
  136. data/spec/command/edit_spec.rb +0 -119
  137. data/spec/command/list_spec.rb +0 -42
  138. data/spec/command/open_spec.rb +0 -12
  139. data/spec/command/preview_spec.rb +0 -40
  140. data/spec/command/rebind_spec.rb +0 -276
  141. 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
- pkg/*
5
- tmp/*
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
@@ -1,3 +1,5 @@
1
1
  rvm:
2
- - '1.9.3-p194'
3
- before_install: gem install bundler --version=1.2.1
2
+ - '1.9.3'
3
+ - '2.0.0'
4
+ - '2.1.0'
5
+ before_script: git version
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
@@ -1,3 +1,6 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ gem 'pry'
6
+ gem 'fuubar'
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 - Flyweight diary workflow. [![Build Status](https://secure.travis-ci.org/hibariya/retter.png?branch=master)](http://travis-ci.org/hibariya/retter)
1
+ # RETTER - A diary workflow for shell users. [![Build Status](https://drone.io/github.com/hibariya/retter/status.png)](https://drone.io/github.com/hibariya/retter/latest)
2
2
 
3
- 手軽さを追求した記事作成ツール。
3
+ ## Required
4
4
 
5
- * CLIでの操作を前提としています
6
- * どこ(cwd)にいてもすぐに記事をMarkdownで編集できます
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
- # Quick Start
9
+ ## Quick Start
14
10
 
15
- *ruby-1.9.2* or later is required.
16
-
17
- **Install:**
18
-
19
- ~~~~
20
- gem install retter
21
- ~~~~
22
-
23
- **Generate a new site:**
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
- `open` sub-command opens your (static) website by your default browser.
22
+ ## List, edit and preview
67
23
 
68
- **Show Articles list:**
24
+ `retter list` lists all articles.
69
25
 
70
- ~~~~
26
+ ```
71
27
  $ retter list
72
- [e0] 2011-11-09
73
- my sweet article title
74
- ~~~~
75
-
76
- **Re-writing an article:**
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
- # Environment variables
35
+ `retter edit [KEYWORD]` opens a source with $EDITOR.
98
36
 
99
- **Important**
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
- retter requires `$EDITOR` variable.
43
+ ### Edit and preview (with livereload)
102
44
 
103
- ## $RETTER_HOME
45
+ To preview, run `retter preview`.
104
46
 
105
- You can use `retter` command anywhere, If you set `$RETTER_HOME` variable.
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
- You have to cd to the directory, If you don't set `$RETTER_HOME` variable.
54
+ In other shell:
113
55
 
114
- ~~~~
115
- $ cd path/to/my_sweet_diary
116
- $ retter
117
- ~~~~
56
+ ```
57
+ $ retter edit # Edit and save
58
+ # And $BROWSER will reload automatically.
59
+ ```
118
60
 
119
- # Using shortcuts
61
+ ## $RETTER_ROOT variable
120
62
 
121
- ~~~~
122
- $ retter commit # Shortcut of `git add . ; git commit -m 'Retter commit'`
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
- # Command options
66
+ **`$RETTER_HOME` variable is deprecated.** Please use `$RETTER_ROOT`.
128
67
 
129
- Date is specify-able in `edit` `preview` sub-command.
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
- Relative date is available too.
72
+ Default configuration is below:
137
73
 
138
- ~~~~
139
- $ retter edit yesterday
140
- $ retter edit today
141
- $ retter edit tommorow
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
- $ retter edit '3 days ago'
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
- And file name.
92
+ Hooks will be invoked after running commands.
153
93
 
154
- ~~~~
155
- $ retter edit today.md
156
- $ retter edit 20110101.md
157
- $ retter preview 20110101.md
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
- # Callbacks
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
- Some command (edit bind rebind commit) will call callback if you defined callbacks.
106
+ ## Markdown structure
163
107
 
164
- In Retterfile:
108
+ Following markdown file includes two articles.
165
109
 
166
- ~~~~
167
- after [command], [invoke command or proc]
168
- ~~~~
110
+ ```
111
+ # First article
169
112
 
170
- ## Example1: Auto preview
113
+ Hi, first article.
171
114
 
172
- In Retterfile:
115
+ # Second article
173
116
 
174
- ~~~~ruby
175
- after :edit do
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
- ## Example2: Auto deploying
120
+ Header equal to h1 means start of an article. Like below:
182
121
 
183
- In Retterfile:
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
- ~~~~ruby
186
- after :rebind, :commit # git commit
137
+ Each article have its own URL.
187
138
 
188
- after :commit do # deploy
189
- system "cd #{config.retter_home}"
190
- system 'git push origin master'
191
- end
192
- ~~~~
139
+ ## Directory structure
193
140
 
194
- ## Skipping callback
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
- `--silent` option skips those callback.
151
+ ## Extract source branch
197
152
 
198
- ## Run callback
153
+ You can move all files (except public files) to `source` branch.
199
154
 
200
- `callback` sub-command runs only callback proccess.
155
+ Migration example is below:
201
156
 
202
- ~~~~
203
- $ retter callback --after edit
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
- # Install DISQUS (Comment tool)
168
+ ## Install DISQUS (Comment service)
207
169
 
208
- ## Prepare
170
+ ### Prepare
209
171
 
210
172
  1. Create DISQUS Account
211
173
  2. Add new site for retter
212
174
 
213
- ## Install
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
- renderer Retter::Renderers::PygmentsRenderer
182
+ config.disqus_shortname = 'your_disqus_shortname'
240
183
  ```
241
184
 
242
- # Remove caches
185
+ Second, Edit templete and inject `= render_disqus_comment_form`.
243
186
 
244
- When change the renderer, you have to remove cache files.
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
- ![Default](http://hibariya.github.com/images/theme_samples/retter_default.jpg)
262
-
263
- ## Orange
264
-
265
- ~~~~haml
266
- %link{href: '/stylesheets/orange.css', media: 'screen', rel: 'stylesheet', type: 'text/css'}
267
- ~~~~
268
-
269
- ![Orange](http://hibariya.github.com/images/theme_samples/retter_orange.jpg)
270
-
271
- # HTML Layout
272
194
 
273
- To customize layout, edit following files.
195
+ ## Migrate from Retter-0.2.5 or earlier
274
196
 
275
- ~~~~
276
- layouts
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
- # Skipping page binding
200
+ ### Migrate command
286
201
 
287
- You can skip following pages bind.
202
+ `retter migrate` attempts to migrate to new version.
288
203
 
289
- * profile.html
290
- * entries.html
291
- * feed.rss
292
-
293
- If you want, add `allow_binding` configuration to Retterfile.
294
-
295
- ```ruby
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
- # Other template engines
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
- The MIT License
216
+ ### Migrate only articles (RECOMMENDED)
310
217
 
311
- Copyright (c) 2011 hibariya, uzura29
218
+ If you can't migrate with `retter migrate`, you may want to migrate only articles. Like below.
312
219
 
313
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
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
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
228
+ ## Contributing
316
229
 
317
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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