ghedsh 1.1.19 → 1.1.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/actions/orgs.rb +81 -25
- data/lib/actions/repo.rb +14 -1
- data/lib/actions/system.rb +1 -1
- data/lib/interface.rb +23 -7
- 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: df4f9b762bbed5fa79231616af6df96b34954dba
|
4
|
+
data.tar.gz: 76d67595bfba20f88780bbbdbe83856f30ff8794
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83f259674514ecbfea88048e0c7d43b05596c33a47380d94939666d7dca96b583a80264f5487ea90c34daf57c128f7c1d34187cf15d28033ea2f3bd621666aac
|
7
|
+
data.tar.gz: ff59f9e13672b1a326f9e6003b5c92c3ea10d9612e85dc6ac560376a8ff6531a917a873b073be8898f990fee9b70a1a115c0b7f23e24b4fb9dec153b81f680e8
|
data/lib/actions/orgs.rb
CHANGED
@@ -45,17 +45,10 @@ class Organizations
|
|
45
45
|
|
46
46
|
end
|
47
47
|
|
48
|
-
def
|
49
|
-
list=self.load_assig()
|
50
|
-
assigs=list["orgs"].detect{|aux| aux["name"]==config["Org"]}
|
51
|
-
|
52
|
-
if assigs==nil
|
53
|
-
list["orgs"].push({"name"=>config["Org"],"assigs"=>[]})
|
54
|
-
Sys.new.save_assigs("#{ENV['HOME']}/.ghedsh",list)
|
55
|
-
end
|
56
|
-
|
48
|
+
def assignment_repository(client,config,name)
|
57
49
|
ex=false
|
58
50
|
until ex==true
|
51
|
+
puts "\n"
|
59
52
|
puts "Assignment: #{name}"
|
60
53
|
puts "1) Add a repository already created "
|
61
54
|
puts "2) Create a new empty repository"
|
@@ -66,35 +59,74 @@ class Organizations
|
|
66
59
|
ex=true
|
67
60
|
end
|
68
61
|
end
|
69
|
-
|
70
62
|
case
|
71
63
|
when op=="1" || op=="2"
|
72
64
|
puts "Name of the repository: "
|
73
65
|
reponame=gets.chomp
|
74
|
-
if
|
75
|
-
|
76
|
-
|
66
|
+
if op==1
|
67
|
+
if client.repository?("#{config["Org"]}/#{reponame}")==false
|
68
|
+
puts "The repository #{reponame} doesn't exist"
|
69
|
+
reponame=""
|
70
|
+
end
|
77
71
|
end
|
78
72
|
if op=="2"
|
79
73
|
Repositories.new().create_repository(client,config,reponame,ORGS)
|
80
74
|
end
|
81
75
|
when op=="3" then reponame=""
|
82
76
|
end
|
77
|
+
return reponame
|
78
|
+
end
|
83
79
|
|
84
|
-
|
80
|
+
def assignment_groups(client,config)
|
81
|
+
team=Teams.new()
|
82
|
+
groupslist=team.get_groupslist(config)
|
83
|
+
groupsadd=[]
|
84
|
+
puts "\n"
|
85
85
|
puts "Add groups to your assignment (Press enter to skip): "
|
86
86
|
op=gets.chomp
|
87
|
-
if op
|
87
|
+
if op==""
|
88
|
+
puts "Do you want to create a new group? (Press any key to preceed, or only enter to skip)"
|
89
|
+
an=gets.chomp
|
90
|
+
|
91
|
+
if an!=""
|
92
|
+
time=Time.new
|
93
|
+
puts "Put the name of the group (If you skip with enter, the group's name will be \"Group-#{time.ctime}\")"
|
94
|
+
name=gets.chomp
|
95
|
+
if name==""
|
96
|
+
name="Group-#{time.ctime}"
|
97
|
+
name=name.split(" ").join("-")
|
98
|
+
end
|
99
|
+
puts "Put a list of Teams"
|
100
|
+
list=gets.chomp
|
101
|
+
list=list.split(" ")
|
102
|
+
team.new_group(client,config,name,list)
|
103
|
+
groupsadd.push(name)
|
104
|
+
else
|
105
|
+
groupsadd=[]
|
106
|
+
end
|
88
107
|
|
108
|
+
else
|
89
109
|
groupsadd=op.split(" ")
|
90
110
|
groupsadd.each do |item|
|
91
111
|
if groupslist.detect{|aux| aux==item}==nil
|
92
112
|
groupsadd.delete(item)
|
93
113
|
end
|
94
114
|
end
|
95
|
-
else
|
96
|
-
groupsadd=[]
|
97
115
|
end
|
116
|
+
return groupsadd
|
117
|
+
end
|
118
|
+
|
119
|
+
def create_assig(client,config,name)
|
120
|
+
list=self.load_assig()
|
121
|
+
assigs=list["orgs"].detect{|aux| aux["name"]==config["Org"]}
|
122
|
+
|
123
|
+
if assigs==nil
|
124
|
+
list["orgs"].push({"name"=>config["Org"],"assigs"=>[]})
|
125
|
+
Sys.new.save_assigs("#{ENV['HOME']}/.ghedsh",list)
|
126
|
+
end
|
127
|
+
|
128
|
+
reponame=self.assignment_repository(client,config,name)
|
129
|
+
groupsadd=self.assignment_groups(client,config)
|
98
130
|
|
99
131
|
begin
|
100
132
|
list["orgs"][list["orgs"].index{|aux| aux["name"]==config["Org"]}]["assigs"].push({"name_assig"=>name,"teams"=>[],"groups"=>groupsadd,"repo"=>reponame})
|
@@ -127,10 +159,22 @@ class Organizations
|
|
127
159
|
list=self.load_assig()
|
128
160
|
as=list["orgs"].detect{|aux| aux["name"]==config["Org"]}
|
129
161
|
as=as["assigs"].detect{|aux| aux["name_assig"]==wanted}
|
130
|
-
puts as
|
131
162
|
return as
|
132
163
|
end
|
133
164
|
|
165
|
+
def show_assig_info(config,assig)
|
166
|
+
assig=self.get_single_assig(config,assig)
|
167
|
+
puts "\n"
|
168
|
+
puts assig["name_assig"]
|
169
|
+
puts "Repository: #{assig["repo"]}"
|
170
|
+
print "Groups: "
|
171
|
+
assig["groups"].each do |y|
|
172
|
+
print y
|
173
|
+
print " "
|
174
|
+
end
|
175
|
+
puts "\n\n"
|
176
|
+
end
|
177
|
+
|
134
178
|
def make_assig(client,config,assig)
|
135
179
|
web="https://github.com/"
|
136
180
|
web2="git@github.com:"
|
@@ -165,21 +209,33 @@ class Organizations
|
|
165
209
|
|
166
210
|
end
|
167
211
|
|
168
|
-
def add_team_to_assig(client,config,data)
|
212
|
+
def add_team_to_assig(client,config,assig,data)
|
213
|
+
assig=self.get_single_assig(config,assig)
|
214
|
+
|
169
215
|
|
170
216
|
end
|
171
217
|
|
172
|
-
def add_group_to_assig(client,config,
|
218
|
+
def add_group_to_assig(client,config,assig)
|
219
|
+
list=self.load_assig()
|
173
220
|
|
221
|
+
groups=self.assignment_groups(client,config)
|
222
|
+
if groups!=""
|
223
|
+
groups.each do |i|
|
224
|
+
list["orgs"].detect{|aux| aux["name"]==config["Org"]}["assigs"].detect{|aux2| aux2["name_assig"]==assig}["groups"].push(i)
|
225
|
+
end
|
226
|
+
Sys.new.save_assigs("#{ENV['HOME']}/.ghedsh",list)
|
227
|
+
end
|
174
228
|
end
|
175
229
|
|
176
|
-
def add_repo_to_assig(client,config,data)
|
177
|
-
options=Hash.new
|
178
|
-
options[:organization]=config["Org"]
|
179
|
-
options[:auto_init]=true
|
180
230
|
|
181
|
-
|
231
|
+
def add_repo_to_assig(client,config,assig)
|
232
|
+
list=self.load_assig()
|
182
233
|
|
234
|
+
reponame=self.assignment_repository(client,config,assig["name_assig"])
|
235
|
+
if reponame!=""
|
236
|
+
list["orgs"].detect{|aux| aux["name"]==config["Org"]}["assigs"].detect{|aux2| aux2["name_assig"]==assig}["repo"]=reponame
|
237
|
+
Sys.new.save_assigs("#{ENV['HOME']}/.ghedsh",list)
|
238
|
+
end
|
183
239
|
end
|
184
240
|
#------------End assig. stuff------------
|
185
241
|
|
data/lib/actions/repo.rb
CHANGED
@@ -33,7 +33,7 @@ class Repositories
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
36
|
+
def create_issue(client,config,scope)
|
37
37
|
puts "Insert Issue tittle: "
|
38
38
|
tittle=gets.chomp
|
39
39
|
puts "Add a description: "
|
@@ -65,6 +65,19 @@ class Repositories
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
+
def open_issue(client,config,scope,id)
|
69
|
+
case
|
70
|
+
when scope==USER_REPO
|
71
|
+
if config["Repo"].split("/").size == 1
|
72
|
+
client.reopen_issue(config["User"]+"/"+config["Repo"],id)
|
73
|
+
else
|
74
|
+
client.reopen_issue(config["Repo"],id)
|
75
|
+
end
|
76
|
+
when scope==ORGS_REPO || scope==TEAM_REPO
|
77
|
+
client.reopen_issue(config["Org"]+"/"+config["Repo"],id)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
68
81
|
def show_issues(client,config,scope)
|
69
82
|
print "\n"
|
70
83
|
case
|
data/lib/actions/system.rb
CHANGED
@@ -10,7 +10,7 @@ class Sys
|
|
10
10
|
attr_reader :client
|
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
|
-
'version', 'cat ', 'groups', 'files', 'assignments','new_issue ', 'open_issue', 'new_','open_', 'new_group ', 'rm_group', 'rm_', 'do ', 'make'].sort
|
13
|
+
'version', 'cat ', 'groups', 'files', 'assignments','new_issue ', 'open_issue', 'new_','open_', 'close_issue', 'new_group ', 'rm_group', 'rm_', 'do ', 'info','make','add_repo','add_group'].sort
|
14
14
|
|
15
15
|
def initialize()
|
16
16
|
@memory=[]
|
data/lib/interface.rb
CHANGED
@@ -183,7 +183,7 @@ class Interface
|
|
183
183
|
@sysbh.add_history_str(1,@teamlist)
|
184
184
|
@deep=2
|
185
185
|
else
|
186
|
-
puts "\nNo organization is available with that name"
|
186
|
+
#puts "\nNo organization is available with that name"
|
187
187
|
self.set(path)
|
188
188
|
end
|
189
189
|
when @deep == ORGS
|
@@ -193,7 +193,7 @@ class Interface
|
|
193
193
|
@config["TeamID"]=@teamlist[path]
|
194
194
|
@deep=TEAM
|
195
195
|
else
|
196
|
-
puts "\nNo team is available with that name"
|
196
|
+
#puts "\nNo team is available with that name"
|
197
197
|
if cdassig(path)==false
|
198
198
|
self.set(path)
|
199
199
|
end
|
@@ -223,11 +223,11 @@ class Interface
|
|
223
223
|
self.set(path_split[2])
|
224
224
|
end
|
225
225
|
else
|
226
|
-
puts "\nNo team is available with that name"
|
226
|
+
#puts "\nNo team is available with that name"
|
227
227
|
self.set(path_split[1])
|
228
228
|
end
|
229
229
|
else
|
230
|
-
puts "\nNo organization is available with that name"
|
230
|
+
#puts "\nNo organization is available with that name"
|
231
231
|
self.set(path)
|
232
232
|
end
|
233
233
|
when @deep==ORGS
|
@@ -237,7 +237,7 @@ class Interface
|
|
237
237
|
@deep=TEAM
|
238
238
|
self.set(path_split[1])
|
239
239
|
else
|
240
|
-
puts "\nNo team is available with that name"
|
240
|
+
#puts "\nNo team is available with that name"
|
241
241
|
end
|
242
242
|
end
|
243
243
|
end
|
@@ -282,7 +282,12 @@ class Interface
|
|
282
282
|
puts "Set in #{@config["Team"]} repository: #{path}\n\n"
|
283
283
|
end
|
284
284
|
end
|
285
|
-
if @deep==USER || @deep==ORGS || @deep==TEAM then puts "No repository is available with that name\n\n" end
|
285
|
+
#if @deep==USER || @deep==ORGS || @deep==TEAM then puts "No repository is available with that name\n\n" end
|
286
|
+
if @deep==USER || @deep==ORGS || @deep==TEAM
|
287
|
+
puts "\nNo organization is available with that name"
|
288
|
+
puts "\nNo team is available with that name"
|
289
|
+
puts "No repository is available with that name\n\n"
|
290
|
+
end
|
286
291
|
end
|
287
292
|
|
288
293
|
def cdrepo(path)
|
@@ -478,6 +483,12 @@ class Interface
|
|
478
483
|
if @deep==ORGS
|
479
484
|
t.list_groups(@client,@config)
|
480
485
|
end
|
486
|
+
when op == "info"
|
487
|
+
if @deep=ASSIG then o.show_assig_info(@config,@assig_path) end
|
488
|
+
when op== "add_repo"
|
489
|
+
if @deep=ASSIG then o.add_repo_to_assig(@client,@config,@assig_path) end
|
490
|
+
when op== "add_group"
|
491
|
+
if @deep=ASSIG then o.add_group_to_assig(@client,@config,@assig_path) end
|
481
492
|
when op == "version"
|
482
493
|
puts "GitHub Education Shell v#{Ghedsh::VERSION}"
|
483
494
|
when op == "assignments"
|
@@ -567,7 +578,7 @@ class Interface
|
|
567
578
|
end
|
568
579
|
if opcd[0]=="new_issue" and opcd.size==1
|
569
580
|
if @deep==ORGS_REPO || @deep==USER_REPO || @deep==TEAM_REPO
|
570
|
-
r.
|
581
|
+
r.create_issue(@client,@config,@deep)
|
571
582
|
end
|
572
583
|
end
|
573
584
|
if opcd[0]=="close_issue" and opcd.size==2
|
@@ -575,6 +586,11 @@ class Interface
|
|
575
586
|
r.close_issue(@client,@config,@deep,opcd[1])
|
576
587
|
end
|
577
588
|
end
|
589
|
+
if opcd[0]=="open_issue" and opcd.size==2
|
590
|
+
if @deep==ORGS_REPO || @deep==USER_REPO || @deep==TEAM_REPO
|
591
|
+
r.open_issue(@client,@config,@deep,opcd[1])
|
592
|
+
end
|
593
|
+
end
|
578
594
|
if opcd[0]=="rm_team"
|
579
595
|
t.delete_team(@client,@teamlist[opcd[1]])
|
580
596
|
self.quit_history(@teamlist[opcd[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.20
|
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: 2016-06-
|
12
|
+
date: 2016-06-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: octokit
|