ghedsh 1.1.23 → 1.1.24

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
  SHA1:
3
- metadata.gz: 0f33992ab76ebb5292a28ce928bf4e16aaf6f789
4
- data.tar.gz: bf405fdeb60b377c4f108aee301a838cf95b2099
3
+ metadata.gz: 36911cdf6e7bac29a670d1b7dd854f7a5dd10c08
4
+ data.tar.gz: 80dd7f25d2e9778a9109c3476f1265e10d710975
5
5
  SHA512:
6
- metadata.gz: 7213d3a442b613f8a84dc5a71c7d684e9d232b2613f50177ecbdbba07fd7e285f9ca38cfab004b46761a018c02a2d4bfedbebb2573eecc353dc0b9a58bb398d1
7
- data.tar.gz: 8183b0ebdab696d62b5799e3fd6bc87bf468159aea557e939aea8b4fde9c504ba2b3c4f2b718fa4c06251cd1f7214c78f1c9dd84dd8442531ae8246218825d18
6
+ metadata.gz: 0cbff224c6963b3c89e300807dab6bfb11fb541e94c1e50b396e00d9825762c566bfa1639925ce26d69c607494448bf30956e2ce9e3ec1a6808c28f7a17ee0a2
7
+ data.tar.gz: 3ceda151d06dccaf7cacc5adbf1cedb356d24686d203460da269704000335861020a133b8b9054f1250cbad4b0a9f4cf433a314b48c9d0edb9eff937fd604632
data/lib/actions/help.rb CHANGED
@@ -9,6 +9,7 @@ class HelpM
9
9
  def user()
10
10
  self.common_opt
11
11
  puts " Users options:"
12
+ print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
12
13
  print "\torgs\t\t\tShow your organizations\n"
13
14
  print "\trepos\t\t\tList your repositories\n"
14
15
  print "\tclone\t\t\tClone a repository or a list of repositories using a regular expresion\n"
@@ -20,29 +21,44 @@ class HelpM
20
21
  def org()
21
22
  self.common_opt
22
23
  puts " Organization options:"
24
+ print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
23
25
  print "\trepos\t\t\tList the repositories of your organization\n"
24
26
  print "\tclone\t\t\tClone a repository or a list of repositories using a regular expresion\n"
25
27
  print "\tset\t\t\tMove you to a specific repository\n"
26
28
  print "\tpeople\t\t\tMembers of a organization\n"
27
29
  print "\tteams\t\t\tTeams of a organization\n"
28
- print "\tnew_assignment\t\tCreate a repository in your organization\n"
30
+ print "\tassignments\t\tShow the list of assignments created\n"
31
+ print "\tnew_assignment\t\tCreate an Assignment in your organization\n"
32
+ print "\tgroups\t\t\tShow the list of groups with each team and user that it has\n"
33
+ print "\tnew_group\t\tCreate a new group. Expected the name and teams given one by one\n"
34
+ print "\t\t\t\t->\tnew_group [name of the group] [team1] [team2] [team3] ... \n\n"
35
+ print "\trm_group\t\tDelete a created group\n"
36
+ print "\t\t\t\t->\trm_group [name of the group]\n\n"
29
37
  print "\trm_team\t\t\tDelete a team in you organization. Expected the name of the team\n"
30
- print "\tnew_team\t\t\tCreate a team in the organization. Expected the name of the team, and/or members given one by one\n\n"
38
+ print "\t\t\t\t->\trm_team [name of the team]\n\n"
39
+ print "\tnew_team\t\tCreate a team in the organization. Expected the name of the team, and/or members given one by one\n"
40
+ print "\t\t\t\t->\tnew_team [name of the team] [member1] [member2] [member3] ... \n\n"
41
+
31
42
  end
32
43
 
33
44
  def org_repo()
34
45
  self.common_opt
35
46
  puts " Repository options:"
47
+ print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
36
48
  print "\tcommits\t\t\tShow the list of commits from the repository\n"
37
49
  print "\tissues\t\t\tShow the list of issues from the repository\n"
50
+ print "\tissue\t\t\tShow the issue and its comments\n"
51
+ print "\t\t\t\t->\tissue [Id of the issue]\n\n"
38
52
  print "\tfiles\t\t\tShow the files of the repository path given\n"
39
53
  print "\tcat\t\t\tShow data from a file\n"
54
+ print "\t\t\t\t->\tcat [file]\n\n"
40
55
  print "\tcol\t\t\tShow the list of collaborators from the repository\n\n"
