gmail_todo 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/todo +3 -2
- data/lib/gmail_todo.rb +32 -15
- metadata +31 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f59cba90f14340495f4b198c0cdfad6d8b152be
|
4
|
+
data.tar.gz: f9f85acfee10a1d8c13aa4342728713b0ce6bb57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16ca7a24ce3043d751dd10ab94a7b7ddf855bd7c1171305275c058f25e63dc28e701d69836777d3893d81eb0e4aa4eec24b5c8b62df602356f415806fdbe0e32
|
7
|
+
data.tar.gz: 65909e8148094b1c3a54bd611c4812ad09c416f5d6f661b391f2738a7293b9206750e4136dd01695008b3b12b47006593afcbc07cb06440e22501c064fa2793f
|
data/bin/todo
CHANGED
data/lib/gmail_todo.rb
CHANGED
@@ -2,25 +2,20 @@ require 'gmail'
|
|
2
2
|
|
3
3
|
class GmailToDo
|
4
4
|
|
5
|
-
|
6
|
-
DEFAULT_CREDENTIALS = File.dirname(__FILE__) + '/credentials.yml' unless defined?(DEFAULT_CREDENTIALS)
|
5
|
+
CREDENTIALS = ENV['HOME'] + '/.gmail_todo_credentials.yml'
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
credentials = YAML.load(File.read(file))
|
11
|
-
@username = credentials["gmail"]["username"]
|
12
|
-
@password = credentials["gmail"]["password"]
|
13
|
-
end
|
7
|
+
attr_reader :username
|
8
|
+
attr_reader :password
|
14
9
|
|
15
|
-
def
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
10
|
+
def initialize
|
11
|
+
if File.exists?(CREDENTIALS)
|
12
|
+
load_credentials
|
13
|
+
else
|
14
|
+
prompt_for_credentials
|
15
|
+
end
|
21
16
|
end
|
22
17
|
|
23
|
-
def
|
18
|
+
def send(todo, details = nil)
|
24
19
|
gmail = Gmail.connect(username, password)
|
25
20
|
|
26
21
|
gmail.deliver do
|
@@ -32,4 +27,26 @@ class GmailToDo
|
|
32
27
|
gmail.logout
|
33
28
|
end
|
34
29
|
|
30
|
+
private
|
31
|
+
|
32
|
+
def load_credentials
|
33
|
+
credentials = YAML.load(File.read(CREDENTIALS))
|
34
|
+
@username = credentials["gmail"]["username"]
|
35
|
+
@password = credentials["gmail"]["password"]
|
36
|
+
end
|
37
|
+
|
38
|
+
def prompt_for_credentials
|
39
|
+
puts "Enter your gmail username: "
|
40
|
+
@username = $stdin.gets.chomp
|
41
|
+
puts "Enter your gmail password or token: "
|
42
|
+
@password = $stdin.gets.chomp
|
43
|
+
|
44
|
+
save_credentials
|
45
|
+
end
|
46
|
+
|
47
|
+
def save_credentials
|
48
|
+
credentials = {gmail: {username: username, password: password}}
|
49
|
+
File.open(CREDENTIALS, 'w') {|f| f.write credentials.to_yaml }
|
50
|
+
end
|
51
|
+
|
35
52
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmail_todo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Hughes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2015-02-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: gmail
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
description: Do you use your inbox as a todo list? Quickly fire yourself a todo from
|
14
28
|
your terminal!
|
15
29
|
email: kevinhughes27@gmail.com
|
@@ -20,22 +34,32 @@ extra_rdoc_files: []
|
|
20
34
|
files:
|
21
35
|
- bin/todo
|
22
36
|
- lib/gmail_todo.rb
|
23
|
-
homepage: https://github.com/
|
37
|
+
homepage: https://github.com/kevinhughes27/gmail_todo
|
24
38
|
licenses:
|
25
39
|
- MIT
|
26
40
|
metadata: {}
|
27
|
-
post_install_message:
|
41
|
+
post_install_message: |2+
|
42
|
+
|
43
|
+
Thanks for installing gmail_todo!
|
44
|
+
|
45
|
+
To get started run `todo` from the console. If you haven't
|
46
|
+
entered credentials yet then you will get a prompt. If you
|
47
|
+
have 2 factor auth turned on for your gmail account (which
|
48
|
+
you should) then you'll need an app token. You can get a
|
49
|
+
token by going to `account -> security -> app passwords` of
|
50
|
+
your gmail account.
|
51
|
+
|
28
52
|
rdoc_options: []
|
29
53
|
require_paths:
|
30
54
|
- lib
|
31
55
|
required_ruby_version: !ruby/object:Gem::Requirement
|
32
56
|
requirements:
|
33
|
-
- -
|
57
|
+
- - ">="
|
34
58
|
- !ruby/object:Gem::Version
|
35
59
|
version: '0'
|
36
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
61
|
requirements:
|
38
|
-
- -
|
62
|
+
- - ">="
|
39
63
|
- !ruby/object:Gem::Version
|
40
64
|
version: '0'
|
41
65
|
requirements: []
|