softcover 0.7.8 → 0.7.9
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 +4 -4
- data/lib/softcover/book.rb +13 -2
- data/lib/softcover/cli.rb +1 -1
- data/lib/softcover/utils.rb +10 -0
- data/lib/softcover/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1a941ddd4f07b9899d6049e70e8d710187fef24
|
4
|
+
data.tar.gz: cfd13be2f490c712552719dc0fb079dbdbc26428
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 502eb6fbeba31f5bc62ea0be588e300e2ecc3b8bb8cf3171611ac8669be39104febccbe95f26151623372ac988f80afe586ccccba49490289fa675fdc874d63a
|
7
|
+
data.tar.gz: 2aa4cd5dffc08d7ff05156eec2ed7f1f096a9f66e37615e10132472c716fd89237144ba0af45bbec407ff8e38a3b28bfe7a8654a5ff86d95ef7d9544944e6845
|
data/lib/softcover/book.rb
CHANGED
@@ -76,9 +76,20 @@ class Softcover::Book
|
|
76
76
|
"#{@client.host}/books/#{id}/redirect"
|
77
77
|
end
|
78
78
|
|
79
|
-
# Opens the book in the browser (OS X
|
79
|
+
# Opens the book in the browser (OS X & Linux).
|
80
80
|
def open_in_browser
|
81
|
-
|
81
|
+
`#{open} #{url}`
|
82
|
+
end
|
83
|
+
|
84
|
+
# Returns the system-dependent `open` command.
|
85
|
+
def open
|
86
|
+
if os_x?
|
87
|
+
'open'
|
88
|
+
elsif linux?
|
89
|
+
'xdg-open'
|
90
|
+
else
|
91
|
+
raise "Platform #{RUBY_PLATFORM} not supported"
|
92
|
+
end
|
82
93
|
end
|
83
94
|
|
84
95
|
def create_or_update
|
data/lib/softcover/cli.rb
CHANGED
data/lib/softcover/utils.rb
CHANGED
@@ -203,5 +203,15 @@ module Softcover::Utils
|
|
203
203
|
yield
|
204
204
|
end
|
205
205
|
end
|
206
|
+
|
207
|
+
# Returns true if platform is OS X.
|
208
|
+
def os_x?
|
209
|
+
RUBY_PLATFORM.match(/darwin/)
|
210
|
+
end
|
211
|
+
|
212
|
+
# Returns true if platform is Linux.
|
213
|
+
def linux?
|
214
|
+
RUBY_PLATFORM.match(/linux/)
|
215
|
+
end
|
206
216
|
end
|
207
217
|
|
data/lib/softcover/version.rb
CHANGED
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.7.
|
4
|
+
version: 0.7.9
|
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-
|
12
|
+
date: 2013-12-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: polytexnic
|