bookshelf 1.0.0 → 1.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.
data/README.md CHANGED
@@ -35,15 +35,13 @@ dependencies.
35
35
  There's no requirements here; just make sure you cleared the correct dependency based
36
36
  on the formats you want to export to.
37
37
 
38
- ## Getting Started
39
-
40
- We first need to generate a new bookshelf project
38
+ ## Creating a new Book
41
39
 
42
- $ bookshelf new my_bookshelf
40
+ $ bookshelf new my_book
43
41
 
44
- This command creates a directory `my_bookshelf` with the following structure:
42
+ This command creates a directory `my_book` with the following structure:
45
43
 
46
- my_bookshelf
44
+ my_book
47
45
  ├── assets
48
46
  │ ├── fonts
49
47
  │ ├── images
@@ -51,7 +49,7 @@ This command creates a directory `my_bookshelf` with the following structure:
51
49
  │ ├── _fonts.scss
52
50
  │ ├── epub.scss
53
51
  │ └── html.scss
54
- ├── books
52
+ ├── text
55
53
  ├── config
56
54
  │ ├── config.yml
57
55
  │ └── helper.rb
@@ -63,17 +61,8 @@ This command creates a directory `my_bookshelf` with the following structure:
63
61
  └── html
64
62
  └── layout.erb
65
63
 
66
- ## Creating a new Book
67
-
68
- To add a book create a folder under the `books` directory, named as per the title.
69
-
70
- my_bookshelf
71
- └── books
72
- └── my_book
73
-
74
- Copy the `config.yml` file from `my_bookshelf/config/config.yml` into `my_bookshelf/books/my_book`
75
64
 
76
- Update `my_bookshelf/config/config.yml` to reflect the books title, author and other attributes.
65
+ Update `my_book/config/config.yml` to reflect the books title, author and other attributes.
77
66
 
78
67
  ## Authoring
79
68
 
@@ -81,31 +70,29 @@ Now, create the content for your book by creating markdown or textile files into
81
70
 
82
71
  *Option 1 - Directories for chapters:*
83
72
 
84
- my_bookshelf
85
- └── books
86
- └── my_book
87
- ├── 01_introduction
88
- │ ├── 01_section_1.markdown
89
- ├── 02_section_2.markdown
90
- │ └── ...
91
- ├── 02_chapter_1
92
- │ ├── 01_section_1.markdown
93
- ├── 02_section_2.markdown
94
- │ └── ...
95
- ├── 03_chapter_2
96
- ├── 04_chapter_3
97
- └── ...
73
+ my_book
74
+ └── text
75
+ ├── 01_introduction
76
+ ├── 01_section_1.markdown
77
+ │ ├── 02_section_2.markdown
78
+ └── ...
79
+ ├── 02_chapter_1
80
+ ├── 01_section_1.markdown
81
+ │ ├── 02_section_2.markdown
82
+ └── ...
83
+ ├── 03_chapter_2
84
+ ├── 04_chapter_3
85
+ └── ...
98
86
 
99
87
  *Option 2 - Files for chapters:*
100
88
 
101
- my_bookshelf
102
- └── books
103
- └── my_book
104
- ├── 01_introduction.markdown
105
- ├── 02_chapter_1.markdown
106
- ├── 03_chapter_2.markdown
107
- ├── 04_chapter_3.markdown
108
- └── ...
89
+ my_book
90
+ └── text
91
+ ├── 01_introduction.markdown
92
+ ├── 02_chapter_1.markdown
93
+ ├── 03_chapter_2.markdown
94
+ ├── 04_chapter_3.markdown
95
+ └── ...
109
96
 
110
97
  Note that you if the number of chapters in your book is likely to exceed 10, you should add an extra 0 to the front of the chapter directory/file names
111
98
 
@@ -47,8 +47,8 @@ module Bookshelf
47
47
  autoload :Dependency, "bookshelf/dependency"
48
48
  autoload :Stats, "bookshelf/stats"
49
49
 
50
- def self.config(book_dir = nil)
51
- path = book_dir.join("config.yml")
50
+ def self.config
51
+ path = Pathname.new("config/config.yml")
52
52
  content = File.read(path)
