ghedsh 1.1.29 → 1.1.30
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 +1 -0
- data/lib/actions/orgs.rb +84 -41
- data/lib/interface.rb +6 -1
- 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: e9ad6c1b3785d23f444874aaf51c1d9eed534ba7
|
4
|
+
data.tar.gz: f7cf2faca38d73638cd5d3db97bba0620f7b78d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fdefa767839703b084dfea4ea0a49ac08ba2dd97f411531aaf64f1c3eefcdaa7672fbb253ec089f4169773a4368a81efe70947fecc97619bacf710a73b43c78
|
7
|
+
data.tar.gz: 7d027abcb718f4aece629a5f53dbb6a02383a429614e0c26412398cae66a307fc2e0ae07f4c30c0517f4a7906f4af18bd7bdaa18518d8f26b66f696300aaad2b
|
data/lib/actions/help.rb
CHANGED
@@ -38,6 +38,7 @@ class HelpM
|
|
38
38
|
print "\tteams\t\t\tTeams of a organization\n"
|
39
39
|
print "\tnew_people_info\t\tGet extended information from a .csv file founded in the excecute path\n"
|
40
40
|
print "\t\t\t\t->\tnew_people_info [name of the file]\n\n"
|
41
|
+
print "\trm people info\t\tDelete the extended information\n"
|
41
42
|
print "\tassignments\t\tShow the list of assignments created\n"
|
42
43
|
print "\tnew_assignment\t\tCreate an Assignment in your organization\n"
|
43
44
|
print "\tgroups\t\t\tShow the list of groups with each team and user that it has\n"
|
data/lib/actions/orgs.rb
CHANGED
@@ -289,6 +289,7 @@ class Organizations
|
|
289
289
|
def add_people_info(client,config,file)
|
290
290
|
list=self.load_people()
|
291
291
|
csvoptions={:quote_char => "|",:headers=>true}
|
292
|
+
members=self.get_organization_members(client,config) #members of the organization
|
292
293
|
|
293
294
|
inpeople=list["orgs"].detect{|aux| aux["name"]==config["Org"]}
|
294
295
|
if inpeople==nil
|
@@ -310,6 +311,7 @@ class Organizations
|
|
310
311
|
users=[]
|
311
312
|
puts "\nFields found: "
|
312
313
|
puts fields
|
314
|
+
puts
|
313
315
|
mem.each do |i|
|
314
316
|
aux=Hash.new
|
315
317
|
fields.each do |j|
|
@@ -327,34 +329,39 @@ class Organizations
|
|
327
329
|
end
|
328
330
|
|
329
331
|
users.each do |i|
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
if here.eql?(i)
|
336
|
-
puts "The information given is the same as in the database, changes are being discard."
|
332
|
+
if members.include?(i["github"])
|
333
|
+
here=list["orgs"].detect{|aux| aux["name"]==config["Org"]}["users"].detect{|aux2| aux2["github"]==i["github"]}
|
334
|
+
if here==nil
|
335
|
+
list["orgs"].detect{|aux| aux["name"]==config["Org"]}["users"]<<i
|
336
|
+
puts "#{i["github"]} information correctly added"
|
337
337
|
else
|
338
|
-
puts "
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
puts "
|
343
|
-
|
338
|
+
puts "\nAlready exits \e[31m#{i["github"]}\e[0m in database"
|
339
|
+
if here.eql?(i)
|
340
|
+
puts "The information given is the same as in the database, changes are being discard."
|
341
|
+
else
|
342
|
+
puts "The information is different thant the original. Do you want to change it?"
|
343
|
+
puts "\n Github:\t#{here["github"]} -> #{i["github"]}"
|
344
344
|
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
index1=list["orgs"].index{|aux| aux["name"]==config["Org"]}
|
349
|
-
index2=list["orgs"][index1]["users"].index{|aux2| aux2["github"]==i["github"]}
|
345
|
+
fields.each do |j|
|
346
|
+
puts " #{j} :\t\t#{here[j.gsub("\"", "").downcase]} -> #{i[j.gsub("\"", "").downcase]}"
|
347
|
+
end
|
350
348
|
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
349
|
+
puts "\nPress any key and enter to proceed, or only enter to skip: "
|
350
|
+
op=gets.chomp
|
351
|
+
if op!=""
|
352
|
+
index1=list["orgs"].index{|aux| aux["name"]==config["Org"]}
|
353
|
+
index2=list["orgs"][index1]["users"].index{|aux2| aux2["github"]==i["github"]}
|
354
|
+
|
355
|
+
list["orgs"][index1]["users"].pop(index2)
|
356
|
+
list["orgs"].detect{|aux| aux["name"]==config["Org"]}["users"]<<i
|
357
|
+
puts "The information about \e[31m#{i["github"]}\e[0m has been changed"
|
358
|
+
else
|
359
|
+
puts "The new information about \e[31m#{i["github"]}\e[0m has been discarded"
|
360
|
+
end
|
356
361
|
end
|
357
362
|
end
|
363
|
+
else
|
364
|
+
puts "#{i["github"]} is not registered in this organiation"
|
358
365
|
end
|
359
366
|
end
|
360
367
|
Sys.new.save_people("#{ENV['HOME']}/.ghedsh",list)
|
@@ -363,8 +370,25 @@ class Organizations
|
|
363
370
|
end
|
364
371
|
end
|
365
372
|
|
373
|
+
def rm_people_info(client,config)
|
374
|
+
list=self.load_people()
|
375
|
+
inpeople=list["orgs"].detect{|aux| aux["name"]==config["Org"]}
|
376
|
+
if inpeople==nil
|
377
|
+
puts "Extended information has not been added yet"
|
378
|
+
else
|
379
|
+
if inpeople["users"].empty?
|
380
|
+
puts "Extended information has not been added yet"
|
381
|
+
else
|
382
|
+
list["orgs"].detect{|aux| aux["name"]==config["Org"]}["users"]=[]
|
383
|
+
Sys.new.save_people("#{ENV['HOME']}/.ghedsh",list)
|
384
|
+
puts "The aditional information of #{config["Org"]} has been removed"
|
385
|
+
end
|
386
|
+
end
|
387
|
+
end
|
388
|
+
|
366
389
|
def show_people_info(client,config,user)
|
367
390
|
list=self.load_people()
|
391
|
+
|
368
392
|
inpeople=list["orgs"].detect{|aux| aux["name"]==config["Org"]}
|
369
393
|
peopleinfolist=[]
|
370
394
|
|
@@ -373,28 +397,36 @@ class Organizations
|
|
373
397
|
Sys.new.save_people("#{ENV['HOME']}/.ghedsh",list)
|
374
398
|
puts "Extended information has not been added yet"
|
375
399
|
else
|
376
|
-
if
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
400
|
+
if inpeople["users"]!=[]
|
401
|
+
if user==nil
|
402
|
+
fields=list["orgs"].detect{|aux| aux["name"]==config["Org"]}["users"][0].keys
|
403
|
+
list["orgs"].detect{|aux| aux["name"]==config["Org"]}["users"].each do |i|
|
404
|
+
puts "\n\e[31m#{i["github"]}\e[0m"
|
405
|
+
fields.each do |j|
|
406
|
+
puts "#{j.capitalize}:\t #{i[j]}"
|
407
|
+
end
|
408
|
+
peopleinfolist<<i["github"]
|
382
409
|
end
|
383
|
-
peopleinfolist
|
384
|
-
end
|
385
|
-
return peopleinfolist
|
386
|
-
else
|
387
|
-
inuser=list["orgs"].detect{|aux| aux["name"]==config["Org"]}["users"].detect{|aux2| aux2["github"]==user}
|
388
|
-
if inuser==nil
|
389
|
-
puts "Not extended information has been added of that user."
|
410
|
+
return peopleinfolist
|
390
411
|
else
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
412
|
+
if user.include?("@")
|
413
|
+
inuser=list["orgs"].detect{|aux| aux["name"]==config["Org"]}["users"].detect{|aux2| aux2["mail"]==user}
|
414
|
+
else
|
415
|
+
inuser=list["orgs"].detect{|aux| aux["name"]==config["Org"]}["users"].detect{|aux2| aux2["github"]==user}
|
416
|
+
end
|
417
|
+
if inuser==nil
|
418
|
+
puts "Not extended information has been added of that user."
|
419
|
+
else
|
420
|
+
fields=inuser.keys
|
421
|
+
puts "\n\e[31m#{inuser["github"]}\e[0m"
|
422
|
+
fields.each do |j|
|
423
|
+
puts "#{j.capitalize}:\t #{inuser[j]}"
|
424
|
+
end
|
425
|
+
puts
|
395
426
|
end
|
396
|
-
puts
|
397
427
|
end
|
428
|
+
else
|
429
|
+
puts "Extended information has not been added yet"
|
398
430
|
end
|
399
431
|
end
|
400
432
|
end
|
@@ -423,6 +455,17 @@ class Organizations
|
|
423
455
|
return orgslist
|
424
456
|
end
|
425
457
|
|
458
|
+
def get_organization_members(client,config)
|
459
|
+
mem=client.organization_members(config["Org"])
|
460
|
+
list=[]
|
461
|
+
if mem!=nil
|
462
|
+
mem.each do |i|
|
463
|
+
list<<i[:login]
|
464
|
+
end
|
465
|
+
end
|
466
|
+
return list
|
467
|
+
end
|
468
|
+
|
426
469
|
def show_orgs(client,config)
|
427
470
|
orgslist=[]
|
428
471
|
print "\n"
|
data/lib/interface.rb
CHANGED
@@ -512,6 +512,10 @@ class Interface
|
|
512
512
|
if @deep==USER_REPO || @deep==TEAM_REPO || @deep==ORGS_REPO then r.info_repository(@client,@config,@deep) end
|
513
513
|
when op== "add_repo"
|
514
514
|
if @deep=ASSIG then o.add_repo_to_assig(@client,@config,@assig_path) end
|
515
|
+
when op.include?("rm")
|
516
|
+
if @deep==ORGS and opcd[1]=="people" and opcd[2]=="info"
|
517
|
+
o.rm_people_info(@client,@config)
|
518
|
+
end
|
515
519
|
when op== "add_group"
|
516
520
|
if @deep=ASSIG then o.add_group_to_assig(@client,@config,@assig_path) end
|
517
521
|
when op == "version"
|
@@ -668,7 +672,8 @@ class Interface
|
|
668
672
|
if opcd[0]=="new_people_info" and opcd.size==2 and @deep==ORGS then o.add_people_info(@client,@config,opcd[1]) end
|
669
673
|
if opcd[0]=="people" and opcd[1]=="info"
|
670
674
|
if opcd.size==2
|
671
|
-
|
675
|
+
info_strm=o.show_people_info(@client,@config,nil)
|
676
|
+
if info_strm!=nil then @sysbh.add_history_str(2,info_strm) end
|
672
677
|
else
|
673
678
|
o.show_people_info(@client,@config,opcd[2])
|
674
679
|
end
|
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.30
|
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-03-
|
12
|
+
date: 2017-03-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: octokit
|