agile-cli 0.0.15 → 0.0.16

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: da7e64a0b4a6304722aea1701cab922e81e381a2a1650ecfd2d8f1f7939be2ff
4
- data.tar.gz: 61fbe335a433053cc089c1ca31eda08b15b4b46bf92fdceb8e2faaa87a3b13cb
3
+ metadata.gz: 6ed766d8eaee010e975e70eb1f48adb7210b473788505fe13b406266bef78572
4
+ data.tar.gz: 6dddd5c95654e5b00d9d37d4069da45f521daad61580a384c3a64f9a09dbbbe5
5
5
  SHA512:
6
- metadata.gz: 4ab2a72ddaf79eedf8067a6f39efa41bb7d36859e00674fce37c0613ba88abe2be10f7b7d88ca9b8b024c932dc3e49758ac6ef1a24bb680222e8113ea6c5287b
7
- data.tar.gz: bdcc3196486cd0cfae0ac88164b46ae726e0211da344b92539625941353f2d070697176191ec83df944cb890d3eded926b89c2b422e3c96beff6872a04616c02
6
+ metadata.gz: cf126ff658051f1bf646a0bad52dbb4d5617e36bcaec0a123ff3ebcc1aa6aaf5f0d1f117b9cc25a030f7dc2b1017f63ef2ba79f3a983069bd98c5ce40844df11
7
+ data.tar.gz: f00751f20fb3e293474e10414596534961e0f7dbb4c35c76b3fc67ccaec039121d38947d955fa4ad3ea49fd29e479a3d757059b9d3c2a7b72910c2f73b3354f0
@@ -5,8 +5,8 @@ module Agile
5
5
  cli = HighLine.new
6
6
  event_description = cli.ask("description for event: ", String)
7
7
  RestClient.post"#{CONFIG['current_remote']}/api/v1/events/",
8
- event_type: type_cli, frequency: frequency_cli, date: date_cli,
9
- start_time: start_time_cli, end_time: end_time_cli, desc: event_description,
8
+ event_type: type_cli, date: date_cli, start_time: start_time_cli,
9
+ end_time: end_time_cli, desc: event_description,
10
10
  current_user: CONFIG["current_user"]
11
11
  say "Successfully added new event!"
12
12
  end
@@ -18,7 +18,7 @@ module Agile
18
18
  JSON.parse(response).each do |event|
19
19
  if event["project_id"] == CONFIG["current_project_id"]
20
20
  info = parse_info(event)
21
- puts "#{event['event_type']} starting #{parse_date(event)} at #{info[:start]} and end at #{info[:end]}"
21
+ say "#{(event['event_type']).upcase} starts at #{parse_date(event)} #{info[:start]} and ends at #{info[:end]}"
22
22
  end
23
23
  end
24
24
  end
@@ -44,7 +44,7 @@ module Agile
44
44
  end
45
45
 
46
46
  def parse_date(event)
47
- Date.parse(event["date"]).strftime("%d %B")
47
+ Date.parse(event["date"]).strftime("%B %d")
48
48
  end
49
49
 
50
50
  def norm_time(param)
@@ -57,12 +57,6 @@ module Agile
57
57
  cli.ask("Choose type of event (select number): ", Integer)
58
58
  end
59
59
 
60
- def frequency_cli
61
- cli = HighLine.new
62
- say "0 - daily\n1 - weekly\n2 - monthly\n3 - not regular"
63
- cli.ask("Choose frequency for event: ", Integer)
64
- end
65
-
66
60
  def date_cli
67
61
  cli = HighLine.new
68
62
  cli.ask("Select data for event (yyyy.mm.dd): ", String)
@@ -19,10 +19,10 @@ module Agile
19
19
  response = RestClient.get "#{CONFIG['current_remote']}/api/v1/userproject/#{CONFIG['current_user']}"
20
20
  say Rainbow("<<Your Projects>>").cornflower
21
21
  JSON.parse(response).each do |proj|
22
- if proj.first.values[1] == CONFIG["current_project"]
23
- say "* #{proj.first.values[1]}"
22
+ if proj["name"] == CONFIG["current_project"]
23
+ say "* #{proj['name']}"
24
24
  else
25
- say proj.first.values[1]
25
+ say proj["name"]
26
26
  end
27
27
  end
28
28
  end
@@ -46,7 +46,7 @@ module Agile
46
46
  def update(project)
47
47
  error_checking_projects
48
48
  choice = HighLine.new
49
- answer = choice.ask("Choose what you need to edit : name or description (N or D): ", String)
49
+ answer = choice.ask("Choose what you want to edit: name or description (N or D): ", String)
50
50
  if answer == "N"
51
51
  update_name(project)
52
52
  elsif answer == "D"
