tsks 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d73c826d7b403aedb18560d1a278b7031bf685379f2a933a566eb2e868132d8
4
- data.tar.gz: d06f2629e6baf5396d91e732f9aeb1504256a93c984bc560c43c57ffea2baaeb
3
+ metadata.gz: 8dcfc253377c9a3e088a512b8e471f8192656e09e4f4974ebe36f1a4fe1ecf59
4
+ data.tar.gz: 1abb7fc7bc71670be855cbcf50670db59003e3eee4835d4ac02ca73f6b39fe5e
5
5
  SHA512:
6
- metadata.gz: bf19e1134320717d80ea4eb4f1a5bad44e0979ee3cc37adcc3f83e5ffcaf69bde1e5896ab367e61c1210c3a4eb0f03475540bfed1bc46fa8748bb053fc89e9e0
7
- data.tar.gz: 10f11a8fa09923a383ce3ce61ec3715bd3c7139a5e3411352f6b5985888869b303827585637514990c9cabda0be9aa09fbed5df570f417198c69cd43fec3feaf
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:3000/v1
2
+ BASE_API_URI=http://localhost:5000/v1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tsks (0.0.8)
4
+ tsks (0.0.10)
5
5
  httparty
6
6
  sqlite3
7
7
  thor
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # tsks
2
2
 
3
- [![build](https://app.travis-ci.com/luanramosvicente/tsks.svg?branch=main)](https://travis-ci.com/luanrvmood/tsks)
3
+ [![build](https://app.travis-ci.com/luanrv/tsks-cli.svg?branch=main)](https://app.travis-ci.com/luanrv/tsks-cli)
4
4
 
5
5
  A stateful command line interface to help you handle your daily tsks (with
6
6
  synchronisation and contexts!).
@@ -85,7 +85,7 @@ Or this to register an account:
85
85
  tsks register --email=sample@mail.com --password=secret
86
86
  ```
87
87
 
88
- ## Development
88
+ ## Developing
89
89
 
90
90
  After checking out the repo, run `bin/setup` to install dependencies. Then, run
91
91
  `rake spec` to run the tests. You can also run `bin/console` for an interactive
@@ -94,6 +94,12 @@ prompt that will allow you to experiment.
94
94
  To install this gem onto your local machine, run `bundle exec rake install`
95
95
  (This command installs the current tsks version in your machine).
96
96
 
97
+ ## Releasing
98
+
99
+ ```sh
100
+ ./bin/release
101
+ ```
102
+
97
103
  ## Contributing
98
104
 
99
105
  Bug reports and pull requests are welcome on GitHub at https://github.com/luanrvmood/tsks.
data/bin/install ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle exec rake install
data/bin/test ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ bundle exec rake spec
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.update_tsks_with_uuid uuid
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: uuid}
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", "Setup tsks folder and storage"
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", "Add a new tsk (Use --context to specify one e.g. Work)"
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", "Mark a tsk you have already done"
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", "See all active tsks, filter by context or that are done"
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 "No tsks found."
83
+ puts "no tsks found."
84
84
  end
85
85
  end
86
86
 
87
- desc "register", "Register an e-mail to be able to sync your tsks"
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
@@ -94,24 +94,24 @@ module Tsks
94
94
 
95
95
  begin
96
96
  res = Tsks::Request.post "/signup", {email: options[:email],
97
- password: options[:password]}
97
+ password: options[:password]}
98
98
 
99
99
  if res && res[:ok] == true
100
- File.write File.join(CLI.setup_folder, "token"), res[:auth_token]
101
- File.write File.join(CLI.setup_folder, "user_id"), res[:user_id]
102
- Tsks::Actions.update_tsks_with_uuid res[:user_id]
103
- puts "Succesfully registered."
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 "This e-mail is already registered."
105
+ puts "this e-mail is already registered."
106
106
  end
107
107
  rescue Errno::ECONNREFUSED, SocketError
108
- puts "Failed to connect to the API."
108
+ puts "failed to connect to API."
109
109
  rescue JSON::ParserError
110
- puts "Error on reading data from the API."
110
+ puts "error on reading data from API."
111
111
  end
112
112
  end
113
113
 
114
- desc "login", "Login to be able to sync your tsks"
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
@@ -121,36 +121,36 @@ module Tsks
121
121
 
122
122
  begin
123
123
  res = Tsks::Request.post "/signin", {email: options[:email],
124
- password: options[:password]}
124
+ password: options[:password]}
125
125
 
126
126
  if res && res[:ok] == true
127
- File.write File.join(CLI.setup_folder, "token"), res[:auth_token]
128
- File.write File.join(CLI.setup_folder, "user_id"), res[:user_id]
129
- Tsks::Actions.update_tsks_with_uuid res[:user_id]
130
- puts "Succesfully logged in."
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 "Invalid e-mail or password."
132
+ puts "invalid e-mail or password."
133
133
  end
134
134
  rescue Errno::ECONNREFUSED, SocketError
135
- puts "Failed to connect to the API."
135
+ puts "failed to connect to API."
136
136
  rescue JSON::ParserError
137
- puts "Error on reading data from the API."
137
+ puts "error on reading data from API."
138
138
  end
139
139
  end
140
140
 
141
- desc "sync", "Synchronize your tsks"
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 "Please, login before try to sync."
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.update_tsks_with_uuid user_id
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
@@ -178,13 +178,13 @@ module Tsks
178
178
  Tsks::Storage.insert_many remote_tsks_to_storage
179
179
  end
180
180
 
181
- puts "Your tsks were succesfully synchronized."
181
+ puts "your tsks were succesfully synchronized."
182
182
  end
183
183
  end
184
184
  rescue Errno::ECONNREFUSED, SocketError
185
- puts "Failed to connect to the API."
185
+ puts "failed to connect to API."
186
186
  rescue JSON::ParserError
187
- puts "Error on reading data from the API."
187
+ puts "error on reading data from API."
188
188
  end
189
189
  end
190
190
 
@@ -196,7 +196,7 @@ module Tsks
196
196
 
197
197
  op_status = Tsks::Storage.delete id
198
198
  if !op_status
199
- puts "The specified tsk do not exist."
199
+ puts "the specified tsk do not exist."
200
200
  end
201
201
  end
202
202
  end
data/lib/tsks/request.rb CHANGED
@@ -2,9 +2,7 @@ require "httparty"
2
2
 
3
3
  module Tsks
4
4
  class Request
5
- #@base_uri = "https://tsks-api.herokuapp.com/v1"
6
- # TODO: tmp for dev purposes
7
- @base_uri = "http://localhost:3000/v1"
5
+ @base_uri = "https://tsks-api.onrender.com/v1"
8
6
 
9
7
  def self.base_uri
10
8
  @base_uri
data/lib/tsks/storage.rb CHANGED
@@ -11,7 +11,7 @@ module Tsks
11
11
  user_id INTEGER DEFAULT 1,
12
12
  tsk VARCHAR NOT NULL,
13
13
  status VARCHAR DEFAULT todo,
14
- context VARCHAR DEFAULT Inbox,
14
+ context VARCHAR DEFAULT inbox,
15
15
  created_at VARCHAR NOT NULL,
16
16
  updated_at VARCHAR NOT NULL
17
17
  )
data/lib/tsks/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tsks
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
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.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luan Ramos Vicente
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-29 00:00:00.000000000 Z
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