41
56
  end
42
57
 
43
58
  def orgs_teams()
44
59
  self.common_opt
45
60
  puts " Organization team options:"
61
+ print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
46
62
  print "\tpeople\t\t\tMembers of the team\n"
47
63
  print "\tclone\t\t\tClone a repository or a list of repositories using a regular expresion\n"
48
64
  print "\tnew_repository\t\tCreate a repository to this team\n"
@@ -52,19 +68,27 @@ class HelpM
52
68
  def user_repo()
53
69
  self.common_opt
54
70
  puts " Repository options:"
71
+ print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
55
72
  print "\tcommits\t\t\tShow the list of commits from the repository\n"
56
73
  print "\tissues\t\t\tShow the list of issues from the repository\n"
74
+ print "\tissue\t\t\tShow the issue and its comments\n"
75
+ print "\t\t\t\t->\tissue [Id of the issue]\n\n"
57
76
  print "\tfiles\t\t\tShow the files of the repository path given\n"
58
77
  print "\tcat\t\t\tShow data from a file\n"
78
+ print "\t\t\t\t->\tcat [file]\n\n"
59
79
  print "\tcol\t\t\tShow the list of collaborators from the repository\n\n"
60
80
  end
61
81
  def team_repo()
62
82
  self.common_opt
63
83
  puts " Repository options:"
84
+ print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
64
85
  print "\tcommits\t\t\tShow the list of commits from the repository\n"
65
86
  print "\tissues\t\t\tShow the list of issues from the repository\n"
87
+ print "\tissue\t\t\tShow the issue and its comments\n"
88
+ print "\t\t\t\t->\tissue [Id of the issue]\n\n"
66
89
  print "\tfiles\t\t\tShow the files of the repository path given\n"
67
90
  print "\tcat\t\t\tShow data from a file\n"
91
+ print "\t\t\t\t->\tcat [file]\n\n"
68
92
  print "\tcol\t\t\tShow the list of collaborators from the repository\n\n"
69
93
  end
70
94
 
@@ -73,10 +97,19 @@ class HelpM
73
97
  puts " List of commands "
74
98
  puts "------------------"
75
99
  puts "\n Main options:"
100
+ print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
76
101
  print "\tdo\t\t\tRun a script in ghedsh execute path\n"
102
+ print "\t\t\t\t->\tdo [filename]\n\n"
77
103
  print "\texit\t\t\tExit from this program\n"
78
104
  print "\thelp\t\t\tList of commands available\n"
79
- print "\tcd\t\t\tGo to the path\n"
105
+ print "\tcd\t\t\tGo to the path. Could be an assignment, an organization, a team or a repository\n"
106
+ print "\t\t\t\t->\tcd [path]\n\n"
107
+ print "\t\t\t\tFor going to the user root path use cd without argument:\n"
108
+ print "\t\t\t\t->\tcd\n\n"
109
+ print "\t\t\t\tYou can go back to the previous level with the argument ".."\n"
110
+ print "\t\t\t\t->\tcd [..]\n\n"
111
+ print "\t\t\t\tDefault search look for repositories at the end of the queue. If you want to look for an specific repository use: \n"
112
+ print "\t\t\t\t->\tcd repo [name] \n\n"
80
113
  print "\t!\t\t\tExecute a bash command\n\n"
81
114
  end
82
115
 
data/lib/actions/orgs.rb CHANGED
@@ -125,7 +125,7 @@ class Organizations
125
125
  puts "\nAdd groups to your assignment (Press enter to skip): "
126
126
  op=gets.chomp
127
127
  if op==""
128
- puts "Do you want to create a new group? (Press any key to preceed, or only enter to skip)"
128
+ puts "Do you want to create a new group? (Press any key to proceed, or only enter to skip)"
129
129
  an=gets.chomp
130
130
 
131
131
  if an!=""
data/lib/actions/repo.rb CHANGED
@@ -18,18 +18,26 @@ class Repositories
18
18
 
19
19
  def show_commits(client,config,scope)
20
20
  print "\n"
