ghedsh 1.1.25 → 1.1.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/actions/help.rb +8 -1
- data/lib/actions/orgs.rb +114 -0
- data/lib/actions/system.rb +19 -1
- data/lib/interface.rb +8 -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: c10eb8a13bcb39eb361684cb6cd6d2cd4d7dbdf4
|
4
|
+
data.tar.gz: 8d2982f7eb2c28c187c232ded7ce869910a6e997
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d56415df068df4cfcdebf7e766103cc89e81fc0daf461eb46d243bda35c54cebf385bf9fb77a5ea06b237f739a403aad5cd6e53a80e91fbfb35fc6b3307409de
|
7
|
+
data.tar.gz: 48305b926590b9342c84a96ad432fe632a0840e84a7956095aaa626b60d28d5f5f3b9e3ad887632c425e932623af6455dbddd6d9db42af7479463457d269a202
|
data/.gitignore
CHANGED
data/lib/actions/help.rb
CHANGED
@@ -25,8 +25,15 @@ class HelpM
|
|
25
25
|
print "\trepos\t\t\tList the repositories of your organization\n"
|
26
26
|
print "\tclone\t\t\tClone a repository or a list of repositories using a regular expresion\n"
|
27
27
|
print "\tset\t\t\tMove you to a specific repository\n"
|
28
|
-
print "\tpeople\t\t\
|
28
|
+
print "\tpeople\t\t\tShow the members of an organization\n"
|
29
|
+
print "\t\t\t\t->\tpeople\n\n"
|
30
|
+
print "\t\t\t\tIf you add the parameter 'info', the extended information will be showed\n"
|
31
|
+
print "\t\t\t\t->\tpeople info\n\n"
|
32
|
+
print "\t\t\t\tTo find a specific member extended info, you can give the github id as parameter.\n"
|
33
|
+
print "\t\t\t\t->\tpeople info [github id]\n\n"
|
29
34
|
print "\tteams\t\t\tTeams of a organization\n"
|
35
|
+
print "\tadd_people_info\t\tGet extended information from a .csv file founded in the excecute path\n"
|
36
|
+
print "\t\t\t\t->\tadd_people_info [name of the file]\n\n"
|
30
37
|
print "\tassignments\t\tShow the list of assignments created\n"
|
31
38
|
print "\tnew_assignment\t\tCreate an Assignment in your organization\n"
|
32
39
|
print "\tgroups\t\t\tShow the list of groups with each team and user that it has\n"
|
data/lib/actions/orgs.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'readline'
|
2
2
|
require 'octokit'
|
3
3
|
require 'json'
|
4
|
+
require 'csv'
|
4
5
|
require 'require_all'
|
5
6
|
require_rel '.'
|
6
7
|
require 'readline'
|
@@ -9,6 +10,7 @@ class Organizations
|
|
9
10
|
|
10
11
|
attr_accessor :orgslist
|
11
12
|
attr_accessor :assiglist
|
13
|
+
attr_accessor :peoplelist
|
12
14
|
|
13
15
|
|
14
16
|
def load_assig()
|
@@ -17,6 +19,12 @@ class Organizations
|
|
17
19
|
return @assiglist
|
18
20
|
end
|
19
21
|
|
22
|
+
def load_people()
|
23
|
+
@peoplelist=Hash.new()
|
24
|
+
@peoplelist=Sys.new.load_people_db("#{ENV['HOME']}/.ghedsh")
|
25
|
+
return @peoplelist
|
26
|
+
end
|
27
|
+
|
20
28
|
def show_assignments(client, config) #client,orgs
|
21
29
|
list=self.load_assig()
|
22
30
|
|
@@ -275,6 +283,111 @@ class Organizations
|
|
275
283
|
end
|
276
284
|
end
|
277
285
|
|
286
|
+
#Takes people info froma a csv file and gets into ghedsh people information
|
287
|
+
def add_people_info(client,config,file)
|
288
|
+
list=self.load_people()
|
289
|
+
inpeople=list["orgs"].detect{|aux| aux["name"]==config["Org"]}
|
290
|
+
if inpeople==nil
|
291
|
+
list["orgs"].push({"name"=>config["Org"],"users"=>[]})
|
292
|
+
Sys.new.save_people("#{ENV['HOME']}/.ghedsh",list)
|
293
|
+
end
|
294
|
+
|
295
|
+
if file.end_with?(".csv")==false
|
296
|
+
file=file+".csv"
|
297
|
+
end
|
298
|
+
if File.exist?(file)
|
299
|
+
puts "here in #{file}"
|
300
|
+
mem = CSV.read(file)
|
301
|
+
users=Hash.new;
|
302
|
+
users=[]
|
303
|
+
mem.each do |i|
|
304
|
+
aux=Hash.new
|
305
|
+
aux["github"]=i[0]
|
306
|
+
aux["id"]=i[1]
|
307
|
+
aux["name"]=i[2]
|
308
|
+
aux["surname"]=i[3]
|
309
|
+
aux["emails"]=i[4]
|
310
|
+
aux["orgs"]=i[5]
|
311
|
+
aux["urls"]=i[6]
|
312
|
+
users<< aux
|
313
|
+
end
|
314
|
+
|
315
|
+
users.each do |i|
|
316
|
+
here=list["orgs"].detect{|aux| aux["name"]==config["Org"]}["users"].detect{|aux2| aux2["github"]==i["github"]}
|
317
|
+
if here==nil
|
318
|
+
list["orgs"].detect{|aux| aux["name"]==config["Org"]}["users"]<<i
|
319
|
+
else
|
320
|
+
puts "\nAlready exits \e[31m#{i["github"]}\e[0m in database"
|
321
|
+
if here.eql?(i)
|
322
|
+
puts "The information given is the same as in the database, changes are being discard."
|
323
|
+
else
|
324
|
+
puts "The information is different thant the original. Do you want to change it?"
|
325
|
+
puts "\n Github:\t#{here["github"]} -> #{i["github"]}"
|
326
|
+
puts " ID:\t\t#{here["id"]} -> #{i["id"]}"
|
327
|
+
puts " Name:\t\t#{here["name"]} -> #{i["name"]}"
|
328
|
+
puts " Surname:\t#{here["surname"]} -> #{i["surname"]}"
|
329
|
+
puts " Emails:\t#{here["emails"]} -> #{i["emails"]}"
|
330
|
+
puts " Organizations:\t#{here["orgs"]} -> #{i["orgs"]}"
|
331
|
+
puts " Urls:\t\t#{here["urls"]} -> #{i["urls"]}"
|
332
|
+
puts "\nPress any key to proceed, or only enter to skip: "
|
333
|
+
op=gets.chomp
|
334
|
+
if op!=""
|
335
|
+
index1=list["orgs"].index{|aux| aux["name"]==config["Org"]}
|
336
|
+
index2=list["orgs"][index1]["users"].index{|aux2| aux2["github"]==i["github"]}
|
337
|
+
|
338
|
+
list["orgs"][index1]["users"].pop(index2)
|
339
|
+
list["orgs"].detect{|aux| aux["name"]==config["Org"]}["users"]<<i
|
340
|
+
puts "The information about \e[31m#{i["github"]}\e[0m has been changed"
|
341
|
+
else
|
342
|
+
puts "The new information about \e[31m#{i["github"]}\e[0m has been discarded"
|
343
|
+
end
|
344
|
+
end
|
345
|
+
end
|
346
|
+
end
|
347
|
+
Sys.new.save_people("#{ENV['HOME']}/.ghedsh",list)
|
348
|
+
else
|
349
|
+
print "\n#{file} file not found.\n\n"
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
def show_people_info(client,config,user)
|
354
|
+
list=self.load_people()
|
355
|
+
inpeople=list["orgs"].detect{|aux| aux["name"]==config["Org"]}
|
356
|
+
if inpeople==nil
|
357
|
+
list["orgs"].push({"name"=>config["Org"],"users"=>[]})
|
358
|
+
Sys.new.save_people("#{ENV['HOME']}/.ghedsh",list)
|
359
|
+
puts "Extended information has not been added yet"
|
360
|
+
else
|
361
|
+
if user==nil
|
362
|
+
list["orgs"].detect{|aux| aux["name"]==config["Org"]}["users"].each do |i|
|
363
|
+
puts "\n#{i["github"]}"
|
364
|
+
puts "\n Github:\t #{i["github"]}"
|
365
|
+
puts " ID:\t\t #{i["id"]}"
|
366
|
+
puts " Name:\t\t #{i["name"]}"
|
367
|
+
puts " Surname:\t #{i["surname"]}"
|
368
|
+
puts " Emails:\t #{i["emails"]}"
|
369
|
+
puts " Organizations:\t #{i["orgs"]}"
|
370
|
+
puts " Urls:\t\t #{i["urls"]}"
|
371
|
+
puts
|
372
|
+
end
|
373
|
+
else
|
374
|
+
inuser=list["orgs"].detect{|aux| aux["name"]==config["Org"]}["users"].detect{|aux2| aux2["github"]==user}
|
375
|
+
if inuser==nil
|
376
|
+
puts "Not extended information has been added of that user."
|
377
|
+
else
|
378
|
+
puts "\n#{inuser["github"]}"
|
379
|
+
puts "\n Github:\t #{inuser["github"]}"
|
380
|
+
puts " ID:\t\t #{inuser["id"]}"
|
381
|
+
puts " Name:\t\t #{inuser["name"]}"
|
382
|
+
puts " Surname:\t #{inuser["surname"]}"
|
383
|
+
puts " Emails:\t #{inuser["emails"]}"
|
384
|
+
puts " Organizations:\t #{inuser["orgs"]}"
|
385
|
+
puts " Urls:\t\t #{inuser["urls"]}"
|
386
|
+
puts
|
387
|
+
end
|
388
|
+
end
|
389
|
+
end
|
390
|
+
end
|
278
391
|
|
279
392
|
def add_repo_to_assig(client,config,assig)
|
280
393
|
list=self.load_assig()
|
@@ -296,6 +409,7 @@ class Organizations
|
|
296
409
|
orgslist.push(m[:login])
|
297
410
|
puts m[:login]
|
298
411
|
end
|
412
|
+
puts
|
299
413
|
return orgslist
|
300
414
|
end
|
301
415
|
|
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 '].sort
|
14
|
+
'add_group','rm_repository ', 'add_people_info ', 'private ', 'people info '].sort
|
15
15
|
|
16
16
|
def initialize()
|
17
17
|
@memory=[]
|
@@ -210,6 +210,20 @@ class Sys
|
|
210
210
|
return config
|
211
211
|
end
|
212
212
|
|
213
|
+
def load_people_db(path)
|
214
|
+
if (File.exist?(path))==true
|
215
|
+
if File.exist?("#{path}/ghedsh-people.json")
|
216
|
+
json = File.read("#{path}/ghedsh-people.json")
|
217
|
+
else
|
218
|
+
con={:orgs=>[]}
|
219
|
+
File.write("#{path}/ghedsh-people.json",con.to_json)
|
220
|
+
json = File.read("#{path}/ghedsh-people.json")
|
221
|
+
end
|
222
|
+
end
|
223
|
+
config=JSON.parse(json)
|
224
|
+
return config
|
225
|
+
end
|
226
|
+
|
213
227
|
def load_script(path)
|
214
228
|
if (File.exist?(path))==true
|
215
229
|
script = File.read("#{path}")
|
@@ -257,6 +271,10 @@ class Sys
|
|
257
271
|
File.write("#{path}/assignments.json",data.to_json)
|
258
272
|
end
|
259
273
|
|
274
|
+
def save_people(path,data)
|
275
|
+
File.write("#{path}/ghedsh-people.json",data.to_json)
|
276
|
+
end
|
277
|
+
|
260
278
|
#creates all ghedsh local stuff
|
261
279
|
def create_config(configure_path)
|
262
280
|
con={:User=>nil,:Org=>nil,:Repo=>nil,:Team=>nil,:TeamID=>nil}
|
data/lib/interface.rb
CHANGED
@@ -638,7 +638,14 @@ class Interface
|
|
638
638
|
t.new_group(@client,@config,opcd[1],opcd[2..opcd.size-1])
|
639
639
|
end
|
640
640
|
end
|
641
|
-
|
641
|
+
if opcd[0]=="add_people_info" and opcd.size==2 and @deep==ORGS then o.add_people_info(@client,@config,opcd[1]) end
|
642
|
+
if opcd[0]=="people" and opcd[1]=="info"
|
643
|
+
if opcd.size==2
|
644
|
+
Organizations.new.show_people_info(@client,@config,nil)
|
645
|
+
else
|
646
|
+
Organizations.new.show_people_info(@client,@config,opcd[2])
|
647
|
+
end
|
648
|
+
end
|
642
649
|
if opcd[0]=="clone"
|
643
650
|
if opcd.size==2
|
644
651
|
r.clone_repo(@client,@config,opcd[1],@deep)
|
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.26
|
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-
|
12
|
+
date: 2017-02-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: octokit
|