@@ -56,25 +56,14 @@ module Agile
56
56
  end
57
57
  end
58
58
 
59
- # def update(project, new_project)
60
- # error_checking_projects
61
- # resp = RestClient.get "#{CONFIG['current_remote']}/api/v1/userproject/#{CONFIG['current_user']}"
62
- # pr_list = JSON.parse(resp).map { |array| array.map { |hash| hash.values_at("name").include?(project) } }
63
- # if pr_list.include?([true])
64
- # RestClient.put "#{CONFIG['current_remote']}/api/v1/projects/#{project}", name: project, new_name: new_project
65
- # say "Updated from #{project} to #{new_project}"
66
- # else
67
- # say "Error"
68
- # end
69
- # end
70
-
71
59
  private
72
60
 
73
61
  def update_name(project)
74
62
  choice = HighLine.new
75
63
  new_project = choice.ask("Enter new name of project: ", String)
76
64
  RestClient.put "#{CONFIG['current_remote']}/api/v1/projects/#{project}",
77
- name: project, new_name: new_project, type: 1
65
+ name: project, new_name: new_project, type: 1,
66
+ current_user: CONFIG["current_user"]
78
67
  say "Updated from #{project} to #{new_project}"
79
68
  end
80
69
 
@@ -82,7 +71,8 @@ module Agile
82
71
  choice = HighLine.new
83
72
  new_description = choice.ask("Enter new description for project: ", String)
84
73
  RestClient.put "#{CONFIG['current_remote']}/api/v1/projects/#{project}",
85
- name: project, new_description: new_description
74
+ name: project, new_description: new_description,
75
+ current_user: CONFIG["current_user"]
86
76
  say "Updated description to #{new_description}"
87
77
  end
88
78
 
@@ -99,7 +89,7 @@ module Agile
99
89
  say "Such project does not exist. Try again"
100
90
  else
101
91
  write_to_config(id_pr, project)
102
- say "Your project: #{project}"
92
+ say "Your current project: #{project}"
103
93
  end
104
94
  end
105
95
 
@@ -7,7 +7,7 @@ module Agile
7
7
  ticket_description = cli.ask("description for ticket: ", String)
8
8
  RestClient.post"#{CONFIG['current_remote']}/api/v1/tickets/",
9
9
  project_id: CONFIG["current_project_id"], name: ticket_name,
10
- user: CONFIG["current_user"], desc: ticket_description
10
+ user: CONFIG["current_user"], desc: ticket_description, status: ticket_status
11
11
  say "Successfully added new ticket!"
12
12
  end
13
13
 
@@ -15,16 +15,14 @@ module Agile
15
15
  def list
16
16
  response = RestClient.get "#{CONFIG['current_remote']}/api/v1/tickets/"
17
17
  info = JSON.parse(response)
18
- say Rainbow("<<All tickets>>").cornflower
19
- info.each { |ticket| puts_tickets(info) if ticket["project_id"] == CONFIG["current_project_id"] }
18
+ info.each { |ticket| puts ticket["name"] if ticket["project_id"] == CONFIG["current_project_id"] }
20
19
  end
21
20
 
22
21
  desc "show <name_ticket>", "Show ticket"
23
22
  def show(ticket)
24
23
  response = RestClient.get "#{CONFIG['current_remote']}/api/v1/tickets/#{ticket}"
25
24
  row = JSON.parse(response)
26
- say "Ticket: #{row['data']['attributes']['name']}"
27
- say "Description: #{row['data']['attributes']['description']}"
25
+ output_ticket(row["data"]["attributes"])
28
26
  end
29
27
 
30
28
  desc "update <ticket>", "update ticket"
@@ -40,14 +38,29 @@ module Agile
40
38
  end
41
39
  end
42
40
 
43
- # desc "take <ticket>", "Take ticket"
44
- # def take(ticket)
45
- # # call api to take ticket
46
- # CONFIG["tickets"].push(ticket)
47
- # File.write("#{GEM_PATH}.config.json", JSON.generate(CONFIG))
48
- # puts "you take ticket"
49
- # end
50
- #
41
+ desc "take <ticket>", "Take ticket"
42
+ def take(ticket)
43
+ RestClient.put "#{CONFIG['current_remote']}/api/v1/tickets/#{ticket}",
44
+ name: ticket, user: CONFIG["current_user"], type: 2
45
+ say "You take ticket #{ticket}"
46
+ end
47
+
48
+ desc "status <ticket>", "Update ticket status"
49
+ def status(ticket)
50
+ RestClient.put "#{CONFIG['current_remote']}/api/v1/tickets/#{ticket}",
51
+ name: ticket, status: ticket_status, type: 3, project_id: CONFIG["current_project_id"]
52
+ say "You take ticket #{ticket}"
53
+ end
54
+
55
+ desc "archive", "View archived tickets"
56
+ def archive
57
+ response = RestClient.get "#{CONFIG['current_remote']}/api/v1/tickets/"
58
+ info = JSON.parse(response)
59
+ info.each do |ticket|
60
+ archive_ticket(ticket) if ticket["project_id"] == CONFIG["current_project_id"] && ticket["status"] == "archived"
61
+ end
62
+ end
63
+
51
64
  # desc "my_list", "Your tickets list"