21
- case
22
- when scope==USER_REPO
23
- if config["Repo"].split("/").size == 1
24
- mem=client.commits(config["User"]+"/"+config["Repo"],"master")
25
- else
26
- mem=client.commits(config["Repo"],"master")
27
- end
28
- when scope==ORGS_REPO
29
- mem=client.commits(config["Org"]+"/"+config["Repo"],"master")
21
+ empty=0
22
+ begin
23
+ case
24
+ when scope==USER_REPO
25
+ if config["Repo"].split("/").size == 1
26
+ mem=client.commits(config["User"]+"/"+config["Repo"],"master")
27
+ else
28
+ mem=client.commits(config["Repo"],"master")
29
+ end
30
+ when scope==ORGS_REPO || scope==TEAM_REPO
31
+ mem=client.commits(config["Org"]+"/"+config["Repo"],"master")
32
+ end
33
+ rescue
34
+ puts "The Repository is empty"
35
+ empty=1
30
36
  end
31
- mem.each do |i|
32
- print i[:sha],"\n",i[:commit][:author][:name],"\n",i[:commit][:author][:date],"\n",i[:commit][:message],"\n\n"
37
+ if empty==0
38
+ mem.each do |i|
39
+ print i[:sha],"\n",i[:commit][:author][:name],"\n",i[:commit][:author][:date],"\n",i[:commit][:message],"\n\n"
40
+ end
33
41
  end
34
42
  end
35
43
 
@@ -78,42 +86,88 @@ class Repositories
78
86
  end
79
87
  end
80
88
 
89
+ def get_issues(client,config,scope)
90
+ case
91
+ when scope==USER_REPO
92
+ if config["Repo"].split("/").size == 1
93
+ mem=client.list_issues(config["User"]+"/"+config["Repo"],{:state=>"all"})
94
+ else
95
+ mem=client.list_issues(config["Repo"],{:state=>"all"})
96
+ end
97
+ when scope==ORGS_REPO || scope==TEAM_REPO
98
+ mem=client.list_issues(config["Org"]+"/"+config["Repo"],{:state=>"all"})
99
+ end
100
+ return mem
101
+ end
102
+
103
+ #show all issues from a repository
81
104
  def show_issues(client,config,scope)
82
105
  print "\n"
83
- case
84
- when scope==USER_REPO
85
- if config["Repo"].split("/").size == 1
86
- mem=client.list_issues(config["User"]+"/"+config["Repo"],{:state=>"all"})
87
- else
88
- mem=client.list_issues(config["Repo"],{:state=>"all"})
89
- end
90
- when scope==ORGS_REPO || scope==TEAM_REPO
91
- mem=client.list_issues(config["Org"]+"/"+config["Repo"],{:state=>"all"})
92
- end
106
+ mem=self.get_issues(client,config,scope)
93
107
  mem.each do |i|
94
108
  #print i[:sha],"\n",i[:commit][:author][:name],"\n",i[:commit][:author][:date],"\n",i[:commit][:message],"\n\n"
95
109
  puts "##{i[:number]} state: #{i[:state]} -> #{i[:title]} "
96
110
  end
111
+ print "\n"
97
112
  return mem
98
- puts "\n"
99
113
  end
100
114
 
101
- def get_issues(client,config,scope)
115
+ #show an specific issue from a repository
116
+ def show_issue(client,config,scope,id)
117
+ issfound=0
118
+ issues_list=self.get_issues(client,config,scope)
119
+ if issues_list!=nil
120
+ issues_list.each do |i|
121
+ if i[:number]==id.to_i
122
+ puts
123
+ puts " --------------------------------------"
124
+ puts " Author: #{i[:user][:login]}"
125
+ puts " ##{i[:number]} state: #{i[:state]}"
126
+ puts " Tittle: #{i[:title]}"
127
+ puts " --------------------------------------"
128
+ puts "\n#{i[:body]}"
129
+ issfound=1
130
+ print "\nShow comments (Press any key to proceed, or only enter to skip) -> "
131
+ show=gets.chomp
132
+ puts
133
+ if show!=""
134
+ self.show_issues_cm(client,config,scope,i[:number])
135
+ end
136
+ end
137
+ end
138
+ end
139
+ if issfound==0
140
+ puts "Issue not found"
141
+ end
142
+ puts "\n"
143
+ end
144
+
145
+ #show issues comment
146
+ def show_issues_cm(client,config,scope,id)
102
147
  case
103
148
  when scope==USER_REPO
104
149
  if config["Repo"].split("/").size == 1
105
- mem=client.list_issues(config["User"]+"/"+config["Repo"],{:state=>"all"})
150
+ mem=client.issue_comments(config["User"]+"/"+config["Repo"],id)
106
151
  else
107
- mem=client.list_issues(config["Repo"],{:state=>"all"})
152
+ mem=client.issue_comments(config["Repo"],id)
108
153
  end
109
154
  when scope==ORGS_REPO || scope==TEAM_REPO
