keybase-unofficial-local 0.4.1 → 0.5.0

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
- SHA1:
3
- metadata.gz: 0bcea24efe63f5ce6ba9810ce7294e4d3dff7137
4
- data.tar.gz: be13fd2c83003e97dd6f13c9b6a17f63ae5fb070
2
+ SHA256:
3
+ metadata.gz: 0f96382e1488aab10aa81e120f34b4255a80ba52a2519c9d58c93bbd3b309005
4
+ data.tar.gz: 8eff2d67f846bdffd8fb00738b1eb204a53b29df4528aa4a567c0cba1eae7b80
5
5
  SHA512:
6
- metadata.gz: 78627dd0167d47a50bedd72a91da3fd8b0c568ad934922c2a47358cd3a8981f95e859491ec2078c32d0244527a8a19d06dc819108e0827594b93c810be52573d
7
- data.tar.gz: 97b48fdedd38efbf853e76001951723423ff75dd8284f5fc870f79422a3f0138318c880a1d49fbe1e4070100685db48fae244a45353e38f6daf81fad7de66cdd
6
+ metadata.gz: 851edd734995c6342b1538d8e4ad9ae62f197ade1bd35e347347823cc49c24e52a5a0ae80e0c469998ec39f64ef4631a733ba158ef9508bdcab7ae7326f2832b
7
+ data.tar.gz: 1f4d7675738ef56c7269f0013e91c564be4f75d924d9f822347428e119d5f9c37441799dc9090614f84f00594daa9dbb56729663c093e1723f93630a27852509
data/lib/keybase/local.rb CHANGED
@@ -14,8 +14,14 @@ 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.4.1"
17
+ VERSION = "0.5.0"
18
18
 
19
19
  extend Config
20
+
21
+ # there's not much this library can do without keybase actually running
22
+ raise Exceptions::KeybaseNotRunningError unless running?
23
+
24
+ # ...or without a logged-in user
25
+ raise Exceptions::KeybaseNotLoggedInError unless logged_in?
20
26
  end
21
27
  end
@@ -16,26 +16,18 @@ module Keybase
16
16
  end
17
17
 
18
18
  # The Keybase configuration file.
19
+ # @note This is not guaranteed to exist on disk.
19
20
  CONFIG_FILE = File.join(CONFIG_DIR, "config.json").freeze
20
21
 
21
- # there's not much this library can do without a local config
22
- raise Exceptions::KeybaseNotInstalledError unless File.file?(CONFIG_FILE)
23
-
24
- # The hash from Keybase's configuration file.
25
- CONFIG_HASH = JSON.parse(File.read(CONFIG_FILE)).freeze
22
+ # The Keybase status hash, obtained from `keybase status -j`.
23
+ STATUS_HASH = JSON.parse(`keybase status -j`)
26
24
 
27
25
  # The mountpoint for KBFS.
28
26
  KBFS_MOUNT = File.realpath "/keybase"
29
27
 
30
28
  # @return [String] the currently logged-in user
31
29
  def current_user
32
- CONFIG_HASH["current_user"]
33
- end
34
-
35
- # @return [Array<Keybase::Local::User>] a list of all local users known
36
- # to Keybase
37
- def local_users
38
- CONFIG_HASH["users"].map { |_, v| User.new(v) }
30
+ STATUS_HASH["Username"]
39
31
  end
40
32
 
41
33
  # @return [String] the user's private KBFS directory
@@ -62,6 +54,10 @@ module Keybase
62
54
  end
63
55
  end
64
56
 
57
+ def logged_in?
58
+ STATUS_HASH["LoggedIn"]
59
+ end
60
+
65
61
  # @return [String] the running Keybase's version string
66
62
  # @raise [Exceptions::KeybaseNotRunningError] if Keybase is not running
67
63
  def running_version
@@ -4,17 +4,17 @@ module Keybase
4
4
  module Local
5
5
  # A namespace for all exceptions defined by {Keybase::Local}.
6
6
  module Exceptions
7
- # Raised if a Keybase installation can't be found.
8
- class KeybaseNotInstalledError < Core::Exceptions::KeybaseError
7
+ # Raised whenever Keybase is not running locally.
8
+ class KeybaseNotRunningError < Core::Exceptions::KeybaseError
9
9
  def initialize
10
- super "keybase needs to be installed"
10
+ super "keybase needs to be running"
11
11
  end
12
12
  end
13
13
 
14
- # Raised whenever Keybase is not running locally.
15
- class KeybaseNotRunningError < Core::Exceptions::KeybaseError
14
+ # Raised whenever Keybase is running *without* a logged-in user.
15
+ class KeybaseNotLoggedInError < Core::Exceptions::KeybaseError
16
16
  def initialize
17
- super "keybase needs to be running"
17
+ super "a user needs to be logged in"
18
18
  end
19
19
  end
20
20
 
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.4.1
4
+ version: 0.5.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: 2018-01-27 00:00:00.000000000 Z
11
+ date: 2018-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: keybase-unofficial-core
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  version: '0'
77
77
  requirements: []
78
78
  rubyforge_project:
79
- rubygems_version: 2.6.13
79
+ rubygems_version: 2.7.6
80
80
  signing_key:
81
81
  specification_version: 4
82
82
  summary: keybase-unofficial-local - Unofficial library for Keybase clients