retter 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/.gitignore +1 -0
  2. data/.travis.yml +1 -0
  3. data/README.md +54 -4
  4. data/bin/retter +2 -0
  5. data/lib/retter/command.rb +37 -41
  6. data/lib/retter/config.rb +94 -84
  7. data/lib/retter/entries.rb +93 -0
  8. data/lib/retter/entry.rb +46 -9
  9. data/lib/retter/generator/skel/images/orange/ic_li01.gif +0 -0
  10. data/lib/retter/generator/skel/layouts/article.html.haml +16 -3
  11. data/lib/retter/generator/skel/layouts/entries.html.haml +2 -2
  12. data/lib/retter/generator/skel/layouts/entry.html.haml +17 -3
  13. data/lib/retter/generator/skel/layouts/index.html.haml +14 -4
  14. data/lib/retter/generator/skel/stylesheets/base.css +1 -1
  15. data/lib/retter/generator/skel/stylesheets/orange.css +17 -2
  16. data/lib/retter/page/view_helper.rb +33 -0
  17. data/lib/retter/page.rb +86 -0
  18. data/lib/retter/pages/archive.rb +13 -0
  19. data/lib/retter/pages/article.rb +35 -0
  20. data/lib/retter/pages/entry.rb +28 -0
  21. data/lib/retter/pages/feed.rb +46 -0
  22. data/lib/retter/pages/index.rb +13 -0
  23. data/lib/retter/pages/profile.rb +13 -0
  24. data/lib/retter/pages.rb +40 -0
  25. data/lib/retter/preprint.rb +21 -0
  26. data/lib/retter/{stationery/renderer.rb → renderer.rb} +1 -1
  27. data/lib/retter/repository.rb +21 -0
  28. data/lib/retter/version.rb +1 -1
  29. data/lib/retter.rb +36 -3
  30. data/retter.gemspec +31 -0
  31. data/spec/command/callback_spec.rb +1 -1
  32. data/spec/command/commit_spec.rb +1 -1
  33. data/spec/command/edit_spec.rb +1 -1
  34. data/spec/command/invoke_after_spec.rb +2 -2
  35. data/spec/command/list_spec.rb +47 -0
  36. data/spec/command/open_spec.rb +1 -1
  37. data/spec/command/preview_spec.rb +1 -1
  38. data/spec/command/rebind_spec.rb +8 -8
  39. data/spec/spec_helper.rb +2 -0
  40. data/spec/support/stream_capture.rb +16 -0
  41. metadata +84 -39
  42. data/lib/retter/stationery/binder.rb +0 -150
  43. data/lib/retter/stationery/previewer.rb +0 -64
  44. data/lib/retter/stationery/view.rb +0 -68
  45. data/lib/retter/stationery.rb +0 -47
@@ -1,47 +0,0 @@
1
- # coding: utf-8
2
-
3
- module Retter::Stationery
4
- class << self
5
- def scan(path)
6
- entries = find_markup_files(path).map {|file|
7
- date = file.basename('.*').to_s
8
- mkup = File.open(file, &:read)
9
- Retter::Entry.new date: Date.parse(date), body: markupper.render(mkup)
10
- }
11
-
12
- entries.sort_by(&:date).reverse
13
- end
14
-
15
- def find_markup_files(path)
16
- path = Pathname.new(path).realpath
17
- Dir.open(path, &:to_a).grep(/^\d{4}(?:0[1-9]|1[012])(?:0[1-9]|[12][0-9]|3[01])\.(md)$/).map {|f| path.join f }
18
- end
19
-
20
- def markupper
21
- @markupper ||= ::Redcarpet::Markdown.new(
22
- Renderer,
23
- autolink: true,
24
- space_after_headers: true,
25
- fenced_code_blocks: true,
26
- strikethrough: true,
27
- superscript: true,
28
- fenced_code_blocks: true,
29
- tables: true
30
- )
31
- end
32
-
33
- def previewer(config, date)
34
- Previewer.new config, date
35
- end
36
-
37
- def binder(config)
38
- Binder.new config
39
- end
40
- end
41
- end
42
-
43
- require 'retter/stationery/renderer'
44
- require 'retter/stationery/view'
45
- require 'retter/stationery/previewer'
46
- require 'retter/stationery/binder'
47
-