110
- mem=client.list_issues(config["Org"]+"/"+config["Repo"],{:state=>"all"})
155
+ mem=client.issue_comments(config["Org"]+"/"+config["Repo"],id)
156
+ end
157
+ if mem!=nil
158
+ puts
159
+ puts " < COMMENTS (#{mem.size}) >"
160
+ mem.each do |i|
161
+ puts
162
+ puts " --------------------------------------"
163
+ puts " Author: #{i[:user][:login]} "
164
+ puts " Date: #{i[:created_at]}"
165
+ puts " --------------------------------------"
166
+ puts "\n#{i[:body]}"
167
+ end
168
+ else
169
+ puts "No comments have been added yet"
111
170
  end
112
- return mem
113
- end
114
-
115
- #show issues comment
116
- def get_issues_cm
117
171
  end
118
172
 
119
173
  #add issue comment
@@ -217,27 +271,44 @@ class Repositories
217
271
  print "\n"
218
272
  forklist=[]
219
273
  case
220
- when scope==USER
274
+ when scope==USER_REPO
275
+ if config["Repo"].split("/").size == 1
276
+ mem=client.forks(config["User"]+"/"+config["Repo"],"master")
277
+ else
278
+ mem=client.forks(config["Repo"],"master")
279
+ end
280
+ when scope==ORGS_REPO || scope==TEAM_REPO
221
281
  mem=client.forks(config["Org"]+"/"+config["Repo"])
222
282
  end
223
- mem.each do |i|
224
- puts i[:owner][:login]
225
- forklist.push(i[:owner][:login])
283
+ if mem.size==0
284
+ puts "No forks found for this repository"
285
+ else
286
+ mem.each do |i|
287
+ puts i[:login]
288
+ forklist.push(i[:login])
289
+ end
290
+ print "\n"
291
+ return forklist
226
292
  end
227
- print "\n"
228
- return forklist
229
293
  end
230
294
 
231
295
  def show_collaborators(client,config,scope)
232
296
  print "\n"
233
297
  collalist=[]
234
298
  case
235
- when scope==USER
299
+ when scope==USER_REPO
300
+ if config["Repo"].split("/").size == 1
301
+ mem=client.collaborators(config["User"]+"/"+config["Repo"],"master")
302
+ else
303
+ mem=client.collaborators(config["Repo"],"master")
304
+ end
305
+ when scope==ORGS_REPO || scope==TEAM_REPO
236
306
  mem=client.collaborators(config["Org"]+"/"+config["Repo"])
237
307
  end
308
+ print " Collaborators\n\n"
238
309
  mem.each do |i|
239
- puts i[:author][:login]
240
- collalist.push(i[:author][:login])
310
+ puts " #{i[:login]}"
311
+ collalist.push(i[:login])
241
312
  end
242
313
  print "\n"
243
314
  return collalist
@@ -328,17 +399,57 @@ class Repositories
328
399
  end
329
400
  end
330
401
 
402
+ def edit_repository(client, config, repo, scope, privacy)
403
+ options=Hash.new
404
+ options[:private]=privacy
405
+
406
+ case
407
+ when scope==ORGS
408
+ options[:organization]=config["Org"]
409
+ if client.repository?("#{config["Org"]}/#{repo}")==true
410
+ client.edit_repository(repo,options)
411
+ puts "Edited repository in #{config["Org"]}"
412
+ return true
413
+ else
414
+ puts "\e[31m Doesn't exists a repository with that name in #{config["Org"]}\e[0m"
415
+ return false
416
+ end
417
+ when scope==USER
418
+ if client.repository?("#{config["User"]}/#{repo}")==true
419
+ client.edit_repository(repo)
420
+ puts "Edited repository #{config["User"]}"
421
+ return true
422
+ else
423
+ puts "\e[31m Doesn't exists a repository with that name in #{config["User"]}\e[0m"
424
+ return false
425
+ end
426
+ when scope==TEAM
427
+ puts "Edited repository in #{config["Org"]} team"
428
+ options[:team_id]=config["TeamID"]
429
+ options[:organization]=config["Org"]
430
+
431
+ if client.repository?("#{config["Org"]}/#{repo}")==true
432
+ client.edit_repository(repo,options)
433
+ puts "Edited repository in #{config["Org"]} for team #{config["Team"]}"
434
+ return true
435
+ else
436
+ puts "\e[31m Doesn't exists a repository with that name in #{config["Org"]}\e[0m"
437
+ return false
438
+ end
439
+ end
440
+ end
441
+
442
+ def change_privacy(client,config,repo,list,list_id,privacy)
443
+ list.each do |i|
444
+ end
445
+ end
446
+
331
447
  def create_repository_by_teamlist(client,config,repo,list,list_id)
