jura 0.0.5 → 0.0.8

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: 2251bfdce558ea81e480b5f137cade4f0775709dea2c4543e2cda730529620af
4
- data.tar.gz: 8b575cb10a2e3c5cf676adb741b66398bf7164580d380784bf768b8bad0324f1
3
+ metadata.gz: 3bdec76bb892af8be3c4d31b8682f25e2ebd8005b0a78f48e8023d5718c935fa
4
+ data.tar.gz: 82d433c2caa2963469aea9f5b27e438d28b650b3bdec7b1df88c4a5dd7196972
5
5
  SHA512:
6
- metadata.gz: af6f5a275593f3acf8a3ea9880bf1409941b07ecb39b99f768bcbab40e6bd14f6f4cf77cbc5d4180456dce980b3e514947948f0c94454384972674f00baf9f7c
7
- data.tar.gz: 69c024d060af2cb6385708aaa546d1ed1e8b4858fbb8aaad9f657a2ac6f48070d950d815919d38f326291658f2c2829489ec102662b0f32fabf4a837b1fb5de3
6
+ metadata.gz: b52e3cd4f98a465d7565776b3236da3d2c67ae4207148ae8614b98fb78dc508e32d354d37478c01d9f3fd58b6439824fd107f31225cda52b0eb7d8c7f9c931d1
7
+ data.tar.gz: 3087c45f8bc1b3772a030e96b63a7370ab81fe4be612272a0e678eceeb8872484df81b09f27ffadbf7eaa69aa4af944ed96ff7706fe6f4ff9d6f920a7b18ba90
data/README.md CHANGED
@@ -1,2 +1,13 @@
1
- # jura
1
+ # Jura
2
2
  A simple Jira CLI app by Ruby
3
+
4
+ ## Install Jura
5
+
6
+ ## Contributing
7
+
8
+ Bug reports and pull requests are welcome on GitHub at https://github.com/nvh0412/jura. This project is intended to be a safe, welcoming space for collaboration.
9
+
10
+
11
+ ## License
12
+
13
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/bin/jura CHANGED
@@ -8,6 +8,8 @@ require 'tty-table'
8
8
  require 'tty-box'
9
9
  require 'tty-markdown'
10
10
  require 'tty-screen'
11
+ require 'tty-link'
12
+ require 'tty-spinner'
11
13
  require 'pastel'
12
14
  require 'optparse'
13
15
 
@@ -15,6 +15,18 @@ module Jura
15
15
  )['values']
16
16
  end
17
17
 
18
+ def configuration(board_id)
19
+ options = {
20
+ headers: {
21
+ "Authorization" => "Basic #{Token.get_token}"
22
+ }
23
+ }
24
+
25
+ url = "/board/#{board_id}/configuration"
26
+
27
+ parse_body(Client.get(url, options).body)
28
+ end
29
+
18
30
  private
19
31
 
20
32
  def parse_body(body)
@@ -27,9 +27,42 @@ module Jura
27
27
  }
28
28
  }
29
29
 
30
- url = "/issue/#{issue_id}"
30
+ url = "https://employmenthero.atlassian.net/rest/api/3/issue/#{issue_id}"
31
31
 
32
- parse_body(Client.get(url, options).body)
32
+ parse_body(HTTParty.get(url, options).body)
33
+ end
34
+
35
+ def get_estimation(issue_id, board_id)
36
+ options = {
37
+ headers: {
38
+ "Authorization" => "Basic #{Token.get_token}"
39
+ }
40
+ }
41
+
42
+ url = "/issue/#{issue_id}/estimation?boardId=#{board_id}"
43
+
44
+ parse_body(
45
+ Client.get(url, options).body
46
+ )
47
+ end
48
+
49
+ def estimate(issue_id, point)
50
+ options = {
51
+ headers: {
52
+ "Authorization" => "Basic #{Token.get_token}"
53
+ },
54
+ body: {
55
+ value: point
56
+ }.to_json
57
+ }
58
+
59
+ board_id = Jura::Configuration.instance.load_config['selected_board_id']
60
+
61
+ url = "/issue/#{issue_id}/estimation?boardId=#{board_id}"
62
+
63
+ parse_body(
64
+ Client.put(url, options).body
65
+ )
33
66
  end
