bookery 0.0.2 → 0.1.0
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 +20 -8
- data/.travis.yml +5 -0
- data/{LICENSE.txt → LICENSE} +0 -0
- data/README.md +26 -11
- data/Rakefile +2 -1
- data/bookery.gemspec +18 -14
- data/docs/config.md +61 -0
- data/docs/contributing.md +47 -0
- data/docs/editing.md +82 -0
- data/docs/project.md +77 -0
- data/lib/bookery.rb +27 -4
- data/lib/bookery/book.rb +13 -15
- data/lib/bookery/cli.rb +29 -12
- data/lib/bookery/config.rb +42 -0
- data/lib/bookery/factories/chapter_factory.rb +35 -0
- data/lib/bookery/factories/publisher_factory.rb +13 -0
- data/lib/bookery/processors/include_processor.rb +17 -0
- data/lib/bookery/project.rb +75 -0
- data/lib/bookery/publishers/html_publisher.rb +68 -0
- data/lib/bookery/version.rb +1 -1
- data/{bin → libexec}/bookery +1 -4
- data/templates/basic/Gemfile.tt +2 -0
- data/templates/basic/assets/css/base.css +7 -0
- data/templates/basic/assets/css/layout.css +23 -0
- data/templates/basic/assets/css/modules/code-block.css +132 -0
- data/templates/{book/assets → basic/assets/includes}/.empty_directory +0 -0
- data/templates/basic/assets/style.css +3 -0
- data/templates/basic/assets/templates/template.html.erb +30 -0
- data/templates/basic/book/en/001-first-chapter/01-chapter-file.md +9 -0
- data/templates/basic/config.yml +14 -0
- data/test/bookery/book_test.rb +32 -9
- data/test/bookery/cli_test.rb +25 -14
- data/test/bookery/config_test.rb +26 -0
- data/test/bookery/factories/chapter_factory_test.rb +24 -0
- data/test/bookery/factories/publisher_factory_test.rb +16 -0
- data/test/bookery/processor/include_processor_test.rb +38 -0
- data/test/bookery/project_test.rb +37 -0
- data/test/bookery/publishers/html_publisher_test.rb +78 -0
- data/test/data/project/Gemfile.tt +2 -0
- data/{templates/book/book/.empty_directory → test/data/project/assets/images/cover.png} +0 -0
- data/test/data/project/assets/includes/ruby/chapter2.rb +3 -0
- data/test/data/project/assets/style.css +1 -0
- data/test/data/project/assets/templates/template.html.erb +15 -0
- data/test/data/project/book/en/001-first-chapter/01-chapter-file.md +9 -0
- data/test/data/project/book/en/002-second-chapter/01-chapter-file.md +7 -0
- data/test/data/project/book/en/002-second-chapter/02-second-chapter-file.md +1 -0
- data/{templates/book/book/en/.empty_directory → test/data/project/book/es/.git-keep} +0 -0
- data/test/data/project/config.yml +19 -0
- data/test/test_helper.rb +3 -46
- metadata +107 -79
- data/Gemfile.lock +0 -64
- data/Guardfile +0 -9
- data/lib/bookery/chapter.rb +0 -30
- data/templates/book/Gemfile +0 -2
- data/templates/book/README.md +0 -3
- data/templates/book/config.yml +0 -5
- data/templates/sample/Gemfile +0 -2
- data/templates/sample/README.md +0 -3
- data/templates/sample/book/en/01-introduction/01-intro-to-book.md +0 -0
- data/templates/sample/book/en/02-second-chapter/01-first-things-first.md +0 -1
- data/templates/sample/book/en/02-second-chapter/02-before_intro.md +0 -1
- data/templates/sample/config.yml +0 -5
- data/test/bookery/chapter_test.rb +0 -21
data/Guardfile
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
# A sample Guardfile
|
2
|
-
# More info at https://github.com/guard/guard#readme
|
3
|
-
|
4
|
-
guard :minitest do
|
5
|
-
# with Minitest::Unit
|
6
|
-
watch(%r{^test/(.*)\/?(.*)_test\.rb})
|
7
|
-
watch(%r{^lib/(.*/)?([^/]+)\.rb}) { |m| "test/#{m[1]}#{m[2]}_test.rb" }
|
8
|
-
watch(%r{^test/test_helper\.rb}) { 'test' }
|
9
|
-
end
|
data/lib/bookery/chapter.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
module Bookery
|
2
|
-
class Chapter
|
3
|
-
attr_reader :name
|
4
|
-
|
5
|
-
def initialize(chapter_dir)
|
6
|
-
@name = sanitize_name(chapter_dir)
|
7
|
-
@dir = chapter_dir
|
8
|
-
end
|
9
|
-
|
10
|
-
def markup
|
11
|
-
@markup ||= concatenate_files
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def sanitize_name(path)
|
17
|
-
File.basename(path).sub(/\A\d+\s?-\s?/, '').titleize
|
18
|
-
end
|
19
|
-
|
20
|
-
def concatenate_files
|
21
|
-
contents = ''
|
22
|
-
|
23
|
-
Dir.glob(File.join(@dir, '**/*.md')) do |file|
|
24
|
-
contents << File.read(file)
|
25
|
-
end
|
26
|
-
|
27
|
-
contents
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
data/templates/book/Gemfile
DELETED
data/templates/book/README.md
DELETED
data/templates/book/config.yml
DELETED
data/templates/sample/Gemfile
DELETED
data/templates/sample/README.md
DELETED
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
# The first file in chapter 2
|
@@ -1 +0,0 @@
|
|
1
|
-
# The second file in chapter 2
|
data/templates/sample/config.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class ChapterTest < AppTest
|
4
|
-
def setup
|
5
|
-
super
|
6
|
-
@chapter = Bookery::Chapter.new('sandbox/book/en/02-second-chapter')
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_name_is_sanitized
|
10
|
-
assert_equal 'Second Chapter', @chapter.name
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_markup_contains_all_files
|
14
|
-
assert_match /# The first file in chapter 2/, @chapter.markup
|
15
|
-
assert_match /# The second file in chapter 2/, @chapter.markup
|
16
|
-
end
|
17
|
-
|
18
|
-
def template_name
|
19
|
-
'sample'
|
20
|
-
end
|
21
|
-
end
|