softcover 0.7.8 → 0.7.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ac882b2914162f9a8c264a62c89f4661aa3d28b
4
- data.tar.gz: 1994a8923b0a0ff81a6c4f054acb33034f7f70bf
3
+ metadata.gz: e1a941ddd4f07b9899d6049e70e8d710187fef24
4
+ data.tar.gz: cfd13be2f490c712552719dc0fb079dbdbc26428
5
5
  SHA512:
6
- metadata.gz: bd83ba2b4532fece145199e30a7519082feb5ea7a934a96b10495abfe8dc58bc0063479eb91cdf570f684b063e3ad1ad221981167ce38becb5c8ca6e5252ae92
7
- data.tar.gz: de30c639e335598ad200a8a36f95e7304446e68be3f26e3284da6957cf06cab8f919f36f1f3d0fcf97f4d41aa7255aeb44496fa5c1b4e12a9579e16ef5bab2d0
6
+ metadata.gz: 502eb6fbeba31f5bc62ea0be588e300e2ecc3b8bb8cf3171611ac8669be39104febccbe95f26151623372ac988f80afe586ccccba49490289fa675fdc874d63a
7
+ data.tar.gz: 2aa4cd5dffc08d7ff05156eec2ed7f1f096a9f66e37615e10132472c716fd89237144ba0af45bbec407ff8e38a3b28bfe7a8654a5ff86d95ef7d9544944e6845
@@ -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 only).
79
+ # Opens the book in the browser (OS X & Linux).
80
80
  def open_in_browser
81
- `open #{url}`
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
@@ -178,7 +178,7 @@ module Softcover
178
178
  # Open
179
179
  # ===============================================
180
180
 
181
- desc "open", "Open book on Softcover website (OS X)"
181
+ desc "open", "Open book on Softcover website"
182
182
  def open
183
183
  Softcover::Commands::Opener.open!
184
184
  end
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module Softcover
2
- VERSION = "0.7.8"
2
+ VERSION = "0.7.9"
3
3
  end
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.8
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-11 00:00:00.000000000 Z
12
+ date: 2013-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: polytexnic