dude-cli 1.0.2 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +8 -0
  3. data/.gitignore +0 -2
  4. data/.travis.yml +4 -3
  5. data/CHANGELOG.md +25 -0
  6. data/Gemfile +0 -2
  7. data/Gemfile.lock +57 -54
  8. data/README.md +41 -25
  9. data/bin/dude +3 -2
  10. data/dude.gemspec +18 -15
  11. data/lib/dude.rb +13 -0
  12. data/lib/dude/commands.rb +24 -0
  13. data/lib/dude/commands/checkout.rb +21 -0
  14. data/lib/dude/commands/install.rb +57 -0
  15. data/lib/dude/commands/move.rb +15 -0
  16. data/lib/dude/commands/start.rb +29 -0
  17. data/lib/dude/commands/stop.rb +15 -0
  18. data/lib/dude/commands/tasks.rb +31 -0
  19. data/lib/dude/commands/track.rb +28 -0
  20. data/lib/dude/commands/version.rb +11 -0
  21. data/lib/dude/git.rb +5 -0
  22. data/lib/dude/git/checkout.rb +2 -16
  23. data/lib/dude/git/current_branch_name.rb +1 -2
  24. data/lib/dude/project_management/client.rb +25 -0
  25. data/lib/dude/project_management/entities/board.rb +9 -0
  26. data/lib/dude/project_management/entities/issue.rb +37 -0
  27. data/lib/dude/project_management/jira.rb +9 -0
  28. data/lib/dude/project_management/jira/client.rb +49 -0
  29. data/lib/dude/project_management/jira/get_current_tasks.rb +40 -0
  30. data/lib/dude/project_management/jira/get_task_name_by_id.rb +24 -0
  31. data/lib/dude/project_management/jira/move_task_to_list.rb +47 -0
  32. data/lib/dude/project_management/trello.rb +6 -0
  33. data/lib/dude/project_management/trello/checkout.rb +4 -0
  34. data/lib/dude/project_management/trello/client.rb +33 -0
  35. data/lib/dude/project_management/trello/get_current_tasks.rb +24 -0
  36. data/lib/dude/project_management/trello/get_lists.rb +15 -0
  37. data/lib/dude/project_management/trello/move_tasks_to_list.rb +14 -0
  38. data/lib/dude/settings.rb +6 -2
  39. data/lib/dude/time_trackers/toggl.rb +5 -0
  40. data/lib/dude/time_trackers/toggl/base.rb +18 -0
  41. data/lib/dude/{toggl → time_trackers/toggl}/start_time_entry.rb +14 -8
  42. data/lib/dude/{toggl → time_trackers/toggl}/stop_time_entry.rb +4 -2
  43. data/lib/dude/version.rb +1 -1
  44. metadata +69 -86
  45. data/.ruby-version +0 -1
  46. data/LICENSE.txt +0 -21
  47. data/lib/dude/cli.rb +0 -156
  48. data/lib/dude/gitlab/add_spend_time.rb +0 -36
  49. data/lib/dude/gitlab/base.rb +0 -38
  50. data/lib/dude/gitlab/count_spend_time.rb +0 -13
  51. data/lib/dude/gitlab/estimate.rb +0 -20
  52. data/lib/dude/gitlab/get_issue_info.rb +0 -9
  53. data/lib/dude/gitlab/get_issue_time_spent.rb +0 -9
  54. data/lib/dude/gitlab/get_issue_title.rb +0 -14
  55. data/lib/dude/gitlab/get_my_issues.rb +0 -31
  56. data/lib/dude/gitlab/move_issue.rb +0 -37
  57. data/lib/dude/interface.rb +0 -98
  58. data/lib/dude/report.rb +0 -38
  59. data/lib/dude/service.rb +0 -18
  60. data/lib/dude/toggl.rb +0 -40
  61. data/lib/dude/toggl/base.rb +0 -36
  62. data/lib/dude/toggl/issue_spend_time.rb +0 -56
  63. data/lib/dude/toggl/report.rb +0 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb7926440f3431ebb117b8b77a91d30761182f9de66f579231344bda39c44c46
4
- data.tar.gz: 1f00f5f11ab2a692e54b91c9d24859b1f099e6bc1321b5510e2368d9b3fdf25a
3
+ metadata.gz: ab445b19a9f362c797062bae3ae1e910d7c60a0448885058060ea7b0547e0726
4
+ data.tar.gz: a2467155447ac7a54d34a862afd530d0df1b9757bb724699bdd6bd7fa43e3794
5
5
  SHA512:
