softcover 0.9.12 → 0.9.13

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.
@@ -1,3 +1,3 @@
1
1
  module Softcover
2
- VERSION = "0.9.12"
2
+ VERSION = "0.9.13"
3
3
  end
data/softcover.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
19
  gem.require_paths = ["lib"]
20
20
 
21
- gem.add_dependency 'polytexnic', '~> 0.9.3'
21
+ gem.add_dependency 'polytexnic', '~> 0.9.6'
22
22
  gem.add_dependency 'msgpack', '~> 0.4.2'
23
23
  gem.add_dependency 'nokogiri', '~> 1.6.0'
24
24
  gem.add_dependency 'thor', '~> 0.18.1'
data/spec/book_spec.rb CHANGED
@@ -11,10 +11,9 @@ describe Softcover::Book do
11
11
 
12
12
  its(:filenames) { should include "html/chapter-1_fragment.html"}
13
13
  its(:filenames) { should_not include "html/chapter-1.html"}
14
+ its(:filenames) { should include "html/#{subject.slug}.html"}
14
15
 
15
- # its(:filenames) { should include "ebooks/test-book.mobi"}
16
- # its(:filenames) { should include "ebooks/test-book.epub"}
17
- # its(:filenames) { should include "ebooks/test-book.pdf"}
16
+ its(:filenames) { should include "config/marketing.yml"}
18
17
 
19
18
  its(:slug) { should eq "book" }
20
19
  its(:url) { should match /\/books\/(.*?)\/redirect/ }
@@ -81,6 +81,11 @@ describe Softcover::Builders::Epub do
81
81
  uuid = Regexp.escape(builder.manifest.uuid)
82
82
  expect(doc.to_xml).to match(/#{uuid}</)
83
83
  end
84
+
85
+ it "should have the right conver meta tag" do
86
+ meta = '<meta name="cover" content="cover-image"/>'
87
+ expect(doc.to_xml).to include meta
88
+ end
84
89
  end
85
90
 
86
91
  context "stylesheets directory" do
@@ -152,6 +157,13 @@ describe Softcover::Builders::Epub do
152
157
  expect(has_math).to be_true
153
158
  end
154
159
 
160
+ describe "cover file" do
161
+ subject(:cover_file) { File.read(path('epub/OEBPS/cover.html')) }
162
+ it "should have the right cover image" do
163
+ expect(cover_file).to include 'cover.jpg'
164
+ end
165
+ end
166
+
155
167
  it "should create math PNGs" do
156
168
  expect(path("epub/OEBPS/images/texmath")).to exist
157
169
  expect(Dir[path("epub/OEBPS/images/texmath/*.png")]).not_to be_empty
@@ -25,8 +25,11 @@ describe Softcover::Builders::Html do
25
25
  let(:output) { File.read("html/book.html") }
26
26
  subject { output }
27
27
 
28
- it { should match('<!DOCTYPE html>') }
29
- it { should match('pygments.css') }
28
+ it { should include '<!DOCTYPE html>' }
29
+ it { should include 'pygments.css' }
30
+ it { should include 'MathJax' }
31
+ it { should_not include 'functionNumber'}
32
+
30
33
  context "HTML document" do
31
34
  subject(:doc) { Nokogiri::HTML(output) }
32
35
 
@@ -98,9 +101,10 @@ describe Softcover::Builders::Html do
98
101
  let(:output) { File.read(path('html/a_chapter.html')) }
99
102
  subject { output }
100
103
 
101
- it { should match 'MathJax.Hub.Config' }
102
- it { should match 'TeX-AMS-MML_SVG' }
103
- it { should match 'A chapter' }
104
+ it { should include 'MathJax.Hub.Config' }
105
+ it { should include 'TeX-AMS-MML_SVG' }
106
+ it { should include 'formatNumber: function (n)' }
107
+ it { should include 'A chapter' }
104
108
  end
105
109
  end
106
110
  end
@@ -76,7 +76,7 @@ describe Softcover::Commands::Generator do
76
76
  it { should match(/html\//) }
77
77
  it { should match(/epub\//) }
78
78
  it { should match(/ebooks\//) }
79
- it { should match(/screencasts\//) }
79
+ it { should match(/media\//) }
80
80
  it { should match(/log\//) }
81
81
  it { should match(/\.DS_Store/) }
82
82
  end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe Softcover::Config do
4
+ before do
5
+ chdir_to_book
6
+ end
7
+
8
+ describe "path" do
9
+ context "local path override" do
10
+ before do
11
+ `touch .softcover`
12
+ end
13
+
14
+ it "uses local path" do
15
+ expect(Softcover::Config.path).to eq ".softcover"
16
+ end
17
+
18
+ after do
19
+ `rm .softcover`
20
+ end
21
+ end
22
+
23
+ context "system path" do
24
+ it "uses home dir" do
25
+ expect(Softcover::Config.path).to eq "~/.softcover"
26
+ end
27
+ end
28
+ end
29
+
30
+ end
@@ -186,6 +186,7 @@ module WebmockHelpers
186
186
  File.write(File.join('html', 'chapter-1.html'), 'test')
187
187
  File.write(File.join('html', 'chapter-1_fragment.html'), 'test')
188
188
  File.write(File.join('html', 'test_fragment.html'), 'test')
189
+ File.write(File.join('html', "#{name}.html"), 'test')
189
190
  File.mkdir 'ebooks' unless File.exist?('ebooks')
190
191
  Softcover::FORMATS.each do |format|
191
192
  dir = format == 'html' ? 'html' : 'ebooks'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: softcover
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.12
4
+ version: 0.9.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hartl
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-26 00:00:00.000000000 Z
12
+ date: 2014-05-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: polytexnic
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ~>
19
19
  - !ruby/object:Gem::Version
20
- version: 0.9.3
20
+ version: 0.9.6
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ~>
26
26
  - !ruby/object:Gem::Version
27
- version: 0.9.3
27
+ version: 0.9.6
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: msgpack
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -993,6 +993,7 @@ files:
993
993
  - lib/softcover/template/images/.gitkeep
994
994
  - lib/softcover/template/images/2011_michael_hartl.png
995
995
  - lib/softcover/template/images/cover-web.png
996
+ - lib/softcover/template/images/cover.jpg
996
997
  - lib/softcover/template/images/cover.pdf
997
998
  - lib/softcover/template/images/cover.png
998
999
  - lib/softcover/template/images/figures/.gitkeep
@@ -1026,6 +1027,7 @@ files:
1026
1027
  - spec/commands/opener_spec.rb
1027
1028
  - spec/commands/publisher_spec.rb
1028
1029
  - spec/commands/server_spec.rb
1030
+ - spec/config_spec.rb
1029
1031
  - spec/fixtures/.gitkeep
1030
1032
  - spec/mathjax_spec.rb
1031
1033
  - spec/output_spec.rb
@@ -1078,6 +1080,7 @@ test_files:
1078
1080
  - spec/commands/opener_spec.rb
1079
1081
  - spec/commands/publisher_spec.rb
1080
1082
  - spec/commands/server_spec.rb
1083
+ - spec/config_spec.rb
1081
1084
  - spec/fixtures/.gitkeep
1082
1085
  - spec/mathjax_spec.rb
1083
1086
  - spec/output_spec.rb