52
65
  # def my_list
53
66
  # CONFIG["tickets"].each do |name|
@@ -60,14 +73,29 @@ module Agile
60
73
  # end
61
74
  private
62
75
 
63
- def puts_tickets(info)
64
- info.each { |ticket| puts ticket["name"] }
76
+ def output_ticket(row)
77
+ say "Ticket: #{row['name']}"
78
+ say "Description: #{row['description']}"
79
+ say "Status: #{row['status']}"
80
+ say "Owner: #{row['owner']}"
81
+ end
82
+
83
+ def archive_ticket(ticket)
84
+ say ticket["name"]
85
+ end
86
+
87
+ def ticket_status
88
+ cli = HighLine.new
89
+ puts "0 - ToDo\n1 - Review\n2 - In progress\n3 - Merged\n4 - Done\n5 - Archived"
90
+ cli.ask("Choose status of ticket (select number): ", Integer)
65
91
  end
66
92
 
67
93
  def update_name(ticket)
68
94
  choice = HighLine.new
69
95
  new_ticket = choice.ask("Enter new name of ticket: ", String)
70
- RestClient.put "#{CONFIG['current_remote']}/api/v1/tickets/#{ticket}", name: ticket, new_name: new_ticket, type: 1
96
+ RestClient.put "#{CONFIG['current_remote']}/api/v1/tickets/#{ticket}",
97
+ name: ticket, new_name: new_ticket, type: 1,
98
+ user: CONFIG["current_user"]
71
99
  say "Updated from #{ticket} to #{new_ticket}"
72
100
  end
73
101
 
@@ -75,7 +103,8 @@ module Agile
75
103
  choice = HighLine.new
76
104
  new_description = choice.ask("Enter new description of ticket: ", String)
77
105
  RestClient.put "#{CONFIG['current_remote']}/api/v1/tickets/#{ticket}",
78
- name: ticket, new_description: new_description
106
+ name: ticket, new_description: new_description,
107
+ user: CONFIG["current_user"]
79
108
  say "Updated description to #{new_description}"
80
109
  end
81
110
  end
@@ -0,0 +1,29 @@
1
+ module Agile
2
+ class Members < Thor
3
+ desc "invite <github_login>", "Add user in project"
4
+ def invite(login)
5
+ RestClient.put"#{CONFIG['current_remote']}/api/v1/userproject/#{login}",
6
+ project: CONFIG["current_project"], current_user: CONFIG["current_user"], new_user: login
7
+ say "Successfully added new user!"
8
+ end
9
+
10
+ desc "role <github_login>", "Assign role to a user"
11
+ def role(login)
12
+ RestClient.put"#{CONFIG['current_remote']}/api/v1/users/#{login}",
13
+ project_id: CONFIG["current_project_id"], name: login, role_id: role_type
14
+ say "Successfully updated user's role!"
15
+ end
16
+
17
+ private
18
+
19
+ def role_type
20
+ cli = HighLine.new
21
+ cli.ask("Choose role type:\n1 - team member\n2 - scrum master\n3 - product owner", Integer)
22
+ end
23
+ end
24
+
25
+ class CLI < Thor
26
+ desc Rainbow("users SUBCOMMAND ...ARGS").cornflower, Rainbow("Command for work with users").darkgoldenrod
27
+ subcommand "users", Members
28
+ end
29
+ end
@@ -1,5 +1,5 @@
1
1
  module Agile
2
- VERSION = "0.0.15".freeze
2
+ VERSION = "0.0.16".freeze
3
3
  GITHUB_URL = %(https://github.com/login).freeze
4
4
  TERMINAL_STYLE = { border_x: "=", border_i: "x", padding_left: 3 }.freeze
5
5
  CLIENT_ID = "8bf42da7e4f9032ac5d8".freeze
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agile-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - rubizza-camp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-28 00:00:00.000000000 Z
11
+ date: 2019-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline
@@ -245,6 +245,7 @@ files:
245
245
  - lib/agile/commands/projects.rb
246
246
  - lib/agile/commands/remotes.rb
247
247
  - lib/agile/commands/tickets.rb
248
+ - lib/agile/commands/users.rb
248
249
  - lib/agile/commands/values.rb
249
250
  - lib/agile/commands/version.rb
250
251
  - lib/agile/constants.rb