6
- metadata.gz: 508caccdec86a0dc90ae30a46ca91cf751b7a441bc587862be44859d3ea82074de7716faea229e3970242e8cdf447a7f8fce8f39b8c59571dc22eafe1b41cfbb
7
- data.tar.gz: 8991faf2d8cea44b026d365ed6e05eec3f85aeb2749f6ce060f6e02381aa032713ebdc28eec7d08fc07cb7755b0f08d36717e54caaae37f2090d455f3758e963
6
+ metadata.gz: a235a311dfa8a7e2aee949c0c091c256270742011cd64683f700fe6ff40905b188107531e9181c03c3156995ba0d7f058e043f1f09690fac1667833ca0302a47
7
+ data.tar.gz: 4ad3ba3d9c2b41486205a15446398711e4207e9984e6b701dda283e4c90e272c2f01f23d29f9ccc41bc385baeaea2488b8d17b40b9e58a4e0c719e02c4f18177
@@ -0,0 +1,8 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "03:00"
8
+ open-pull-requests-limit: 10
data/.gitignore CHANGED
@@ -6,8 +6,6 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
- .byebug_history
10
9
 
11
10
  # rspec failure tracking
12
11
  .rspec_status
13
- .ruby-gemset
data/.travis.yml CHANGED
@@ -1,5 +1,6 @@
1
- sudo: false
1
+ ---
2
2
  language: ruby
3
+ cache: bundler
3
4
  rvm:
4
- - 2.4.0
5
- before_install: gem install bundler -v 1.16.0
5
+ - 2.7.2
6
+ before_install: gem install bundler -v 2.1.4
data/CHANGELOG.md ADDED
@@ -0,0 +1,25 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased]
4
+
5
+ ### Added
6
+
7
+ - Added Trello support
8
+
9
+ ## [2.0.0] - 2021-03-10
10
+
11
+ ### Added
12
+
13
+ - Basic commands for project management
14
+ - Jira support
15
+ - Toggl support
16
+
17
+ ### Changed
18
+
19
+ - Removed stats
20
+ - Removed estimates
21
+ - Removed GitLab support
22
+ - Removed automatic project detection based on folder name. Replaced with .duderc setting
23
+
24
+ [2.0.0]: https://github.com/npupko/dude/releases/tag/2.0.0
25
+ [1.0.2]: https://github.com/npupko/dude/releases/tag/1.0.2
data/Gemfile CHANGED
@@ -1,6 +1,4 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
3
  # Specify your gem's dependencies in dude.gemspec
6
4
  gemspec
data/Gemfile.lock CHANGED
@@ -1,73 +1,76 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dude-cli (1.0.1)
5
- colorize (~> 0.8)
6
- git (~> 1.3)
7
- gitlab (~> 4.3)
8
- rest-client (~> 2.0)
9
- thor (~> 0.20)
4
+ dude-cli (2.0.4)
5
+ colorize (~> 0.8.1)
6
+ dry-cli (~> 0.6)
7
+ faraday (~> 1.1)
8
+ jira-ruby (~> 2.1)
10
9
 
11
10
  GEM
12
11
  remote: https://rubygems.org/
13
12
  specs:
14
- coderay (1.1.2)
13
+ activesupport (6.1.3)
14
+ concurrent-ruby (~> 1.0, >= 1.0.2)
15
+ i18n (>= 1.6, < 2)
16
+ minitest (>= 5.1)
17
+ tzinfo (~> 2.0)
18
+ zeitwerk (~> 2.3)
19
+ atlassian-jwt (0.2.0)
20
+ jwt (~> 2.1.0)
21
+ coderay (1.1.3)
15
22
  colorize (0.8.1)
