biff 0.3.0 → 0.4.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 +4 -4
- data/README.md +7 -3
- data/VERSION +1 -1
- data/lib/biff.rb +25 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2baea458f955162e0a3a6bc431cbdc6911d8f049
|
4
|
+
data.tar.gz: 7de399206437a9b1ee3aa78c5a413400b8642daf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4ea12c2f02fccede0695d88fa9c65dd12bcec1934c3c33671e0ebe8d03a920435ec8b04570cc6af6c8cd07c87013fd0b613c0dd2baef2d6a71228a82f59b298
|
7
|
+
data.tar.gz: be6a0c1408e071dbd1957a3f8eb586bf3e733b7fcd3cb780722d5a8da2747b390ae6148c96dd45fdcc19811b7eacc7ae6a2d1770ae4eda46d524aea6732caeb4
|
data/README.md
CHANGED
@@ -14,14 +14,18 @@ The gem provides two command-line scripts, `biffer` (to avoid conflict w/ system
|
|
14
14
|
|
15
15
|
`biff.5m.rb` is a [BitBar](https://getbitbar.com) script, which will run every 5 minutes to update the menubar entry.
|
16
16
|
|
17
|
-
Both scripts use (by default) the configuration in ~/.biff.yaml, which should be in the following format, multiple top-level keys (servers) are allowed. Note that one of
|
17
|
+
Both scripts use (by default) the configuration in ~/.biff.yaml, which should be in the following format, multiple top-level keys (servers) are allowed. Note that one of `password`, `passcmd`, `token` or `tokencmd` is required.
|
18
|
+
|
19
|
+
`token` and `tokencmd` are used for gmail oauth2 authentication, and will generate a runtime error if the [gmail_xoauth](https://github.com/nfo/gmail_xoauth) gem is not installed. See the [gmail_xoauth](https://github.com/nfo/gmail_xoauth) homepage for info on how to generate an oauth2 token.
|
18
20
|
|
19
21
|
```yaml
|
20
22
|
Name:
|
21
|
-
host: required.host.
|
22
|
-
|
23
|
+
host: required.host.user
|
24
|
+
addressmak: required_user_name
|
23
25
|
password: optional_password
|
24
26
|
passcmd: shell_command_if_password_not_specified
|
27
|
+
token: gmail_app_oauth2_token
|
28
|
+
tokencmd: shell_command_for_gmail_token
|
25
29
|
run: optional_command_to_run_after_inbox_changes
|
26
30
|
cmd: optional_email_command_for_bitbar_menu_hot_link
|
27
31
|
debug: optional_set_net_imap_debug
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/lib/biff.rb
CHANGED
@@ -19,10 +19,7 @@ class Biff
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def open
|
22
|
-
|
23
|
-
log('login', @config['user'])
|
24
|
-
|
25
|
-
@imap.login(@config['user'], pass)
|
22
|
+
authenticate || login
|
26
23
|
@imap.examine('INBOX')
|
27
24
|
end
|
28
25
|
|
@@ -107,6 +104,30 @@ class Biff
|
|
107
104
|
end
|
108
105
|
|
109
106
|
private
|
107
|
+
# gmail oauth
|
108
|
+
def authenticate
|
109
|
+
return false unless @config['token'] || @config['tokencmd']
|
110
|
+
|
111
|
+
begin
|
112
|
+
require 'gmail_xoauth'
|
113
|
+
rescue Error => e
|
114
|
+
log('Is gmail_xoauth installed?')
|
115
|
+
raise e
|
116
|
+
end
|
117
|
+
|
118
|
+
token = @config['token'] || `#{@config['tokencmd']}`.chomp
|
119
|
+
|
120
|
+
@imap.authenticate('XOAUTH2', @config['user'], token)
|
121
|
+
end
|
122
|
+
|
123
|
+
# password login
|
124
|
+
def login
|
125
|
+
pass = @config['password'] || `#{@config['passcmd']}`.chomp
|
126
|
+
log('login', @config['user'])
|
127
|
+
|
128
|
+
@imap.login(@config['user'], pass)
|
129
|
+
end
|
130
|
+
|
110
131
|
def log(*args)
|
111
132
|
return unless @config['verbose']
|
112
133
|
$stderr.puts(['INFO', *args].join(' '))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: biff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rick Frankel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: version
|