53
53
  erb = ERB.new(content).result
54
54
  YAML.load(erb).with_indifferent_access
@@ -32,15 +32,8 @@ module Bookshelf
32
32
  raise Error, "The --only option need to be one of: #{FORMATS.join(", ")}"
33
33
  end
34
34
 
35
- book_dirs = if options[:book]
36
- [Bookshelf.root_dir.join("books/#{options[:book]}")]
37
- else
38
- Dir.glob(Bookshelf.root_dir.join("books/*")).map{|book_dir| Pathname.new(book_dir) }
39
- end
40
-
41
- book_dirs.each do |book_dir|
42
- Bookshelf::Exporter.run(book_dir, options)
43
- end
35
+ book_dir = Pathname.new("text")
36
+ Bookshelf::Exporter.run(book_dir, options)
44
37
  end
45
38
 
46
39
  desc "version", "Prints the Bookshelf's version information"
@@ -50,7 +50,7 @@ module Bookshelf
50
50
  end
51
51
 
52
52
  def config
53
- Bookshelf.config(book_dir)
53
+ Bookshelf.config
54
54
  end
55
55
  end
56
56
  end
@@ -14,62 +14,47 @@ module Bookshelf
14
14
  File.dirname(__FILE__) + "/../../templates"
15
15
  end
16
16
 
17
- def copy_html_templates
18
- copy_file "layout.erb" , "templates/html/layout.erb"
19
- copy_file "layout.css" , "templates/html/layout.css"
20
- copy_file "user.css" , "templates/html/user.css"
21
- copy_file "syntax.css" , "templates/html/syntax.css"
22
- end
23
-
24
- def copy_epub_templates
25
- copy_file "cover.erb" , "templates/epub/cover.erb"
26
- copy_file "epub.css" , "templates/epub/user.css"
27
- copy_file "epub.erb" , "templates/epub/page.erb"
28
- copy_file "cover.png" , "templates/epub/cover.png"
17
+ def copy_top_level
18
+ copy_file "Gemfile", "Gemfile"
19
+ copy_file "README.md", "README.md"
29
20
  end
30
21
 
31
- def copy_sample_page
32
- copy_file "sample.md" , "text/01_Welcome.md"
22
+ def copy_assets
23
+ copy_file "epub.scss" , "assets/styles/epub.scss"
24
+ copy_file "html.scss" , "assets/styles/html.scss"
25
+ copy_file "html.scss" , "assets/styles/_fonts.scss"
26
+ empty_directory "assets/fonts"
27
+ empty_directory "assets/images"
33
28
  end
34
29
 
35
30
  def copy_config_file
36
- @name = full_name
37
- @uid = Digest::MD5.hexdigest("#{Time.now}--#{rand}")
38
- @year = Date.today.year
39
- template "config.erb", "config/bookshelf.yml"
31
+ template "config.erb", "config/config.yml"
40
32
  end
41
33
 
42
34
  def copy_helper_file
43
35
  copy_file "helper.rb", "config/helper.rb"
44
36
  end
45
37
 
46
- def create_directories
38
+ def copy_templates
39
+ copy_file "layout.erb" , "templates/html/layout.erb"
40
+ copy_file "cover.erb" , "templates/epub/cover.erb"
41
+ copy_file "epub.erb" , "templates/epub/page.erb"
42
+ end
43
+
44
+ def create_empty_directories
47
45
  empty_directory "output"
48
- empty_directory "images"
49
- empty_directory "code"
46
+ empty_directory "text"
50
47
  end
51
48
 
52
49
  def create_git_files
53
50
  create_file ".gitignore" do
54
51
  "output/*.{html,epub,pdf}\noutput/tmp"
55
52
  end
56
-
53
+ create_file "assets/fonts/.gitkeep"
54
+ create_file "assets/images/.gitkeep"
55
+ create_file "assets/styles/.gitkeep"
57
56
  create_file "output/.gitkeep"
