tsks 0.0.4 → 0.0.7

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: 9556deb4b5e30cbe04ad5c58748675d148861575065ba9421c03e9fe65a5a180
4
- data.tar.gz: 45bda05308651ffc0301f1b5c25bfdc9eb1f913743ab7a70bd5201cbe04de094
3
+ metadata.gz: 6fccdeb10c81fd73cbe4e0fd79054461347530f1ecedc43b188ea6a399bccf22
4
+ data.tar.gz: c3c82813fe5882c7a2c6b5dfa2a13c23cc2bb1e9fd617baafb9a4812f623564e
5
5
  SHA512:
6
- metadata.gz: f67dc537a7735951d63c1f7b8cb9198e863c33d88971afb4a49cbb4ee9ff87ab338ed581bf11225726f0c2606258924225a2e184d90db7850075ba892c6c2805
7
- data.tar.gz: 1ceffcc60b0b7bfab4c1b893232740c3848db7d7d1b3d60d4613a43e48f73c022984f59238b97cd6ed6e853c8ba65092da0cea075b17398fa6f5b0f78b8fc7b3
6
+ metadata.gz: e686b61f0a2bc64fd9043b1a3141de4dfd01bbce44cf5b3d6540672bc42193b453cf3af2bd624c909b8264f68af3b9859d09e006ac5be85e85e2f663856677a2
7
+ data.tar.gz: 6f37c91a93ef83854e0efca12e7af0a89c00253907baf79012657582ecff9c93cf739a8b8661cf1701461f599742d970504de30e20d9ae27416f79d3de5efa94
data/Gemfile CHANGED
@@ -5,7 +5,6 @@ gemspec
5
5
 
6
6
  gem "rake", "~> 12.0"
7
7
  gem "rspec", "~> 3.0"
8
- gem "dotenv", "~> 2.7.6"
9
8
  gem "thor", "~> 1.0.1"
10
9
  gem "sqlite3", "~> 1.4.2"
11
10
  gem "httparty", "~> 0.18.1"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tsks (0.0.4)
4
+ tsks (0.0.7)
5
5
  httparty
6
6
  sqlite3
7
7
  thor
@@ -11,7 +11,6 @@ GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
13
  diff-lcs (1.4.4)
14
- dotenv (2.7.6)
15
14
  httparty (0.18.1)
16
15
  mime-types (~> 3.0)
17
16
  multi_xml (>= 0.5.2)
@@ -45,7 +44,6 @@ PLATFORMS
45
44
  ruby
46
45
 
47
46
  DEPENDENCIES
48
- dotenv (~> 2.7.6)
49
47
  httparty (~> 0.18.1)
50
48
  rake (~> 12.0)
51
49
  rspec (~> 3.0)
@@ -55,4 +53,4 @@ DEPENDENCIES
55
53
  uuid (~> 2.3.9)
56
54
 
57
55
  BUNDLED WITH
58
- 2.1.2
56
+ 2.2.22
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 **v0.0.2** in your machine
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/cli.rb CHANGED
@@ -6,12 +6,16 @@ require "tsks/actions"
6
6
 
7
7
  module Tsks
8
8
  class CLI < Thor
9
- @setup_folder = File.expand_path ENV["SETUP_FOLDER"] || "~/.tsks"
9
+ @setup_folder = File.expand_path "~/.tsks"
10
10
 
11
11
  def self.setup_folder
12
12
  @setup_folder
13
13
  end
14
14
 
15
+ def self.setup_folder= folder_path
16
+ @setup_folder = folder_path
17
+ end
18
+
15
19
  desc "version", ""
16
20
  def version
17
21
  puts "tsks #{Tsks::VERSION}"
@@ -61,13 +65,13 @@ module Tsks
61
65
  tsks = nil
62
66
 
63
67
  if options[:done] && options[:context]
64
- tsks = Tsks::Storage.select_by({done: 1, context: options[:context]})
68
+ tsks = Tsks::Storage.select_by({status: 'done', context: options[:context]})
65
69
  elsif options[:done]
66
- tsks = Tsks::Storage.select_by({done: 1})
70
+ tsks = Tsks::Storage.select_by({status: 'done'})
67
71
  elsif options[:context]
68
72
  tsks = Tsks::Storage.select_by({context: options[:context]})
69
73
  else
70
- tsks = Tsks::Storage.select_by({done: 0})
74
+ tsks = Tsks::Storage.select_by({status: 'todo'})
71
75
  end
72
76
 
73
77
  if tsks.count > 0
