persie 0.0.1.alpha

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.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/.rspec +3 -0
  4. data/Gemfile +3 -0
  5. data/LICENSE +21 -0
  6. data/README.md +52 -0
  7. data/Rakefile +85 -0
  8. data/bin/persie +12 -0
  9. data/lib/persie/asciidoctor_ext/htmlbook.rb +1120 -0
  10. data/lib/persie/asciidoctor_ext/sample.rb +54 -0
  11. data/lib/persie/asciidoctor_ext/spine_item_processor.rb +43 -0
  12. data/lib/persie/book.rb +60 -0
  13. data/lib/persie/builder.rb +110 -0
  14. data/lib/persie/builders/epub.rb +434 -0
  15. data/lib/persie/builders/mobi.rb +80 -0
  16. data/lib/persie/builders/pdf.rb +113 -0
  17. data/lib/persie/builders/site.rb +110 -0
  18. data/lib/persie/cli.rb +106 -0
  19. data/lib/persie/dependency.rb +26 -0
  20. data/lib/persie/generator.rb +68 -0
  21. data/lib/persie/server.rb +27 -0
  22. data/lib/persie/ui.rb +27 -0
  23. data/lib/persie/version.rb +3 -0
  24. data/lib/persie.rb +32 -0
  25. data/persie.gemspec +41 -0
  26. data/spec/build_pdf_command_spec.rb +25 -0
  27. data/spec/fixtures/a-book/.gitignore +2 -0
  28. data/spec/fixtures/a-book/Gemfile +3 -0
  29. data/spec/fixtures/a-book/book.adoc +31 -0
  30. data/spec/fixtures/a-book/manuscript/chapter1.adoc +5 -0
  31. data/spec/fixtures/a-book/manuscript/chapter2.adoc +3 -0
  32. data/spec/fixtures/a-book/manuscript/preface.adoc +6 -0
  33. data/spec/fixtures/a-book/themes/pdf/pdf.css +1 -0
  34. data/spec/fixtures/a-book-with-parts/.gitignore +2 -0
  35. data/spec/fixtures/a-book-with-parts/Gemfile +3 -0
  36. data/spec/fixtures/a-book-with-parts/book.adoc +39 -0
  37. data/spec/fixtures/a-book-with-parts/manuscript/chapter1.adoc +4 -0
  38. data/spec/fixtures/a-book-with-parts/manuscript/chapter2.adoc +4 -0
  39. data/spec/fixtures/a-book-with-parts/manuscript/chapter3.adoc +3 -0
  40. data/spec/fixtures/a-book-with-parts/manuscript/chapter4.adoc +3 -0
  41. data/spec/fixtures/a-book-with-parts/manuscript/part1.adoc +3 -0
  42. data/spec/fixtures/a-book-with-parts/manuscript/part2.adoc +3 -0
  43. data/spec/fixtures/a-book-with-parts/manuscript/preface.adoc +4 -0
  44. data/spec/htmlbook_spec.rb +29 -0
  45. data/spec/new_command_spec.rb +57 -0
  46. data/spec/pdf_builder_spec.rb +39 -0
  47. data/spec/spec_helper.rb +14 -0
  48. data/spec/version_command_spec.rb +8 -0
  49. data/templates/Gemfile.txt +3 -0
  50. data/templates/book.adoc.erb +35 -0
  51. data/templates/chapter1.adoc +3 -0
  52. data/templates/chapter2.adoc +3 -0
  53. data/templates/gitignore.txt +2 -0
  54. data/templates/preface.adoc +4 -0
  55. data/workflow.png +0 -0
  56. metadata +278 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 29923bff5628fc5e8f09c52fe022859068a32c67