58
- create_file "images/.gitkeep"
59
- create_file "code/.gitkeep"
60
- end
61
-
62
- def copy_guardfile
63
- copy_file "Guardfile", "Guardfile"
64
- end
65
-
66
- private
67
- # Retrieve user's name using finger.
68
- # Defaults to <tt>John Doe</tt>.
69
- #
70
- def full_name
71
- name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp
72
- name.present? ? name.squish : "John Doe"
57
+ create_file "text/.gitkeep"
73
58
  end
74
59
  end
75
60
  end
@@ -30,7 +30,7 @@ module Bookshelf
30
30
  # Return the configuration file.
31
31
  #
32
32
  def config
33
- Bookshelf.config(book_dir)
33
+ Bookshelf.config
34
34
  end
35
35
 
36
36
  # Render a eRb template using +locals+ as data seed.
@@ -1,7 +1,7 @@
1
1
  module Bookshelf
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 0
4
+ MINOR = 1
5
5
  PATCH = 0
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
@@ -0,0 +1,3 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem "bookshelf"
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  # The book's title. Will be used everywhere!
2
- title: "[Your Book Title]"
2
+ title:
3
3
 
4
4
  # The book's language.
5
5
  language: en
@@ -13,23 +13,23 @@ language: en
13
13
  # This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
14
14
  # This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
15
15
  #
16
- copyright: "Copyright (C) <%= @year %> <%= @name %>."
16
+ copyright:
17
17
 
18
18
  # Who's publishing this book.
19
- publisher: "<%= @name %>"
19
+ publisher:
20
20
 
21
21
  # When this book was published.
22
- published_at: "<%= Date.today %>"
22
+ published_at:
23
23
 
24
24
  # Some book description.
25
- subject: "[Your book description]"
25
+ subject:
26
26
 
27
- # Some keywords that identify this book.
28
- keywords: "[Your book keywords (comma-separated)]"
27
+ # Some keywords that identify this book (comma separated.
28
+ keywords:
29
29
 
30
30
  # Some unique identification. Works great with your domain
31
31
  # like `http://yourbook.example.com`.
32
- uid: "<%= @uid %>"
32
+ uid:
33
33
 
34
34
  # Your book identification like ISBN or ISSN.
35
35
  identifier:
@@ -38,7 +38,5 @@ identifier:
38
38
 
39
39
  # This book authors.
40
40
  authors:
41
- - "<%= @name %>"
42
-
43
- # The base URL from your source code.
44
- base_url: http://example.com
41
+ -
42
+
@@ -1,16 +1,15 @@
1
- <?xml version="1.0" encoding="UTF-8" ?>
2
- <!DOCTYPE html PUBLIC
3
- "-//W3C//DTD XHTML 1.1//EN"
4
- "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
5
3
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= language %>">
6
4
  <head>
7
- <title><%= title %></title>
8
- <link rel="stylesheet" href="user.css" type="text/css" />
9
- <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
5
+ <title></title>
6
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
7
+ <link rel="stylesheet" type="text/css" href="styles/epub.css"/>
10
8
  </head>
9
+
11
10
  <body>
12
- <div>
13
- <h1><%= title %></h1>
11
+ <div class="chapter">
12
+ <%= content %>
14
13
  </div>
15
14
  </body>
16
15
  </html>
@@ -2,14 +2,13 @@
2
2
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3
3
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= language %>">
4
4
  <head>
5
- <title></title>
6
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
7
- <link rel="stylesheet" type="text/css" href="user.css"/>
5
+ <title><%= title %></title>
6
+ <link rel="stylesheet" href="styles/epub.css" type="text/css" />
7
+ <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
8
8
  </head>
9
-
10
9
  <body>
11
- <div class="chapter">
12
- <%= content %>
10
+ <div>
11
+ <h1><%= title %></h1>
13
12
  </div>
14
13
  </body>
15
14
  </html>
