tsks 0.0.8 → 0.0.10
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/.env.sample +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +20 -13
- data/bin/install +6 -0
- data/bin/test +3 -0
- data/lib/tsks/actions.rb +6 -6
- data/lib/tsks/cli.rb +35 -33
- data/lib/tsks/request.rb +1 -1
- data/lib/tsks/storage.rb +1 -1
- data/lib/tsks/version.rb +1 -1
- data/tsks.gemspec +3 -3
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8dcfc253377c9a3e088a512b8e471f8192656e09e4f4974ebe36f1a4fe1ecf59
|
4
|
+
data.tar.gz: 1abb7fc7bc71670be855cbcf50670db59003e3eee4835d4ac02ca73f6b39fe5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dfd37445ab1a61c066489b43d68ffece47083de6f1a13c12308240bf0b5eec429409bdab7ef9e0d097109f01df7ab6c9eb1687a1a28d29ae3aee3d7e16cf72d
|
7
|
+
data.tar.gz: ac8be97dbc67159ebcdd01b272ab9ae38a03b2bd67a9132e37b1f7968c673ed8fc1d9860c1f5a8969bffce11ac41c8158374c49fcdb929546c142c7bedcbc098
|
data/.env.sample
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
SETUP_FOLDER=~/.tsks_test
|
2
|
-
BASE_API_URI=http://localhost:
|
2
|
+
BASE_API_URI=http://localhost:5000/v1
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# tsks
|
2
2
|
|
3
|
-
|
4
|
-
synchronisation and contexts!).
|
3
|
+
[](https://app.travis-ci.com/luanrv/tsks-cli)
|
5
4
|
|
6
|
-
|
5
|
+
A stateful command line interface to help you handle your daily tsks (with
|
6
|
+
synchronisation and contexts!).
|
7
7
|
|
8
8
|
## Features
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
- Add tsks, check what is already done and list active or archived tsks
|
11
|
+
- Synchronise your tsks and access them from all your terminals!
|
12
12
|
(soon accessible from a webapp as well)
|
13
|
-
|
13
|
+
- Increase your daily tsks management with contexts using
|
14
14
|
`tsks add tsk --context=today` (see `tsks help add` for more info)
|
15
15
|
|
16
16
|
## Installation
|
@@ -21,9 +21,9 @@ gem install tsks
|
|
21
21
|
|
22
22
|
## Usage
|
23
23
|
|
24
|
-
After follow the step above you should be able to run `tsks` from your terminal.
|
24
|
+
After follow the step above you should be able to run `tsks` from your terminal.
|
25
25
|
|
26
|
-
_It's important to notice that you will need to run `tsks init` to setup stuffs
|
26
|
+
_It's important to notice that you will need to run `tsks init` to setup stuffs
|
27
27
|
like the storage before any other command._
|
28
28
|
|
29
29
|
### Adding new tsks
|
@@ -38,7 +38,7 @@ tsks add "My first tsk"
|
|
38
38
|
tsks add "Bootstraps my pet project environment" --context=Today
|
39
39
|
```
|
40
40
|
|
41
|
-
### Marking tsks as done
|
41
|
+
### Marking tsks as done
|
42
42
|
|
43
43
|
```sh
|
44
44
|
tsks done 2 # Where 2 is the tsk id
|
@@ -57,17 +57,18 @@ tsks list --context=Today
|
|
57
57
|
```
|
58
58
|
|
59
59
|
**Or tsks already done**
|
60
|
+
|
60
61
|
```sh
|
61
62
|
tsks list --done
|
62
63
|
```
|
63
64
|
|
64
|
-
**Tip:** It's possible to combine the flags `--done` and `--context` when
|
65
|
+
**Tip:** It's possible to combine the flags `--done` and `--context` when
|
65
66
|
listing.
|
66
67
|
|
67
68
|
### Synchronising your tsks
|
68
69
|
|
69
|
-
As easy as running `tsks sync`. This command will fetch your tsks from the API,
|
70
|
-
then filter what is not synchronised yet from local, then update both
|
70
|
+
As easy as running `tsks sync`. This command will fetch your tsks from the API,
|
71
|
+
then filter what is not synchronised yet from local, then update both
|
71
72
|
remote and local tsks with most recent data.
|
72
73
|
|
73
74
|
#### To be able to sync you will need to login or register an account
|
@@ -84,7 +85,7 @@ Or this to register an account:
|
|
84
85
|
tsks register --email=sample@mail.com --password=secret
|
85
86
|
```
|
86
87
|
|
87
|
-
##
|
88
|
+
## Developing
|
88
89
|
|
89
90
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
90
91
|
`rake spec` to run the tests. You can also run `bin/console` for an interactive
|
@@ -93,6 +94,12 @@ prompt that will allow you to experiment.
|
|
93
94
|
To install this gem onto your local machine, run `bundle exec rake install`
|
94
95
|
(This command installs the current tsks version in your machine).
|
95
96
|
|
97
|
+
## Releasing
|
98
|
+
|
99
|
+
```sh
|
100
|
+
./bin/release
|
101
|
+
```
|
102
|
+
|
96
103
|
## Contributing
|
97
104
|
|
98
105
|
Bug reports and pull requests are welcome on GitHub at https://github.com/luanrvmood/tsks.
|
data/bin/install
ADDED
data/bin/test
ADDED
data/lib/tsks/actions.rb
CHANGED
@@ -2,11 +2,11 @@ require "tsks/storage"
|
|
2
2
|
|
3
3
|
module Tsks
|
4
4
|
class Actions
|
5
|
-
def self.
|
5
|
+
def self.update_tsks_with_user_id user_id
|
6
6
|
current_tsks = Tsks::Storage.select_all
|
7
7
|
|
8
8
|
for tsk in current_tsks
|
9
|
-
Tsks::Storage.update tsk[:local_id], {user_id:
|
9
|
+
Tsks::Storage.update tsk[:local_id], {user_id: user_id}
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -22,10 +22,10 @@ module Tsks
|
|
22
22
|
|
23
23
|
def self.get_tsk_status status
|
24
24
|
available_status = {
|
25
|
-
todo: '
|
26
|
-
done: '
|
27
|
-
doing: '
|
28
|
-
freezed: '
|
25
|
+
todo: '-',
|
26
|
+
done: '*',
|
27
|
+
doing: '+',
|
28
|
+
freezed: '!',
|
29
29
|
archived: 'x',
|
30
30
|
}
|
31
31
|
|
data/lib/tsks/cli.rb
CHANGED
@@ -21,7 +21,7 @@ module Tsks
|
|
21
21
|
puts "tsks #{Tsks::VERSION}"
|
22
22
|
end
|
23
23
|
|
24
|
-
desc "init", "
|
24
|
+
desc "init", "setup tsks folder and storage"
|
25
25
|
def init
|
26
26
|
if File.directory? CLI.setup_folder
|
27
27
|
return puts "tsks was already initialized."
|
@@ -31,7 +31,7 @@ module Tsks
|
|
31
31
|
Tsks::Storage.init
|
32
32
|
end
|
33
33
|
|
34
|
-
desc "add TSK", "
|
34
|
+
desc "add TSK", "add a new tsk (Use --context to specify one e.g. Work)"
|
35
35
|
option :context
|
36
36
|
def add tsk
|
37
37
|
if !File.directory? CLI.setup_folder
|
@@ -45,7 +45,7 @@ module Tsks
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
desc "done ID", "
|
48
|
+
desc "done ID", "mark a tsk you have already done"
|
49
49
|
def done id
|
50
50
|
if !File.directory? CLI.setup_folder
|
51
51
|
return puts "tsks was not initialized yet."
|
@@ -54,7 +54,7 @@ module Tsks
|
|
54
54
|
Tsks::Storage.update id
|
55
55
|
end
|
56
56
|
|
57
|
-
desc "list", "
|
57
|
+
desc "list", "see all active tsks, filter by context or that are done"
|
58
58
|
option :done, type: :boolean
|
59
59
|
option :context
|
60
60
|
def list
|
@@ -80,11 +80,11 @@ module Tsks
|
|
80
80
|
puts "#{tsk_status} | #{tsk[:local_id]} #{tsk[:tsk]} @#{tsk[:context]}"
|
81
81
|
end
|
82
82
|
else
|
83
|
-
puts "
|
83
|
+
puts "no tsks found."
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
desc "register", "
|
87
|
+
desc "register", "register an e-mail to be able to sync your tsks"
|
88
88
|
option :email, required: true
|
89
89
|
option :password, required: true
|
90
90
|
def register
|
@@ -93,25 +93,25 @@ module Tsks
|
|
93
93
|
end
|
94
94
|
|
95
95
|
begin
|
96
|
-
res = Tsks::Request.post "/
|
97
|
-
|
96
|
+
res = Tsks::Request.post "/signup", {email: options[:email],
|
97
|
+
password: options[:password]}
|
98
98
|
|
99
99
|
if res && res[:ok] == true
|
100
|
-
File.write File.join(CLI.setup_folder, "token"), res[:
|
101
|
-
File.write File.join(CLI.setup_folder, "user_id"), res[:
|
102
|
-
Tsks::Actions.
|
103
|
-
puts "
|
100
|
+
File.write File.join(CLI.setup_folder, "token"), res[:user][:auth_token]
|
101
|
+
File.write File.join(CLI.setup_folder, "user_id"), res[:user][:id]
|
102
|
+
Tsks::Actions.update_tsks_with_user_id res[:user][:id]
|
103
|
+
puts "succesfully registered."
|
104
104
|
elsif res && res[:ok] == false
|
105
|
-
puts "
|
105
|
+
puts "this e-mail is already registered."
|
106
106
|
end
|
107
107
|
rescue Errno::ECONNREFUSED, SocketError
|
108
|
-
puts "
|
108
|
+
puts "failed to connect to API."
|
109
109
|
rescue JSON::ParserError
|
110
|
-
puts "
|
110
|
+
puts "error on reading data from API."
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
|
-
desc "login", "
|
114
|
+
desc "login", "login to be able to sync your tsks"
|
115
115
|
option :email, required: true
|
116
116
|
option :password, required: true
|
117
117
|
def login
|
@@ -120,37 +120,37 @@ module Tsks
|
|
120
120
|
end
|
121
121
|
|
122
122
|
begin
|
123
|
-
res = Tsks::Request.post "/
|
124
|
-
|
123
|
+
res = Tsks::Request.post "/signin", {email: options[:email],
|
124
|
+
password: options[:password]}
|
125
125
|
|
126
126
|
if res && res[:ok] == true
|
127
|
-
File.write File.join(CLI.setup_folder, "token"), res[:
|
128
|
-
File.write File.join(CLI.setup_folder, "user_id"), res[:
|
129
|
-
Tsks::Actions.
|
130
|
-
puts "
|
127
|
+
File.write File.join(CLI.setup_folder, "token"), res[:user][:auth_token]
|
128
|
+
File.write File.join(CLI.setup_folder, "user_id"), res[:user][:id]
|
129
|
+
Tsks::Actions.update_tsks_with_user_id res[:user][:id]
|
130
|
+
puts "succesfully logged in."
|
131
131
|
elsif res && res[:ok] == false
|
132
|
-
puts "
|
132
|
+
puts "invalid e-mail or password."
|
133
133
|
end
|
134
134
|
rescue Errno::ECONNREFUSED, SocketError
|
135
|
-
puts "
|
135
|
+
puts "failed to connect to API."
|
136
136
|
rescue JSON::ParserError
|
137
|
-
puts "
|
137
|
+
puts "error on reading data from API."
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
|
-
desc "sync", "
|
141
|
+
desc "sync", "synchronize your tsks"
|
142
142
|
def sync
|
143
143
|
if !File.directory? CLI.setup_folder
|
144
144
|
return puts "tsks was not initialized yet."
|
145
145
|
end
|
146
146
|
|
147
147
|
if !File.exist? File.join CLI.setup_folder, "token"
|
148
|
-
return puts "
|
148
|
+
return puts "please, login before try to sync."
|
149
149
|
end
|
150
150
|
|
151
151
|
user_id = File.read File.join CLI.setup_folder, "user_id"
|
152
152
|
token = File.read File.join CLI.setup_folder, "token"
|
153
|
-
Tsks::Actions.
|
153
|
+
Tsks::Actions.update_tsks_with_user_id user_id
|
154
154
|
Tsks::Actions.update_server_for_removed_tsks token
|
155
155
|
Tsks::Storage.delete_removed_uuids
|
156
156
|
local_tsks = Tsks::Storage.select_all local_id=false
|
@@ -168,7 +168,9 @@ module Tsks
|
|
168
168
|
if get_res[:ok] == true
|
169
169
|
local_tsks_to_post = local_tsks - remote_tsks
|
170
170
|
if local_tsks_to_post.count > 0
|
171
|
-
|
171
|
+
for tsk in local_tsks_to_post
|
172
|
+
Tsks::Request.post "/tsks", token, {tsk: tsk}
|
173
|
+
end
|
172
174
|
end
|
173
175
|
|
174
176
|
remote_tsks_to_storage = remote_tsks - local_tsks
|
@@ -176,13 +178,13 @@ module Tsks
|
|
176
178
|
Tsks::Storage.insert_many remote_tsks_to_storage
|
177
179
|
end
|
178
180
|
|
179
|
-
puts "
|
181
|
+
puts "your tsks were succesfully synchronized."
|
180
182
|
end
|
181
183
|
end
|
182
184
|
rescue Errno::ECONNREFUSED, SocketError
|
183
|
-
puts "
|
185
|
+
puts "failed to connect to API."
|
184
186
|
rescue JSON::ParserError
|
185
|
-
puts "
|
187
|
+
puts "error on reading data from API."
|
186
188
|
end
|
187
189
|
end
|
188
190
|
|
@@ -194,7 +196,7 @@ module Tsks
|
|
194
196
|
|
195
197
|
op_status = Tsks::Storage.delete id
|
196
198
|
if !op_status
|
197
|
-
puts "
|
199
|
+
puts "the specified tsk do not exist."
|
198
200
|
end
|
199
201
|
end
|
200
202
|
end
|
data/lib/tsks/request.rb
CHANGED
data/lib/tsks/storage.rb
CHANGED
data/lib/tsks/version.rb
CHANGED
data/tsks.gemspec
CHANGED
@@ -3,10 +3,10 @@ require_relative 'lib/tsks/version'
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "tsks"
|
5
5
|
spec.version = Tsks::VERSION
|
6
|
-
spec.authors = ["Luan
|
6
|
+
spec.authors = ["Luan Ramos Vicente"]
|
7
7
|
spec.email = ["luanrvmood@gmail.com"]
|
8
|
-
spec.summary = "A stateful command line interface to help you handle your daily tsks (with synchronisation and contexts
|
9
|
-
spec.homepage = "https://github.com/
|
8
|
+
spec.summary = "A stateful command line interface to help you handle your daily tsks (with synchronisation and contexts)"
|
9
|
+
spec.homepage = "https://github.com/luanrv/tsks"
|
10
10
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
11
11
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
12
12
|
spec.metadata["homepage_uri"] = spec.homepage
|
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.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Luan
|
7
|
+
- Luan Ramos Vicente
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -97,7 +97,9 @@ files:
|
|
97
97
|
- README.md
|
98
98
|
- Rakefile
|
99
99
|
- bin/console
|
100
|
+
- bin/install
|
100
101
|
- bin/setup
|
102
|
+
- bin/test
|
101
103
|
- exe/tsks
|
102
104
|
- lib/tsks.rb
|
103
105
|
- lib/tsks/actions.rb
|
@@ -106,12 +108,12 @@ files:
|
|
106
108
|
- lib/tsks/storage.rb
|
107
109
|
- lib/tsks/version.rb
|
108
110
|
- tsks.gemspec
|
109
|
-
homepage: https://github.com/
|
111
|
+
homepage: https://github.com/luanrv/tsks
|
110
112
|
licenses: []
|
111
113
|
metadata:
|
112
114
|
allowed_push_host: https://rubygems.org
|
113
|
-
homepage_uri: https://github.com/
|
114
|
-
source_code_uri: https://github.com/
|
115
|
+
homepage_uri: https://github.com/luanrv/tsks
|
116
|
+
source_code_uri: https://github.com/luanrv/tsks
|
115
117
|
post_install_message:
|
116
118
|
rdoc_options: []
|
117
119
|
require_paths:
|
@@ -131,5 +133,5 @@ rubygems_version: 3.3.7
|
|
131
133
|
signing_key:
|
132
134
|
specification_version: 4
|
133
135
|
summary: A stateful command line interface to help you handle your daily tsks (with
|
134
|
-
synchronisation and contexts
|
136
|
+
synchronisation and contexts)
|
135
137
|
test_files: []
|