weekdone-cli 0.1.1
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 +7 -0
- data/.gitignore +59 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +55 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +21 -0
- data/Makefile +9 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/weekdone +5 -0
- data/lib/weekdone/cli.rb +9 -0
- data/lib/weekdone/cli/base.rb +17 -0
- data/lib/weekdone/cli/command.rb +73 -0
- data/lib/weekdone/cli/command_company.rb +22 -0
- data/lib/weekdone/cli/command_item.rb +44 -0
- data/lib/weekdone/cli/command_objective.rb +46 -0
- data/lib/weekdone/cli/command_tag.rb +32 -0
- data/lib/weekdone/cli/credential.rb +17 -0
- data/lib/weekdone/cli/output.rb +24 -0
- data/lib/weekdone/cli/version.rb +5 -0
- data/weekdone-cli.gemspec +30 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 20d5e54c2c787ee68b9a37f1c13c701d0f4d6379
|
4
|
+
data.tar.gz: 10eca4644da8e9059211c9e6d62aa4789b4af9ad
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7a38dbe9feb95b65d29f17d9f33c82e997715442c1459d1726c751d27b5122873af5199e17732055d1956ffea608959c5523e9046ff22bcd001afd62d4daca0c
|
7
|
+
data.tar.gz: 4c709085b224c0f9ba6cf1e283b70f4dc85e8797827e7b7ac661ed775852b26952de269b2875195efb5b4d87dc774aafd4ab6e1603c07c88c3a326c8adf80a45
|
data/.gitignore
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/test/tmp/
|
8
|
+
/test/version_tmp/
|
9
|
+
/tmp/
|
10
|
+
|
11
|
+
# Used by dotenv library to load environment variables.
|
12
|
+
# .env
|
13
|
+
|
14
|
+
# Ignore Byebug command history file.
|
15
|
+
.byebug_history
|
16
|
+
|
17
|
+
## Specific to RubyMotion:
|
18
|
+
.dat*
|
19
|
+
.repl_history
|
20
|
+
build/
|
21
|
+
*.bridgesupport
|
22
|
+
build-iPhoneOS/
|
23
|
+
build-iPhoneSimulator/
|
24
|
+
|
25
|
+
## Specific to RubyMotion (use of CocoaPods):
|
26
|
+
#
|
27
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
28
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
29
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
30
|
+
#
|
31
|
+
# vendor/Pods/
|
32
|
+
|
33
|
+
## Documentation cache and generated files:
|
34
|
+
/.yardoc/
|
35
|
+
/_yardoc/
|
36
|
+
/doc/
|
37
|
+
/rdoc/
|
38
|
+
|
39
|
+
## Environment normalization:
|
40
|
+
/.bundle/
|
41
|
+
/vendor/bundle
|
42
|
+
/lib/bundler/man/
|
43
|
+
|
44
|
+
# for a library or gem, you might want to ignore these files since the code is
|
45
|
+
# intended to run in multiple environments; otherwise, check them in:
|
46
|
+
# Gemfile.lock
|
47
|
+
# .ruby-version
|
48
|
+
# .ruby-gemset
|
49
|
+
|
50
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
51
|
+
.rvmrc
|
52
|
+
|
53
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
54
|
+
# .rubocop-https?--*
|
55
|
+
|
56
|
+
# rspec failure tracking
|
57
|
+
/spec/reports/
|
58
|
+
/spec/examples.txt
|
59
|
+
.rspec_status
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
weekdone-cli (0.1.1)
|
5
|
+
thor (~> 1.0)
|
6
|
+
weekdone-sdk (~> 0.3)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
diff-lcs (1.4.4)
|
12
|
+
faraday (1.0.1)
|
13
|
+
multipart-post (>= 1.2, < 3)
|
14
|
+
jwt (2.2.2)
|
15
|
+
multi_json (1.15.0)
|
16
|
+
multi_xml (0.6.0)
|
17
|
+
multipart-post (2.1.1)
|
18
|
+
oauth2 (1.4.4)
|
19
|
+
faraday (>= 0.8, < 2.0)
|
20
|
+
jwt (>= 1.0, < 3.0)
|
21
|
+
multi_json (~> 1.3)
|
22
|
+
multi_xml (~> 0.5)
|
23
|
+
rack (>= 1.2, < 3)
|
24
|
+
rack (2.2.3)
|
25
|
+
rake (12.3.3)
|
26
|
+
rspec (3.9.0)
|
27
|
+
rspec-core (~> 3.9.0)
|
28
|
+
rspec-expectations (~> 3.9.0)
|
29
|
+
rspec-mocks (~> 3.9.0)
|
30
|
+
rspec-core (3.9.2)
|
31
|
+
rspec-support (~> 3.9.3)
|
32
|
+
rspec-expectations (3.9.2)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.9.0)
|
35
|
+
rspec-mocks (3.9.1)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.9.0)
|
38
|
+
rspec-support (3.9.3)
|
39
|
+
thor (1.0.1)
|
40
|
+
weekdone-sdk (0.3.2)
|
41
|
+
faraday (~> 1.0)
|
42
|
+
oauth2 (~> 1.4)
|
43
|
+
|
44
|
+
PLATFORMS
|
45
|
+
ruby
|
46
|
+
|
47
|
+
DEPENDENCIES
|
48
|
+
rake (~> 12.0)
|
49
|
+
rspec (~> 3.0)
|
50
|
+
thor (~> 1.0)
|
51
|
+
weekdone-cli!
|
52
|
+
weekdone-sdk (~> 0.3)
|
53
|
+
|
54
|
+
BUNDLED WITH
|
55
|
+
2.1.4
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2020 thaim
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 thaim
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/Makefile
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
|
2
|
+
.PHONY: help release
|
3
|
+
|
4
|
+
help: ## Show help
|
5
|
+
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-12s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
6
|
+
|
7
|
+
release: ## Publish gem to rubygems.org
|
8
|
+
bundle exec rake release
|
9
|
+
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Weekdone CLI
|
2
|
+
CLI for weekdone
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
|
6
|
+
1. Register [weekdone-sdk](https://github.com/thaim/weekdone-sdk-ruby) application to [weekdone.com](https://weekdone.com/settings?tab=application).
|
7
|
+
2. Configure your `Client ID` and `Client Secret` as environment variable `WEEKDONE_CLIENT_ID` and `WEEKDONE_CLIENT_SECRET`.
|
8
|
+
3. Loging by running `$ weekdone login`. Make sure you have to paste Oauth2 code to stdin.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'weekdone-cli'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle install
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install weekdone-cli
|
25
|
+
|
26
|
+
## Development
|
27
|
+
|
28
|
+
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.
|
29
|
+
|
30
|
+
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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/thaim/weekdone-cli.
|
35
|
+
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "weekdone/cli"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/weekdone
ADDED
data/lib/weekdone/cli.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'weekdone'
|
2
|
+
|
3
|
+
require_relative 'credential'
|
4
|
+
|
5
|
+
module Weekdone::Cli
|
6
|
+
def build_client
|
7
|
+
client_id = ENV['WEEKDONE_CLIENT_ID']
|
8
|
+
client_secret = ENV['WEEKDONE_CLIENT_SECRET']
|
9
|
+
|
10
|
+
client = Weekdone::Api.new(client_id, client_secret)
|
11
|
+
|
12
|
+
token_hash = Credential.read_credential
|
13
|
+
client.token_hash = token_hash if not token_hash.nil?
|
14
|
+
|
15
|
+
client
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'weekdone'
|
3
|
+
|
4
|
+
require_relative 'command_item'
|
5
|
+
require_relative 'command_tag'
|
6
|
+
require_relative 'command_objective'
|
7
|
+
require_relative 'command_company'
|
8
|
+
|
9
|
+
module Weekdone::Cli
|
10
|
+
class Command < Thor
|
11
|
+
include Weekdone::Cli
|
12
|
+
|
13
|
+
def self.exit_on_failure?
|
14
|
+
true
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "login", "oauth login to weekdone"
|
18
|
+
def login
|
19
|
+
client = build_client
|
20
|
+
|
21
|
+
puts "open URL to authorize:"
|
22
|
+
puts client.authorization_request
|
23
|
+
|
24
|
+
print "\ninput authorization code: "
|
25
|
+
auth_code = STDIN.gets.chomp
|
26
|
+
client.authorization_grant(auth_code)
|
27
|
+
|
28
|
+
Credential.write_credential(client.token_hash)
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "report", "get report"
|
32
|
+
def report
|
33
|
+
client = build_client
|
34
|
+
|
35
|
+
report = client.getReport
|
36
|
+
Credential.write_credential(client.token_hash)
|
37
|
+
Output.format(report, format: :json)
|
38
|
+
end
|
39
|
+
|
40
|
+
desc "teams", "get all teams"
|
41
|
+
def teams
|
42
|
+
client = build_client
|
43
|
+
|
44
|
+
teams = client.getAllTeams
|
45
|
+
Credential.write_credential(client.token_hash)
|
46
|
+
Output.format(teams, format: :json)
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "users", "get all users"
|
50
|
+
def users
|
51
|
+
client = build_client
|
52
|
+
|
53
|
+
users = client.getAllUsers
|
54
|
+
Credential.write_credential(client.token_hash)
|
55
|
+
Output.format(users, format: :json)
|
56
|
+
end
|
57
|
+
|
58
|
+
desc "types", "get all types"
|
59
|
+
def types
|
60
|
+
client = build_client
|
61
|
+
|
62
|
+
types = client.getAllTypes
|
63
|
+
Credential.write_credential(client.token_hash)
|
64
|
+
Output.format(types, format: :json)
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
register(Item, 'item', 'item [COMMAND]', 'command for item')
|
69
|
+
register(Tag, 'tag', 'tag [COMMAND]', 'command for tag')
|
70
|
+
register(Objective, 'objective', 'objective [COMMAND]', 'command for objective')
|
71
|
+
register(Company, 'company', 'company [COMMAND]', 'command for company')
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'weekdone'
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
require_relative 'base'
|
6
|
+
require_relative 'credential'
|
7
|
+
require_relative 'output'
|
8
|
+
|
9
|
+
module Weekdone::Cli
|
10
|
+
class Company < Thor
|
11
|
+
include Weekdone::Cli
|
12
|
+
|
13
|
+
desc "info", "get company info"
|
14
|
+
def info
|
15
|
+
client = build_client
|
16
|
+
|
17
|
+
info = client.getCompanyInfo
|
18
|
+
Credential.write_credential(client.token_hash)
|
19
|
+
Output.format(info, format: :json)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'weekdone'
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
require_relative 'base'
|
6
|
+
require_relative 'credential'
|
7
|
+
require_relative 'output'
|
8
|
+
|
9
|
+
module Weekdone::Cli
|
10
|
+
class Item < Thor
|
11
|
+
include Weekdone::Cli
|
12
|
+
|
13
|
+
desc "search", "search for items"
|
14
|
+
option :userid, type: :numeric, required: true
|
15
|
+
def search
|
16
|
+
client = build_client
|
17
|
+
|
18
|
+
items = client.searchForItems(user_id: options[:userid])
|
19
|
+
Credential.write_credential(client.token_hash)
|
20
|
+
Output.format(items, format: :json)
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "likes", "get item likes"
|
24
|
+
option :itemid, type: :numeric, required: true
|
25
|
+
def likes
|
26
|
+
client = build_client
|
27
|
+
|
28
|
+
likes = client.getItemLikes(options[:itemid])
|
29
|
+
Credential.write_credential(client.token_hash)
|
30
|
+
Output.format(likes, format: :json)
|
31
|
+
end
|
32
|
+
|
33
|
+
map 'get-comments' => 'getComments'
|
34
|
+
desc "get-comments", "get item comments"
|
35
|
+
option :itemid, type: :numeric, required: true
|
36
|
+
def getComments
|
37
|
+
client = build_client
|
38
|
+
|
39
|
+
comments = client.getItemComments(options[:itemid])
|
40
|
+
Credential.write_credential(client.token_hash)
|
41
|
+
Output.format(comments, :json)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'weekdone'
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
require_relative 'base'
|
6
|
+
require_relative 'credential'
|
7
|
+
require_relative 'output'
|
8
|
+
|
9
|
+
|
10
|
+
module Weekdone::Cli
|
11
|
+
class Objective < Thor
|
12
|
+
include Weekdone::Cli
|
13
|
+
|
14
|
+
desc "list", "get all objectives"
|
15
|
+
option :type, type: :string
|
16
|
+
option :departmentid, type: :numeric
|
17
|
+
option :teamid, type: :numeric
|
18
|
+
option :userid, type: :numeric
|
19
|
+
option :period, type: :string
|
20
|
+
def list
|
21
|
+
client = build_client
|
22
|
+
|
23
|
+
params = {}
|
24
|
+
params[:type] = options[:type] if not options[:type].nil?
|
25
|
+
params[:departmentid] = options[:departmentid] if not options[:departmentid].nil?
|
26
|
+
params[:teamid] = options[:teamid] if not options[:teamid].nil?
|
27
|
+
params[:userid] = options[:userid] if not options[:userid].nil?
|
28
|
+
params[:period] = options[:period] if not options[:period].nil?
|
29
|
+
|
30
|
+
objectives = client.getAllObjectives(params)
|
31
|
+
|
32
|
+
Credential.write_credential(client.token_hash)
|
33
|
+
Output.format(objectives, format: :json)
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "comments", "list objective comments"
|
37
|
+
option :objectiveid, type: :numeric, required: true
|
38
|
+
def comments
|
39
|
+
client = build_client
|
40
|
+
|
41
|
+
objectives = client.listObjectiveComments(options[:objectiveid])
|
42
|
+
Credential.write_credential(client.token_hash)
|
43
|
+
Output.format(objectives, format: :json)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'weekdone'
|
3
|
+
require 'logger'
|
4
|
+
|
5
|
+
require_relative 'base'
|
6
|
+
require_relative 'credential'
|
7
|
+
require_relative 'output'
|
8
|
+
|
9
|
+
module Weekdone::Cli
|
10
|
+
class Tag < Thor
|
11
|
+
include Weekdone::Cli
|
12
|
+
|
13
|
+
desc "list", "get all tags"
|
14
|
+
def list
|
15
|
+
client = build_client
|
16
|
+
|
17
|
+
tags = client.getAllTags
|
18
|
+
Credential.write_credential(client.token_hash)
|
19
|
+
Output.format(tags, format: :json)
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "get", "get single tag"
|
23
|
+
option :tagid, type: :numeric, required: true
|
24
|
+
def get
|
25
|
+
client = build_client
|
26
|
+
|
27
|
+
tag = client.getSingleTag(options[:tagid])
|
28
|
+
Credential.write_credential(client.token_hash)
|
29
|
+
Output.format(tag, format: :json)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Weekdone::Cli
|
2
|
+
class Credential
|
3
|
+
def self.read_credential
|
4
|
+
File.open(ENV['HOME'] + "/.weekdone/credentials", "r") do |f|
|
5
|
+
@credential = JSON.parse(f.gets)
|
6
|
+
end
|
7
|
+
|
8
|
+
@credential
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.write_credential(token_hash)
|
12
|
+
File.open(ENV['HOME'] + "/.weekdone/credentials", "w") do |f|
|
13
|
+
f.write(token_hash.to_json)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
module Weekdone::Cli
|
4
|
+
class Output
|
5
|
+
class << self
|
6
|
+
def format(data, format: :json, loglevel: Logger::DEBUG)
|
7
|
+
@@logger = Logger.new(STDERR)
|
8
|
+
@@logger.level = loglevel
|
9
|
+
|
10
|
+
if format == :json
|
11
|
+
@@logger.debug("print in json format")
|
12
|
+
print data.to_json
|
13
|
+
elsif format == :text
|
14
|
+
@@logger.debug("print in text format")
|
15
|
+
formatText(data)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def formatText(data)
|
20
|
+
print data
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require_relative 'lib/weekdone/cli/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "weekdone-cli"
|
5
|
+
spec.version = Weekdone::Cli::VERSION
|
6
|
+
spec.authors = ["thaim"]
|
7
|
+
spec.email = ["thaim24@gmail.com"]
|
8
|
+
|
9
|
+
spec.summary = "cli for weekdone"
|
10
|
+
spec.description = "cli for weekdone"
|
11
|
+
spec.homepage = "https://github.com/thaim/weekdone-cli-ruby"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
+
|
15
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
16
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
17
|
+
spec.metadata["changelog_uri"] = spec.homepage
|
18
|
+
|
19
|
+
# Specify which files should be added to the gem when it is released.
|
20
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
21
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
22
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
|
+
end
|
24
|
+
spec.bindir = "exe"
|
25
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
|
+
spec.require_paths = ["lib"]
|
27
|
+
|
28
|
+
spec.add_dependency "thor", "~> 1.0"
|
29
|
+
spec.add_dependency "weekdone-sdk", "~> 0.3"
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: weekdone-cli
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- thaim
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-08-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: weekdone-sdk
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.3'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.3'
|
41
|
+
description: cli for weekdone
|
42
|
+
email:
|
43
|
+
- thaim24@gmail.com
|
44
|
+
executables:
|
45
|
+
- weekdone
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- ".rspec"
|
51
|
+
- ".travis.yml"
|
52
|
+
- Gemfile
|
53
|
+
- Gemfile.lock
|
54
|
+
- LICENSE
|
55
|
+
- LICENSE.txt
|
56
|
+
- Makefile
|
57
|
+
- README.md
|
58
|
+
- Rakefile
|
59
|
+
- bin/console
|
60
|
+
- bin/setup
|
61
|
+
- exe/weekdone
|
62
|
+
- lib/weekdone/cli.rb
|
63
|
+
- lib/weekdone/cli/base.rb
|
64
|
+
- lib/weekdone/cli/command.rb
|
65
|
+
- lib/weekdone/cli/command_company.rb
|
66
|
+
- lib/weekdone/cli/command_item.rb
|
67
|
+
- lib/weekdone/cli/command_objective.rb
|
68
|
+
- lib/weekdone/cli/command_tag.rb
|
69
|
+
- lib/weekdone/cli/credential.rb
|
70
|
+
- lib/weekdone/cli/output.rb
|
71
|
+
- lib/weekdone/cli/version.rb
|
72
|
+
- weekdone-cli.gemspec
|
73
|
+
homepage: https://github.com/thaim/weekdone-cli-ruby
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata:
|
77
|
+
homepage_uri: https://github.com/thaim/weekdone-cli-ruby
|
78
|
+
source_code_uri: https://github.com/thaim/weekdone-cli-ruby
|
79
|
+
changelog_uri: https://github.com/thaim/weekdone-cli-ruby
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 2.3.0
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
requirements: []
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 2.6.13
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: cli for weekdone
|
100
|
+
test_files: []
|