4
+ data.tar.gz: 27903ece8d8c245fca96ded9a2a53b699bdc53d3
5
+ SHA512:
6
+ metadata.gz: 008043e0fdaa9c724a0df7323b7d308e0df2bdb8dee56028ca7ff60adeb560c5bfb86fd7e2035da5697c959beac57eac5302edd828080d04111d3c6c310fb140
7
+ data.tar.gz: 356f44b4cd8ca4ef14fb18b0b4c3c889c5326e174fafc4f2f8dd68e748bffa2e3c1e7c39706e831f2ffb5a64e2ddf6efd88f77f6cd7bfac08ed94daf35525b60
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ Gemfile.lock
2
+ *.gem
3
+ pkg/
4
+ tmp/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --order rand
2
+ --color
3
+ --format doc
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (C) 2014 Andor Chen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # persie
2
+
3
+ [![Dependency Status](https://gemnasium.com/AndorChen/persie.svg)](https://gemnasium.com/AndorChen/persie)
4
+
5
+ ## 作用
6
+
7
+ 电子书工具链。
8
+
9
+ ## 特性
10
+
11
+ ### 一出四
12
+
13
+ 一个文稿源,生成四种格式电子书:PDF,ePub,mobi 和静态网站。
14
+
15
+ ## 原理
16
+
17
+ ![](workflow.png)
18
+
19
+ ## 用法
20
+
21
+ 参见[用户手册](http://andorchen.github.io/persie-manual/)。
22
+
23
+ ## FAQ
24
+
25
+ **问:为什么开发这个程序?**
26
+
27
+ 答:我有生成电子书的需求,而目前市面上并没有合我心意的类似工具。我在挠自己的痒处。
28
+
29
+ **问:为什么没有“那个”功能?**
30
+
31
+ 答:我只知道我自己哪里痒,不知道你哪里痒。如果你也痒,请[告诉](https://github.com/AndorChen/persie/issues)我你痒在何处。我可以给你挠,但不保证能为你止痒。
32
+
33
+ **问:使用中遇到问题怎么办?**
34
+
35
+ 答:首先我很抱歉,因为我能力有限,无法保证不出问题。如果遇到问题,而你自己无法解决,或许你可以[告诉](https://github.com/AndorChen/persie/issues)我,咱们一起解决。
36
+
37
+ **问:生成的电子书好难看,你得做点儿什么!**
38
+
39
+ 答:精力有限,暂时不打算提供基础样式。如果你有迫切的需求,做好预算后随时可以[联系](mailto:andor.chen.27@gmail.com)我。
40
+
41
+ **问:我很喜欢这个工具,想表示表示,该怎么做?**
42
+
43
+ 答:不会吧,烂成这样的程序!好吧,如果你真想表示一下,那就买本[我翻译的书](https://selfstore.io/~andor)吧。
44
+
45
+ ## 作者
46
+
47
+ [Andor Chen](http://about.ac)
48
+
49
+ ## 协议
50
+
51
+ [MIT](LICENSE)
52
+
data/Rakefile ADDED
@@ -0,0 +1,85 @@
1
+ $:.unshift(File.join(File.dirname(__FILE__), *%w[lib]))
2
+
3
+ require 'rake'
4
+ require 'rdoc'
5
+ require 'date'
6
+ require 'persie'
7
+
8
+ #############################################################################
9
+ #
10
+ # Helper functions
11
+ #
12
+ #############################################################################
13
+
14
+ def name
15
+ @name ||= Dir['*.gemspec'].first.split('.').first
16
+ end
17
+
18
+ def version
19
+ Persie::VERSION
20
+ end
21
+
22
+ def date
23
+ Date.today.to_s
24
+ end
25
+
26
+ def gemspec_file
27
+ "#{name}.gemspec"
28
+ end
29
+
30
+ def gem_file
31
+ "#{name}-#{version}.gem"
32
+ end
33
+
34
+ #############################################################################
35
+ #
36
+ # Standard tasks
37
+ #
38
+ #############################################################################
39
+
40
+ task :default => :spec
41
+
42
+ desc "Run all spec examples"
43
+ task :spec do
44
+ system 'bundle exec rspec spec'
45
+ end
46
+
47
+ require 'rdoc/task'
48
+ Rake::RDocTask.new do |rdoc|
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "#{name} #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
54
+
55
+ desc "Open an irb session preloaded with this library"
56
+ task :console do
57
+ sh "irb -rubygems -r ./lib/#{name}.rb"
58
+ end
59
+
60
+ #############################################################################
61
+ #
62
+ # Packaging tasks
63
+ #
64
+ #############################################################################
65
+
66
+ desc 'Release the gem, push to github and rubygems.org'
67
+ task :release => :build do
68
+ unless `git branch` =~ /^\* master$/
69
+ puts "You must be on the master branch to release!"
70
+ exit!
71
+ end
72
+ sh "git commit --allow-empty -m 'Release #{version}'"
73
+ sh "git tag v#{version}"
74
+ sh "git push origin master"
75
+ sh "git push origin v#{version}"
76
+ sh "gem push pkg/#{name}-#{version}.gem"
77
+ end
78
+
79
+ desc 'Build the gem and then move to /pkg'
80
+ task :build do
81
+ sh "mkdir -p pkg"
82
+ sh "gem build #{gemspec_file}"
83
+ sh "mv #{gem_file} pkg"
84
+ end
85
+
data/bin/persie ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.expand_path('../../lib', __FILE__)
4
+
5
+ require 'persie'
6
+
7
+ ::Persie.ruby_platform_warning
8
+ ::Persie.ruby_version_warning
9
+
10
+ ::Persie.require_plugins
11
+
12
+ ::Persie::Cli.start