softcover 0.8.0 → 0.8.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e55cdffedc838f8932586db5eff983d9a84dd4b
4
- data.tar.gz: fc341b0355f009345ef895b9d57a24ed9a651412
3
+ metadata.gz: 07a415417ed5fad2c917387b14c57e4a9a99a03b
4
+ data.tar.gz: 671345de32f01724b59f3cfe9246f8881f2184bd
5
5
  SHA512:
6
- metadata.gz: 050cf03897d867223e98e3ff8b49b1efffb4984e7241a5bcd73cc53b0171fc50ea5de1ab3481ed546c53054f7a677146201f8a30e62ab69752af13addb846256
7
- data.tar.gz: a81b24fe60937288477896740a7bd5eb11b9dc50aed52728d771bdfedde29d013410fda4944c42784632dd6e13dd45324d1734793721cbea7bfa5f5731ece8be
6
+ metadata.gz: 7b4418ffe0e20d96883813ae2bc618278414ce5147b7d66ee4e5f082ede3b1026e035e619d0c3a44f4f006b35c122782ff566431ab0e98a084f632be8d3ffa59
7
+ data.tar.gz: c1dfb29493b30f039ec968e122c317ed1cd4358bc579b142fa3a9bfe42afb9a2668be66eb782f64c3bdcd0f9195bf30a9ce0c6b9c8a1c6a73bef88659ff628e4
File without changes
File without changes
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ rvm:
2
+ - "2.0.0"
3
+
4
+ before_install:
5
+ - sudo apt-get update -qq
6
+ - sudo apt-get install -qq texlive texlive-xetex texlive-latex-extra
7
+ - sudo apt-get install -qq inkscape
8
+ - sudo python -c "import sys; py3 = sys.version_info[0] > 2; u = __import__('urllib.request' if py3 else 'urllib', fromlist=1); exec(u.urlopen('http://status.calibre-ebook.com/linux_installer').read()); main(install_dir='`echo ~`')"
9
+ - export PATH=$PATH:`echo ~`
10
+ - curl -O -L https://github.com/IDPF/epubcheck/releases/download/v3.0/epubcheck-3.0.zip && unzip epubcheck-3.0.zip -d ~
11
+ - curl -o ~/kindlegen http://softcover-binaries.s3.amazonaws.com/kindlegen && chmod +x ~/kindlegen
data/Gemfile CHANGED
@@ -4,9 +4,9 @@ gemspec
4
4
 
5
5
  group :test do
6
6
  gem 'rspec'
7
- gem 'debugger2'
7
+ gem 'debugger2' unless ENV['CI']
8
8
  gem 'webmock', require: false
9
- gem 'simplecov', require: false
9
+ gem 'coveralls', require: false
10
10
  gem 'rack-test'
11
11
  gem 'ruby-prof'
12
12
  end
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Softcover
2
2
 
