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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf122781e8faff2a45760d9bf8bb6d546d7158c47433ce4dc487ff7faa57b163
4
- data.tar.gz: cb8ab03aa9f5ad004ac243746d2b3b368ccf522fbc734ea20e9c3081c1092882
3
+ metadata.gz: 250b699fe0084a0cc5be062a6f3e36770c0a1912fa791777a08f0b3ae89d9183
4
+ data.tar.gz: b63f9e998022028585a84ea52be887cb506312dbdf57e6c4faaafc95344e8c97
5
5
  SHA512:
6
- metadata.gz: 738bf65c66226c36d14a56c389e970fb789ac98cff0569f4b58aaf02d178ea6d5542beee6c4204bbb4d26eaf91949118dcc2280fc327c8ff1005d1e55395c2ba
7
- data.tar.gz: b763cdfa17b2b5e995eb8fab45fa42034167fa5b48ce9a512be8a2d8a8ff6485a1e60c46f7844e71b07dec4f3527a012e22070075c2075808e4ac09882818d9c
6
+ metadata.gz: 650490972ad8a2bc123aadd84a057fe941e8e7487ae140ab07aa0f661c95fd28aac3fe4b6902c03ce9ae260167446b31deeb886e361491fc5587f968aa42bb0e
7
+ data.tar.gz: 4ab117f3c1f34d71ed1c7ed9aaa123320291ace5f6480c7e66de96d56e011df51abdbb45059041badfe092dcc63d1620d80b9acb8f847b0131fa65c06b807a19
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tsks (0.0.2)
4
+ tsks (0.0.3)
5
5
  httparty
6
6
  sqlite3
7
7
  thor
data/README.md CHANGED
@@ -1,14 +1,17 @@
1
- # tsks-cli
1
+ # tsks
2
2
 
3
- _A stateful command line interface to help you handle your daily tsks
4
- (with contexts!)._
3
+ A stateful command line interface to help you handle your daily tsks (with
4
+ synchronisation and contexts!).
5
+
6
+ [![build](https://travis-ci.com/luanrvmood/tsks.svg?branch=master)](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
- * Synchronize your tsks and access them from all your terminals!)
10
- * Increase your daily tsks management with contexts `tsks add tsk --context=today`
11
- (see `tsks help add` for more info!)
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` before any other
24
- command to setup stuffs like the storage._
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=Personal"
38
+ tsks add "Bootstraps my pet project environment" --context=Today
36
39
  ```
37
40
 
38
- ### Checking done tsks
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=Personal
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
- ### Synchronizing your tsks
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 synced yet from local, and then update both remote and
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
 
@@ -82,16 +82,22 @@ module Tsks
82
82
  return puts "tsks was not initialized yet."
83
83
  end
84
84
 
85
- res = Tsks::Request.post "/register", {email: options[:email],
86
- password: options[:password]}
87
-
88
- if res && res[:status_code] == 201
89
- File.write File.join(CLI.setup_folder, "token"), res[:token]
90
- File.write File.join(CLI.setup_folder, "user_id"), res[:user_id]
91
- Tsks::Actions.update_tsks_with_uuid res[:user_id]
92
- puts "Succesfully registered."
93
- elsif res && res[:status_code] == 409
94
- puts "This e-mail is already registered."
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
- res = Tsks::Request.post "/login", {email: options[:email],
107
- password: options[:password]}
108
-
109
- if res && res[:status_code] == 200
110
- File.write File.join(CLI.setup_folder, "token"), res[:token]
111
- File.write File.join(CLI.setup_folder, "user_id"), res[:user_id]
112
- Tsks::Actions.update_tsks_with_uuid res[:user_id]
113
- puts "Succesfully logged in."
114
- elsif res && res[:status_code] == 403
115
- puts "Invalid e-mail or password."
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
- for tsk in get_res[:tsks]
137
- tsk[:created_at] = Time.parse(tsk[:created_at]).strftime "%F %T"
138
- tsk[:updated_at] = Time.parse(tsk[:updated_at]).strftime "%F %T"
139
- remote_tsks.append tsk
140
- end
141
-
142
- if get_res && get_res[:status_code] == 200
143
- local_tsks_to_post = local_tsks - remote_tsks
144
- if local_tsks_to_post.count > 0
145
- Tsks::Request.post "/tsks", token, {tsks: local_tsks_to_post}
146
- end
147
-
148
- remote_tsks_to_storage = remote_tsks - local_tsks
149
- if remote_tsks_to_storage.count > 0
150
- Tsks::Storage.insert_many remote_tsks_to_storage
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 "Your tsks were succesfully synchronized."
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
@@ -1,3 +1,3 @@
1
1
  module Tsks
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -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.2
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-08 00:00:00.000000000 Z
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: []