ghedsh 1.1.34 → 1.1.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/actions/help.rb +10 -0
- data/lib/actions/orgs.rb +241 -75
- data/lib/actions/repo.rb +3 -0
- data/lib/actions/system.rb +14 -2
- data/lib/interface.rb +40 -22
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ad491e04b2533a4043a8eae4c8391323dc04e92
|
4
|
+
data.tar.gz: 3e4bd3eabb39c8133dba7b0f6fc3b7397ccfbff2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cb4f0ae4f096d72fad72c7bf411ab9a00ea89a71f3e6bf1ca4fadd0344573e6345e205993100730e3aafe2d0295726674a681f7e7836e5e2d754a8df437d7b3
|
7
|
+
data.tar.gz: a0bb16a3fe99284259016b946ca14c56ddf36db529d73d61a5cf49883ca7bf522a5ab91dde6581a72e4614c43fd707af353868beb6f0c41e669d8629fe6db589
|
data/lib/actions/help.rb
CHANGED
@@ -16,6 +16,8 @@ class HelpM
|
|
16
16
|
print "\tclone\t\t\tClone a repository or a list of repositories using a regular expresion\n"
|
17
17
|
print "\tnew repository\t\tCreate a repository in your personal account\n"
|
18
18
|
print "\t\t\t\t->\tnew repository [name of the repository]\n\n"
|
19
|
+
print "\trm repository\t\tDelete a repository in your personal account\n"
|
20
|
+
print "\t\t\t\t->\trm repository [name of the repository]\n\n"
|
19
21
|
print "\tset\t\t\tMove you to a specific repository\n"
|
20
22
|
|
21
23
|
end
|
@@ -27,6 +29,8 @@ class HelpM
|
|
27
29
|
print "\trepos\t\t\tList the repositories of your organization\n"
|
28
30
|
print "\tnew repository\t\tCreate a repository in a organization\n"
|
29
31
|
print "\t\t\t\t->\tnew repository [name of the repository]\n\n"
|
32
|
+
print "\trm repository\t\tDelete a repository in a organization\n"
|
33
|
+
print "\t\t\t\t->\trm repository [name of the repository]\n\n"
|
30
34
|
print "\topen\t\t\tOpen the organization's url of github in your web browser.\n"
|
31
35
|
print "\t\t\t\tIf you have added the aditional .csv information with, you can open an specific github profile.\n"
|
32
36
|
print "\t\t\t\t->\topen [user]\n\n"
|
@@ -39,6 +43,8 @@ class HelpM
|
|
39
43
|
print "\t\t\t\tTo find a specific member extended info, you can give the github id as parameter.\n"
|
40
44
|
print "\t\t\t\t->\tpeople info [github id]\n\n"
|
41
45
|
print "\tteams\t\t\tTeams of a organization\n"
|
46
|
+
print "\tnew relation\t\tSet a relation for the extendend information between Github ID and an email from a .csv file\n"
|
47
|
+
print "\t\t\t\t->\tnew relation [name of the file]\n\n"
|
42
48
|
print "\tnew people info\t\tGet extended information from a .csv file founded in the excecute path\n"
|
43
49
|
print "\t\t\t\t->\tnew people info [name of the file]\n\n"
|
44
50
|
print "\trm people info\t\tDelete the extended information\n"
|
@@ -131,7 +137,11 @@ class HelpM
|
|
131
137
|
print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
|
132
138
|
print "\tinfo\t\t\t\Show information about the assignment\n"
|
133
139
|
print "\tadd repo\t\tAdd or create the repository of the assignment\n"
|
140
|
+
print "\tchange repo\t\tChange a repository of the assignment\n"
|
141
|
+
print "\t\t\t\t->\tchange repo [number of the repo]\n\n"
|
134
142
|
print "\tadd group\t\tAdd a new group to the assignment\n"
|
143
|
+
print "\topen\t\t\topen the github assignment repositories disposition\n"
|
144
|
+
print "\tadd students\t\tAdd new students to the assignment\n"
|
135
145
|
print "\tmake\t\t\tCreate the repository assignment in Github for each team of every group\n\n"
|
136
146
|
end
|
137
147
|
|
data/lib/actions/orgs.rb
CHANGED
@@ -39,10 +39,19 @@ class Organizations
|
|
39
39
|
assig["assigs"].each do |i|
|
40
40
|
puts "\n"
|
41
41
|
puts i["name_assig"]
|
42
|
-
puts "
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
i.each{|key, value| if key.include?("repo") then puts "Repository #{key.delete("repo")}: #{value}" end}
|
43
|
+
if i["groups"]!=[] and i["groups"]!=nil
|
44
|
+
puts "\tGroups: "
|
45
|
+
i["groups"].each do |y|
|
46
|
+
puts "\t\t#{y}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
if i["people"]!=[] and i["people"]!=nil
|
50
|
+
puts "\tStudents: "
|
51
|
+
i["people"].each do |y|
|
52
|
+
puts "\t\t#{y}"
|
53
|
+
end
|
54
|
+
puts "\n"
|
46
55
|
end
|
47
56
|
print "\n"
|
48
57
|
end
|
@@ -157,6 +166,7 @@ class Organizations
|
|
157
166
|
puts "2)Take all the Teams available"
|
158
167
|
puts "3)Take the teams from a file\n"
|
159
168
|
puts "4)Add the teams to the group later"
|
169
|
+
print "option => "
|
160
170
|
op2=gets.chomp
|
161
171
|
end while (op2!="1" && op2!="2" && op2!="3" && op2!="4")
|
162
172
|
refuse=false #para no añadirlo cuando se niege en la repeticion de la busqueda de fichero
|
@@ -206,6 +216,60 @@ class Organizations
|
|
206
216
|
return groupsadd
|
207
217
|
end
|
208
218
|
|
219
|
+
def assignment_people(client,config)
|
220
|
+
refuse=false
|
221
|
+
members=self.get_organization_members(client,config)
|
222
|
+
sys=Sys.new()
|
223
|
+
begin
|
224
|
+
puts "\n1)Put a list of students"
|
225
|
+
puts "2)Take all the list"
|
226
|
+
puts "3)Take the students from a file\n"
|
227
|
+
puts "4)Add the students later"
|
228
|
+
print "option => "
|
229
|
+
op2=gets.chomp
|
230
|
+
end while (op2!="1" && op2!="2" && op2!="3" && op2!="4")
|
231
|
+
if op2=="1"
|
232
|
+
puts members
|
233
|
+
puts "\nPut a list of students (Separeted with space): "
|
234
|
+
list=gets.chomp
|
235
|
+
list=list.split(" ")
|
236
|
+
end
|
237
|
+
if op2=="2"
|
238
|
+
puts "All the students have been taken"
|
239
|
+
list=members
|
240
|
+
end
|
241
|
+
if op2=="3"
|
242
|
+
begin
|
243
|
+
ex=2
|
244
|
+
puts "Put the name of the file: "
|
245
|
+
file=gets.chomp
|
246
|
+
list=sys.loadfile(file)
|
247
|
+
if list==nil
|
248
|
+
puts "The file doesn't exist or It's empty. Do you like to try again? (y/n):"
|
249
|
+
op3=gets.chomp
|
250
|
+
if op3 == "n" or op3 == "N"
|
251
|
+
ex=1
|
252
|
+
refuse=true
|
253
|
+
end
|
254
|
+
else
|
255
|
+
ex=1
|
256
|
+
end
|
257
|
+
end while ex!=1
|
258
|
+
end
|
259
|
+
if op2!=4 and refuse==false
|
260
|
+
if op2!=2
|
261
|
+
list.each do |i|
|
262
|
+
if !members.include?(i)
|
263
|
+
list.delete(i)
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
return list
|
268
|
+
else
|
269
|
+
return []
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
209
273
|
def create_assig(client,config,name)
|
210
274
|
list=self.load_assig()
|
211
275
|
assigs=list["orgs"].detect{|aux| aux["name"]==config["Org"]}
|
@@ -217,16 +281,31 @@ class Organizations
|
|
217
281
|
|
218
282
|
assig_exist=list["orgs"].detect{|aux| aux["name"]==config["Org"]}["assigs"].detect{|aux| aux["name_assig"]==name}
|
219
283
|
if assig_exist==nil
|
220
|
-
|
221
|
-
reponame=self.assignment_repository(client,config,name)
|
222
|
-
groupsadd=self.assignment_groups(client,config)
|
223
|
-
|
224
284
|
begin
|
225
|
-
|
226
|
-
|
227
|
-
puts
|
285
|
+
puts "\n1)Individual assignment"
|
286
|
+
puts "2)Group assignment"
|
287
|
+
puts "3)Discard assignment"
|
288
|
+
print "option => "
|
289
|
+
op=gets.chomp
|
290
|
+
end while op!="1" && op!="2" && op!="3"
|
291
|
+
|
292
|
+
if op!="3"
|
293
|
+
reponame=self.assignment_repository(client,config,name)
|
294
|
+
if op=="2"
|
295
|
+
groupsadd=self.assignment_groups(client,config)
|
296
|
+
peopleadd=[]
|
297
|
+
end
|
298
|
+
if op=="1"
|
299
|
+
peopleadd=self.assignment_people(client,config)
|
300
|
+
groupsadd=[]
|
301
|
+
end
|
302
|
+
begin
|
303
|
+
list["orgs"][list["orgs"].index{|aux| aux["name"]==config["Org"]}]["assigs"].push({"name_assig"=>name,"teams"=>[],"people"=>peopleadd,"groups"=>groupsadd,"repo"=>reponame})
|
304
|
+
rescue Exception => e
|
305
|
+
puts e
|
306
|
+
end
|
307
|
+
Sys.new.save_assigs("#{ENV['HOME']}/.ghedsh",list)
|
228
308
|
end
|
229
|
-
Sys.new.save_assigs("#{ENV['HOME']}/.ghedsh",list)
|
230
309
|
else
|
231
310
|
puts "Already exists an Assignment with that name"
|
232
311
|
end
|
@@ -263,16 +342,27 @@ class Organizations
|
|
263
342
|
team=Teams.new()
|
264
343
|
puts "\n"
|
265
344
|
puts assig["name_assig"]
|
266
|
-
puts "
|
267
|
-
|
268
|
-
assig["groups"]
|
269
|
-
puts "\
|
270
|
-
|
271
|
-
|
272
|
-
|
345
|
+
assig.each{|key, value| if key.include?("repo") then puts "Repository #{key.delete("repo")}: #{value}" end}
|
346
|
+
|
347
|
+
if assig["groups"]!=[]
|
348
|
+
puts "\tGroups: "
|
349
|
+
assig["groups"].each do |y|
|
350
|
+
puts "\t\t#{y}"
|
351
|
+
t=team.get_single_group(config,y)
|
352
|
+
if t!=nil
|
353
|
+
t.each do |z|
|
354
|
+
puts "\t\t\t#{z}"
|
355
|
+
end
|
356
|
+
end
|
273
357
|
end
|
274
358
|
end
|
275
|
-
|
359
|
+
if assig["people"]!=[] and assig["people"]!=nil
|
360
|
+
puts "\tStudents: "
|
361
|
+
assig["people"].each do |y|
|
362
|
+
puts "\t\t#{y}"
|
363
|
+
end
|
364
|
+
puts "\n"
|
365
|
+
end
|
276
366
|
end
|
277
367
|
|
278
368
|
def make_assig(client,config,assig)
|
@@ -289,31 +379,59 @@ class Organizations
|
|
289
379
|
|
290
380
|
#system("git clone #{web2}#{config["Org"]}/#{assig["repo"]}.git #{ENV['HOME']}/.ghedsh/#{assig["repo"]}")
|
291
381
|
system("git clone #{web2}#{assig["repo"]}.git #{ENV['HOME']}/.ghedsh/temp/#{assig["repo"]}")
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
382
|
+
if assig["groups"]!=[]
|
383
|
+
assig["groups"].each do |i|
|
384
|
+
teamsforgroup=team.get_single_group(config,i)
|
385
|
+
if teamsforgroup!=nil
|
386
|
+
teamsforgroup.each do |y|
|
387
|
+
config["TeamID"]=teamlist["#{y}"]
|
388
|
+
config["Team"]=y
|
389
|
+
repo.create_repository(client,config,"#{y}-#{assig["name_assig"]}",true,TEAM)
|
390
|
+
system("git -C #{ENV['HOME']}/.ghedsh/temp/#{assig["repo"]} remote rm origin")
|
391
|
+
system("git -C #{ENV['HOME']}/.ghedsh/temp/#{assig["repo"]} remote add origin #{web2}#{config["Org"]}/#{y}-#{assig["name_assig"]}.git")
|
392
|
+
|
393
|
+
system("git -C #{ENV['HOME']}/.ghedsh/temp/#{assig["repo"]} push origin --all")
|
394
|
+
end
|
395
|
+
end
|
396
|
+
end
|
397
|
+
end
|
398
|
+
if assig["people"]!=[] and assig["people"]!=nil
|
399
|
+
assig["people"].each do |i|
|
400
|
+
repo.create_repository(client,config,"#{i}-#{assig["name_assig"]}",true,ORGS)
|
401
|
+
system("git -C #{ENV['HOME']}/.ghedsh/temp/#{assig["repo"]} remote rm origin")
|
402
|
+
system("git -C #{ENV['HOME']}/.ghedsh/temp/#{assig["repo"]} remote add origin #{web2}#{config["Org"]}/#{i}-#{assig["name_assig"]}.git")
|
403
|
+
system("git -C #{ENV['HOME']}/.ghedsh/temp/#{assig["repo"]} push origin --all")
|
404
|
+
repo.add_collaborator(client,"#{config["Org"]}/#{i}-#{assig["name_assig"]}",i)
|
303
405
|
end
|
304
406
|
end
|
305
|
-
#system("rm -rf #{ENV['HOME']}/.ghedsh/temp/#{assig["repo"]}")
|
306
407
|
else
|
307
408
|
puts "\e[31m No repository is given for this assignment\e[0m"
|
308
409
|
end
|
309
|
-
|
310
|
-
|
311
410
|
end
|
312
411
|
|
313
412
|
def add_team_to_assig(client,config,assig,data)
|
314
413
|
assig=self.get_single_assig(config,assig)
|
315
414
|
end
|
316
415
|
|
416
|
+
def add_people_to_assig(client,config,assig)
|
417
|
+
list=self.load_assig()
|
418
|
+
people=self.assignment_people(client,config)
|
419
|
+
if list["orgs"].detect{|aux| aux["name"]==config["Org"]}["assigs"].detect{|aux2| aux2["name_assig"]==assig}["people"]==nil
|
420
|
+
list["orgs"].detect{|aux| aux["name"]==config["Org"]}["assigs"].detect{|aux2| aux2["name_assig"]==assig}["people"]=[]
|
421
|
+
end
|
422
|
+
|
423
|
+
if people!=""
|
424
|
+
people.each do |i|
|
425
|
+
if !list["orgs"].detect{|aux| aux["name"]==config["Org"]}["assigs"].detect{|aux2| aux2["name_assig"]==assig}["people"].include?(i)
|
426
|
+
list["orgs"].detect{|aux| aux["name"]==config["Org"]}["assigs"].detect{|aux2| aux2["name_assig"]==assig}["people"].push(i)
|
427
|
+
else
|
428
|
+
puts "#{i} is already in this assignment."
|
429
|
+
end
|
430
|
+
end
|
431
|
+
Sys.new.save_assigs("#{ENV['HOME']}/.ghedsh",list)
|
432
|
+
end
|
433
|
+
end
|
434
|
+
|
317
435
|
def add_group_to_assig(client,config,assig)
|
318
436
|
list=self.load_assig()
|
319
437
|
|
@@ -326,8 +444,12 @@ class Organizations
|
|
326
444
|
end
|
327
445
|
end
|
328
446
|
|
447
|
+
def open_assig(config,assig)
|
448
|
+
Sys.new.open_url("https://github.com/search?q=org%3A#{config["Org"]}+#{assig}")
|
449
|
+
end
|
450
|
+
|
329
451
|
#Takes people info froma a csv file and gets into ghedsh people information
|
330
|
-
def add_people_info(client,config,file)
|
452
|
+
def add_people_info(client,config,file,relation)
|
331
453
|
list=self.load_people()
|
332
454
|
csvoptions={:quote_char => "|",:headers=>true,:skip_blanks=>true}
|
333
455
|
members=self.get_organization_members(client,config) #members of the organization
|
@@ -347,6 +469,7 @@ class Organizations
|
|
347
469
|
rescue
|
348
470
|
print "Invalid csv format."
|
349
471
|
end
|
472
|
+
|
350
473
|
fields=mem.headers
|
351
474
|
users=Hash.new;
|
352
475
|
users=[]
|
@@ -359,9 +482,11 @@ class Organizations
|
|
359
482
|
if i[j]!=nil
|
360
483
|
if GITHUB_LIST.include?(j.gsub("\"", "").downcase.strip)
|
361
484
|
aux["github"]=i[j].gsub("\"", "").strip
|
485
|
+
j="github"
|
362
486
|
else
|
363
487
|
if MAIL_LIST.include?(j.gsub("\"", "").downcase.strip)
|
364
488
|
aux["email"]=i[j].gsub("\"", "").strip
|
489
|
+
j="email"
|
365
490
|
else
|
366
491
|
aux[j.gsub("\"", "").downcase.strip]=i[j].gsub("\"", "").strip
|
367
492
|
end
|
@@ -370,45 +495,43 @@ class Organizations
|
|
370
495
|
aux[j.gsub("\"", "").downcase.strip]=i[j]
|
371
496
|
end
|
372
497
|
end
|
373
|
-
users
|
498
|
+
users.push(aux)
|
374
499
|
end
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
if here.eql?(i)
|
385
|
-
puts "The information given is the same as in the database, changes are being discard."
|
386
|
-
else
|
387
|
-
puts "The information is different thant the original. Do you want to change it?"
|
388
|
-
puts "\n Github:\t#{here["github"]} -> #{i["github"]}"
|
389
|
-
|
390
|
-
fields.each do |j|
|
391
|
-
puts " #{j} :\t\t#{here[j.gsub("\"", "").downcase]} -> #{i[j.gsub("\"", "").downcase]}"
|
392
|
-
end
|
393
|
-
|
394
|
-
puts "\nPress any key and enter to proceed, or only enter to skip: "
|
395
|
-
op=gets.chomp
|
396
|
-
if op!=""
|
397
|
-
index1=list["orgs"].index{|aux| aux["name"]==config["Org"]}
|
398
|
-
index2=list["orgs"][index1]["users"].index{|aux2| aux2["github"]==i["github"]}
|
399
|
-
|
400
|
-
list["orgs"][index1]["users"].pop(index2)
|
500
|
+
## Aqui empiezan las diferenciaa
|
501
|
+
if relation==true
|
502
|
+
|
503
|
+
# if users.keys.include?("github") and users.keys.include?("email") and users.keys.size==2
|
504
|
+
if fields.include?("github") and fields.include?("email") and fields.size==2
|
505
|
+
users.each do |i|
|
506
|
+
if members.include?(i["github"])
|
507
|
+
here=list["orgs"].detect{|aux| aux["name"]==config["Org"]}["users"].detect{|aux2| aux2["github"]==i["github"]} #miro si ya esta registrado
|
508
|
+
if here==nil
|
401
509
|
list["orgs"].detect{|aux| aux["name"]==config["Org"]}["users"]<<i
|
402
|
-
puts "
|
403
|
-
else
|
404
|
-
puts "
|
510
|
+
puts "#{i["github"]} information correctly added"
|
511
|
+
else #si ya esta registrado...
|
512
|
+
puts "#{i["github"]} is already registered in this organization"
|
405
513
|
end
|
514
|
+
else
|
515
|
+
puts "#{i["github"]} is not registered in this organization"
|
406
516
|
end
|
407
517
|
end
|
408
518
|
else
|
409
|
-
puts "
|
519
|
+
puts "No relationship found between github users and emails."
|
520
|
+
return nil
|
521
|
+
end
|
522
|
+
else #insercion normal, relacion ya hecha
|
523
|
+
users.each do |i|
|
524
|
+
here=list["orgs"].detect{|aux| aux["name"]==config["Org"]}["users"].detect{|aux2| aux2["email"]==i["email"]}
|
525
|
+
if here!=nil
|
526
|
+
i.each do |j|
|
527
|
+
list["orgs"].detect{|aux| aux["name"]==config["Org"]}["users"].detect{|aux2| aux2["email"]==i["email"]}["#{j[0]}"]=j[1]
|
528
|
+
end
|
529
|
+
else
|
530
|
+
puts "No relation found of #{i["email"]} in #{config["Org"]}"
|
531
|
+
end
|
410
532
|
end
|
411
533
|
end
|
534
|
+
#tocho
|
412
535
|
Sys.new.save_people("#{ENV['HOME']}/.ghedsh",list)
|
413
536
|
else
|
414
537
|
print "\n#{file} file not found.\n\n"
|
@@ -476,16 +599,59 @@ class Organizations
|
|
476
599
|
end
|
477
600
|
end
|
478
601
|
|
479
|
-
def add_repo_to_assig(client,config,assig)
|
602
|
+
def add_repo_to_assig(client,config,assig,change)
|
480
603
|
list=self.load_assig()
|
604
|
+
notexist=false
|
605
|
+
|
606
|
+
if change!=nil #change an specific repository
|
607
|
+
reponumber=change
|
608
|
+
fields=list["orgs"].detect{|aux| aux["name"]==config["Org"]}["assigs"].detect{|aux2| aux2["name_assig"]==assig}.keys
|
609
|
+
if reponumber=="1"
|
610
|
+
if !fields.include?("repo")
|
611
|
+
notexist=true
|
612
|
+
end
|
613
|
+
else
|
614
|
+
if !fields.include?("repo"+change)
|
615
|
+
notexist=true
|
616
|
+
end
|
617
|
+
end
|
618
|
+
else #adding new repository
|
619
|
+
fields=list["orgs"].detect{|aux| aux["name"]==config["Org"]}["assigs"].detect{|aux2| aux2["name_assig"]==assig}.keys
|
620
|
+
reponumber=1
|
621
|
+
ex=0
|
622
|
+
while ex==0
|
623
|
+
if reponumber==1
|
624
|
+
if fields.include?("repo")
|
625
|
+
reponumber=reponumber+1
|
626
|
+
else
|
627
|
+
ex=1
|
628
|
+
end
|
629
|
+
else
|
630
|
+
if fields.include?("repo#{reponumber}")
|
631
|
+
reponumber=reponumber+1
|
632
|
+
else
|
633
|
+
ex=1
|
634
|
+
end
|
635
|
+
end
|
636
|
+
end
|
637
|
+
end
|
481
638
|
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
639
|
+
if notexist==true
|
640
|
+
puts "Doesn't exist that repository"
|
641
|
+
else
|
642
|
+
reponame=self.assignment_repository(client,config,assig["name_assig"])
|
643
|
+
end
|
644
|
+
|
645
|
+
if reponame!="" and notexist==false
|
646
|
+
if reponumber==1
|
647
|
+
list["orgs"].detect{|aux| aux["name"]==config["Org"]}["assigs"].detect{|aux2| aux2["name_assig"]==assig}["repo"]=reponame
|
648
|
+
Sys.new.save_assigs("#{ENV['HOME']}/.ghedsh",list)
|
649
|
+
else
|
650
|
+
list["orgs"].detect{|aux| aux["name"]==config["Org"]}["assigs"].detect{|aux2| aux2["name_assig"]==assig}["repo#{reponumber}"]=reponame
|
651
|
+
Sys.new.save_assigs("#{ENV['HOME']}/.ghedsh",list)
|
652
|
+
end
|
486
653
|
end
|
487
654
|
end
|
488
|
-
#------------End assig. stuff------------
|
489
655
|
|
490
656
|
def show_organization_members_bs(client,config)
|
491
657
|
orgslist=[]
|
@@ -569,10 +735,10 @@ class Organizations
|
|
569
735
|
end
|
570
736
|
else
|
571
737
|
if inuser.keys.include?(field.downcase)
|
572
|
-
if
|
573
|
-
url="http://"+inuser["#{field.downcase}"]
|
574
|
-
else
|
738
|
+
if inuser[field.downcase].include?("https://") or inuser[field.downcase].include?("http://")
|
575
739
|
url=inuser["#{field.downcase}"]
|
740
|
+
else
|
741
|
+
url="http://"+inuser["#{field.downcase}"]
|
576
742
|
end
|
577
743
|
Sys.new.open_url(url)
|
578
744
|
else
|
data/lib/actions/repo.rb
CHANGED
data/lib/actions/system.rb
CHANGED
@@ -11,7 +11,7 @@ class Sys
|
|
11
11
|
attr_reader :memory
|
12
12
|
LIST = ['repos', 'exit', 'orgs','help', 'people','teams', 'cd ', 'cd repo ','commits','forks', 'add_team_member ','new team ','rm team ','new repository ','new assignment ','clone ', 'issues',
|
13
13
|
'version', 'cat ', 'groups', 'files', 'assignments','new issue ', 'open issue', 'new ','open ', 'close issue', 'new group ', 'rm group', 'rm ', 'do ', 'info','make','add repo',
|
14
|
-
'add group','rm repository ', 'new people info ', 'private ', 'people info ', 'new issue comment ', "rm people info"].sort
|
14
|
+
'add group','rm repository ', 'new people info ', 'private ', 'people info ', 'new issue comment ', "rm people info", "change repo",'add students','new relation'].sort
|
15
15
|
|
16
16
|
def initialize()
|
17
17
|
@memory=[]
|
@@ -141,6 +141,14 @@ class Sys
|
|
141
141
|
return users
|
142
142
|
end
|
143
143
|
|
144
|
+
# USER=1
|
145
|
+
# ORGS=2
|
146
|
+
# USER_REPO=10
|
147
|
+
# ORGS_REPO=3
|
148
|
+
# TEAM=4
|
149
|
+
# ASSIG=6
|
150
|
+
# TEAM_REPO=5
|
151
|
+
|
144
152
|
def return_deep(path)
|
145
153
|
json = File.read("#{path}/ghedsh-cache.json")
|
146
154
|
cache=JSON.parse(json)
|
@@ -157,7 +165,11 @@ class Sys
|
|
157
165
|
if cache["Repo"]!=nil
|
158
166
|
deep=3
|
159
167
|
else
|
160
|
-
|
168
|
+
if cache["Assig"]!=nil
|
169
|
+
deep=6
|
170
|
+
else
|
171
|
+
deep=2
|
172
|
+
end
|
161
173
|
end
|
162
174
|
else
|
163
175
|
if cache["Repo"]!=nil
|
data/lib/interface.rb
CHANGED
@@ -26,7 +26,7 @@ class Interface
|
|
26
26
|
attr_accessor :client
|
27
27
|
attr_accessor :deep
|
28
28
|
attr_accessor :memory
|
29
|
-
attr_reader :orgs_list,:repos_list, :teamlist, :orgs_repos, :teams_repos, :repo_path, :
|
29
|
+
attr_reader :orgs_list,:repos_list, :teamlist, :orgs_repos, :teams_repos, :repo_path, :issues_list
|
30
30
|
|
31
31
|
def initialize
|
32
32
|
@sysbh=Sys.new()
|
@@ -35,21 +35,21 @@ class Interface
|
|
35
35
|
|
36
36
|
options=@sysbh.parse
|
37
37
|
|
38
|
-
trap("SIGINT") { throw :ctrl_c}
|
39
|
-
catch :ctrl_c do
|
40
|
-
|
38
|
+
# trap("SIGINT") { throw :ctrl_c}
|
39
|
+
# catch :ctrl_c do
|
40
|
+
# begin
|
41
41
|
if options[:user]==nil && options[:token]==nil && options[:path]!=nil
|
42
42
|
self.run(options[:path],options[:token],options[:user])
|
43
43
|
else
|
44
44
|
self.run("#{ENV['HOME']}/.ghedsh",options[:token],options[:user])
|
45
45
|
end
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
end
|
46
|
+
# rescue SystemExit, Interrupt
|
47
|
+
# raise
|
48
|
+
# rescue Exception => e
|
49
|
+
# puts "exit"
|
50
|
+
# puts e
|
51
|
+
# end
|
52
|
+
# end
|
53
53
|
end
|
54
54
|
|
55
55
|
def prompt()
|
@@ -62,7 +62,7 @@ class Interface
|
|
62
62
|
return @config["User"]+">"+ "\e[31m#{@config["Repo"]}\e[0m"+"> "
|
63
63
|
end
|
64
64
|
when @deep == ORGS then return @config["User"]+">"+ "\e[34m#{@config["Org"]}\e[0m"+"> "
|
65
|
-
when @deep == ASSIG then return @config["User"]+">"+ "\e[34m#{@config["Org"]}\e[0m"+">"+"\e[35m#{@
|
65
|
+
when @deep == ASSIG then return @config["User"]+">"+ "\e[34m#{@config["Org"]}\e[0m"+">"+"\e[35m#{@config["Assig"]}\e[0m"+"> "
|
66
66
|
when @deep == TEAM then return @config["User"]+">"+"\e[34m#{@config["Org"]}\e[0m"+">"+"\e[32m#{@config["Team"]}\e[0m"+"> "
|
67
67
|
when @deep == TEAM_REPO
|
68
68
|
if @repo_path!=""
|
@@ -140,7 +140,7 @@ class Interface
|
|
140
140
|
@deep=2
|
141
141
|
when @deep == ASSIG
|
142
142
|
@deep=ORGS
|
143
|
-
@
|
143
|
+
@config["Assig"]=nil
|
144
144
|
when @deep == TEAM_REPO
|
145
145
|
if @repo_path==""
|
146
146
|
@config["Repo"]=nil
|
@@ -160,9 +160,10 @@ class Interface
|
|
160
160
|
@config["Repo"]=nil
|
161
161
|
@config["Team"]=nil
|
162
162
|
@config["TeamID"]=nil
|
163
|
+
@config["Assig"]=nil
|
163
164
|
@deep=1
|
164
165
|
@orgs_repos=[]; @teams_repos=[]
|
165
|
-
@repo_path="";
|
166
|
+
@repo_path="";
|
166
167
|
end
|
167
168
|
end
|
168
169
|
|
@@ -270,24 +271,26 @@ class Interface
|
|
270
271
|
puts "Set in #{@config["User"]} repository: #{path}\n\n"
|
271
272
|
end
|
272
273
|
when @deep==ORGS
|
273
|
-
|
274
|
+
|
274
275
|
if @orgs_repos.empty? == false
|
275
276
|
reposlist=@orgs_repos
|
276
277
|
else
|
277
278
|
reposlist=reposlist.get_repos_list(@client,@config,@deep)
|
278
279
|
end
|
279
280
|
if reposlist.one?{|aux| aux==path}
|
281
|
+
@config["Repo"]=path
|
280
282
|
@deep=ORGS_REPO
|
281
283
|
puts "Set in #{@config["Org"]} repository: #{path}\n\n"
|
282
284
|
end
|
283
285
|
when @deep==TEAM
|
284
|
-
|
286
|
+
|
285
287
|
if @teams_repos.empty? == false
|
286
288
|
reposlist=@teams_repos
|
287
289
|
else
|
288
290
|
reposlist=reposlist.get_repos_list(@client,@config,@deep)
|
289
291
|
end
|
290
292
|
if reposlist.one?{|aux| aux==path}
|
293
|
+
@config["Repo"]=path
|
291
294
|
@deep=TEAM_REPO
|
292
295
|
puts "Set in #{@config["Team"]} repository: #{path}\n\n"
|
293
296
|
end
|
@@ -322,8 +325,8 @@ class Interface
|
|
322
325
|
list=o.get_assigs(@client,@config)
|
323
326
|
if list.one?{|aux| aux==path}
|
324
327
|
@deep=ASSIG
|
325
|
-
@assig_path=path
|
326
328
|
puts "Set in #{@config["Org"]} assignment: #{path}\n\n"
|
329
|
+
@config["Assig"]=path
|
327
330
|
return true
|
328
331
|
else
|
329
332
|
puts "No assignment is available with that name"
|
@@ -536,11 +539,15 @@ class Interface
|
|
536
539
|
r.add_issue_cm(@client,@config,@deep,opcd[3],config_path)
|
537
540
|
end
|
538
541
|
when op.include?("new") && opcd[0]=="new" && opcd[1]=="people" && opcd[2]=="info"
|
539
|
-
if @deep==ORGS && opcd.size==4 then o.add_people_info(@client,@config,opcd[3]) end
|
542
|
+
if @deep==ORGS && opcd.size==4 then o.add_people_info(@client,@config,opcd[3],false) end
|
540
543
|
when op.include?("new") && opcd[0]=="new" && opcd[1]=="repository"
|
541
544
|
if opcd.size==3
|
542
545
|
r.create_repository(@client,@config,opcd[2],false,@deep)
|
543
546
|
end
|
547
|
+
when op.include?("new relation") && opcd[0]=="new" && opcd[1]="relation"
|
548
|
+
if opcd.size==3 and @deep==ORGS
|
549
|
+
o.add_people_info(@client,@config,opcd[2],true)
|
550
|
+
end
|
544
551
|
when op.include?("new assignment") && opcd[0]=="new" && opcd[1]="assignment"
|
545
552
|
if opcd.size==3 and @deep==ORGS
|
546
553
|
r.create_repository_by_teamlist(@client,@config,opcd[2],opcd[3,opcd.size],self.get_teamlist(opcd[3,opcd.size]))
|
@@ -582,16 +589,26 @@ class Interface
|
|
582
589
|
end
|
583
590
|
|
584
591
|
when op == "info"
|
585
|
-
if @deep==ASSIG then o.show_assig_info(@config,@
|
592
|
+
if @deep==ASSIG then o.show_assig_info(@config,@config["Assig"]) end
|
586
593
|
if @deep==USER_REPO || @deep==TEAM_REPO || @deep==ORGS_REPO then r.info_repository(@client,@config,@deep) end
|
587
594
|
when op== "add repo"
|
588
|
-
if @deep
|
595
|
+
if @deep==ASSIG then o.add_repo_to_assig(@client,@config,@config["Assig"],nil) end
|
596
|
+
when op.include?("change repo") && opcd[0]=="change" && opcd[1]="repo"
|
597
|
+
if @deep==ASSIG
|
598
|
+
if opcd.size>2
|
599
|
+
o.add_repo_to_assig(@client,@config,@config["Assig"],opcd[2])
|
600
|
+
else
|
601
|
+
o.add_repo_to_assig(@client,@config,@config["Assig"],1)
|
602
|
+
end
|
603
|
+
end
|
604
|
+
when op=="add students" && @deep==ASSIG
|
605
|
+
o.add_people_to_assig(@client,@config,@config["Assig"])
|
589
606
|
when op.include?("rm")
|
590
607
|
if @deep==ORGS and opcd[1]=="people" and opcd[2]=="info"
|
591
608
|
o.rm_people_info(@client,@config)
|
592
609
|
end
|
593
610
|
when op== "add group"
|
594
|
-
if @deep=ASSIG then o.add_group_to_assig(@client,@config,@
|
611
|
+
if @deep=ASSIG then o.add_group_to_assig(@client,@config,@config["Assig"]) end
|
595
612
|
when op == "version"
|
596
613
|
puts "GitHub Education Shell v#{Ghedsh::VERSION}"
|
597
614
|
|
@@ -616,7 +633,7 @@ class Interface
|
|
616
633
|
end
|
617
634
|
when op =="make"
|
618
635
|
if @deep==ASSIG
|
619
|
-
o.make_assig(@client,@config,@
|
636
|
+
o.make_assig(@client,@config,@config["Assig"])
|
620
637
|
end
|
621
638
|
when op.include?("open") && opcd[0]=="open"
|
622
639
|
if @deep==USER_REPO || @deep==TEAM_REPO || @deep==ORGS_REPO then r.open_repository(@client,@config,@deep) end
|
@@ -633,6 +650,7 @@ class Interface
|
|
633
650
|
end
|
634
651
|
end
|
635
652
|
if @deep==TEAM then t.open_team_repos(@config) end
|
653
|
+
if @deep==ASSIG then o.open_assig(@config,@config["Assig"]) end
|
636
654
|
end
|
637
655
|
|
638
656
|
if opcd[0]=="issue" and opcd.size>1
|
data/lib/version.rb
CHANGED
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.
|
4
|
+
version: 1.1.35
|
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-04-
|
12
|
+
date: 2017-04-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: octokit
|