keybase-unofficial-local 0.0.6 → 0.1.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: b2bcfd5336f871c3720df6c66f35da0adfb34be7
4
- data.tar.gz: 97407963db949092e2b9a89da88dfd255df51369
3
+ metadata.gz: 5555fb9991555773e853cc654333e6ae2d673ac3
4
+ data.tar.gz: 160f3018590b1925ea7e5cc0498588116c49a036
5
5
  SHA512:
6
- metadata.gz: 4edaba39e20464dbfa9411cc840153e4edbaab5438de8e8e4475e552f7a0d0ded1f490003976ae258c85cc267bc6bbee6ff4f3e761cba15891b09b066b4a847b
7
- data.tar.gz: ab33532407096daac6d9595ff3dee3432e31d7ad9909351c8c22950aa8dc6161e56da7b388577d2d31b178b840212da39499c559a9f10572ae75b8da7e842314
6
+ metadata.gz: 73f0c186ddfe2d3d34e055d0c6dd8f2c782521e68ae5b1484664b8189c56268ea4b94808d39ec1973876fed7604fdb786c48ce16db058c2021fc3fc487dca42c
7
+ data.tar.gz: 7f9ab2d86d5262b189d660baaf818cd29ce425994a668e7f6a93e19a6342d4eb3f8f5d9487590e4e20c990b83e82efbc57b27e3319454f345c531698962addb7
@@ -1,11 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "json"
4
+ require "ostruct"
5
+
3
6
  module Keybase
4
7
  module Local
5
8
  # Represents an interface to KBFS.
6
- # @note This is a stub.
7
9
  module KBFS
8
- # stub
10
+ # The path to a hidden status file on KBFS.
11
+ # @note The presence of this file is used to determine whether or not the mountpoint
12
+ # is actually KBFS or just a directory (since an accidental directory at the mountpoint
13
+ # is unlikely to contain this file).
14
+ KBFS_STATUS_FILE = File.join Config::KBFS_MOUNT, ".kbfs_status"
15
+
16
+ class << self
17
+ # @return [Boolean] whether KBFS is currently mounted
18
+ def mounted?
19
+ File.exist? KBFS_STATUS_FILE
20
+ end
21
+
22
+ # @return [OpenStruct] a struct mapping of the contents of {KBFS_STATUS_FILE}
23
+ # @raise [Exceptions::KBFSNotRunningError] if KBFS is not mounted
24
+ def status
25
+ raise Exceptions::KBFSNotRunningError unless mounted?
26
+ JSON.parse File.read(KBFS_STATUS_FILE), object_class: OpenStruct
27
+ end
28
+ end
9
29
  end
10
30
  end
11
31
  end
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.0.6"
17
+ VERSION = "0.1.0"
18
18
 
19
19
  extend Config
20
20
  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.0.6
4
+ version: 0.1.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-10-10 00:00:00.000000000 Z
11
+ date: 2017-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: keybase-unofficial-core