3
+ [![Build Status](https://travis-ci.org/softcover/softcover.png?branch=master)](https://travis-ci.org/softcover/softcover) [![Coverage Status](https://coveralls.io/repos/softcover/softcover/badge.png)](https://coveralls.io/r/softcover/softcover)
4
+
3
5
  ## **Note:** Softcover is currently in private beta
4
6
 
5
7
  It is strongly recommended that right now only members of the private beta use the `softcover` gem. Go to [Softcover.io](http://softcover.io/) to request an invitation to the private beta.
@@ -107,7 +107,10 @@ class Softcover::Book
107
107
  prices: prices,
108
108
  faq: faq,
109
109
  testimonials: testimonials,
110
- marketing_content: marketing_content
110
+ marketing_content: marketing_content,
111
+ contact_email: contact_email,
112
+ hide_custom_domain_footer:
113
+ hide_custom_domain_footer
111
114
 
112
115
  if res['errors']
113
116
  @errors = res['errors']
@@ -136,7 +139,10 @@ class Softcover::Book
136
139
  end
137
140
 
138
141
  @uploader.upload!(options)
142
+ notify_upload_complete
143
+ end
139
144
 
145
+ def notify_upload_complete
140
146
  res = @client.notify_upload_complete
141
147
 
142
148
  if res['errors'].nil?
@@ -199,6 +205,7 @@ class Softcover::Book
199
205
  notify_file_upload params['path']
200
206
  end
201
207
  screencast_uploader.upload!
208
+ notify_upload_complete
202
209
  else
203
210
  raise 'server error'
204
211
  end
@@ -206,6 +213,6 @@ class Softcover::Book
206
213
 
207
214
  private
208
215
  def method_missing(name, *args, &block)
209
- @manifest.send(name) || @marketing.send(name) || super
216
+ @manifest.send(name) || @marketing.send(name) || nil
210
217
  end
211
218
  end
@@ -82,6 +82,13 @@ class Softcover::BookManifest < OpenStruct
82
82
  def initialize(options = {})
83
83
  @source = options[:source] || :polytex
84
84
  @origin = options[:origin]
85
+
86
+ if ungenerated_markdown?
87
+ puts "Error: No book to publish"
88
+ puts "Run `softcover build:<format>` for at least one format"
89
+ exit 1
90
+ end
91
+
85
92
  yaml_attrs = read_from_yml
86
93
  attrs = case
87
94
  when polytex? then yaml_attrs
@@ -130,6 +137,13 @@ class Softcover::BookManifest < OpenStruct
130
137
  verify_paths! if options[:verify_paths]
131
138
  end
132
139
 
140
+ # Handles case of Markdown books without running `softcover build`.
141
+ def ungenerated_markdown?
142
+ dir = 'generated_polytex'
143
+ @origin == :markdown && (!File.directory?(dir) ||
144
+ Dir.glob(path("#{dir}/*")).empty?)
145
+ end
146
+
133
147
  # Returns the directory where the LaTeX files are located.
134
148
  # We put them in the a separate directory when using them as an intermediate
135
149
  # format when working with Markdown books. Otherwise, we use the chapters
@@ -20,7 +20,7 @@ module Softcover
20
20
  range = manifest.pdf_preview_page_range.split('..').map(&:to_i)
21
21
  cmd = %(yes | #{ghostscript} -dBATCH -sOutputFile="#{output}")
22
22
  cmd += %( -dFirstPage=#{range.first} -dLastPage=#{range.last})
23
- cmd += %( -sDEVICE=pdfwrite "#{input}" >& /dev/null)
23
+ cmd += %( -sDEVICE=pdfwrite "#{input}" > /dev/null)
24
24
  execute cmd
25
25
  end
26
26
 
@@ -69,3 +69,6 @@ testimonials:
69
69
  text: "Testimonial 2 text"
70
70
 
71
71
  marketing_content: ''
72
+
73
+ contact_email: ''
74
+ hide_custom_domain_footer: false
@@ -72,7 +72,7 @@ module Softcover
72
72
  else
73
73
  puts "Nothing to upload." unless options[:silent]
74
74
  end
75
-
75
+ @params.size > 0
76
76
  end
77
77
 
78
78
  def total_size
@@ -1,3 +1,3 @@
1
1
  module Softcover
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  end
data/spec/cli_spec.rb CHANGED
@@ -42,7 +42,7 @@ describe Softcover::CLI do
42
42
  before(:all) { chdir_to_fixtures }
43
43
  after(:all) { remove_book }
44
44
  it "should not raise error" do
45
- result = `softcover new book 2>&1`
45
+ result = `softcover new book &> /dev/null`
46
46
  expect($?.exitstatus).to eq 0
47
47
  end
48
48
  end
data/spec/spec_helper.rb CHANGED
@@ -1,12 +1,13 @@
1
+ require 'coveralls'
2
+ Coveralls::Output.silent = !ENV['CI']
3
+ Coveralls.wear!
4
+
1
5
  require 'rubygems'
2
6
  require 'bundler/setup'
3
7
  require 'webmock/rspec'
4
8
  require 'webmock_helpers'
5
9
  require 'ostruct'
6
10
 
7
- # require 'simplecov'
8
- # SimpleCov.start
9
-
10
11
  require 'json'
11
12
  require 'softcover'
12
13
  require 'softcover/utils'
@@ -63,7 +63,9 @@ module WebmockHelpers
63
63
  prices: book.prices,
64
64
  faq: book.faq,
65
65
  testimonials: book.testimonials,
66
- marketing_content: ''
66
+ marketing_content: '',
67
+ contact_email: book.contact_email,
68
+ hide_custom_domain_footer: book.hide_custom_domain_footer
67
69
  }.to_json,
68
70
  :headers => headers).
69
71
  to_return(:status => 200, :body => return_body, :headers => {})
@@ -108,6 +110,7 @@ module WebmockHelpers
108
110
 
109
111
  def stub_screencasts_upload(book)
110
112
  stub_s3_post
113
+ stub_create_book(book)
111
114
 
112
115
  files = book.find_screencasts
113
116
  stub_request(:post,
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.8.0
4
+ version: 0.8.1
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: 2013-12-31 00:00:00.000000000 Z
12
+ date: 2014-01-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: polytexnic
@@ -380,7 +380,10 @@ files:
380
380
  - .pull_requests/1387944330
381
381
  - .pull_requests/1388094706
382
382
  - .pull_requests/1388441218
383
+ - .pull_requests/1388518194
384
+ - .pull_requests/1388713504
383
385
  - .rspec
386
+ - .travis.yml
384
387
  - Gemfile
385
388
  - LICENSE.txt
386
389
  - README.md
@@ -987,6 +990,7 @@ files:
987
990
  - lib/softcover/template/images/cover.pdf
988
991
  - lib/softcover/template/images/cover.png
989
992
  - lib/softcover/template/images/figures/.gitkeep
993
+ - lib/softcover/template/images/testimonial_1.png
990
994
  - lib/softcover/template/latex_styles/custom.sty
991
995
  - lib/softcover/template/latex_styles/framed.sty
992
996
  - lib/softcover/template/latex_styles/softcover.sty