agile-cli 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/agile/commands/events.rb +9 -0
- data/lib/agile/commands/tickets.rb +14 -0
- data/lib/agile/commands/users.rb +24 -3
- data/lib/agile/constants.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0eb8d9571738a50946c3a3c87757c2edf8eb1654f135767274303c0b8fb64527
|
4
|
+
data.tar.gz: 184c4e1fcec4cfafd0e494af402327aac8c273da66ca7e6859b77f5f4b510860
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 334a9eff19a2610467d45d8018b4f230eb643a41dbbe42761980437606975f142ca4b1e95e85e96173ef5bb176d8d53902619418ac01c5fda71864ccfaf5585c
|
7
|
+
data.tar.gz: 001abdd1a4cc5084faa621ddbe0d0f6885e90194b12fa3106824ad5319bc37c0de7944ca978652c809c4f826ddbcbf3f726a2fa174e08df1c6b2b29db7380fc2
|
@@ -2,6 +2,7 @@ module Agile
|
|
2
2
|
class Events < Thor
|
3
3
|
desc "create", "Add new event"
|
4
4
|
def create
|
5
|
+
error_checking_events
|
5
6
|
cli = HighLine.new
|
6
7
|
event_description = cli.ask("description for event: ", String)
|
7
8
|
RestClient.post"#{CONFIG['current_remote']}/api/v1/events/",
|
@@ -13,6 +14,7 @@ module Agile
|
|
13
14
|
|
14
15
|
desc "list", "Show all events"
|
15
16
|
def list
|
17
|
+
error_checking_events
|
16
18
|
response = RestClient.get "#{CONFIG['current_remote']}/api/v1/events/"
|
17
19
|
say "<<Project events>>"
|
18
20
|
JSON.parse(response).each do |event|
|
@@ -26,12 +28,19 @@ module Agile
|
|
26
28
|
desc "show <date (yyyy-mm-dd)>", "Show event"
|
27
29
|
# :reek:ControlParameter
|
28
30
|
def show(date)
|
31
|
+
error_checking_events
|
29
32
|
response = RestClient.get "#{CONFIG['current_remote']}/api/v1/events/"
|
30
33
|
JSON.parse(response).each { |event| puts_info(event) if event["date"] == date }
|
31
34
|
end
|
32
35
|
|
33
36
|
private
|
34
37
|
|
38
|
+
def error_checking_events
|
39
|
+
abort "You haven't done init yet!" unless CONFIG["current_remote"]
|
40
|
+
abort "Please, log in!" unless CONFIG["current_user"]
|
41
|
+
abort "Please, choose a project to work with!" unless CONFIG["current_project"]
|
42
|
+
end
|
43
|
+
|
35
44
|
def puts_info(event)
|
36
45
|
say "Type of event: #{event['event_type']}\nDescription: #{event['description']}"
|
37
46
|
say "Start at #{norm_time(event['start_time'])}\nEnd at #{norm_time(event['end_time'])}"
|
@@ -4,6 +4,7 @@ module Agile
|
|
4
4
|
class Tickets < Thor
|
5
5
|
desc "create <ticket>", "Add new ticket"
|
6
6
|
def create(ticket)
|
7
|
+
error_checking_tickets
|
7
8
|
ticket_name = ticket
|
8
9
|
cli = HighLine.new
|
9
10
|
ticket_description = cli.ask("description for ticket: ", String)
|
@@ -15,6 +16,7 @@ module Agile
|
|
15
16
|
|
16
17
|
desc "list", "Tickets list"
|
17
18
|
def list
|
19
|
+
error_checking_tickets
|
18
20
|
response = RestClient.get "#{CONFIG['current_remote']}/api/v1/tickets/"
|
19
21
|
info = JSON.parse(response)
|
20
22
|
print_tickets_list(info)
|
@@ -22,6 +24,7 @@ module Agile
|
|
22
24
|
|
23
25
|
desc "my_list", "Tickets list"
|
24
26
|
def my_list
|
27
|
+
error_checking_tickets
|
25
28
|
response = RestClient.get "#{CONFIG['current_remote']}/api/v1/tickets/"
|
26
29
|
owner = []
|
27
30
|
JSON.parse(response).each { |ticket| owner << ticket if ticket["owner"] == CONFIG["current_user"] }
|
@@ -30,6 +33,7 @@ module Agile
|
|
30
33
|
|
31
34
|
desc "show <name_ticket>", "Show ticket"
|
32
35
|
def show(ticket)
|
36
|
+
error_checking_tickets
|
33
37
|
response = RestClient.get "#{CONFIG['current_remote']}/api/v1/tickets/#{ticket}"
|
34
38
|
row = JSON.parse(response)
|
35
39
|
output_ticket(row["data"]["attributes"])
|
@@ -37,6 +41,7 @@ module Agile
|
|
37
41
|
|
38
42
|
desc "update <ticket>", "update ticket"
|
39
43
|
def update(ticket)
|
44
|
+
error_checking_tickets
|
40
45
|
choice = HighLine.new
|
41
46
|
answer = choice.ask("Choose what you need to edit : name or description (N or D): ", String)
|
42
47
|
if answer == "N"
|
@@ -50,6 +55,7 @@ module Agile
|
|
50
55
|
|
51
56
|
desc "take <ticket>", "Take ticket"
|
52
57
|
def take(ticket)
|
58
|
+
error_checking_tickets
|
53
59
|
RestClient.put "#{CONFIG['current_remote']}/api/v1/tickets/#{ticket}",
|
54
60
|
name: ticket, user: CONFIG["current_user"], type: 2
|
55
61
|
say "You take ticket #{ticket}"
|
@@ -57,6 +63,7 @@ module Agile
|
|
57
63
|
|
58
64
|
desc "status <ticket>", "Update ticket status"
|
59
65
|
def status(ticket)
|
66
|
+
error_checking_tickets
|
60
67
|
RestClient.put "#{CONFIG['current_remote']}/api/v1/tickets/#{ticket}",
|
61
68
|
name: ticket, status: ticket_status, type: 3, project_id: CONFIG["current_project_id"]
|
62
69
|
say "You take ticket #{ticket}"
|
@@ -64,6 +71,7 @@ module Agile
|
|
64
71
|
|
65
72
|
desc "archive", "View archived tickets"
|
66
73
|
def archive
|
74
|
+
error_checking_tickets
|
67
75
|
response = RestClient.get "#{CONFIG['current_remote']}/api/v1/tickets/"
|
68
76
|
info = JSON.parse(response)
|
69
77
|
info.each do |ticket|
|
@@ -73,6 +81,12 @@ module Agile
|
|
73
81
|
|
74
82
|
private
|
75
83
|
|
84
|
+
def error_checking_tickets
|
85
|
+
abort "You haven't done init yet!" unless CONFIG["current_remote"]
|
86
|
+
abort "Please, log in!" unless CONFIG["current_user"]
|
87
|
+
abort "Please, choose a project to work with!" unless CONFIG["current_project"]
|
88
|
+
end
|
89
|
+
|
76
90
|
def output_ticket(row)
|
77
91
|
say "Ticket: #{row['name']}"
|
78
92
|
say "Description: #{row['description']}"
|
data/lib/agile/commands/users.rb
CHANGED
@@ -2,13 +2,20 @@ module Agile
|
|
2
2
|
class Members < Thor
|
3
3
|
desc "invite <github_login>", "Add user in project"
|
4
4
|
def invite(login)
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
error_checking_users
|
6
|
+
find_user(login)
|
7
|
+
if @users_array.include?(login)
|
8
|
+
RestClient.put "#{CONFIG['current_remote']}/api/v1/userproject/#{login}",
|
9
|
+
project: CONFIG["current_project"], current_user: CONFIG["current_user"], new_user: login
|
10
|
+
say "Successfully added new user!"
|
11
|
+
else
|
12
|
+
say "There is no such user!"
|
13
|
+
end
|
8
14
|
end
|
9
15
|
|
10
16
|
desc "role <github_login>", "Assign role to a user"
|
11
17
|
def role(login)
|
18
|
+
error_checking_users
|
12
19
|
RestClient.put"#{CONFIG['current_remote']}/api/v1/users/#{login}",
|
13
20
|
project_id: CONFIG["current_project_id"], name: login, role_id: role_type
|
14
21
|
say "Successfully updated user's role!"
|
@@ -16,6 +23,20 @@ module Agile
|
|
16
23
|
|
17
24
|
private
|
18
25
|
|
26
|
+
def find_user(login)
|
27
|
+
@users_array = []
|
28
|
+
all_users = RestClient.get "#{CONFIG['current_remote']}/api/v1/users"
|
29
|
+
JSON.parse(all_users).each do |hash|
|
30
|
+
@users_array.push(login) if hash["github_login"] == login
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def error_checking_users
|
35
|
+
abort "You haven't done init yet!" unless CONFIG["current_remote"]
|
36
|
+
abort "Please, log in!" unless CONFIG["current_user"]
|
37
|
+
abort "Please, choose a project to work with!" unless CONFIG["current_project"]
|
38
|
+
end
|
39
|
+
|
19
40
|
def role_type
|
20
41
|
cli = HighLine.new
|
21
42
|
cli.ask("Choose role type:\n1 - team member\n2 - scrum master\n3 - product owner", Integer)
|
data/lib/agile/constants.rb
CHANGED