tsks 0.0.5 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +2 -4
- data/lib/tsks/actions.rb +12 -0
- data/lib/tsks/cli.rb +10 -9
- data/lib/tsks/storage.rb +14 -14
- data/lib/tsks/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc64bfc231b5bdddc48e461c610e21564cb6e84cacf98ec865669c9f9326aa4d
|
4
|
+
data.tar.gz: bdf3d97cb380ebd6e014b99a86557af4db94716339a2c6d7fc7ef40f664aa652
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0301898a19b38ca228ced6c841cefbc24a8ce595ccaa54ee8a9b5c616f27e278e5c592e37cde8498927b5fad1664a15d23dca9d0f14985bb3703129b3b661430'
|
7
|
+
data.tar.gz: d3c2d5f445335576c3be41ef095b432f52a75f7c8acee1346ed5fc2823cd904fbe6c8a9b35b6ef5145f58aa3709a82ec2a6f0205f973c61ec473dc397c3f9c3a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -91,10 +91,8 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
91
91
|
prompt that will allow you to experiment.
|
92
92
|
|
93
93
|
To install this gem onto your local machine, run `bundle exec rake install`
|
94
|
-
(This command installs the current tsks version
|
95
|
-
path).
|
94
|
+
(This command installs the current tsks version in your machine).
|
96
95
|
|
97
96
|
## Contributing
|
98
97
|
|
99
|
-
Bug reports and pull requests are welcome on GitHub at
|
100
|
-
https://github.com/luanrvmood/tsks-cli.
|
98
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/luanrvmood/tsks.
|
data/lib/tsks/actions.rb
CHANGED
data/lib/tsks/cli.rb
CHANGED
@@ -65,18 +65,19 @@ module Tsks
|
|
65
65
|
tsks = nil
|
66
66
|
|
67
67
|
if options[:done] && options[:context]
|
68
|
-
tsks = Tsks::Storage.select_by({
|
68
|
+
tsks = Tsks::Storage.select_by({status: 'done', context: options[:context]})
|
69
69
|
elsif options[:done]
|
70
|
-
tsks = Tsks::Storage.select_by({
|
70
|
+
tsks = Tsks::Storage.select_by({status: 'done'})
|
71
71
|
elsif options[:context]
|
72
72
|
tsks = Tsks::Storage.select_by({context: options[:context]})
|
73
73
|
else
|
74
|
-
tsks = Tsks::Storage.select_by({
|
74
|
+
tsks = Tsks::Storage.select_by({status: 'todo'})
|
75
75
|
end
|
76
76
|
|
77
77
|
if tsks.count > 0
|
78
78
|
for tsk in tsks
|
79
|
-
|
79
|
+
tsk_status = Tsks::Actions.get_tsk_status tsk[:status]
|
80
|
+
puts "#{tsk_status} | #{tsk[:local_id]} #{tsk[:tsk]} @#{tsk[:context]}"
|
80
81
|
end
|
81
82
|
else
|
82
83
|
puts "No tsks found."
|
@@ -95,12 +96,12 @@ module Tsks
|
|
95
96
|
res = Tsks::Request.post "/register", {email: options[:email],
|
96
97
|
password: options[:password]}
|
97
98
|
|
98
|
-
if res && res[:
|
99
|
+
if res && res[:ok] == true
|
99
100
|
File.write File.join(CLI.setup_folder, "token"), res[:token]
|
100
101
|
File.write File.join(CLI.setup_folder, "user_id"), res[:user_id]
|
101
102
|
Tsks::Actions.update_tsks_with_uuid res[:user_id]
|
102
103
|
puts "Succesfully registered."
|
103
|
-
elsif res && res[:
|
104
|
+
elsif res && res[:ok] == false
|
104
105
|
puts "This e-mail is already registered."
|
105
106
|
end
|
106
107
|
rescue Errno::ECONNREFUSED, SocketError
|
@@ -122,12 +123,12 @@ module Tsks
|
|
122
123
|
res = Tsks::Request.post "/login", {email: options[:email],
|
123
124
|
password: options[:password]}
|
124
125
|
|
125
|
-
if res && res[:
|
126
|
+
if res && res[:ok] == true
|
126
127
|
File.write File.join(CLI.setup_folder, "token"), res[:token]
|
127
128
|
File.write File.join(CLI.setup_folder, "user_id"), res[:user_id]
|
128
129
|
Tsks::Actions.update_tsks_with_uuid res[:user_id]
|
129
130
|
puts "Succesfully logged in."
|
130
|
-
elsif res && res[:
|
131
|
+
elsif res && res[:ok] == false
|
131
132
|
puts "Invalid e-mail or password."
|
132
133
|
end
|
133
134
|
rescue Errno::ECONNREFUSED, SocketError
|
@@ -164,7 +165,7 @@ module Tsks
|
|
164
165
|
remote_tsks.append tsk
|
165
166
|
end
|
166
167
|
|
167
|
-
if get_res[:
|
168
|
+
if get_res[:ok] == true
|
168
169
|
local_tsks_to_post = local_tsks - remote_tsks
|
169
170
|
if local_tsks_to_post.count > 0
|
170
171
|
Tsks::Request.post "/tsks", token, {tsks: local_tsks_to_post}
|
data/lib/tsks/storage.rb
CHANGED
@@ -10,8 +10,8 @@ module Tsks
|
|
10
10
|
id VARCHAR PRIMARY KEY UNIQUE NOT NULL,
|
11
11
|
user_id INTEGER DEFAULT 1,
|
12
12
|
tsk VARCHAR NOT NULL,
|
13
|
+
status VARCHAR DEFAULT todo,
|
13
14
|
context VARCHAR DEFAULT Inbox,
|
14
|
-
done BOOLEAN DEFAULT false,
|
15
15
|
created_at VARCHAR NOT NULL,
|
16
16
|
updated_at VARCHAR NOT NULL
|
17
17
|
)
|
@@ -31,15 +31,15 @@ module Tsks
|
|
31
31
|
|
32
32
|
if ctx
|
33
33
|
storage.execute("
|
34
|
-
INSERT INTO tsks (id, tsk, context, created_at, updated_at)
|
35
|
-
VALUES (?, ?, ?, ?, ?)",
|
36
|
-
[uuid, tsk, ctx, now, now]
|
34
|
+
INSERT INTO tsks (id, tsk, status, context, created_at, updated_at)
|
35
|
+
VALUES (?, ?, ?, ?, ?, ?)",
|
36
|
+
[uuid, tsk, 'todo', ctx, now, now]
|
37
37
|
)
|
38
38
|
else
|
39
39
|
storage.execute("
|
40
|
-
INSERT INTO tsks (id, tsk, created_at, updated_at)
|
41
|
-
VALUES (?, ?, ?, ?)",
|
42
|
-
[uuid, tsk, now, now]
|
40
|
+
INSERT INTO tsks (id, tsk, status, created_at, updated_at)
|
41
|
+
VALUES (?, ?, ?, ?, ?)",
|
42
|
+
[uuid, tsk, 'todo', now, now]
|
43
43
|
)
|
44
44
|
end
|
45
45
|
end
|
@@ -50,13 +50,13 @@ module Tsks
|
|
50
50
|
for tsk in tsks
|
51
51
|
storage.execute("
|
52
52
|
INSERT INTO tsks
|
53
|
-
(id, user_id, tsk,
|
53
|
+
(id, user_id, tsk, status, context, created_at, updated_at) VALUES
|
54
54
|
(?, ?, ?, ?, ?, ?, ?)",
|
55
55
|
[tsk[:id],
|
56
56
|
tsk[:user_id],
|
57
57
|
tsk[:tsk],
|
58
|
+
tsk[:status],
|
58
59
|
tsk[:context],
|
59
|
-
tsk[:done],
|
60
60
|
tsk[:created_at],
|
61
61
|
tsk[:updated_at]]
|
62
62
|
)
|
@@ -77,7 +77,7 @@ module Tsks
|
|
77
77
|
"WHERE rowid=?",
|
78
78
|
[params.values.first, local_id])
|
79
79
|
else
|
80
|
-
storage.execute "UPDATE tsks SET done
|
80
|
+
storage.execute "UPDATE tsks SET status='done' WHERE rowid=?", local_id
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
@@ -154,16 +154,16 @@ module Tsks
|
|
154
154
|
t[:id] = tsk[1]
|
155
155
|
t[:user_id] = tsk[2]
|
156
156
|
t[:tsk] = tsk[3]
|
157
|
-
t[:
|
158
|
-
t[:
|
157
|
+
t[:status] = tsk[4]
|
158
|
+
t[:context] = tsk[5]
|
159
159
|
t[:created_at] = tsk[6]
|
160
160
|
t[:updated_at] = tsk[7]
|
161
161
|
else
|
162
162
|
t[:id] = tsk[0]
|
163
163
|
t[:user_id] = tsk[1]
|
164
164
|
t[:tsk] = tsk[2]
|
165
|
-
t[:
|
166
|
-
t[:
|
165
|
+
t[:status] = tsk[3]
|
166
|
+
t[:context] = tsk[4]
|
167
167
|
t[:created_at] = tsk[5]
|
168
168
|
t[:updated_at] = tsk[6]
|
169
169
|
end
|
data/lib/tsks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tsks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luan F. R. Vicente
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -80,7 +80,7 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
description:
|
83
|
+
description:
|
84
84
|
email:
|
85
85
|
- luanrvmood@gmail.com
|
86
86
|
executables:
|
@@ -112,7 +112,7 @@ metadata:
|
|
112
112
|
allowed_push_host: https://rubygems.org
|
113
113
|
homepage_uri: https://github.com/luanrvmood/tsks
|
114
114
|
source_code_uri: https://github.com/luanrvmood/tsks
|
115
|
-
post_install_message:
|
115
|
+
post_install_message:
|
116
116
|
rdoc_options: []
|
117
117
|
require_paths:
|
118
118
|
- lib
|
@@ -127,8 +127,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
127
|
- !ruby/object:Gem::Version
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
|
-
rubygems_version: 3.
|
131
|
-
signing_key:
|
130
|
+
rubygems_version: 3.3.7
|
131
|
+
signing_key:
|
132
132
|
specification_version: 4
|
133
133
|
summary: A stateful command line interface to help you handle your daily tsks (with
|
134
134
|
synchronisation and contexts!)
|