16
- diff-lcs (1.3)
17
- domain_name (0.5.20180417)
18
- unf (>= 0.0.5, < 1.0.0)
19
- git (1.4.0)
20
- gitlab (4.4.0)
21
- httparty (>= 0.14.0)
22
- terminal-table (>= 1.5.1)
23
- http-cookie (1.0.3)
24
- domain_name (~> 0.5)
25
- httparty (0.16.2)
26
- multi_xml (>= 0.5.2)
27
- method_source (0.9.0)
28
- mime-types (3.1)
29
- mime-types-data (~> 3.2015)
30
- mime-types-data (3.2016.0521)
31
- multi_xml (0.6.0)
32
- netrc (0.11.0)
33
- pry (0.11.3)
34
- coderay (~> 1.1.0)
35
- method_source (~> 0.9.0)
36
- rake (10.0.4)
37
- rest-client (2.0.2)
38
- http-cookie (>= 1.0.2, < 2.0)
39
- mime-types (>= 1.16, < 4.0)
40
- netrc (~> 0.8)
41
- rspec (3.7.0)
42
- rspec-core (~> 3.7.0)
43
- rspec-expectations (~> 3.7.0)
44
- rspec-mocks (~> 3.7.0)
45
- rspec-core (3.7.0)
46
- rspec-support (~> 3.7.0)
47
- rspec-expectations (3.7.0)
23
+ concurrent-ruby (1.1.8)
24
+ diff-lcs (1.4.4)
25
+ dry-cli (0.6.0)
26
+ concurrent-ruby (~> 1.0)
27
+ faraday (1.3.0)
28
+ faraday-net_http (~> 1.0)
29
+ multipart-post (>= 1.2, < 3)
30
+ ruby2_keywords
31
+ faraday-net_http (1.0.1)
32
+ i18n (1.8.9)
33
+ concurrent-ruby (~> 1.0)
34
+ jira-ruby (2.1.5)
35
+ activesupport
36
+ atlassian-jwt
37
+ multipart-post
38
+ oauth (~> 0.5, >= 0.5.0)
39
+ jwt (2.1.0)
40
+ method_source (1.0.0)
41
+ minitest (5.14.4)
42
+ multipart-post (2.1.1)
43
+ oauth (0.5.5)
44
+ pry (0.14.0)
45
+ coderay (~> 1.1)
46
+ method_source (~> 1.0)
47
+ rake (13.0.3)
48
+ rspec (3.10.0)
49
+ rspec-core (~> 3.10.0)
50
+ rspec-expectations (~> 3.10.0)
51
+ rspec-mocks (~> 3.10.0)
52
+ rspec-core (3.10.1)
53
+ rspec-support (~> 3.10.0)
54
+ rspec-expectations (3.10.1)
48
55
  diff-lcs (>= 1.2.0, < 2.0)
49
- rspec-support (~> 3.7.0)
50
- rspec-mocks (3.7.0)
56
+ rspec-support (~> 3.10.0)
57
+ rspec-mocks (3.10.2)
51
58
  diff-lcs (>= 1.2.0, < 2.0)
52
- rspec-support (~> 3.7.0)
53
- rspec-support (3.7.0)
54
- terminal-table (1.8.0)
55
- unicode-display_width (~> 1.1, >= 1.1.1)
56
- thor (0.20.0)
57
- unf (0.1.4)
58
- unf_ext
59
- unf_ext (0.0.7.5)
60
- unicode-display_width (1.4.0)
59
+ rspec-support (~> 3.10.0)
60
+ rspec-support (3.10.2)
61
+ ruby2_keywords (0.0.4)
62
+ tzinfo (2.0.4)
63
+ concurrent-ruby (~> 1.0)
64
+ zeitwerk (2.4.2)
61
65
 
62
66
  PLATFORMS
63
67
  ruby
64
68
 
65
69
  DEPENDENCIES
66
- bundler (~> 1.16)
67
70
  dude-cli!
68
- pry (~> 0.11.3)
69
- rake (~> 10.0)
71
+ pry (~> 0.14.0)
72
+ rake (~> 13.0)
70
73
  rspec (~> 3.0)
71
74
 
72
75
  BUNDLED WITH
73
- 1.16.3
76
+ 2.1.4
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A daily assistant in the hard work of a programmer
4
4
 