34
67
 
35
68
  private
@@ -16,6 +16,7 @@ module Jura
16
16
 
17
17
  !values.nil?
18
18
  rescue HTTParty::ResponseError => e
19
+ p e
19
20
  false
20
21
  end
21
22
 
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+
5
+ module Jura
6
+ module Api
7
+ module Transitions
8
+ extend self
9
+
10
+ def all(issue_id)
11
+ options = {
12
+ headers: {
13
+ "Authorization" => "Basic #{Token.get_token}"
14
+ }
15
+ }
16
+
17
+ url = "https://employmenthero.atlassian.net/rest/api/3/issue/#{issue_id}/transitions"
18
+
19
+ parse_body(HTTParty.get(url, options).body)['transitions']
20
+ end
21
+
22
+ def transition(issue_id, body)
23
+ options = {
24
+ headers: {
25
+ 'Authorization': "Basic #{Token.get_token}",
26
+ 'Accept': 'application/json',
27
+ 'Content-Type': 'application/json'
28
+ },
29
+ body: body.to_json
30
+ }
31
+
32
+ url = "https://employmenthero.atlassian.net/rest/api/3/issue/#{issue_id}/transitions"
33
+
34
+ HTTParty.post(url, options)
35
+ end
36
+
37
+ def parse_body(body)
38
+ JSON.parse(body)
39
+ end
40
+ end
41
+ end
42
+ end
data/lib/jura/api.rb CHANGED
@@ -4,3 +4,4 @@ require 'jura/api/board'
4
4
  require 'jura/api/issue'
5
5
  require 'jura/api/sprint'
6
6
  require 'jura/api/token'
7
+ require 'jura/api/transition'
@@ -27,15 +27,18 @@ module Jura
27
27
 
28
28
  Jura::Configuration.instance.set_config(config)
29
29
 
30
+ Jura::RootControl.instance.config_commands
31
+ Jura::Control::Sprint.instance.config_commands
32
+
30
33
  loop do
31
34
  command_buffer = Readline.readline("\e[15;48;5;27m Jura Guarrr! \e[0m > ", true)
32
35
 
33
- Jura::Command.execute!(command_buffer.strip())
36
+ Jura::CommandHandler.call(command_buffer.strip())
34
37
  rescue IndexError, NoMethodError => _e
35
38
  Command::Invalid.execute("Something went wrong, please try with another command")
36
39
  end
37
40
  rescue Interrupt
38
- Command::Exit.execute
41
+ Command::Exit.execute!
39
42
  end
40
43
 
41
44
  def config_credentials(prompt)
@@ -6,7 +6,11 @@ module Jura
6
6
  class Select
7
7
  def self.execute
8
8
  prompt = TTY::Prompt.new
9
- boards = Api::Board.all
9
+
10
+ boards = Jura::Component::Spinner.render do
11
+ Api::Board.all
12
+ end
13
+
10
14
  board = prompt.select("Choose your board?", filter: true, per_page: 10) do |menu|
11
15
  boards.each do |b|
12
16
  menu.choice b['location']['displayName'], b
@@ -3,7 +3,7 @@
3
3
  module Jura
4
4
  module Command
5
5
  class Exit
6
- def self.execute
6
+ def self.execute!(_sub_cmd, _args)
7
7
  puts "Guar :("
8
8
  exit
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Jura
4
4
  module Command
5
5
  class Help
6
- def self.execute
6
+ def self.execute!(_sub_cmd, _args)
7
7
  puts Component::Help.render
8
8
  end
