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.
- 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
data/lib/retter/page/feed.rb
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require 'builder'
|
4
|
-
require 'uri'
|
5
|
-
|
6
|
-
module Retter
|
7
|
-
module Page
|
8
|
-
class Feed
|
9
|
-
include Base
|
10
|
-
|
11
|
-
def path
|
12
|
-
config.retter_home.join('entries.rss')
|
13
|
-
end
|
14
|
-
|
15
|
-
def bind
|
16
|
-
print rss
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def print(content)
|
22
|
-
path.open('w') {|f| f.write content }
|
23
|
-
end
|
24
|
-
|
25
|
-
def articles(limit = 20)
|
26
|
-
entries.map {|e| e.articles.reverse }.flatten[0..limit]
|
27
|
-
end
|
28
|
-
|
29
|
-
def helper
|
30
|
-
@helper ||= Object.new.extend(Page::ViewHelper)
|
31
|
-
end
|
32
|
-
|
33
|
-
def rss
|
34
|
-
xml = Builder::XmlMarkup.new
|
35
|
-
xml.instruct!
|
36
|
-
xml.rdf:RDF, :xmlns => 'http://purl.org/rss/1.0/',
|
37
|
-
:'xmlns:rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
|
38
|
-
:'xmlns:dc' => 'http://purl.org/dc/elements/1.1/',
|
39
|
-
:'xmlns:content' => 'http://purl.org/rss/1.0/modules/content/',
|
40
|
-
:'xml:lang' => 'ja' do
|
41
|
-
xml.channel :'rdf:about' => config.url do
|
42
|
-
xml.title config.title
|
43
|
-
xml.link config.url
|
44
|
-
xml.dc:date, (entries.empty? ? Time.now : entries.first.date).iso8601
|
45
|
-
xml.description config.description
|
46
|
-
xml.items { xml.rdf(:Seq) { articles.each {|a| xml.rdf:li, :'rdf:resource' => helper.article_url(a) } } }
|
47
|
-
end
|
48
|
-
|
49
|
-
articles.each do |article|
|
50
|
-
xml.item about: helper.article_url(article) do
|
51
|
-
xml.title article.title
|
52
|
-
xml.description article.snippet
|
53
|
-
xml.content(:encoded) { xml.cdata! article.body }
|
54
|
-
xml.dc:date, article.entry.date.iso8601
|
55
|
-
xml.link helper.article_url(article)
|
56
|
-
xml.author config.author
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
data/lib/retter/page/index.rb
DELETED
data/lib/retter/page/profile.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
module Retter
|
4
|
-
module Page::ViewHelper
|
5
|
-
include Site
|
6
|
-
|
7
|
-
def entry_path(*args)
|
8
|
-
case args.first
|
9
|
-
when Date, Time
|
10
|
-
entry_path_by_date(*args)
|
11
|
-
when Entry
|
12
|
-
entry_path_by_entry(args.first)
|
13
|
-
else
|
14
|
-
raise TypeError, "wrong argument type #{args.first.class} (expected Date, Time or Retter::Entry)"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def entry_url(*args)
|
19
|
-
URI.parse(config.url) + entry_path(*args)
|
20
|
-
end
|
21
|
-
|
22
|
-
def article_url(*args)
|
23
|
-
URI.parse(config.url) + article_path(*args)
|
24
|
-
end
|
25
|
-
|
26
|
-
def article_path(*args)
|
27
|
-
case args.first
|
28
|
-
when Date, Time
|
29
|
-
article_path_by_date_and_id(*args)
|
30
|
-
when Entry::Article
|
31
|
-
article_path_by_article(args.first)
|
32
|
-
else
|
33
|
-
raise TypeError, "wrong argument type #{args.first.class} (expected Date, Time or Retter::Entry::Article)"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def render_disqus_comment_form(disqus_shortname = config.disqus_shortname)
|
38
|
-
Haml::Engine.new(<<-HAML).render
|
39
|
-
#disqus_thread
|
40
|
-
:javascript
|
41
|
-
var disqus_shortname = '#{disqus_shortname}';
|
42
|
-
(function() {
|
43
|
-
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
44
|
-
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
|
45
|
-
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
46
|
-
})();
|
47
|
-
HAML
|
48
|
-
end
|
49
|
-
|
50
|
-
def article_path_by_date_and_id(date, id)
|
51
|
-
date.strftime("/entries/%Y%m%d/#{id}.html")
|
52
|
-
end
|
53
|
-
|
54
|
-
def article_path_by_article(article)
|
55
|
-
article_path(article.entry.date, article.id)
|
56
|
-
end
|
57
|
-
|
58
|
-
def entry_path_by_date(date, id = nil)
|
59
|
-
date.strftime('/entries/%Y%m%d.html') + (id ? "##{id}" : '')
|
60
|
-
end
|
61
|
-
|
62
|
-
def entry_path_by_entry(entry)
|
63
|
-
entry_path(entry.date)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
data/lib/retter/preprint.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
module Retter
|
4
|
-
class Preprint
|
5
|
-
class ViewContext < Page::Base::ViewContext
|
6
|
-
attr_reader :entry
|
7
|
-
|
8
|
-
def initialize(entry)
|
9
|
-
@entry = entry
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
include Page::Base
|
14
|
-
|
15
|
-
def path
|
16
|
-
config.retter_home.join '.preview.html'
|
17
|
-
end
|
18
|
-
|
19
|
-
def template_path
|
20
|
-
Page.find_template_path('entry')
|
21
|
-
end
|
22
|
-
|
23
|
-
def bind(entry)
|
24
|
-
context = ViewContext.new(entry)
|
25
|
-
part = Tilt.new(
|
26
|
-
template_path.to_path,
|
27
|
-
ugly: true,
|
28
|
-
filename: template_path.to_path
|
29
|
-
).render(context)
|
30
|
-
|
31
|
-
print part
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe 'Retter::Command#callback', clean: :all do
|
6
|
-
context 'invoke with proc' do
|
7
|
-
specify 'callback should called' do
|
8
|
-
command.should_receive(:commit)
|
9
|
-
|
10
|
-
invoke_command :callback, after: :edit do |config|
|
11
|
-
config.after :edit do
|
12
|
-
commit
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'invoke with symbol' do
|
19
|
-
specify 'callback should called' do
|
20
|
-
command.should_receive(:commit)
|
21
|
-
|
22
|
-
invoke_command :callback, after: :edit do |config|
|
23
|
-
config.after :edit, :commit
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
data/spec/command/clean_spec.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe 'Retter::Command#clean', clean: :all do
|
6
|
-
let(:cache_path) { %(#{Retter::Site.config.cache.cache_path}/*) }
|
7
|
-
|
8
|
-
before do
|
9
|
-
write_to_wip_file 'hi'
|
10
|
-
|
11
|
-
invoke_command :rebind
|
12
|
-
flunk if Dir.glob(cache_path).empty?
|
13
|
-
|
14
|
-
invoke_command :clean
|
15
|
-
end
|
16
|
-
|
17
|
-
subject { Dir.glob(cache_path) }
|
18
|
-
|
19
|
-
it { should be_empty }
|
20
|
-
end
|
data/spec/command/commit_spec.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'grit'
|
5
|
-
|
6
|
-
describe 'Retter::Command#commit', clean: :all do
|
7
|
-
let(:retter_home) { Retter::Site.config.retter_home }
|
8
|
-
let(:repo) { Grit::Repo.new(retter_home) }
|
9
|
-
let(:article) { '今日の記事' }
|
10
|
-
|
11
|
-
before do
|
12
|
-
command.stub!(:say) { true }
|
13
|
-
|
14
|
-
write_to_wip_file article
|
15
|
-
|
16
|
-
invoke_command :rebind
|
17
|
-
|
18
|
-
Grit::Repo.init retter_home.to_path
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'with no options' do
|
22
|
-
before do
|
23
|
-
command.should_receive(:after_callback).with(:commit)
|
24
|
-
|
25
|
-
invoke_command :commit
|
26
|
-
end
|
27
|
-
|
28
|
-
subject { repo.commits.first }
|
29
|
-
|
30
|
-
its(:message) { should == 'Retter commit' }
|
31
|
-
end
|
32
|
-
|
33
|
-
context 'with silent option' do
|
34
|
-
specify 'callback should not called' do
|
35
|
-
command.should_not_receive(:after_callback).with(:commit)
|
36
|
-
|
37
|
-
invoke_command :commit, silent: :true
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
data/spec/command/edit_spec.rb
DELETED
@@ -1,119 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe 'Retter::Command#edit', clean: :all do
|
6
|
-
context 'no options' do
|
7
|
-
before do
|
8
|
-
command.should_receive(:after_callback).with(:edit)
|
9
|
-
|
10
|
-
invoke_command :edit
|
11
|
-
end
|
12
|
-
|
13
|
-
it { wip_file.should written }
|
14
|
-
end
|
15
|
-
|
16
|
-
context 'after edit and rebind (no options)' do
|
17
|
-
let(:date_str) { '2011/01/01' }
|
18
|
-
let(:today_entry) { find_entry_by_string(date_str) }
|
19
|
-
|
20
|
-
before do
|
21
|
-
time_travel_to date_str
|
22
|
-
|
23
|
-
today_entry.path.open('w') { |f| f.puts 'written' }
|
24
|
-
|
25
|
-
invoke_command :rebind
|
26
|
-
invoke_command :edit
|
27
|
-
end
|
28
|
-
|
29
|
-
specify 'wip file should not be written' do
|
30
|
-
wip_file.should_not be_exist
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'with date (YYYYMMDD) option' do
|
35
|
-
before do
|
36
|
-
invoke_command :edit, '20110101'
|
37
|
-
end
|
38
|
-
|
39
|
-
it { wip_file.should_not written }
|
40
|
-
|
41
|
-
describe 'date file' do
|
42
|
-
subject { markdown_file('20110101' ) }
|
43
|
-
|
44
|
-
it { should written }
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
context 'with date (1.day.ago) option' do
|
49
|
-
before do
|
50
|
-
time_travel_to '2011/04/02'
|
51
|
-
|
52
|
-
invoke_command :edit, '1.day.ago'
|
53
|
-
end
|
54
|
-
|
55
|
-
describe 'target date file' do
|
56
|
-
subject { markdown_file('2011/04/01') }
|
57
|
-
|
58
|
-
it { should written }
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
context 'with date (yesterday) option' do
|
63
|
-
before do
|
64
|
-
time_travel_to '2011/04/02'
|
65
|
-
|
66
|
-
invoke_command :edit, 'yesterday'
|
67
|
-
end
|
68
|
-
|
69
|
-
describe 'target date file' do
|
70
|
-
subject { markdown_file('2011/04/01') }
|
71
|
-
|
72
|
-
it { should written }
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
context 'with filename (20110401.md) option' do
|
77
|
-
before do
|
78
|
-
FileUtils.touch markdown_file('20110401')
|
79
|
-
|
80
|
-
Retter::Site.reset! # XXX
|
81
|
-
|
82
|
-
invoke_command :edit, '20110401.md'
|
83
|
-
end
|
84
|
-
|
85
|
-
describe 'target date file' do
|
86
|
-
subject { markdown_file('20110401') }
|
87
|
-
|
88
|
-
it { should written }
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
context 'with no exist filename option' do
|
93
|
-
it {
|
94
|
-
-> { invoke_command :edit, '19850126.md' }.should raise_error(Retter::EntryLoadError)
|
95
|
-
}
|
96
|
-
end
|
97
|
-
|
98
|
-
context 'with filename (today.md) option' do
|
99
|
-
before do
|
100
|
-
FileUtils.touch wip_file.to_path
|
101
|
-
|
102
|
-
invoke_command :edit, 'today.md'
|
103
|
-
end
|
104
|
-
|
105
|
-
describe 'target file' do
|
106
|
-
it { wip_file.should written }
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
context 'with silent option' do
|
111
|
-
before do
|
112
|
-
command.should_not_receive(:after_callback)
|
113
|
-
|
114
|
-
invoke_command :edit, silent: true
|
115
|
-
end
|
116
|
-
|
117
|
-
it { wip_file.should written }
|
118
|
-
end
|
119
|
-
end
|
data/spec/command/list_spec.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe 'Retter::Command#list', clean: :all do
|
6
|
-
context 'happy case' do
|
7
|
-
before do
|
8
|
-
markdown_file('20110101').open('w') do |f|
|
9
|
-
f.puts <<-EOM
|
10
|
-
# 朝11時
|
11
|
-
|
12
|
-
おはようございます
|
13
|
-
|
14
|
-
# 夜1時
|
15
|
-
|
16
|
-
おやすみなさい
|
17
|
-
EOM
|
18
|
-
end
|
19
|
-
|
20
|
-
markdown_file('20110222').open('w') do |f|
|
21
|
-
f.puts <<-EOM
|
22
|
-
# 朝11時30分
|
23
|
-
|
24
|
-
おはようございます
|
25
|
-
|
26
|
-
# 夜1時30分
|
27
|
-
|
28
|
-
おやすみなさい
|
29
|
-
EOM
|
30
|
-
end
|
31
|
-
|
32
|
-
Retter::Site.reset! # XXX
|
33
|
-
end
|
34
|
-
|
35
|
-
subject { capture(:stdout) { invoke_command :list }.split(/\n+/) }
|
36
|
-
|
37
|
-
its([0]) { should match /\[e0\]\s+2011\-02\-22/ }
|
38
|
-
its([1]) { should match /朝11時30分, 夜1時30分/ }
|
39
|
-
its([2]) { should match /\[e1\]\s+2011\-01\-01/ }
|
40
|
-
its([3]) { should match /朝11時, 夜1時/ }
|
41
|
-
end
|
42
|
-
end
|