noko_cli 0.1.0 → 0.2.0

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: abe5e53bc2eb433366dc06a9c8dfff7536dec60d03b695f73cb6e00af6c0d717
4
- data.tar.gz: caabe1b9b771830f1b3d79c6166caafdcdfc89ae6878c8168741042e635bcf93
3
+ metadata.gz: d780be4c41c8d0cff7f3e342841085d8fcb558eadc6502c5d36fbbe8c84decad
4
+ data.tar.gz: 1308b2f5e9d97e5e2b6fd63b6d8768ba5522d5599653c619264f787f5f9bab79
5
5
  SHA512:
6
- metadata.gz: 63478e76b192460dc5e6bacadd75056b6d777ba165997072686f0d7341a320421b1d6f88f56299e55bbd5182252347675ef57f41b0df55c0823f6cdc448e7e27
7
- data.tar.gz: 66b1b46a4103369bc6d477d61ab83e48149c08b17464257c99ed5149dc7a4c034bb6938af3ce9ccc5857e558337f4fe5ce9b35fe3e64b412a11c511042d07496
6
+ metadata.gz: c3429ac28510732444354e9d1dbfbba0bee6a2b086aae8b3ef2262ba9b0eca39d20e06d71e137dd1696e9c1b328a1b14ccbb002685b5c706772f2b093c60742e
7
+ data.tar.gz: c7eb6d562c9bd1a126aaefe07e342113728be25ff22b4e794c44f8c46363884f81be9e999f9802f652122299d65f5d9a4a9ba9fecbcf91fb967180bcfbed93c1
data/.overcommit.yml ADDED
@@ -0,0 +1,41 @@
1
+ # Use this file to configure the Overcommit hooks you wish to use. This will
2
+ # extend the default configuration defined in:
3
+ # https://github.com/sds/overcommit/blob/master/config/default.yml
4
+ #
5
+ # At the topmost level of this YAML file is a key representing type of hook
6
+ # being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
7
+ # customize each hook, such as whether to only run it on certain files (via
8
+ # `include`), whether to only display output if it fails (via `quiet`), etc.
9
+ #
10
+ # For a complete list of hooks, see:
11
+ # https://github.com/sds/overcommit/tree/master/lib/overcommit/hook
12
+ #
13
+ # For a complete list of options that you can use to customize hooks, see:
14
+ # https://github.com/sds/overcommit#configuration
15
+ #
16
+ # Uncomment the following lines to make the configuration take effect.
17
+
18
+ #PostCheckout:
19
+ # ALL: # Special hook name that customizes all hooks of this type
20
+ # quiet: true # Change all post-checkout hooks to only display output on failure
21
+ #
22
+ # IndexTags:
23
+ # enabled: true # Generate a tags file with `ctags` each time HEAD changes
24
+
25
+ PreCommit:
26
+ TrailingWhitespace:
27
+ enabled: true
28
+ RuboCop:
29
+ enabled: true
30
+ command: ["bundle", "exec", "rubocop"]
31
+
32
+ PrePush:
33
+ RSpec:
34
+ enabled: true
35
+
36
+ PostCheckout:
37
+ ALL:
38
+ quiet: true
39
+
40
+ IndexTags:
41
+ enabled: true
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ AllCops:
2
+ NewCops: enable
3
+
4
+ require:
5
+ - rubocop-performance
6
+ - rubocop-rake
7
+ - rubocop-rspec
8
+
9
+ Style/StringLiterals:
10
+ EnforcedStyle: double_quotes
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.0.2
1
+ 2.6.6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
- ## [Unreleased]
1
+ # Changelog
2
2
 
3
- ## [0.1.0] - 2022-06-11
3
+ ## [0.2.0](https://github.com/JuanVqz/noko_cli/compare/v0.1.2...v0.2.0) (2022-07-31)
4
4
 
