ghedsh 1.1.24 → 1.1.25
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 +9 -0
- data/lib/actions/repo.rb +48 -39
- data/lib/interface.rb +18 -12
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72082b3deaffb0bfcbbf6543bd82790f47bdabe2
|
4
|
+
data.tar.gz: 09b5b77bd69db794a6763d4def466a92af434a00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1db7a8a55956df116b844ef5381cde05c86a35cb999cd9c55abd599bedbb9ad09107f3c29cffeeccc9847c5144a630782d450793b6f90f7a3f78b56f7989d68
|
7
|
+
data.tar.gz: 4db544ac54e938fb4052fc7c076131d1b898ed5774d40723d4635b6794c8db0ac991d34b30be2cc7142211f93ad7b26d1f93a905c1dc73d280b6cd026a0708ff
|
data/lib/actions/help.rb
CHANGED
@@ -45,6 +45,7 @@ class HelpM
|
|
45
45
|
self.common_opt
|
46
46
|
puts " Repository options:"
|
47
47
|
print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
|
48
|
+
print "\tinfo\t\t\tShow information about the repository\n"
|
48
49
|
print "\tcommits\t\t\tShow the list of commits from the repository\n"
|
49
50
|
print "\tissues\t\t\tShow the list of issues from the repository\n"
|
50
51
|
print "\tissue\t\t\tShow the issue and its comments\n"
|
@@ -52,6 +53,8 @@ class HelpM
|
|
52
53
|
print "\tfiles\t\t\tShow the files of the repository path given\n"
|
53
54
|
print "\tcat\t\t\tShow data from a file\n"
|
54
55
|
print "\t\t\t\t->\tcat [file]\n\n"
|
56
|
+
print "\tprivate\t\t\tChange the privacy of a repository. Expected 'true' or 'false' as parameter.\n"
|
57
|
+
print "\t\t\t\t->\tprivate [true]\n\n"
|
55
58
|
print "\tcol\t\t\tShow the list of collaborators from the repository\n\n"
|
56
59
|
end
|
57
60
|
|
@@ -69,6 +72,7 @@ class HelpM
|
|
69
72
|
self.common_opt
|
70
73
|
puts " Repository options:"
|
71
74
|
print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
|
75
|
+
print "\tinfo\t\t\tShow information about the repository\n"
|
72
76
|
print "\tcommits\t\t\tShow the list of commits from the repository\n"
|
73
77
|
print "\tissues\t\t\tShow the list of issues from the repository\n"
|
74
78
|
print "\tissue\t\t\tShow the issue and its comments\n"
|
@@ -76,12 +80,15 @@ class HelpM
|
|
76
80
|
print "\tfiles\t\t\tShow the files of the repository path given\n"
|
77
81
|
print "\tcat\t\t\tShow data from a file\n"
|
78
82
|
print "\t\t\t\t->\tcat [file]\n\n"
|
83
|
+
print "\tprivate\t\t\tChange the privacy of a repository. Expected 'true' or 'false' as parameter.\n"
|
84
|
+
print "\t\t\t\t->\tprivate [true]\n\n"
|
79
85
|
print "\tcol\t\t\tShow the list of collaborators from the repository\n\n"
|
80
86
|
end
|
81
87
|
def team_repo()
|
82
88
|
self.common_opt
|
83
89
|
puts " Repository options:"
|
84
90
|
print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
|
91
|
+
print "\tinfo\t\t\tShow information about the repository\n"
|
85
92
|
print "\tcommits\t\t\tShow the list of commits from the repository\n"
|
86
93
|
print "\tissues\t\t\tShow the list of issues from the repository\n"
|
87
94
|
print "\tissue\t\t\tShow the issue and its comments\n"
|
@@ -89,6 +96,8 @@ class HelpM
|
|
89
96
|
print "\tfiles\t\t\tShow the files of the repository path given\n"
|
90
97
|
print "\tcat\t\t\tShow data from a file\n"
|
91
98
|
print "\t\t\t\t->\tcat [file]\n\n"
|
99
|
+
print "\tprivate\t\t\tChange the privacy of a repository. Expected 'true' or 'false' as parameter.\n"
|
100
|
+
print "\t\t\t\t->\tprivate [true]\n\n"
|
92
101
|
print "\tcol\t\t\tShow the list of collaborators from the repository\n\n"
|
93
102
|
end
|
94
103
|
|
data/lib/actions/repo.rb
CHANGED
@@ -41,6 +41,35 @@ class Repositories
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
+
def info_repository(client,config,scope)
|
45
|
+
empty=0
|
46
|
+
begin
|
47
|
+
case
|
48
|
+
when scope==USER_REPO
|
49
|
+
if config["Repo"].split("/").size == 1
|
50
|
+
mem=client.repository(config["User"]+"/"+config["Repo"])
|
51
|
+
else
|
52
|
+
mem=client.repository(config["Repo"])
|
53
|
+
end
|
54
|
+
when scope==ORGS_REPO || scope==TEAM_REPO
|
55
|
+
mem=client.repository(config["Org"]+"/"+config["Repo"])
|
56
|
+
end
|
57
|
+
rescue
|
58
|
+
puts "The Repository is empty"
|
59
|
+
empty=1
|
60
|
+
end
|
61
|
+
if empty==0
|
62
|
+
puts "\n Name: \t\t#{mem[:name]}"
|
63
|
+
puts " Full name: \t#{mem[:full_name]}"
|
64
|
+
puts " Description: \t#{mem[:description]}"
|
65
|
+
puts " Private: \t#{mem[:private]}"
|
66
|
+
puts "\n Created: \t#{mem[:created_at]}"
|
67
|
+
puts " Last update: \t#{mem[:updated_at]}"
|
68
|
+
puts " Url: \t\t#{mem[:html_url]}"
|
69
|
+
puts
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
44
73
|
def create_issue(client,config,scope)
|
45
74
|
puts "Insert Issue tittle: "
|
46
75
|
tittle=gets.chomp
|
@@ -57,7 +86,6 @@ class Repositories
|
|
57
86
|
when scope==ORGS_REPO || scope==TEAM_REPO
|
58
87
|
client.create_issue(config["Org"]+"/"+config["Repo"],tittle,desc)
|
59
88
|
end
|
60
|
-
|
61
89
|
end
|
62
90
|
|
63
91
|
def close_issue(client,config,scope,id)
|
@@ -281,7 +309,7 @@ class Repositories
|
|
281
309
|
mem=client.forks(config["Org"]+"/"+config["Repo"])
|
282
310
|
end
|
283
311
|
if mem.size==0
|
284
|
-
puts "No forks found
|
312
|
+
puts "No forks found in this repository"
|
285
313
|
else
|
286
314
|
mem.each do |i|
|
287
315
|
puts i[:login]
|
@@ -320,7 +348,6 @@ class Repositories
|
|
320
348
|
end
|
321
349
|
|
322
350
|
def delete_repository(client,config,repo,scope)
|
323
|
-
|
324
351
|
if scope==ORGS
|
325
352
|
if client.repository?("#{config["Org"]}/#{repo}")==false
|
326
353
|
puts "\e[31m It doesn't exist a repository with that name in #{config["Org"]}\e[0m"
|
@@ -357,14 +384,12 @@ class Repositories
|
|
357
384
|
|
358
385
|
def create_repository(client,config,repo,empty,scope)
|
359
386
|
options=Hash.new
|
360
|
-
|
361
387
|
if empty==false
|
362
388
|
options[:auto_init]=true
|
363
389
|
end
|
364
390
|
|
365
391
|
case
|
366
392
|
when scope==ORGS
|
367
|
-
|
368
393
|
options[:organization]=config["Org"]
|
369
394
|
if client.repository?("#{config["Org"]}/#{repo}")==false
|
370
395
|
client.create_repository(repo,options)
|
@@ -399,43 +424,27 @@ class Repositories
|
|
399
424
|
end
|
400
425
|
end
|
401
426
|
|
402
|
-
def edit_repository(client, config,
|
427
|
+
def edit_repository(client, config, scope, privacy)
|
403
428
|
options=Hash.new
|
429
|
+
if privacy=="true"
|
430
|
+
privacy=true
|
431
|
+
else
|
432
|
+
privacy=false
|
433
|
+
end
|
404
434
|
options[:private]=privacy
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
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
|
435
|
+
begin
|
436
|
+
case
|
437
|
+
when scope==USER_REPO
|
438
|
+
if config["Repo"].split("/").size == 1
|
439
|
+
mem=client.edit_repository(config["User"]+"/"+config["Repo"],options)
|
440
|
+
else
|
441
|
+
mem=client.edit_repository(config["Repo"],options)
|
442
|
+
end
|
443
|
+
when scope==ORGS_REPO || scope==TEAM_REPO
|
444
|
+
mem=client.edit_repository(config["Org"]+"/"+config["Repo"],options)
|
438
445
|
end
|
446
|
+
rescue
|
447
|
+
puts "Not allow to change privacy"
|
439
448
|
end
|
440
449
|
end
|
441
450
|
|
data/lib/interface.rb
CHANGED
@@ -34,22 +34,22 @@ class Interface
|
|
34
34
|
@repo_path=''
|
35
35
|
|
36
36
|
options=@sysbh.parse
|
37
|
-
|
38
|
-
trap("SIGINT") { throw :ctrl_c }
|
39
|
-
catch :ctrl_c do
|
40
|
-
|
37
|
+
#
|
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()
|
@@ -497,7 +497,8 @@ class Interface
|
|
497
497
|
t.list_groups(@client,@config)
|
498
498
|
end
|
499
499
|
when op == "info"
|
500
|
-
if @deep
|
500
|
+
if @deep==ASSIG then o.show_assig_info(@config,@assig_path) end
|
501
|
+
if @deep==USER_REPO || @deep==TEAM_REPO || @deep==ORGS_REPO then r.info_repository(@client,@config,@deep) end
|
501
502
|
when op== "add_repo"
|
502
503
|
if @deep=ASSIG then o.add_repo_to_assig(@client,@config,@assig_path) end
|
503
504
|
when op== "add_group"
|
@@ -592,6 +593,11 @@ class Interface
|
|
592
593
|
r.open_issue(@client,@config,@deep,opcd[1])
|
593
594
|
end
|
594
595
|
end
|
596
|
+
if opcd[0]=="private" and opcd.size==2
|
597
|
+
if opcd[1]=="true" || opcd[1]=="false"
|
598
|
+
r.edit_repository(@client,@config,@deep,opcd[1])
|
599
|
+
end
|
600
|
+
end
|
595
601
|
if opcd[0]=="rm_team"
|
596
602
|
t.delete_team(@client,@teamlist[opcd[1]])
|
597
603
|
self.quit_history(@teamlist[opcd[1]])
|
data/lib/version.rb
CHANGED