keybase-unofficial-local 0.3.0 → 0.4.0

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: f3a1adda41e99d65322a01fe1743e53372a89a9c
4
- data.tar.gz: d03dab857b300bb9066ec45da73922a69f45d150
3
+ metadata.gz: 05d2db9b79b7345a485cfb6bea7909e7fde2e465
4
+ data.tar.gz: '08319c5cad2c89da0a2903aa72cfd21b2ecbfba2'
5
5
  SHA512:
6
- metadata.gz: '09e28fb48d0732a42e856cbf93a79cccdefc3f9e1040ff347c157631a8f8367709b819412a71242f0272ee2f4f40ebad232e25a2bbb139d757957e59b25093bf'
7
- data.tar.gz: 85b46b56b645ca98bb6740c8a4b51ed42e203bee91539277bd92b404847874915654ec410919a9ba224f7f7d9511e0c8b46191793ca53b0e68fa9679de9cd7db
6
+ metadata.gz: 3fba3cb63b897b8f213a1a1a26ec48b4fbbf58ecba79c72a7e6d0c3e0e7d38959a9df8b62e3c27af2c1c76015e01c8f6ab349e60c81f2f8906fe9e93c1b84feb
7
+ data.tar.gz: e5a7b079d0f69866eeb0c7f15a0442fb0797020dc80c4cb99210a178d683b1e715b72d6de29099dee182671c4e94134b218c254d94074fd15d6c9624c4030e6f
data/lib/keybase/local.rb CHANGED
@@ -14,7 +14,7 @@ module Keybase
14
14
  # The namespace for `keybase-unofficial-local`.
15
15
  module Local
16
16
  # The current version of `keybase-unofficial-local`.
17
- VERSION = "0.3.0"
17
+ VERSION = "0.4.0"
18
18
 
19
19
  extend Config
20
20
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "json"
4
4
  require "ostruct"
5
+ require "sys/filesystem"
5
6
 
6
7
  module Keybase
7
8
  module Local
@@ -29,20 +30,25 @@ module Keybase
29
30
  end
30
31
 
31
32
  # @return [Boolean] whether or not KBFS is currently mounted
32
- # @note The criteria for being mounted is as follows:
33
+ # @note {mounted?} does *not* mean that KBFS is fully functional. For that, see
34
+ # {functional?}
35
+ def mounted?
36
+ Sys::Filesystem.mounts.any? { |m| m.mount_point == Config::KBFS_MOUNT }
37
+ end
38
+
39
+ # @return [Boolean] whether or not KBFS is currently fully functional
40
+ # @note The criteria for being "functional" is as follows:
33
41
  # 1. Keybase is running
34
42
  # 2. KBFS is running
35
- # 3. {KBFS_STATUS_FILE} exists
36
- def mounted?
37
- return false unless Local.running?
38
- return false unless running?
39
- File.exist? KBFS_STATUS_FILE
43
+ # 3. {KBFS_MOUNT} is mounted
44
+ def functional?
45
+ Local.running? && running? && mounted?
40
46
  end
41
47
 
42
48
  # @return [OpenStruct] a struct mapping of the contents of {KBFS_STATUS_FILE}
43
- # @raise [Exceptions::KBFSNotRunningError] if KBFS is not mounted
49
+ # @raise [Exceptions::KBFSNotRunningError] if KBFS is not functional
44
50
  def status
45
- raise Exceptions::KBFSNotRunningError unless mounted?
51
+ raise Exceptions::KBFSNotRunningError unless functional?
46
52
  JSON.parse File.read(KBFS_STATUS_FILE), object_class: OpenStruct
47
53
  end
48
54
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keybase-unofficial-local
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Woodruff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-06 00:00:00.000000000 Z
11
+ date: 2017-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: keybase-unofficial-core
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sys-filesystem
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
27
41
  description: |
28
42
  This library provides access to Keybase's desktop utility from
29
43
  Ruby.