@@ -91,12 +95,12 @@ module Tsks
91
95
  res = Tsks::Request.post "/register", {email: options[:email],
92
96
  password: options[:password]}
93
97
 
94
- if res && res[:status_code] == 201
98
+ if res && res[:ok] == true
95
99
  File.write File.join(CLI.setup_folder, "token"), res[:token]
96
100
  File.write File.join(CLI.setup_folder, "user_id"), res[:user_id]
97
101
  Tsks::Actions.update_tsks_with_uuid res[:user_id]
98
102
  puts "Succesfully registered."
99
- elsif res && res[:status_code] == 409
103
+ elsif res && res[:ok] == false
100
104
  puts "This e-mail is already registered."
101
105
  end
102
106
  rescue Errno::ECONNREFUSED, SocketError
@@ -118,12 +122,12 @@ module Tsks
118
122
  res = Tsks::Request.post "/login", {email: options[:email],
119
123
  password: options[:password]}
120
124
 
121
- if res && res[:status_code] == 200
125
+ if res && res[:ok] == true
122
126
  File.write File.join(CLI.setup_folder, "token"), res[:token]
123
127
  File.write File.join(CLI.setup_folder, "user_id"), res[:user_id]
124
128
  Tsks::Actions.update_tsks_with_uuid res[:user_id]
125
129
  puts "Succesfully logged in."
126
- elsif res && res[:status_code] == 403
130
+ elsif res && res[:ok] == false
127
131
  puts "Invalid e-mail or password."
128
132
  end
129
133
  rescue Errno::ECONNREFUSED, SocketError
@@ -160,7 +164,7 @@ module Tsks
160
164
  remote_tsks.append tsk
161
165
  end
162
166
 
163
- if get_res[:status_code] == 200
167
+ if get_res[:ok] == true
164
168
  local_tsks_to_post = local_tsks - remote_tsks
165
169
  if local_tsks_to_post.count > 0
166
170
  Tsks::Request.post "/tsks", token, {tsks: local_tsks_to_post}
data/lib/tsks/request.rb CHANGED
@@ -2,7 +2,7 @@ require "httparty"
2
2
 
3
3
  module Tsks
4
4
  class Request
5
- @base_uri = ENV["BASE_API_URI"] || "https://tsks-api.herokuapp.com/v1"
5
+ @base_uri = "https://tsks-api.herokuapp.com/v1"
6
6
 
7
7
  def self.base_uri
8
8
  @base_uri
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, context, done, created_at, updated_at) VALUES
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=true WHERE rowid=?", local_id
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[:context] = tsk[4]
158
- t[:done] = tsk[5]
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[:context] = tsk[3]
166
- t[:done] = tsk[4]
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
@@ -1,3 +1,3 @@
1
1
  module Tsks
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.7"
3
3
  end
data/lib/tsks.rb CHANGED
@@ -1,4 +1,3 @@
1
- require "dotenv/load"
2
1
  require "tsks/version"
3
2
  require "tsks/cli"
4
3
 
data/tsks.gemspec CHANGED
@@ -18,7 +18,6 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
  spec.add_development_dependency "rspec"
21
- spec.add_development_dependency "dotenv"
22
21
  spec.add_dependency "thor"
23
22
  spec.add_dependency "sqlite3"
24
23
  spec.add_dependency "httparty"
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
4
+ version: 0.0.7
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: 2020-11-09 00:00:00.000000000 Z
11
+ date: 2022-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: dotenv
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: thor
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -94,7 +80,7 @@ dependencies:
94
80
  - - ">="
95
81
  - !ruby/object:Gem::Version
96
82
  version: '0'
97
- description:
83
+ description:
98
84
  email:
99
85
  - luanrvmood@gmail.com
100
86
  executables:
@@ -126,7 +112,7 @@ metadata:
126
112
  allowed_push_host: https://rubygems.org
127
113
  homepage_uri: https://github.com/luanrvmood/tsks
128
114
  source_code_uri: https://github.com/luanrvmood/tsks
129
- post_install_message:
115
+ post_install_message:
130
116
  rdoc_options: []
131
117
  require_paths:
132
118
  - lib
@@ -141,8 +127,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
127
  - !ruby/object:Gem::Version
142
128
  version: '0'
143
129
  requirements: []
144
- rubygems_version: 3.1.2
145
- signing_key:
130
+ rubygems_version: 3.3.7
131
+ signing_key:
146
132
  specification_version: 4
147
133
  summary: A stateful command line interface to help you handle your daily tsks (with
148
134
  synchronisation and contexts!)