5
- - Initial release
5
+
6
+ ### Features
7
+
8
+ * **gems:** Add zeitwerk configuration ([#34](https://github.com/JuanVqz/noko_cli/issues/34)) ([535bd6b](https://github.com/JuanVqz/noko_cli/commit/535bd6bbbe172b197a16931dd39453458c4ecd7b)), closes [#31](https://github.com/JuanVqz/noko_cli/issues/31)
9
+
10
+
11
+ ### Miscellaneous
12
+
13
+ * **noko_cli:** Show project's name in entries list ([#36](https://github.com/JuanVqz/noko_cli/issues/36)) ([e9c303a](https://github.com/JuanVqz/noko_cli/commit/e9c303abba74f9154a8f42c76897f953f5045e1d)), closes [#35](https://github.com/JuanVqz/noko_cli/issues/35)
14
+ * **workflows:** Fix release typo ([#32](https://github.com/JuanVqz/noko_cli/issues/32)) ([3d6a359](https://github.com/JuanVqz/noko_cli/commit/3d6a359ddb0f3edef1c80acd2072567f4ad26948))
15
+
16
+ ## [0.1.2](https://github.com/JuanVqz/noko_cli/compare/v0.1.1...v0.1.2) (2022-07-23)
17
+
18
+
19
+ ### Miscellaneous
20
+
21
+ * Change standard to rubocop ([#27](https://github.com/JuanVqz/noko_cli/issues/27)) ([4a28bd4](https://github.com/JuanVqz/noko_cli/commit/4a28bd400d7f14e7e47016091fa82a399988e86c))
22
+ * **GitHub-action:** Change name ([#30](https://github.com/JuanVqz/noko_cli/issues/30)) ([e4a1745](https://github.com/JuanVqz/noko_cli/commit/e4a1745c618360c1b4e616ffa3287bf56e958549))
23
+ * **readme:** Update test status ([5db36b9](https://github.com/JuanVqz/noko_cli/commit/5db36b9b7d1cbb7c0761af9e8503c5ef3fdef8ec))
24
+
25
+ ## 0.1.1 (2022-07-03)
26
+
27
+
28
+ ### Miscellaneous
29
+
30
+ * Add release-please config ([6d26c03](https://github.com/JuanVqz/noko_cli/commit/6d26c0368e3529b850f350e0ea42ac1e5beca4d9))
data/Gemfile CHANGED
@@ -7,4 +7,7 @@ gemspec
7
7
 
8
8
  gem "rake", "~> 13.0"
9
9
  gem "rspec", "~> 3.0"
10
- gem "standard", "~> 1.3"
10
+ gem "rubocop", "~> 1.31.1", require: false
11
+ gem "rubocop-performance", "~> 1.14.2", require: false
12
+ gem "rubocop-rake", "~> 0.6.0", require: false
13
+ gem "rubocop-rspec", "~> 2.12.1", require: false
data/Gemfile.lock CHANGED
@@ -1,16 +1,31 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- noko_cli (0.1.0)
4
+ noko_cli (0.2.0)
5
+ faraday (~> 2.3.0)
6
+ tty-table (~> 0.12.0)
7
+ zeitwerk (~> 2.6)
5
8
 
6
9
  GEM
7
10
  remote: https://rubygems.org/
8
11
  specs:
9
12
  ast (2.4.2)
13
+ coderay (1.1.3)
10
14
  diff-lcs (1.5.0)
15
+ faraday (2.3.0)
16
+ faraday-net_http (~> 2.0)
17
+ ruby2_keywords (>= 0.0.4)
18
+ faraday-net_http (2.1.0)
19
+ json (2.6.2)
20
+ method_source (1.0.0)
11
21
  parallel (1.22.1)
12
22
  parser (3.1.2.0)
13
23
  ast (~> 2.4.1)
24
+ pastel (0.8.0)
25
+ tty-color (~> 0.5)
26
+ pry (0.14.1)
27
+ coderay (~> 1.1)
28
+ method_source (~> 1.0)
14
29
  rainbow (3.1.1)
15
30
  rake (13.0.6)
16
31
  regexp_parser (2.5.0)
@@ -28,34 +43,54 @@ GEM
28
43
  diff-lcs (>= 1.2.0, < 2.0)
29
44
  rspec-support (~> 3.11.0)
30
45
  rspec-support (3.11.0)
31
- rubocop (1.29.1)
46
+ rubocop (1.31.1)
47
+ json (~> 2.3)
32
48
  parallel (~> 1.10)
33
49
  parser (>= 3.1.0.0)
34
50
  rainbow (>= 2.2.2, < 4.0)
35
51
  regexp_parser (>= 1.8, < 3.0)
36
52
  rexml (>= 3.2.5, < 4.0)
37
- rubocop-ast (>= 1.17.0, < 2.0)
53
+ rubocop-ast (>= 1.18.0, < 2.0)
38
54
  ruby-progressbar (~> 1.7)
39
55
  unicode-display_width (>= 1.4.0, < 3.0)
40
56
  rubocop-ast (1.18.0)
41
57
  parser (>= 3.1.1.0)
42
- rubocop-performance (1.13.3)
58
+ rubocop-performance (1.14.2)
43
59
  rubocop (>= 1.7.0, < 2.0)
44
60
  rubocop-ast (>= 0.4.0)
61
+ rubocop-rake (0.6.0)
62
+ rubocop (~> 1.0)
63
+ rubocop-rspec (2.12.1)
64
+ rubocop (~> 1.31)
45
65
  ruby-progressbar (1.11.0)
46
- standard (1.12.1)
47
- rubocop (= 1.29.1)
48
- rubocop-performance (= 1.13.3)
49
- unicode-display_width (2.1.0)
66
+ ruby2_keywords (0.0.5)
67
+ strings (0.2.1)
68
+ strings-ansi (~> 0.2)
69
+ unicode-display_width (>= 1.5, < 3.0)
70
+ unicode_utils (~> 1.4)
71
+ strings-ansi (0.2.0)
72
+ tty-color (0.6.0)
73
+ tty-screen (0.8.1)
74
+ tty-table (0.12.0)
75
+ pastel (~> 0.8)
76
+ strings (~> 0.2.0)
77
+ tty-screen (~> 0.8)
78
+ unicode-display_width (2.2.0)
79
+ unicode_utils (1.4.0)
80
+ zeitwerk (2.6.0)
50
81
 
51
82
  PLATFORMS
52
- x86_64-linux
83
+ ruby
53
84
 
54
85
  DEPENDENCIES
55
86
  noko_cli!
87
+ pry (~> 0.14.1)
56
88
  rake (~> 13.0)
57
89
  rspec (~> 3.0)
58
- standard (~> 1.3)
90
+ rubocop (~> 1.31.1)
91
+ rubocop-performance (~> 1.14.2)
92
+ rubocop-rake (~> 0.6.0)
93
+ rubocop-rspec (~> 2.12.1)
59
94
 
60
95
  BUNDLED WITH
61
- 2.3.15
96
+ 2.2.29
data/README.md CHANGED
@@ -1,34 +1,18 @@
1
1
  # NokoCli
2
2
 
3
- ![Test Suite](https://github.com/juanvqz/noko_cli/actions/workflows/main/badge.svg)
3
+ ![build status](https://github.com/juanvqz/noko_cli/actions/workflows/main.yml/badge.svg)
4
4
 
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/noko_cli`. To experiment with that code, run `bin/console` for an interactive prompt.
6
-
7
- TODO: Delete this and the text above, and describe your gem
8
-
9
- ## Installation
10
-
11
- Install the gem and add to the application's Gemfile by executing:
12
-
13
- $ bundle add noko_cli
14
-
15
- If bundler is not being used to manage dependencies, install the gem by executing:
16
-
17
- $ gem install noko_cli
18
-
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
5
 
23
6
  ## Development
24
7
 
25
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
8
+ To setup this repository you need to run `./bin/setup`
26
9
 
27
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
10
 
29
11
  ## Contributing
30
12
 
31
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/noko_cli. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/noko_cli/blob/master/CODE_OF_CONDUCT.md).
13
+ Bug reports and pull requests are welcome on GitHub at https://github.com/juanvqz/noko_cli.
14
+ This project is intended to be a safe, welcoming space for collaboration,
15
+ and contributors are expected to adhere to the [code of conduct](https://github.com/juanvqz/noko_cli/blob/master/CODE_OF_CONDUCT.md).
32
16
 
33
17
  ## License
34
18
 
@@ -36,4 +20,6 @@ The gem is available as open source under the terms of the [MIT License](https:/
36
20
 
37
21
  ## Code of Conduct
38
22
 
39
- Everyone interacting in the NokoCli project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/noko_cli/blob/master/CODE_OF_CONDUCT.md).
23
+ Everyone interacting in the NokoCli project's codebases, issue trackers,
24
+ chat rooms and mailing lists is expected to follow the
25
+ [code of conduct](https://github.com/juanvqz/noko_cli/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile CHANGED
@@ -2,9 +2,14 @@
2
2
 
3
3
  require "bundler/gem_tasks"
4
4
  require "rspec/core/rake_task"
5
+ require "rubocop/rake_task"
5
6
 
6
7
  RSpec::Core::RakeTask.new(:spec)
7
8
 
8
- require "standard/rake"
9
+ RuboCop::RakeTask.new do |task|
10
+ task.requires << "rubocop-performance"
11
+ task.requires << "rubocop-rake"
12
+ task.requires << "rubocop-rspec"
13
+ end
9
14
 
10
- task default: %i[spec standard]
15
+ task default: %i[spec rubocop]
data/exe/noko_cli ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "noko_cli"
5
+
6
+ NokoCli::Entries.new.list
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "faraday"
4
+ require "tty-table"
5
+
6
+ module NokoCli
7
+ # This is an entry resource, which could be listed
8
+ class Entries
9
+ BASE_URL = "https://api.nokotime.com/v2"
10
+ NOKO_TOKEN = ENV.fetch("NOKO_TOKEN", nil)
11
+
12
+ def initialize(adapter: Faraday.default_adapter, stubs: nil)
13
+ @adapter = adapter
14
+ @stubs = stubs
15
+ end
16
+
17
+ def list
18
+ puts TTY::Table.new(headers, rows).render(:ascii, resize: true)
19
+ end
20
+
21
+ private
22
+
23
+ def conn
24
+ @conn ||= Faraday.new({ url: BASE_URL, params: { noko_token: NOKO_TOKEN } }) do |f|
25
+ unless @stubs
26
+ f.request :json
27
+ f.response :json, content_type: "application/json"
28
+ end
29
+ f.adapter @adapter, @stubs
30
+ end
31
+ end
32
+
33
+ def current_user_entries
34
+ conn.get("current_user/entries").body
35
+ end
36
+
37
+ def headers
38
+ %w[date minutes project description]
39
+ end
40
+
41
+ def rows
42
+ current_user_entries.map { |entry| row(entry) }
43
+ end
44
+
45
+ def row(entry)
46
+ [entry["date"], entry["minutes"], entry["project"]["name"], entry["description"]]
47
+ end
48
+ end
49
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NokoCli
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/noko_cli.rb CHANGED
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "noko_cli/version"
3
+ require "zeitwerk"
4
4
 
5
+ loader = Zeitwerk::Loader.for_gem
6
+ loader.setup
7
+
8
+ # The main task of this gem is allow users list and create new entries.
5
9
  module NokoCli
6
- class Error < StandardError; end
7
- # Your code goes here...
8
10
  end
metadata CHANGED
@@ -1,28 +1,86 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noko_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Vasquez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-27 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2022-07-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.3.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.3.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: tty-table
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.12.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.12.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: zeitwerk
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.6'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.14.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.14.1
13
69
  description: 'Noko CLI is the easiest way to add, remove, and view all your entries
14
70
  from your terminal.
15
71
 
16
72
  '
17
73
  email:
18
74
  - me@juanvasquez.dev
19
- executables: []
75
+ executables:
76
+ - noko_cli
20
77
  extensions: []
21
78
  extra_rdoc_files: []
22
79
  files:
80
+ - ".overcommit.yml"
23
81
  - ".rspec"
82
+ - ".rubocop.yml"
24
83
  - ".ruby-version"
25
- - ".standard.yml"
26
84
  - CHANGELOG.md
27
85
  - CODE_OF_CONDUCT.md
28
86
  - Gemfile
@@ -30,7 +88,9 @@ files:
30
88
  - LICENSE.txt
31
89
  - README.md
32
90
  - Rakefile
91
+ - exe/noko_cli
33
92
  - lib/noko_cli.rb
93
+ - lib/noko_cli/entries.rb
34
94
  - lib/noko_cli/version.rb
35
95
  - sig/noko_cli.rbs
36
96
  homepage: https://github.com/juanvqz/noko_cli
@@ -53,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
113
  - !ruby/object:Gem::Version
54
114
  version: '0'
55
115
  requirements: []
56
- rubygems_version: 3.2.22
116
+ rubygems_version: 3.0.3
57
117
  signing_key:
58
118
  specification_version: 4
59
119
  summary: Register Noko entries from the comfort of your terminal
data/.standard.yml DELETED
@@ -1,3 +0,0 @@
1
- # For available configuration options, see:
2
- # https://github.com/testdouble/standard
3
- ruby_version: 2.6