tsks 0.0.2 → 0.0.3
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/Gemfile.lock +1 -1
- data/README.md +21 -16
- data/lib/tsks/cli.rb +58 -38
- data/lib/tsks/version.rb +1 -1
- data/tsks.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 250b699fe0084a0cc5be062a6f3e36770c0a1912fa791777a08f0b3ae89d9183
|
4
|
+
data.tar.gz: b63f9e998022028585a84ea52be887cb506312dbdf57e6c4faaafc95344e8c97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 650490972ad8a2bc123aadd84a057fe941e8e7487ae140ab07aa0f661c95fd28aac3fe4b6902c03ce9ae260167446b31deeb886e361491fc5587f968aa42bb0e
|
7
|
+
data.tar.gz: 4ab117f3c1f34d71ed1c7ed9aaa123320291ace5f6480c7e66de96d56e011df51abdbb45059041badfe092dcc63d1620d80b9acb8f847b0131fa65c06b807a19
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,14 +1,17 @@
|
|
1
|
-
# tsks
|
1
|
+
# tsks
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
A stateful command line interface to help you handle your daily tsks (with
|
4
|
+
synchronisation and contexts!).
|
5
|
+
|
6
|
+
[](https://travis-ci.com/luanrvmood/tsks)
|
5
7
|
|
6
8
|
## Features
|
7
9
|
|
8
10
|
* Add tsks, check what is already done and list active or archived tsks
|
9
|
-
*
|
10
|
-
|
11
|
-
|
11
|
+
* Synchronise your tsks and access them from all your terminals!
|
12
|
+
(soon accessible from a webapp as well)
|
13
|
+
* Increase your daily tsks management with contexts using
|
14
|
+
`tsks add tsk --context=today` (see `tsks help add` for more info)
|
12
15
|
|
13
16
|
## Installation
|
14
17
|
|
@@ -20,8 +23,8 @@ gem install tsks
|
|
20
23
|
|
21
24
|
After follow the step above you should be able to run `tsks` from your terminal.
|
22
25
|
|
23
|
-
_It's important to notice that you will need to run `tsks init`
|
24
|
-
|
26
|
+
_It's important to notice that you will need to run `tsks init` to setup stuffs
|
27
|
+
like the storage before any other command._
|
25
28
|
|
26
29
|
### Adding new tsks
|
27
30
|
|
@@ -32,13 +35,13 @@ tsks add "My first tsk"
|
|
32
35
|
**Adding with context**
|
33
36
|
|
34
37
|
```sh
|
35
|
-
tsks add "Bootstraps my pet project environment --context=
|
38
|
+
tsks add "Bootstraps my pet project environment" --context=Today
|
36
39
|
```
|
37
40
|
|
38
|
-
###
|
41
|
+
### Marking tsks as done
|
39
42
|
|
40
43
|
```sh
|
41
|
-
tsks done 2 # Where 2 is the id
|
44
|
+
tsks done 2 # Where 2 is the tsk id
|
42
45
|
```
|
43
46
|
|
44
47
|
### Listing your tsks
|
@@ -50,7 +53,7 @@ tsks list
|
|
50
53
|
**Filtering by context**
|
51
54
|
|
52
55
|
```sh
|
53
|
-
tsks list --context=
|
56
|
+
tsks list --context=Today
|
54
57
|
```
|
55
58
|
|
56
59
|
**Or tsks already done**
|
@@ -61,11 +64,11 @@ tsks list --done
|
|
61
64
|
**Tip:** It's possible to combine the flags `--done` and `--context` when
|
62
65
|
listing.
|
63
66
|
|
64
|
-
###
|
67
|
+
### Synchronising your tsks
|
65
68
|
|
66
69
|
As easy as running `tsks sync`. This command will fetch your tsks from the API,
|
67
|
-
then filter what is not
|
68
|
-
local tsks with most recent data.
|
70
|
+
then filter what is not synchronised yet from local, then update both
|
71
|
+
remote and local tsks with most recent data.
|
69
72
|
|
70
73
|
#### To be able to sync you will need to login or register an account
|
71
74
|
|
@@ -87,7 +90,9 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
87
90
|
`rake spec` to run the tests. You can also run `bin/console` for an interactive
|
88
91
|
prompt that will allow you to experiment.
|
89
92
|
|
90
|
-
To install this gem onto your local machine, run `bundle exec rake install
|
93
|
+
To install this gem onto your local machine, run `bundle exec rake install`
|
94
|
+
(This command installs the current tsks version **v0.0.2** in your machine
|
95
|
+
path).
|
91
96
|
|
92
97
|
## Contributing
|
93
98
|
|
data/lib/tsks/cli.rb
CHANGED
@@ -82,16 +82,22 @@ module Tsks
|
|
82
82
|
return puts "tsks was not initialized yet."
|
83
83
|
end
|
84
84
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
85
|
+
begin
|
86
|
+
res = Tsks::Request.post "/register", {email: options[:email],
|
87
|
+
password: options[:password]}
|
88
|
+
|
89
|
+
if res && res[:status_code] == 201
|
90
|
+
File.write File.join(CLI.setup_folder, "token"), res[:token]
|
91
|
+
File.write File.join(CLI.setup_folder, "user_id"), res[:user_id]
|
92
|
+
Tsks::Actions.update_tsks_with_uuid res[:user_id]
|
93
|
+
puts "Succesfully registered."
|
94
|
+
elsif res && res[:status_code] == 409
|
95
|
+
puts "This e-mail is already registered."
|
96
|
+
end
|
97
|
+
rescue Errno::ECONNREFUSED
|
98
|
+
puts "Failed to connect to the API."
|
99
|
+
rescue JSON::ParserError
|
100
|
+
puts "Error on reading data from the API."
|
95
101
|
end
|
96
102
|
end
|
97
103
|
|
@@ -103,16 +109,22 @@ module Tsks
|
|
103
109
|
return puts "tsks was not initialized yet."
|
104
110
|
end
|
105
111
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
112
|
+
begin
|
113
|
+
res = Tsks::Request.post "/login", {email: options[:email],
|
114
|
+
password: options[:password]}
|
115
|
+
|
116
|
+
if res && res[:status_code] == 200
|
117
|
+
File.write File.join(CLI.setup_folder, "token"), res[:token]
|
118
|
+
File.write File.join(CLI.setup_folder, "user_id"), res[:user_id]
|
119
|
+
Tsks::Actions.update_tsks_with_uuid res[:user_id]
|
120
|
+
puts "Succesfully logged in."
|
121
|
+
elsif res && res[:status_code] == 403
|
122
|
+
puts "Invalid e-mail or password."
|
123
|
+
end
|
124
|
+
rescue Errno::ECONNREFUSED
|
125
|
+
puts "Failed to connect to the API."
|
126
|
+
rescue JSON::ParserError
|
127
|
+
puts "Error on reading data from the API."
|
116
128
|
end
|
117
129
|
end
|
118
130
|
|
@@ -131,26 +143,34 @@ module Tsks
|
|
131
143
|
local_tsks = Tsks::Storage.select_all local_id=false
|
132
144
|
|
133
145
|
token = File.read File.join CLI.setup_folder, "token"
|
134
|
-
get_res = Tsks::Request.get "/tsks", token
|
135
146
|
remote_tsks = []
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
147
|
+
begin
|
148
|
+
get_res = Tsks::Request.get "/tsks", token
|
149
|
+
if get_res[:tsks]
|
150
|
+
for tsk in get_res[:tsks]
|
151
|
+
tsk[:created_at] = Time.parse(tsk[:created_at]).strftime "%F %T"
|
152
|
+
tsk[:updated_at] = Time.parse(tsk[:updated_at]).strftime "%F %T"
|
153
|
+
remote_tsks.append tsk
|
154
|
+
end
|
155
|
+
|
156
|
+
if get_res[:status_code] == 200
|
157
|
+
local_tsks_to_post = local_tsks - remote_tsks
|
158
|
+
if local_tsks_to_post.count > 0
|
159
|
+
Tsks::Request.post "/tsks", token, {tsks: local_tsks_to_post}
|
160
|
+
end
|
161
|
+
|
162
|
+
remote_tsks_to_storage = remote_tsks - local_tsks
|
163
|
+
if remote_tsks_to_storage.count > 0
|
164
|
+
Tsks::Storage.insert_many remote_tsks_to_storage
|
165
|
+
end
|
166
|
+
|
167
|
+
puts "Your tsks were succesfully synchronized."
|
168
|
+
end
|
151
169
|
end
|
152
|
-
|
153
|
-
puts "
|
170
|
+
rescue Errno::ECONNREFUSED
|
171
|
+
puts "Failed to connect to the API."
|
172
|
+
rescue JSON::ParserError
|
173
|
+
puts "Error on reading data from the API."
|
154
174
|
end
|
155
175
|
end
|
156
176
|
end
|
data/lib/tsks/version.rb
CHANGED
data/tsks.gemspec
CHANGED
@@ -5,7 +5,7 @@ Gem::Specification.new do |spec|
|
|
5
5
|
spec.version = Tsks::VERSION
|
6
6
|
spec.authors = ["Luan F. R. Vicente"]
|
7
7
|
spec.email = ["luanrvmood@gmail.com"]
|
8
|
-
spec.summary = "A stateful command line interface to help you handle your daily tsks (with contexts!)"
|
8
|
+
spec.summary = "A stateful command line interface to help you handle your daily tsks (with synchronisation and contexts!)"
|
9
9
|
spec.homepage = "https://github.com/luanrvmood/tsks"
|
10
10
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
11
11
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luan F. R. Vicente
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -145,5 +145,5 @@ rubygems_version: 3.1.2
|
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: A stateful command line interface to help you handle your daily tsks (with
|
148
|
-
contexts!)
|
148
|
+
synchronisation and contexts!)
|
149
149
|
test_files: []
|