@@ -0,0 +1 @@
1
+ @import "fonts";
@@ -0,0 +1 @@
1
+ @import "fonts";
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bookshelf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-19 00:00:00.000000000 Z
12
+ date: 2013-05-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70233285321100 !ruby/object:Gem::Requirement
16
+ requirement: &70107041166720 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70233285321100
24
+ version_requirements: *70107041166720
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: nokogiri
27
- requirement: &70233285320640 !ruby/object:Gem::Requirement
27
+ requirement: &70107041166260 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70233285320640
35
+ version_requirements: *70107041166260
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: RedCloth
38
- requirement: &70233285320220 !ruby/object:Gem::Requirement
38
+ requirement: &70107041165840 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70233285320220
46
+ version_requirements: *70107041165840
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rdiscount
49
- requirement: &70233285319800 !ruby/object:Gem::Requirement
49
+ requirement: &70107041165420 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70233285319800
57
+ version_requirements: *70107041165420
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: i18n
60
- requirement: &70233285319380 !ruby/object:Gem::Requirement
60
+ requirement: &70107041165000 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70233285319380
68
+ version_requirements: *70107041165000
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: thor
71
- requirement: &70233285318960 !ruby/object:Gem::Requirement
71
+ requirement: &70107040946860 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70233285318960
79
+ version_requirements: *70107040946860
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: eeepub-with-cover-support
82
- requirement: &70233268785200 !ruby/object:Gem::Requirement
82
+ requirement: &70107040943560 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70233268785200
90
+ version_requirements: *70107040943560
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: notifier
93
- requirement: &70233268782640 !ruby/object:Gem::Requirement
93
+ requirement: &70107040942300 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *70233268782640
101
+ version_requirements: *70107040942300
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rspec
104
- requirement: &70233268781540 !ruby/object:Gem::Requirement
104
+ requirement: &70107040940380 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70233268781540
112
+ version_requirements: *70107040940380
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: test_notifier
115
- requirement: &70233285350100 !ruby/object:Gem::Requirement
115
+ requirement: &70107053171060 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70233285350100
123
+ version_requirements: *70107053171060
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: rake
126
- requirement: &70233285349680 !ruby/object:Gem::Requirement
126
+ requirement: &70107053170640 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *70233285349680
134
+ version_requirements: *70107053170640
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: pry
137
- requirement: &70233285349260 !ruby/object:Gem::Requirement
137
+ requirement: &70107053170220 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ! '>='
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: '0'
143
143
  type: :development
144
144
  prerelease: false
145
- version_requirements: *70233285349260
145
+ version_requirements: *70107053170220
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: pry-nav
148
- requirement: &70233285348840 !ruby/object:Gem::Requirement
148
+ requirement: &70107053169800 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ! '>='
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: '0'
154
154
  type: :development
155
155
  prerelease: false
156
- version_requirements: *70233285348840
156
+ version_requirements: *70107053169800
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: awesome_print
159
- requirement: &70233285348420 !ruby/object:Gem::Requirement
159
+ requirement: &70107053169380 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - ! '>='
@@ -164,7 +164,7 @@ dependencies:
164
164
  version: '0'
165
165
  type: :development
166
166
  prerelease: false
167
- version_requirements: *70233285348420
167
+ version_requirements: *70107053169380
168
168
  description: A framework that generates PDF and e-Pub from Markdown, Textile, and
169
169
  HTML files.
170
170
  email:
@@ -204,17 +204,16 @@ files:
204
204
  - lib/bookshelf/toc/epub.rb
205
205
  - lib/bookshelf/toc/html.rb
206
206
  - lib/bookshelf/version.rb
207
- - templates/Guardfile
207
+ - templates/Gemfile
208
+ - templates/README.md
209
+ - templates/_fonts.scss
208
210
  - templates/config.erb
209
211
  - templates/cover.erb
210
- - templates/cover.png
211
- - templates/ebook.png
212
- - templates/epub.css
213
212
  - templates/epub.erb
213
+ - templates/epub.scss
214
214
  - templates/helper.rb
215
- - templates/layout.css
215
+ - templates/html.scss
216
216
  - templates/layout.erb
217
- - templates/user.css
218
217
  homepage: https://bitbucket.org/bradcrawford/bookshelf
219
218
  licenses:
220
219
  - MIT