keybase-unofficial-local 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/keybase/local.rb +7 -1
- data/lib/keybase/local/config.rb +8 -12
- data/lib/keybase/local/exceptions.rb +6 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0f96382e1488aab10aa81e120f34b4255a80ba52a2519c9d58c93bbd3b309005
|
4
|
+
data.tar.gz: 8eff2d67f846bdffd8fb00738b1eb204a53b29df4528aa4a567c0cba1eae7b80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
data/lib/keybase/local/config.rb
CHANGED
@@ -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
|
-
#
|
22
|
-
|
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
|
-
|
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
|
8
|
-
class
|
7
|
+
# Raised whenever Keybase is not running locally.
|
8
|
+
class KeybaseNotRunningError < Core::Exceptions::KeybaseError
|
9
9
|
def initialize
|
10
|
-
super "keybase needs to be
|
10
|
+
super "keybase needs to be running"
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
# Raised whenever Keybase is
|
15
|
-
class
|
14
|
+
# Raised whenever Keybase is running *without* a logged-in user.
|
15
|
+
class KeybaseNotLoggedInError < Core::Exceptions::KeybaseError
|
16
16
|
def initialize
|
17
|
-
super "
|
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
|
+
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-
|
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
|
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
|