5
- This program helps to combine such services as [Gitlab](https://gitlab.com), [Toggl](https://toggl.com) and replace most routine activities with one simple CLI utility.
5
+ This program helps to combine such services as [Jira](https://atlassian.net), [Toggl](https://toggl.com) and replace most routine activities with one simple CLI utility.
6
6
 
7
7
  ## Installation
8
8
 
@@ -26,45 +26,61 @@ After that create .duderc file in your HOME directory by command:
26
26
 
27
27
  And configure all variables in this file
28
28
 
29
- `TOGGL_EMAIL` - Your email, registered in Toggl
29
+ `PROJECT_MANAGEMENT_TOOL=jira` - Project management (Now only Jira supported)
30
+ `ATLASSIAN_EMAIL` - Your Jira email
30
31
 
31
- `TOGGL_TOKEN=` - Your Toggl [token](https://toggl.com/app/profile)
32
+ `ATLASSIAN_TOKEN` - How to create Atlassian token: https://support.siteimprove.com/hc/en-gb/articles/360004317332-How-to-create-an-API-token-from-your-Atlassian-account
32
33
 
33
- `TOGGL_WORKSPACE_ID` - Your Toggl Workspace ID (You can find it in Toggl [team](https://toggl.com/app/team) or [projects](https://toggl.com/app/projects/) url)
34
+ `ATLASSIAN_URL` - URL of your project. Example: https://example.atlassian.net
34
35
 
35
- `GITLAB_ENDPOINT=https://gitlab.yoursite.com/api/v4/` - Change yoursite.com to your site
36
+ `ATLASSIAN_PROJECT_KEY` - KEY of your project. If your issues have id BT-123 - BT is the key
36
37
 
37
- `GITLAB_TOKEN=imyiKqwsQBbn1zCMY2PJ` - Your Gitlab token (<https://gitlab.yoursite.com/profile/personal_access_tokens>)
38
+ `ATLASSIAN_BOARD_ID`:
39
+ Just open your atlassian main board and copy id from the url after rapidView=*ID* part.
38
40
 
39
- `HOURS_PER_DAY=8` - Working hours per day
41
+ Example: https://dealmakerns.atlassian.net/secure/RapidBoard.jspa?rapidView=23&projectKey=DT - 23 is the id
40
42
 
41
- `HOURS_PER_WEEK=40` - Working hours per week
42
43
 
43
- ## Usage
44
+ #### Replace it with your project list names. Skip for empty lists
45
+
46
+ ```
47
+ TODO_LIST_NAME=To Do
48
+ IN_PROGRESS_LIST_NAME=In Progress
49
+ CODE_REVIEW_LIST_NAME=Code Review
50
+ TESTING_LIST_NAME=TESTABLE
51
+ DONE_LIST_NAME=Done
52
+ ```
44
53
 
45
- | Command | Required parameters | Optional parameters | Description |
46
- |---------------|:-------------------:|:-------------------------------:|------------------------------------------------------------|
47
- | dude install | - | - | Create .duderc file in your home directory |
48
- | dude checkout | issue_id | project_title<sup>1</sup> | Checkout to branch with name "ID-issue-title" |
49
- | dude track | issue_id | project_title<sup>1</sup> | Start time entry in Toggl with issue project, title and id |
50
- | dude tasks | - | project_title<sup>1</sup> | Show issues in current project assigned to you |
51
- | dude estimate | duration | issue_id<sup>2</sup>, project_title<sup>1</sup> | Estimate time for issue |
52
- | dude stop | - | project_title<sup>1</sup> | Stop current time entry in Toggl, move issue to `To Do` |
53
- | dude stats | - | - | Display your daily and weekly stats from Toggl |
54
- | dude start | issue_id | project_title<sup>1</sup> | Do `checkout`, `track` and `move` actions |
55
- | dude move | label | issue_id<sup>2</sup>, project_title<sup>1</sup> | Move issue to another column |
56
- | dude version | - | - | Display gem version |
54
+ `TOGGL_PROJECT_NAME` - Your Toggl project name
57
55
 
58
- You also can use `dude help` for short description of every command.
56
+ `TOGGL_TOKEN` - Your Toggl API token can be found at the bottom of the page: https://track.toggl.com/profile
59
57
 
60
- <sup>1</sup>: You can not specify a `project_title` if the project folder name matches its name<br>
61
- <sup>2</sup>: You can not specify `issue_id` if the correct name for the git branch is specified
58
+ `TOGGL_WORKSPACE_ID` - Can be copied from url here: https://toggl.com/app/projects/. Example: 123456
62
59
 
60
+ #### Use the *id* and *title* and specify format for the task titles in Trello or keep it as it is
61
+ `TOGGL_TASK_FORMAT=[id] title`
62
+
63
+ ## Usage
64
+
65
+ | Command | Required parameters | Optional parameters | Description |
66
+ |:-------------:|:-------------------|:-------------------|:--------------------------------------------------------------------------------------|
67
+ | dude install | - | - | Create .duderc file in your home directory |
68
+ | dude checkout | ISSUE_ID | - | Checkout to branch with name "ID-issue-title" |
69
+ | dude track | ISSUE_ID | - | Start time entry in Toggl with issue project, title and id |
70
+ | dude tasks | ISSUE_ID | - | Show all issues in current project (For current sprint) |
71
+ | dude stop | - | - | Stop current time entry in Toggl |
72
+ | dude start | - | - | Do `checkout`, `track` and `move` actions |
73
+ | dude move | ISSUE_ID | --list=NAME | Move issue to another column (Will provide options if called without --list parameter) |
74
+ | dude version | - | - | Display gem version |
75
+
76
+ You also can use `dude help` for short description of every command.
63
77
 
64
78
  ## Contributing
65
79
 
66
- Bug reports and pull requests are welcome on GitHub at https://github.com/Random4405/dude.
80
+ Bug reports and pull requests are welcome on GitHub at https://github.com/npupko/dude.
67
81
 
68
82
  ## License
69
83
 
70
84
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
85
+
86
+ ## [Changelog](https://github.com/npupko/dude/CHANGELOG.md)
data/bin/dude CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "dude/cli"
3
+ require "bundler/setup"
4
+ require "dude"
4
5
 
5
- Dude::CLI.start
6
+ Dry::CLI.new(Dude::Commands).call
data/dude.gemspec CHANGED
@@ -1,32 +1,35 @@
1
1
  lib = File.expand_path("../lib", __FILE__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "dude/version"
3
+ require_relative 'lib/dude/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "dude-cli"
7
7
  spec.version = Dude::VERSION
8
8
  spec.authors = ["Nikita Pupko"]
9
9
  spec.email = ["work.pupko@gmail.com"]
10
+
10
11
  spec.summary = %q{A daily assistant in the hard work of a programmer.}
11
- spec.description = %q{This program helps to combine such services as Gitlab, Toggl and git and replace most routine activities with one simple CLI utility.}
12
+ spec.description = %q{This program helps to combine such services as Jira, Toggl and git and replace most routine activities with one simple CLI utility.}
12
13
  spec.homepage = "https://github.com/npupko/dude"
13
14
  spec.license = "MIT"
14
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
15
- f.match(%r{^(test|spec|features)/})
16
- end
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/npupko/dude"
19
+ spec.metadata["changelog_uri"] = "https://github.com/npupko/dude/blob/master/CHANGELOG.md"
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+
17
23
  spec.bindir = "bin"
18
24
  spec.executables = ["dude"]
19
25
  spec.require_paths = ["lib"]
20
- spec.required_ruby_version = '>= 2.2.0'
21
26
 
22
- spec.add_development_dependency "bundler", "~> 1.16"
23
- spec.add_development_dependency "rake", "~> 10.0"
24
- spec.add_development_dependency "pry", "~> 0.11.3"
25
- spec.add_development_dependency "rspec", "~> 3.0"
27
+ spec.add_runtime_dependency 'dry-cli', '~> 0.6'
28
+ spec.add_runtime_dependency "faraday", "~> 1.1"
29
+ spec.add_runtime_dependency "colorize", "~> 0.8.1"
30
+ spec.add_runtime_dependency "jira-ruby", "~> 2.1"
26
31
 
27
- spec.add_runtime_dependency "thor", "~> 0.20"
28
- spec.add_runtime_dependency "colorize", "~> 0.8"
29
- spec.add_runtime_dependency "gitlab", "~> 4.3"
30
- spec.add_runtime_dependency "git", "~> 1.3"
31
- spec.add_runtime_dependency "rest-client", "~> 2.0"
32
+ spec.add_development_dependency 'pry', '~> 0.14.0'
33
+ spec.add_development_dependency 'rake', '~> 13.0'
34
+ spec.add_development_dependency 'rspec', '~> 3.0'
32
35
  end
data/lib/dude.rb CHANGED
@@ -1,2 +1,15 @@
1
+ require "colorize"
2
+
3
+ require "dude/settings"
4
+ require "dude/version"
5
+ require "dude/commands"
6
+ require "dude/git"
7
+ require "dude/project_management/trello"
8
+ require "dude/project_management/jira"
9
+ require "dude/time_trackers/toggl"
10
+
1
11
  module Dude
12
+ class ToBeImplementedError < StandardError; end
13
+
14
+ LIST_OF_AVAILABLE_PROJECT_MANAGEMENT_TOOLS = %w[jira]
2
15
  end
@@ -0,0 +1,24 @@
1
+ require "dry/cli"
2
+ require_relative "./commands/version"
3
+ require_relative "./commands/tasks"
4
+ require_relative "./commands/move"
5
+ require_relative "./commands/checkout"
6
+ require_relative "./commands/start"
7
+ require_relative "./commands/track"
8
+ require_relative "./commands/stop"
9
+ require_relative "./commands/install"
10
+
11
+ module Dude
12
+ module Commands
13
+ extend Dry::CLI::Registry
14
+
15
+ register "install", Dude::Commands::Install, aliases: ["install"]
16
+ register "version", Dude::Commands::Version, aliases: ["v", "-v", "--version"]
17
+ register "tasks", Dude::Commands::Tasks, aliases: ["t", "-t", "--tasks"]
18
+ register "move", Dude::Commands::Move, aliases: ["m", "-m", "--move"]
19
+ register "checkout", Dude::Commands::Checkout, aliases: ["co"]
20
+ register "track", Dude::Commands::Track, aliases: ["tr"]
21
+ register "stop", Dude::Commands::Stop
22
+ register "start", Dude::Commands::Start, aliases: ["st"]
23
+ end
24
+ end
@@ -0,0 +1,21 @@
1
+ module Dude
2
+ module Commands
3
+ class Checkout < Dry::CLI::Command
4
+ desc "Checkout to branch named as current issue"
5
+
6
+ argument :id, required: true, desc: "The card short ID"
7
+
8
+ def call(id:)
9
+ client = ProjectManagement::Client.new
10
+ issue_title = client.get_task_name_by_id(id)
11
+ Dude::Git::Checkout.new.call(branch_name(issue_title, id))
12
+ end
13
+
14
+ private
15
+
16
+ def branch_name(issue_title, id)
17
+ issue_title.downcase.gsub(/[^a-z0-9\-_]+/, '-').prepend("#{id}-")
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,57 @@
1
+ require 'dude/settings'
2
+
3
+ module Dude
4
+ module Commands
5
+ class Install < Dry::CLI::Command
6
+ desc "Creates .duderc for future configuration"
7
+
8
+ def call
9
+ path = File.join(Dir.home, Settings::CONFIG_FILE)
10
+ if File.exist?(path)
11
+ puts "Config file already exists"
12
+ else
13
+ File.open(path, 'w') {|f| f.write(duderc_file_content) }
14
+ puts ".duderc created in your HOME directory"
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def duderc_file_content
21
+ <<~HEREDOC
22
+ # Please, don't use quotes and spaces.
23
+ # Write all variables using following format: NAME=VALUE
24
+ #
25
+ # Now jira only (Github, Gitlab, Trello later)
26
+ PROJECT_MANAGEMENT_TOOL=jira
27
+ ATLASSIAN_EMAIL=
28
+ # How to create Atlassian token: https://support.siteimprove.com/hc/en-gb/articles/360004317332-How-to-create-an-API-token-from-your-Atlassian-account
29
+ ATLASSIAN_TOKEN=
30
+ # URL of your project. Example: https://example.atlassian.net
31
+ ATLASSIAN_URL=
32
+ # KEY of your project. If your issues have id BT-123 - BT is the key
33
+ ATLASSIAN_PROJECT_KEY=
34
+ # Just open your atlassian main board and copy id from the url after rapidView=*ID* part.
35
+ # Example: https://dealmakerns.atlassian.net/secure/RapidBoard.jspa?rapidView=23&projectKey=DT - 23 is the id
36
+ ATLASSIAN_BOARD_ID=
37
+
38
+ # Replace it with your project list names. Skip for empty lists
39
+ TODO_LIST_NAME=To Do
40
+ IN_PROGRESS_LIST_NAME=In Progress
41
+ CODE_REVIEW_LIST_NAME=Code Review
42
+ TESTING_LIST_NAME=TESTABLE
43
+ DONE_LIST_NAME=Done
44
+
45
+ # Your Toggl project name
46
+ TOGGL_PROJECT_NAME=
47
+ # Your Toggl API token can be found at the bottom of the page: https://track.toggl.com/profile
48
+ TOGGL_TOKEN=
49
+ # Can be copied from url here: https://toggl.com/app/projects/. Example: 123456
50
+ TOGGL_WORKSPACE_ID=
51
+ # Use the *id* and *title* and specify format for the task titles in Trello or keep it as it is
52
+ TOGGL_TASK_FORMAT=[id] title
53
+ HEREDOC
54
+ end
55
+ end
56
+ end
57
+ end