9
9
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jura
4
+ module Command
5
+ module Sprint
6
+ class Active < Base
7
+ def self.execute!(opts = nil)
8
+ sprints = Component::Spinner.render do
9
+ Api::Sprint.all(board_id)
10
+ end
11
+
12
+ configuration = Component::Spinner.render do
13
+ Api::Board.configuration(board_id)
14
+ end
15
+
16
+ active_sprint = sprints.detect { |sprint| sprint['state'] == 'active' }
17
+ puts Component::Sprint::Active.render(board_id, active_sprint, configuration)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jura
4
+ module Command
5
+ module Sprint
6
+ class DisplaySubmenu < Base
7
+ def self.execute!(issue)
8
+ prompt = TTY::Prompt.new
9
+ action = prompt.select("Choose your action") do |menu|
10
+ menu.choice name: "View", value: 1
11
+ menu.choice name: "Estimate the story point", value: 2
12
+ menu.choice name: "Change the status/column", value: 3
13
+ menu.choice name: "Move it back to the backlog", value: 4
14
+ menu.choice name: "Back", value: 5
15
+ end
16
+
17
+ case action
18
+ when 1
19
+ Jura::Control::Sprint.instance.execute_command("show_issue", issue)
20
+ when 2
21
+ puts Component::Issue::Estimate.render(issue)
22
+ when 3
23
+ puts Component::Issue::ChangeColumn.render(issue)
24
+ when 4
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -4,7 +4,7 @@ module Jura
4
4
  module Command
5
5
  module Sprint
6
6
  class List < Base
7
- def self.execute!
7
+ def self.execute!(opts = {})
8
8
  sprints = Api::Sprint.all(board_id)
9
9
  puts Component::Sprint.render(sprints)
10
10
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'byebug'
4
+
5
+ module Jura
6
+ module Command
7
+ module Sprint
8
+ class ShowIssue < Base
9
+ def self.execute!(issue)
10
+ puts Component::Issue::Show.render(issue)
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -2,20 +2,20 @@
2
2
 
3
3
  require 'jura/command/sprint/base'
4
4
  require 'jura/command/sprint/list'
5
- require 'jura/command/sprint/show'
5
+ require 'jura/command/sprint/active'
6
+ require 'jura/command/sprint/display_submenu'
7
+ require 'jura/command/sprint/show_issue'
6
8
 
7
9
  module Jura
8
10
  module Command
9
11
  module Sprint
10
12
  def self.execute!(sub_cmd, args)
11
- case sub_cmd
12
- when "show"
13
- Command::Sprint::Show.execute!(args)
14
- when "list"
15
- Command::Sprint::List.execute!
16
- else
17
- Command::Invalid.execute("Command not found: #{command.inspect}. Run #{"help".inspect} for more informations")
13
+ unless Jura::Control::Sprint.instance.support_command?(sub_cmd)
14
+ return Command::Invalid.execute("Command not found: #{sub_cmd}. Run #{"help".inspect} for more informations")
18
15
  end
16
+
17
+ Jura::Control::Sprint.instance.execute_command(sub_cmd)
18
+ Jura::Control::Sprint.instance.undo_command
19
19
  end
20
20
  end
21
21
  end
@@ -7,34 +7,24 @@ require 'jura/command/exit'
7
7
  require 'jura/command/invalid'
8
8
 
9
9
  module Jura
10
- module Command
11
- COMMANDS = {
12
- "board" => -> (sub_cmd, args) { Command::Board.execute!(sub_cmd, args) },
13
- "issue" => -> (sub_cmd, args) { Command::Issue.execute!(sub_cmd, args) },
14
- "sprint" => -> (sub_cmd, args) { Command::Sprint.execute!(sub_cmd, args) },
15
- "help" => -> (*_args) { Command::Help.execute() },
16
- "exit" => -> (*_args) { Command::Exit.execute() }
17
- }
18
-
19
- def self.execute!(cmd_buffer)
10
+ module CommandHandler
11
+ def self.call(cmd_buffer)
20
12
  cmd_name, sub_cmd, *args = cmd_buffer.to_s.strip.split(" ")