332
448
  options=Hash.new
333
449
  options[:organization]=config["Org"]
334
- #puts list_id
335
450
  y=0
336
451
  list.each do |i|
337
452
  options[:team_id]=list_id[y]
338
- # puts i, list_id[y]
339
- # puts repo
340
- # puts options
341
- # puts "\n"
342
453
  client.create_repository(i+"/"+repo,false,options)
343
454
  y=y+1
344
455
  end
data/lib/actions/teams.rb CHANGED
@@ -187,7 +187,9 @@ class Teams
187
187
  end
188
188
  end
189
189
  end
190
+ end
190
191
 
192
+ def change_group_repos_privacity()
191
193
  end
192
194
 
193
195
  def add_to_group(config,name)
data/lib/interface.rb CHANGED
@@ -187,7 +187,11 @@ class Interface
187
187
  self.set(path)
188
188
  end
189
189
  when @deep == ORGS
190
+ if @teamlist==[]
191
+ @teamlist=Teams.new.read_teamlist(@client,@config)
192
+ end
190
193
  aux=@teamlist
194
+ # puts "lul #{@teamlist}"
191
195
  if aux[path]!=nil
192
196
  @config["Team"]=path
193
197
  @config["TeamID"]=@teamlist[path]
@@ -231,6 +235,10 @@ class Interface
231
235
  self.set(path)
232
236
  end
233
237
  when @deep==ORGS
238
+ if @teamlist==[]
239
+ @teamlist=Teams.new.read_teamlist(@client,@config)
240
+ end
241
+ aux=@teamlist
234
242
  if aux[path_split[0]]!=nil
235
243
  @config["Team"]=path_split[0]
236
244
  @config["TeamID"]=@teamlist[path_split[0]]
@@ -408,16 +416,16 @@ class Interface
408
416
  end
409
417
 
410
418
  def show_forks()
411
- case
412
- when @deep==ORGS_REPO
413
- Repositories.new.show_forks(@client,@config,1)
419
+ c=Repositories.new
420
+ if @deep==ORGS_REPO || @deep==USER_REPO || @deep==TEAM_REPO
421
+ c.show_forks(@client,@config,@deep)
414
422
  end
415
423
  end
416
424
 
417
425
  def collaborators()
418
- case
419
- when @deep==ORGS_REPO
420
- Repositories.show_collaborators(@client,@config,1)
426
+ c=Repositories.new
427
+ if @deep==ORGS_REPO || @deep==USER_REPO || @deep==TEAM_REPO
428
+ c.show_collaborators(@client,@config,@deep)
421
429
  end
422
430
  end
423
431
 
@@ -446,6 +454,7 @@ class Interface
446
454
  @config=s.load_config(config_path,argv_token) #retorna la configuracion ya guardada anteriormente
447
455
  @client=s.client
448
456
  @deep=s.return_deep(config_path)
457
+ #if @deep==ORGS then @teamlist=t.get_teamlist end #solucion a la carga de las ids de los equipos de trabajo
449
458
  end
450
459
 
451
460
  #@deep=USER
@@ -506,21 +515,9 @@ class Interface
506
515
  end
507
516
 
508
517
  if opcd[0]=="issue" and opcd.size>1
509
- issfound=0
510
- @issues_list=r.get_issues(@client,@config,@deep)
511
- if @issues_list!=nil
512
- @issues_list.each do |i|
513
- if i[:number]==opcd[1].to_i
514
- puts "##{i[:number]} state: #{i[:state]} -> #{i[:title]} \n"
515
- puts "#{i[:body]}"
516
- issfound=1
517
- end
518
- end
519
- end
520
- if issfound==0
521
- puts "Issue not found"
518
+ if @deep==ORGS_REPO || @deep==USER_REPO || @deep==TEAM_REPO
519
+ r.show_issue(@client,@config,@deep,opcd[1])
522
520
  end
523
- puts "\n"
524
521
  end
525
522
 
526
523
  if opcd[0]=="cd" and opcd[1]!=".."
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ghedsh
2
- VERSION='1.1.23'
2
+ VERSION='1.1.24'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghedsh
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.23
4
+ version: 1.1.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Clemente
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-02-15 00:00:00.000000000 Z
12
+ date: 2017-02-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: octokit