ghedsh 1.1.20 → 1.1.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +34 -5
- data/lib/actions/orgs.rb +59 -17
- data/lib/actions/repo.rb +69 -8
- data/lib/actions/system.rb +2 -1
- 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: 91993b0a9f8bd97edbb09612f1c1ce4924436b22
|
4
|
+
data.tar.gz: 3f8ae8fadc7bc61d17fc0c2f454272620c05e297
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7694cc5fe678e4c7ea228b6adcfcad7f10d62437f6d4de9711e8fdd3d2b7bbcaebf149bf64cb4cebfe30e8c422eda0d119f1774b2baf527bdae315f9fac98904
|
7
|
+
data.tar.gz: 4401a6bcb3041ef9c4454cd4e85bb6bbe965b4c378ab8c266e26a0e29726889241bf86100ead09fc28719aa2d99f1527e577f792a2f7b0ff6efc7bf51f59947c
|
data/README.md
CHANGED
@@ -45,7 +45,8 @@ Logged in our app you start set in your personal profile. There you can list you
|
|
45
45
|
Levels
|
46
46
|
└── User
|
47
47
|
├── Organizations
|
48
|
-
│ ├──
|
48
|
+
│ ├── Groups
|
49
|
+
│ ├── Teams
|
49
50
|
│ │ └── Team Repositories
|
50
51
|
│ ├── Assignments
|
51
52
|
│ └── Organization Repositories
|
@@ -133,14 +134,14 @@ assignments
|
|
133
134
|
Muestra las tareas o asignaciones hechas para una organizacion.
|
134
135
|
|
135
136
|
```sh
|
136
|
-
|
137
|
+
new_repository <nombre>
|
137
138
|
```
|
138
|
-
Crea
|
139
|
+
Crea un repositorio para un usuario, para una organizacion, o para un equipo dentro de una organizacion. Espera el nombre del repositorio.
|
139
140
|
|
140
141
|
```sh
|
141
|
-
|
142
|
+
rm_repository <nombre>
|
142
143
|
```
|
143
|
-
|
144
|
+
Borra un repositorio de un usuario o de una organizacion. El comando espera el nombre del repositorio, ademas pedira confirmacion para el borrado del mismo si se ha comprobado su existencia.
|
144
145
|
|
145
146
|
```sh
|
146
147
|
clone <nombre>
|
@@ -182,9 +183,37 @@ close_issue <id>
|
|
182
183
|
```
|
183
184
|
Cierra un issue especifico dentro de un repositorio. Se debe especificar el issue mediante la id del mismo.
|
184
185
|
|
186
|
+
###Comandos para las Tareas o asignaciones
|
185
187
|
|
188
|
+
```sh
|
189
|
+
new_assignment <nombre>
|
190
|
+
```
|
191
|
+
Crea una asignacion para una organizacion. Espera por parametro el nombre. Tras ejecutar el comando pedira un repositorio ya existente, la creacion de uno nuevo o la no insercion de un repositorio. Ademas esperara una lista de grupos para asignar a la tarea, ademas de la posible creacion de un grupo al que se le añadiran sus equipos. Todos los pasos pueden ser saltados, y tanto los grupos como el repositorio pueden ser añadidos posteriormente mediante **add_group** y **add_repo**.
|
186
192
|
|
193
|
+
```sh
|
194
|
+
cd <asignacion>
|
195
|
+
```
|
196
|
+
Dentro de una organizacion nos situara dentro de una asignacion para poder listar o editar los datos de la misma.
|
187
197
|
|
198
|
+
```sh
|
199
|
+
make <nombre>
|
200
|
+
```
|
201
|
+
Situado dentro de una asignacion o tarea, se creara un repositorio para cada equipo que pertenezca al grupo o grupos asignados. Se volcara el contenido del repositorio original a cada uno de los nuevos repositorios asignados a cada equipo.
|
202
|
+
|
203
|
+
```sh
|
204
|
+
info
|
205
|
+
```
|
206
|
+
Dentro de la asignacion, mostrara los datos de la misma. Se listaran los grupos y el repositorio asignado.
|
207
|
+
|
208
|
+
```sh
|
209
|
+
add_repo
|
210
|
+
```
|
211
|
+
Dentro de la asignacion, se activara el proceso de añadido del repositorio. Entre las opciones a elegir, estara la de añadir un repositorio ya creado, crear un nuevo repositorio o saltar el paso y no añadir el repositorio. Si ya habia un repositorio asignado anteriormente, este comando lo reemplazara.
|
212
|
+
|
213
|
+
```sh
|
214
|
+
add_group
|
215
|
+
```
|
216
|
+
Dentro de la asignacion, se activara el proceso de añadido de groups. Entre las opciones a elegir, estaran la de añadir directamente grupos ya creados o crear uno desde cero. Si se crea uno desde cero se pedira un nombre o se creara un nombre con la fecha actual, despues se añadiran los equipos que perteneceran al grupo. Si ya existian grupos en la asignacion, este comando añadira otro mas a la lista.
|
188
217
|
|
189
218
|
|
190
219
|
##Aditional information
|
data/lib/actions/orgs.rb
CHANGED
@@ -55,22 +55,56 @@ class Organizations
|
|
55
55
|
puts "3) Don't assign a repository yet"
|
56
56
|
print "option => "
|
57
57
|
op=gets.chomp
|
58
|
+
puts "\n"
|
58
59
|
if op=="3" or op=="1" or op=="2"
|
59
60
|
ex=true
|
60
61
|
end
|
61
62
|
end
|
62
63
|
case
|
63
64
|
when op=="1" || op=="2"
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
65
|
+
|
66
|
+
if op=="1"
|
67
|
+
ex2=false
|
68
|
+
until ex2==true
|
69
|
+
exname=false
|
70
|
+
until exname==true
|
71
|
+
puts "Name of the repository -> Owner/Repository or Organization/Repository :"
|
72
|
+
reponame=gets.chomp
|
73
|
+
if reponame.split("/").size!=2 and reponame!=""
|
74
|
+
puts "Please introduce a valid format."
|
75
|
+
else
|
76
|
+
exname=true
|
77
|
+
end
|
78
|
+
if reponame==""
|
79
|
+
exname=true
|
80
|
+
ex2=true
|
81
|
+
end
|
82
|
+
end
|
83
|
+
if reponame!=""
|
84
|
+
if client.repository?("#{reponame}")==false
|
85
|
+
puts "The repository #{reponame} doesn't exist\n"
|
86
|
+
puts "\nName of the repository (To skip and add the repository later, only press enter): "
|
87
|
+
if reponame==""
|
88
|
+
ex2=true
|
89
|
+
end
|
90
|
+
else
|
91
|
+
ex2=true
|
92
|
+
end
|
93
|
+
end
|
70
94
|
end
|
71
95
|
end
|
72
96
|
if op=="2"
|
73
|
-
|
97
|
+
ex2=false
|
98
|
+
until ex2==true
|
99
|
+
ex2=Repositories.new().create_repository(client,config,reponame,false,ORGS)
|
100
|
+
if ex2==false
|
101
|
+
puts "Name of the repository (To skip and add the repository later, press enter): "
|
102
|
+
reponame=gets.chomp
|
103
|
+
if reponame==""
|
104
|
+
ex2=true
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
74
108
|
end
|
75
109
|
when op=="3" then reponame=""
|
76
110
|
end
|
@@ -81,8 +115,12 @@ class Organizations
|
|
81
115
|
team=Teams.new()
|
82
116
|
groupslist=team.get_groupslist(config)
|
83
117
|
groupsadd=[]
|
118
|
+
teamlist=team.read_teamlist(client,config)
|
119
|
+
|
84
120
|
puts "\n"
|
85
|
-
puts "
|
121
|
+
puts "Groups currently available:\n\n"
|
122
|
+
puts groupslist
|
123
|
+
puts "\nAdd groups to your assignment (Press enter to skip): "
|
86
124
|
op=gets.chomp
|
87
125
|
if op==""
|
88
126
|
puts "Do you want to create a new group? (Press any key to preceed, or only enter to skip)"
|
@@ -96,7 +134,12 @@ class Organizations
|
|
96
134
|
name="Group-#{time.ctime}"
|
97
135
|
name=name.split(" ").join("-")
|
98
136
|
end
|
99
|
-
puts "
|
137
|
+
puts "Teams currently available:\n\n"
|
138
|
+
teamlist.each do |aux|
|
139
|
+
print "#{aux[0]} "
|
140
|
+
end
|
141
|
+
puts "\n\nPut a list of Teams: "
|
142
|
+
|
100
143
|
list=gets.chomp
|
101
144
|
list=list.split(" ")
|
102
145
|
team.new_group(client,config,name,list)
|
@@ -185,23 +228,22 @@ class Organizations
|
|
185
228
|
|
186
229
|
if assig["repo"]!=""
|
187
230
|
|
188
|
-
system("git clone #{web2}#{config["Org"]}/#{assig["repo"]}.git")
|
189
|
-
system("git
|
231
|
+
#system("git clone #{web2}#{config["Org"]}/#{assig["repo"]}.git #{ENV['HOME']}/.ghedsh/#{assig["repo"]}")
|
232
|
+
system("git clone #{web2}#{assig["repo"]}.git #{ENV['HOME']}/.ghedsh/#{assig["repo"]}")
|
190
233
|
|
191
234
|
assig["groups"].each do |i|
|
192
235
|
teamsforgroup=team.get_single_group(config,i)
|
193
236
|
teamsforgroup.each do |y|
|
194
237
|
config["TeamID"]=teamlist["#{y}"]
|
195
238
|
config["Team"]=y
|
196
|
-
repo.create_repository(client,config,"#{y}-#{assig["name_assig"]}",TEAM)
|
197
|
-
|
198
|
-
|
239
|
+
repo.create_repository(client,config,"#{y}-#{assig["name_assig"]}",true,TEAM)
|
240
|
+
system("git -C #{ENV['HOME']}/.ghedsh/#{assig["repo"]} remote rm origin")
|
241
|
+
system("git -C #{ENV['HOME']}/.ghedsh/#{assig["repo"]} remote add origin #{web2}#{config["Org"]}/#{y}-#{assig["name_assig"]}.git")
|
199
242
|
|
200
|
-
|
201
|
-
system("git -C #{assig["repo"]} remote add #{y} #{web2}#{config["Org"]}/#{y}-#{assig["name_assig"]}.git")
|
202
|
-
system("git -C #{assig["repo"]} push #{y} --all")
|
243
|
+
system("git -C #{ENV['HOME']}/.ghedsh/#{assig["repo"]} push origin --all")
|
203
244
|
end
|
204
245
|
end
|
246
|
+
system("rm -rf #{ENV['HOME']}/.ghedsh/#{assig["repo"]}")
|
205
247
|
else
|
206
248
|
puts "No repository is given for this assignment"
|
207
249
|
end
|
data/lib/actions/repo.rb
CHANGED
@@ -239,22 +239,83 @@ class Repositories
|
|
239
239
|
return mem
|
240
240
|
end
|
241
241
|
|
242
|
-
def
|
242
|
+
def delete_repository(client,config,repo,scope)
|
243
|
+
|
244
|
+
if scope==ORGS
|
245
|
+
if client.repository?("#{config["Org"]}/#{repo}")==false
|
246
|
+
puts "It doesn't exist a repository with that name in #{config["Org"]}"
|
247
|
+
else
|
248
|
+
ex=false
|
249
|
+
until ex==true
|
250
|
+
puts "Repository #{repo} will be delete. Are you sure? (yes/no) (y/n)"
|
251
|
+
op=gets.chomp
|
252
|
+
if op=="yes" or op=="y"
|
253
|
+
client.delete_repository("#{config["Org"]}/#{repo}")
|
254
|
+
ex=true
|
255
|
+
end
|
256
|
+
if op=="no" or op=="n" then ex=true end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
if scope==USER || scope==TEAM
|
261
|
+
if client.repository?("#{config["User"]}/#{repo}")==false
|
262
|
+
puts "It doesn't exist a repository with that name in #{config["User"]}"
|
263
|
+
else
|
264
|
+
ex=false
|
265
|
+
until ex==true
|
266
|
+
puts "Repository #{repo} will be delete. Are you sure? (yes/no) (y/n)"
|
267
|
+
op=gets.chomp
|
268
|
+
if op=="yes" or op=="y"
|
269
|
+
client.delete_repository("#{config["User"]}/#{repo}")
|
270
|
+
ex=true
|
271
|
+
end
|
272
|
+
if op=="no" or op=="n" then ex=true end
|
273
|
+
end
|
274
|
+
end
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
def create_repository(client,config,repo,empty,scope)
|
243
279
|
options=Hash.new
|
244
|
-
|
280
|
+
|
281
|
+
if empty==false
|
282
|
+
options[:auto_init]=true
|
283
|
+
end
|
284
|
+
|
245
285
|
case
|
246
286
|
when scope==ORGS
|
247
|
-
|
287
|
+
|
248
288
|
options[:organization]=config["Org"]
|
249
|
-
client.
|
289
|
+
if client.repository?("#{config["Org"]}/#{repo}")==false
|
290
|
+
client.create_repository(repo,options)
|
291
|
+
puts "created repository in #{config["Org"]}"
|
292
|
+
return true
|
293
|
+
else
|
294
|
+
puts "Already exists a repository with that name in #{config["Org"]}"
|
295
|
+
return false
|
296
|
+
end
|
250
297
|
when scope==USER
|
251
|
-
|
252
|
-
|
298
|
+
if client.repository?("#{config["User"]}/#{repo}")==false
|
299
|
+
client.create_repository(repo)
|
300
|
+
puts "created repository #{config["User"]}"
|
301
|
+
return true
|
302
|
+
else
|
303
|
+
puts "Already exists a repository with that name in #{config["User"]}"
|
304
|
+
return false
|
305
|
+
end
|
253
306
|
when scope==TEAM
|
254
307
|
puts "created repository in #{config["Org"]} team"
|
255
308
|
options[:team_id]=config["TeamID"]
|
256
309
|
options[:organization]=config["Org"]
|
257
|
-
|
310
|
+
|
311
|
+
if client.repository?("#{config["Org"]}/#{repo}")==false
|
312
|
+
client.create_repository(repo,options)
|
313
|
+
puts "created repository in #{config["Org"]} for team #{config["Team"]}"
|
314
|
+
return true
|
315
|
+
else
|
316
|
+
puts "Already exists a repository with that name in #{config["Org"]}"
|
317
|
+
return false
|
318
|
+
end
|
258
319
|
end
|
259
320
|
end
|
260
321
|
|
@@ -269,7 +330,7 @@ class Repositories
|
|
269
330
|
# puts repo
|
270
331
|
# puts options
|
271
332
|
# puts "\n"
|
272
|
-
client.create_repository(i+"/"+repo,options)
|
333
|
+
client.create_repository(i+"/"+repo,false,options)
|
273
334
|
y=y+1
|
274
335
|
end
|
275
336
|
end
|
data/lib/actions/system.rb
CHANGED
@@ -10,7 +10,8 @@ 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_', 'close_issue', 'new_group ', 'rm_group', 'rm_', 'do ', 'info','make','add_repo',
|
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
15
|
|
15
16
|
def initialize()
|
16
17
|
@memory=[]
|
data/lib/interface.rb
CHANGED
@@ -602,13 +602,18 @@ class Interface
|
|
602
602
|
t.delete_group(@config,opcd[1])
|
603
603
|
end
|
604
604
|
end
|
605
|
+
if opcd[0]=="rm_repository" and opcd.size==2
|
606
|
+
if @deep==ORGS || @deep==USER || @deep==TEAM
|
607
|
+
r.delete_repository(@client,@config,opcd[1],@deep)
|
608
|
+
end
|
609
|
+
end
|
605
610
|
if opcd[0]=="new_team" and opcd.size>2
|
606
611
|
t.create_team_with_members(@client,@config,opcd[1],opcd[2..opcd.size])
|
607
612
|
@teamlist=t.read_teamlist(@client,@config)
|
608
613
|
@sysbh.add_history_str(1,@teamlist)
|
609
614
|
end
|
610
615
|
if opcd[0]=="new_repository" and opcd.size==2
|
611
|
-
r.create_repository(@client,@config,opcd[1],@deep)
|
616
|
+
r.create_repository(@client,@config,opcd[1],false,@deep)
|
612
617
|
end
|
613
618
|
if opcd[0]=="new_assignment" and opcd.size>1 #2
|
614
619
|
case
|
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.21
|
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-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: octokit
|