21
13
 
22
14
  if cmd_name.nil? || cmd_name.empty?
23
15
  # TODO: return and execute empty command error
24
16
  end
25
17
 
26
- command = COMMANDS[cmd_name]
27
-
28
- if command.nil?
29
- return Command::Invalid.execute("Command not found: #{command.inspect}. Run #{"help".inspect} for more informations")
18
+ unless Jura::RootControl.instance.support_command?(cmd_name)
19
+ return Command::Invalid.execute("Command not found: #{cmd_name}. Run #{"help".inspect} for more informations")
30
20
  end
31
21
 
32
22
  puts '' # Empty line
33
- command.call(sub_cmd, args)
23
+ Jura::RootControl.instance.execute_command(cmd_name, sub_cmd: sub_cmd, args: args)
34
24
  puts '' # Empty line
35
25
  rescue Command::Board::RequiredBoardIdError => _
36
26
  puts 'Please select a board first!'
37
- Command::Board.execute!('select', [])
27
+ Jura::RootControl.execute_command('select')
38
28
  end
39
29
 
40
30
  def generate_suggestions(buffer, command_buffer)
@@ -46,5 +36,6 @@ module Jura
46
36
 
47
37
  commands.keys.grep(/^#{Regexp.escape(buffer)}/)
48
38
  end
39
+
49
40
  end
50
41
  end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jura
4
+ module Component
5
+ module Issue
6
+ class ChangeColumn
7
+ def self.render(issue)
8
+ prompt = TTY::Prompt.new
9
+
10
+ transitions = Api::Transitions.all(issue['id'])
11
+
12
+ status = prompt.select("Choose the status") do |menu|
13
+ transitions.each do |t|
14
+ menu.choice t['name'], t
15
+ end
16
+
17
+ menu.choice 'Cancel', 'cancel'
18
+ end
19
+
20
+ if status == 'cancel'
21
+ Sprint::Active.display_submenu(prompt, issue)
22
+ return
23
+ end
24
+
25
+ unless prompt.yes?("Do you want to change the status of this issue to '#{status['name']}'?")
26
+ render(issue)
27
+ end
28
+
29
+ Spinner.render(
30
+ "Changed status of this issue from #{issue['fields']['status']['name']} to #{status['name']}!", clear: false
31
+ ) do
32
+ Api::Transitions.transition(issue['id'], { transition: { id: status['id'] } })
33
+ end
34
+
35
+ puts ""
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jura
4
+ module Component
5
+ module Issue
6
+ class Estimate
7
+ def self.render(issue)
8
+ prompt = TTY::Prompt.new
9
+ point_value = prompt.ask("How many points do you want to estimate?", default: 1)
10
+
11
+ Spinner.render("Estimated this issue - #{point_value} points!", clear: false) do
12
+ Api::Issue.estimate(issue['id'], point_value)
13
+ end
14
+
15
+ puts ""
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -5,8 +5,14 @@ module Jura
5
5
  module Issue
6
6
  class Show
7
7
  def self.render(issue)
8
+ board_id = Jura::Configuration.instance.load_config['selected_board_id']
9
+ estimation = Api::Issue.get_estimation(issue['id'], board_id)
10
+
8
11
  issue_id = issue['key']
12
+ key = Issue.convert_key(issue)
13
+ url = URI.parse(issue['self']).host
9
14
  project = issue['fields']['project']['name']
15
+ description = issue['fields']['description'] || ""
10
16
  box = TTY::Box.frame(
11
17
  border: :thick,
12
18
  padding: [1,2],
@@ -16,11 +22,13 @@ module Jura
16
22
  <<~TEMPLATE
17
23
  #{Jura::Utils.format_bold(issue['fields']['summary'])}
18
24
 
19
- #{Jura::Utils.format_bold('URL')}: #{issue['self']}
25
+ #{Jura::Utils.format_bold('URL')}: #{TTY::Link.link_to("Issue Link", "https://#{url}/browse/#{key}")}
26
+
27
+ #{Jura::Utils.format_bold('Story points:')} #{Jura::Utils.paint(estimation["value"] || 0, :green)}
20
28
 
21
29
  #{Jura::Utils.format_bold('Description')}
22
30
 
23
- #{TTY::Markdown.parse(issue['fields']['description'])}
31
+ #{TTY::Markdown.parse(description)}
24
32
  TEMPLATE
25
33
  end
26
34
  end
@@ -2,6 +2,8 @@
2
2
 
3
3
  require "jura/component/issue/help"
4
4
  require "jura/component/issue/show"
5
+ require "jura/component/issue/change_column"
6
+ require "jura/component/issue/estimate"
5
7
 
6
8
  module Jura
7
9
  module Component
@@ -12,6 +14,15 @@ module Jura
12
14
  TEMPLATE
13
15
  end
14
16
 
17
+ def self.render_line(issue)
18
+ render_issue(issue)
19
+ end
20
+
21
+ def self.convert_key(issue)
22
+ kws = issue['key'].split('-')
23
+ "#{kws[0]}-#{(kws[1].rjust(3, ' '))}"
24
+ end
25
+
15
26
  private
16
27
 
17
28
  def self.render_issue(issue)
@@ -33,11 +44,6 @@ module Jura
33
44
  p.decorate(status,:white)
34
45
  end
35
46
  end
36
-
37
- def self.convert_key(issue)
38
- kws = issue['key'].split('-')
39
- "#{kws[0]}-#{(kws[1].rjust(3, ' '))}"
40
- end
41
47
  end
42
48
  end
43
49
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jura
4
+ module Component
5
+ class Spinner
6
+ def self.render(success_message = 'Loading', clear: true)
7
+ spinner = TTY::Spinner.new("[:spinner] #{success_message}", format: :pulse_2, clear: clear)
8
+ spinner.auto_spin
9
+ res = yield
10
+ success_message ? spinner.success(success_message) : spinner.stop
11
+ res
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jura
4
+ module Component
5
+ module Sprint
6
+ class Active
7
+ def self.render(board_id, sprint, config)
8
+ prompt = TTY::Prompt.new
9
+ columns = config.dig('columnConfig', 'columns')
10
+ column = prompt.select("Choose the column", filter: true, per_page: 5) do |menu|
11
+ columns.each do |c|
12
+ menu.choice c['name'], c
13
+ end
14
+ end
15
+
16
+ issues = Spinner.render do
17
+ Api::Sprint.show(board_id, sprint['id'])
18
+ end
19
+
20
+ selected_issues = issues.select do |i|
21
+ status = i.dig('fields','status', 'name')
22
+
23
+ column['name'].downcase == status.downcase
24
+ end
25
+
26
+ issue = prompt.select("Choose the issue", filter: true, per_page: 10) do |menu|
27
+ selected_issues.each do |i|
28
+ menu.choice Component::Issue.render_line(i), i
29
+ end
30
+ end
31
+
32
+ Control::Sprint.instance.execute_command("display_submenu", issue)
33
+ puts ""
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -7,6 +7,7 @@ module Jura
7
7
  def self.render
8
8
  <<~TEMPLATE.strip
9
9
  #{Utils.format_bold("# Available sprint commands:")}
10
+ sprint active - Show the active sprint
10
11
  sprint list - Show list of sprints
11
12
  sprint show <sprint_id> - Show list of issues of 1 sprint
12
13
  TEMPLATE
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "jura/component/sprint/help"
4
- require "jura/component/sprint/show"
4
+ require "jura/component/sprint/active"
5
5
 
6
6
  module Jura
7
7
  module Component
@@ -3,3 +3,4 @@ require "jura/component/board"
3
3
  require "jura/component/issue"
4
4
  require "jura/component/sprint"
5
5
  require "jura/component/logo"
6
+ require "jura/component/spinner"
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'byebug'
4
+
5
+ module Jura
6
+ module Control
7
+ class Sprint < Jura::RootControl
8
+ def execute_command(name, opts = nil)
9
+ commands[name].execute!(opts)
10
+ executed_commands << [commands[name], opts]
11
+ end
12
+
13
+ def undo_command
14
+ return if executed_commands.length < 2
15
+
16
+ executed_commands.pop
17
+ command, opts = executed_commands.pop
18
+ command.execute!(opts)
19
+ executed_commands << [command, opts]
20
+ end
21
+
22
+ def config_commands
23
+ set_command("list", Command::Sprint::List)
24
+ set_command("active", Command::Sprint::Active)
25
+ set_command("display_submenu", Command::Sprint::DisplaySubmenu)
26
+ set_command("show_issue", Command::Sprint::ShowIssue)
27
+ end
28
+
29
+ def executed_commands
30
+ @executed_commands ||= []
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1 @@
1
+ require 'jura/control/sprint'
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+ require 'singleton'
3
+
4
+ module Jura
5
+ class RootControl
6
+ include Singleton
7
+
8
+ def set_command(key, command)
9
+ commands[key] = command
10
+ end
11
+
12
+ def undo_command
13
+ return if executed_commands.length.zero?
14
+
15
+ command, opts = executed_commands.pop
16
+ command.execute!(opts[:sub_cmd], opts[:args])
17
+ end
18
+
19
+ def support_command?(name)
20
+ commands.keys.include?(name)
21
+ end
22
+
23
+ def execute_command(name, opts = {})
24
+ commands[name].execute!(opts[:sub_cmd], opts[:args])
25
+ executed_commands << [commands[name], opts]
26
+ end
27
+
28
+ def commands
29
+ @commands ||= {}
30
+ end
31
+
32
+ def config_commands
33
+ set_command("board", Command::Board)
34
+ set_command("issue", Command::Issue)
35
+ set_command("sprint", Command::Sprint)
36
+ set_command("help", Command::Help)
37
+ set_command("exit", Command::Exit)
38
+ end
39
+
40
+ def executed_commands
41
+ @executed_commands ||= []
42
+ end
43
+ end
44
+ end
data/lib/jura.rb CHANGED
@@ -5,6 +5,8 @@ require "jura/version"
5
5
  require "jura/utils"
6
6
  require "jura/configuration"
7
7
  require "jura/api"
8
+ require "jura/root_control"
9
+ require "jura/control"
8
10
  require "jura/component"
9
- require "jura/command"
11
+ require "jura/command_handler"
10
12
  require "jura/application"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jura
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hoa Nguyen
@@ -14,16 +14,22 @@ dependencies:
14
14
  name: httparty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.18.1
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 0.21.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: 0.18.1
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 0.21.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: tty-prompt
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +100,34 @@ dependencies:
94
100
  - - "~>"
95
101
  - !ruby/object:Gem::Version
96
102
  version: 0.8.1
103
+ - !ruby/object:Gem::Dependency
104
+ name: tty-link
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: 0.1.1
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: 0.1.1
117
+ - !ruby/object:Gem::Dependency
118
+ name: tty-spinner
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: 0.9.3
124
+ type: :runtime
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: 0.9.3
97
131
  - !ruby/object:Gem::Dependency
98
132
  name: pastel
99
133
  requirement: !ruby/object:Gem::Requirement
@@ -125,8 +159,8 @@ files:
125
159
  - lib/jura/api/issue.rb
126
160
  - lib/jura/api/sprint.rb
127
161
  - lib/jura/api/token.rb
162
+ - lib/jura/api/transition.rb
128
163
  - lib/jura/application.rb
129
- - lib/jura/command.rb
130
164
  - lib/jura/command/board.rb
131
165
  - lib/jura/command/board/select.rb
132
166
  - lib/jura/command/exit.rb
@@ -139,21 +173,30 @@ files:
139
173
  - lib/jura/command/issue/select.rb
140
174
  - lib/jura/command/issue/show.rb
141
175
  - lib/jura/command/sprint.rb
176
+ - lib/jura/command/sprint/active.rb
142
177
  - lib/jura/command/sprint/base.rb
178
+ - lib/jura/command/sprint/display_submenu.rb
143
179
  - lib/jura/command/sprint/list.rb
144
- - lib/jura/command/sprint/show.rb
180
+ - lib/jura/command/sprint/show_issue.rb
181
+ - lib/jura/command_handler.rb
145
182
  - lib/jura/component.rb
146
183
  - lib/jura/component/board.rb
147
184
  - lib/jura/component/board/help.rb
148
185
  - lib/jura/component/help.rb
149
186
  - lib/jura/component/issue.rb
187
+ - lib/jura/component/issue/change_column.rb
188
+ - lib/jura/component/issue/estimate.rb
150
189
  - lib/jura/component/issue/help.rb
151
190
  - lib/jura/component/issue/show.rb
152
191
  - lib/jura/component/logo.rb
192
+ - lib/jura/component/spinner.rb
153
193
  - lib/jura/component/sprint.rb
194
+ - lib/jura/component/sprint/active.rb
154
195
  - lib/jura/component/sprint/help.rb
155
- - lib/jura/component/sprint/show.rb
156
196
  - lib/jura/configuration.rb
197
+ - lib/jura/control.rb
198
+ - lib/jura/control/sprint.rb
199
+ - lib/jura/root_control.rb
157
200
  - lib/jura/utils.rb
158
201
  - lib/jura/version.rb
159
202
  homepage: https://rubygems.org/gems/jura
@@ -175,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
218
  - !ruby/object:Gem::Version
176
219
  version: '0'
177
220
  requirements: []
178
- rubygems_version: 3.1.2
221
+ rubygems_version: 3.0.3.1
179
222
  signing_key:
180
223
  specification_version: 4
181
224
  summary: Jura Guarrr!
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Jura
4
- module Command
5
- module Sprint
6
- class Show < Base
7
- def self.execute!(args)
8
- if args.length != 1
9
- return
10
- end
11
-
12
- sprint_id = args[0]
13
-
14
- issues = Api::Sprint.show(board_id, sprint_id)
15
- puts Component::Sprint::Show.render(issues)
16
- rescue HTTParty::ResponseError => _e
17
- Command::Invalid.execute("Something went wrong, please try with another command")
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Jura
4
- module Component
5
- module Sprint
6
- class Show
7
- def self.render(issues)
8
- table = TTY::Table.new(
9
- header: [
10
- "TO DO",
11
- Jura::Utils.paint("IN PROGRESS", :blue),
12
- Jura::Utils.paint("IN REVIEW", :purple),
13
- Jura::Utils.paint("DONE", :green)
14
- ]
15
- )
16
- convertIssues(table, issues)
17
- table.render :unicode, resize: true, column_widths: [25, 25, 25, 25] do |renderer|
18
- renderer.border.separator = :each_row
19
- end
20
- end
21
-
22
- def self.convertIssues(table, issues)
23
- issues.each do |issue|
24
- state = issue['fields']['status']['name']
25
- case state.downcase
26
- when 'to do'
27
- table << [render_issue(issue), '', '', '']
28
- when 'in progress'
29
- table << ['', render_issue(issue), '', '']
30
- when 'in review'
31
- table << ['', '', render_issue(issue), '']
32
- when 'done'
33
- table << ['', '', '', render_issue(issue)]
34
- end
35
- end
36
- end
37
-
38
- def self.render_issue(issue)
39
- "#{issue['key']} - #{issue['fields']['summary']}"
40
- end
41
- end
42
- end
43
- end
44
- end