ghedsh 1.1.12 → 1.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +79 -2
- data/lib/actions/help.rb +4 -0
- data/lib/actions/repo.rb +120 -36
- data/lib/actions/system.rb +28 -0
- data/lib/actions/teams.rb +24 -4
- data/lib/interface.rb +142 -65
- 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: 22bf718c37c91117187718f6e18e4dfe9ef32f2c
|
4
|
+
data.tar.gz: a78d6daebd105e6b3bad708bfad1a7ef89f88d0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3db8a568180a6da2d8fb52ca43dd825953e26a85e669a480c2309b42b23bfcebb757f3f0fff997a31112ba516d86880d6d5032fb43d73ccddd7f802cbc1763fa
|
7
|
+
data.tar.gz: e33b7b9797e5eabb1041662834b826e8c8bce6e76070e5bacda83b1ab600a1f92030d7ea241cb6dd28cba7ddf6110a87fb0f676e04b3181c9766cf4eea833442
|
data/README.md
CHANGED
@@ -14,8 +14,6 @@ Ir order to run this program, you need to make an **Access token** from Github w
|
|
14
14
|
|
15
15
|
##Running the program in your computer
|
16
16
|
|
17
|
-
You can run this program downloading this repository directly, but you need to setting the configure file. Rename the file *configure_template.json* to *configure.json* in **./lib/configure/.**
|
18
|
-
|
19
17
|
To start using the program, put "rake bash" or "rake" in your command line in the main folder of this program. You can invoke the binary file using the command *ghedsh*.
|
20
18
|
|
21
19
|
##Using the gem
|
@@ -39,5 +37,84 @@ Levels
|
|
39
37
|
└── User Repositories
|
40
38
|
```
|
41
39
|
|
40
|
+
##Lista de comandos
|
41
|
+
|
42
|
+
|
43
|
+
```sh
|
44
|
+
cd <nombre>
|
45
|
+
```
|
46
|
+
|
47
|
+
Va a la ruta correspondiente con el nombre dado. La ruta puede ser un repositorio, una organizacion, o un equipo. Si el usuario se encuentra en la raiz, el comando primero buscara una organizacion con el nombre dado, y si no la encuentra buscara un repositorio, y si el usuario esta situado en una organizacion el programa buscara primero un equipo y despues un repositorio.
|
48
|
+
|
49
|
+
Si queremos ir directamente a un repositorio es posible usar `` cd repo <nombre> ``
|
50
|
+
|
51
|
+
|
52
|
+
```sh
|
53
|
+
! <comando>
|
54
|
+
```
|
55
|
+
Ejecuta un comando en la terminal donde se este ejecutando el programa.
|
56
|
+
|
57
|
+
```sh
|
58
|
+
help
|
59
|
+
```
|
60
|
+
Muestra las opciones disponibles segun el ambito en el que la ayuda sea invocada.
|
61
|
+
```sh
|
62
|
+
exit
|
63
|
+
```
|
64
|
+
Con este comando el usuario sale de ghedsh.
|
65
|
+
|
66
|
+
```sh
|
67
|
+
orgs
|
68
|
+
```
|
69
|
+
Estando en el ambito del usuario, mostrara la lista de Organizaciones a las que pertenece el usuario.
|
70
|
+
|
71
|
+
```sh
|
72
|
+
repos
|
73
|
+
```
|
74
|
+
|
75
|
+
Muestra la lista de todos los repositorios disponibles del usuario segun el ambito. Si estamos en un Usuario, mostrara los repositorios de los que es dueño, de los que es colaborador, y los repositorios publicos de las organizaciones a las que pertenezca, asi como en los que participe. Si se ejecuta en el ambito de una Organizacion, mostrara todos los repositorios de una organizacion en concreto. Cuando ejecutamos el comando dentro de un Equipo, mostrara los repositorios que pertecen al mismo.
|
76
|
+
|
77
|
+
Si queremos realizar una busqueda inteligente, el comando permite el uso de *expresiones regulares*. Para ese caso deberia ejecutarse ``repos /<RegEx>/``
|
78
|
+
|
79
|
+
```sh
|
80
|
+
teams
|
81
|
+
```
|
82
|
+
Muestra todos los equipos de una organizacion.
|
83
|
+
|
84
|
+
```sh
|
85
|
+
groups
|
86
|
+
```
|
87
|
+
Muestra los grupos de equipos de una organizacion.
|
88
|
+
|
89
|
+
```sh
|
90
|
+
clone <nombre>
|
91
|
+
```
|
92
|
+
Clona el repositorio en el path actual. Es posible clonar una lista de repositorios usando una expresion regular. ``clone /<RegEx>/``
|
93
|
+
|
94
|
+
```sh
|
95
|
+
people
|
96
|
+
```
|
97
|
+
Muestra los miembros de una organizacion si nos encontramos en ese ambito, o los miembros de un equipo.
|
98
|
+
|
99
|
+
```sh
|
100
|
+
files <path>
|
101
|
+
```
|
102
|
+
Dentro de un repositorio, muestra los archivos y directorios que se encuentren en el path dado. Si se ejecuta sin opciones mostrara los archivos de la raiz del repositorio.
|
103
|
+
|
104
|
+
```sh
|
105
|
+
cat <file>
|
106
|
+
```
|
107
|
+
Muestra el contenido de un archivo.
|
108
|
+
|
109
|
+
```sh
|
110
|
+
commits
|
111
|
+
```
|
112
|
+
Muestra los commits del repositorio en el que se encuentre el usuario.
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
42
119
|
##Aditional information
|
43
120
|
[Github Education](https://education.github.com/)
|
data/lib/actions/help.rb
CHANGED
@@ -31,6 +31,8 @@ class HelpM
|
|
31
31
|
def org_repo()
|
32
32
|
self.common_opt
|
33
33
|
print "\tcommits\t\t\tshow the list of commits from the repository\n"
|
34
|
+
print "\tfiles\t\t\tshow the files of the repository path given\n"
|
35
|
+
print "\tcat\t\t\tshow data from a file\n"
|
34
36
|
print "\tcol\t\t\tshow the list of collaborators from the repository\n\n"
|
35
37
|
end
|
36
38
|
|
@@ -45,6 +47,8 @@ class HelpM
|
|
45
47
|
def user_repo()
|
46
48
|
self.common_opt
|
47
49
|
print "\tcommits\t\t\tshow the list of commits from the repository\n"
|
50
|
+
print "\tfiles\t\t\tshow the files of the repository path given\n"
|
51
|
+
print "\tcat\t\t\tshow data from a file\n"
|
48
52
|
print "\tcol\t\t\tshow the list of collaborators from the repository\n\n"
|
49
53
|
end
|
50
54
|
|
data/lib/actions/repo.rb
CHANGED
@@ -3,11 +3,10 @@ require 'octokit'
|
|
3
3
|
require 'json'
|
4
4
|
require 'readline'
|
5
5
|
require 'require_all'
|
6
|
+
require 'base64'
|
6
7
|
require_rel '.'
|
7
8
|
|
8
|
-
|
9
9
|
class Repositories
|
10
|
-
|
11
10
|
attr_reader :reposlist
|
12
11
|
#scope = 1 -> organization repos
|
13
12
|
#scope = 2 -> user repos
|
@@ -20,10 +19,14 @@ class Repositories
|
|
20
19
|
def show_commits(client,config,scope)
|
21
20
|
print "\n"
|
22
21
|
case
|
23
|
-
|
22
|
+
when scope==USER_REPO
|
23
|
+
if config["Repo"].split("/").size == 1
|
24
|
+
mem=client.commits(config["User"]+"/"+config["Repo"],"master")
|
25
|
+
else
|
26
|
+
mem=client.commits(config["Repo"],"master")
|
27
|
+
end
|
28
|
+
when scope==ORGS_REPO
|
24
29
|
mem=client.commits(config["Org"]+"/"+config["Repo"],"master")
|
25
|
-
when scope==2
|
26
|
-
mem=client.commits(config["User"]+"/"+config["Repo"],"master")
|
27
30
|
end
|
28
31
|
mem.each do |i|
|
29
32
|
print i[:sha],"\n",i[:commit][:author][:name],"\n",i[:commit][:author][:date],"\n",i[:commit][:message],"\n\n"
|
@@ -38,6 +41,7 @@ class Repositories
|
|
38
41
|
options=Hash.new
|
39
42
|
o=Organizations.new
|
40
43
|
regex=false
|
44
|
+
force_exit=false
|
41
45
|
|
42
46
|
if exp!=nil
|
43
47
|
if exp.match(/^\//)
|
@@ -48,13 +52,12 @@ class Repositories
|
|
48
52
|
end
|
49
53
|
|
50
54
|
case
|
51
|
-
when scope==
|
55
|
+
when scope==USER
|
52
56
|
repo=client.repositories(options) #config["User"]
|
53
57
|
listorgs=o.read_orgs(client)
|
54
|
-
|
55
|
-
when scope==2
|
58
|
+
when scope==ORGS
|
56
59
|
repo=client.organization_repositories(config["Org"])
|
57
|
-
when scope==
|
60
|
+
when scope==TEAM
|
58
61
|
repo=client.team_repositories(config["TeamID"])
|
59
62
|
end
|
60
63
|
|
@@ -62,24 +65,42 @@ class Repositories
|
|
62
65
|
allpages=true
|
63
66
|
|
64
67
|
repo.each do |i|
|
65
|
-
if
|
66
|
-
if
|
67
|
-
|
68
|
-
|
69
|
-
|
68
|
+
if force_exit==false
|
69
|
+
if regex==false
|
70
|
+
if counter==100 && allpages==true
|
71
|
+
op=Readline.readline("\nThere are more results. Show next repositories (press any key), show all repositories (press a) or quit (q): ",true)
|
72
|
+
if op=="a"
|
73
|
+
allpages=false
|
74
|
+
end
|
75
|
+
if op=="q"
|
76
|
+
force_exit=true
|
77
|
+
end
|
78
|
+
counter=0
|
79
|
+
end
|
80
|
+
if scope ==USER
|
81
|
+
if i[:owner][:login]==config["User"]
|
82
|
+
puts i.name
|
83
|
+
rlist.push(i.name)
|
84
|
+
else
|
85
|
+
puts i.full_name
|
86
|
+
rlist.push(i.full_name)
|
87
|
+
end
|
88
|
+
else
|
89
|
+
puts i.name
|
90
|
+
rlist.push(i.name)
|
70
91
|
end
|
71
|
-
counter=0
|
72
|
-
end
|
73
|
-
|
74
|
-
puts i.name
|
75
|
-
rlist.push(i.name)
|
76
|
-
counter=counter+1
|
77
|
-
else
|
78
|
-
|
79
|
-
if i.name.match(exp)
|
80
|
-
puts i.name
|
81
|
-
rlist.push(i.name)
|
82
92
|
counter=counter+1
|
93
|
+
else
|
94
|
+
if i.name.match(exp)
|
95
|
+
if scope ==USER
|
96
|
+
puts i.full_name
|
97
|
+
rlist.push(i.full_name)
|
98
|
+
else
|
99
|
+
puts i.name
|
100
|
+
rlist.push(i.name)
|
101
|
+
end
|
102
|
+
counter=counter+1
|
103
|
+
end
|
83
104
|
end
|
84
105
|
end
|
85
106
|
end
|
@@ -110,7 +131,7 @@ class Repositories
|
|
110
131
|
print "\n"
|
111
132
|
forklist=[]
|
112
133
|
case
|
113
|
-
when scope==
|
134
|
+
when scope==USER
|
114
135
|
mem=client.forks(config["Org"]+"/"+config["Repo"])
|
115
136
|
end
|
116
137
|
mem.each do |i|
|
@@ -125,7 +146,7 @@ class Repositories
|
|
125
146
|
print "\n"
|
126
147
|
collalist=[]
|
127
148
|
case
|
128
|
-
when scope==
|
149
|
+
when scope==USER
|
129
150
|
mem=client.collaborators(config["Org"]+"/"+config["Repo"])
|
130
151
|
end
|
131
152
|
mem.each do |i|
|
@@ -144,14 +165,14 @@ class Repositories
|
|
144
165
|
def create_repository(client,config,repo,scope)
|
145
166
|
options=Hash.new
|
146
167
|
case
|
147
|
-
when scope==
|
168
|
+
when scope==ORGS
|
148
169
|
puts "created repository in org"
|
149
170
|
options[:organization]=config["Org"]
|
150
171
|
client.create_repository(repo,options)
|
151
|
-
when scope==
|
172
|
+
when scope==USER
|
152
173
|
puts "created repository in user"
|
153
174
|
client.create_repository(repo)
|
154
|
-
when scope==
|
175
|
+
when scope==TEAM
|
155
176
|
puts "created repository in org team"
|
156
177
|
options[:team_id]=config["TeamID"]
|
157
178
|
options[:organization]=config["Org"]
|
@@ -179,15 +200,19 @@ class Repositories
|
|
179
200
|
def get_repos_list(client,config,scope)
|
180
201
|
reposlist=[]
|
181
202
|
case
|
182
|
-
when scope==
|
203
|
+
when scope==USER
|
183
204
|
repo=client.repositories
|
184
|
-
when scope==
|
205
|
+
when scope==ORGS
|
185
206
|
repo=client.organization_repositories(config["Org"])
|
186
|
-
when scope==
|
207
|
+
when scope==TEAM
|
187
208
|
repo=client.team_repositories(config["TeamID"])
|
188
209
|
end
|
189
210
|
repo.each do |i|
|
190
|
-
|
211
|
+
if scope!=USER
|
212
|
+
reposlist.push(i.name)
|
213
|
+
else
|
214
|
+
reposlist.push(i.full_name)
|
215
|
+
end
|
191
216
|
end
|
192
217
|
return reposlist
|
193
218
|
end
|
@@ -209,12 +234,12 @@ class Repositories
|
|
209
234
|
|
210
235
|
if (list.empty?) == false
|
211
236
|
case
|
212
|
-
when scope==
|
237
|
+
when scope==USER
|
213
238
|
list.each do |i|
|
214
239
|
command = "git clone #{web}#{config["User"]}/#{i}.git"
|
215
240
|
system(command)
|
216
241
|
end
|
217
|
-
when scope==
|
242
|
+
when scope==ORGS
|
218
243
|
list.each do |i|
|
219
244
|
command = "git clone #{web}#{config["Org"]}/#{i}.git"
|
220
245
|
system(command)
|
@@ -224,4 +249,63 @@ class Repositories
|
|
224
249
|
puts "No repositories found it with the parameters given"
|
225
250
|
end
|
226
251
|
end
|
252
|
+
|
253
|
+
def show_files(list)
|
254
|
+
print "\n"
|
255
|
+
list.each do |i|
|
256
|
+
puts i.name
|
257
|
+
end
|
258
|
+
print "\n"
|
259
|
+
end
|
260
|
+
|
261
|
+
def cat_file(client,config,path,scope)
|
262
|
+
if path.match(/.\./)!=nil
|
263
|
+
case
|
264
|
+
when scope==USER_REPO
|
265
|
+
if config["Repo"].split("/").size > 1
|
266
|
+
data=Base64.decode64(client.content(config["Repo"],:path=>path).content)
|
267
|
+
else
|
268
|
+
data=Base64.decode64(client.content(config["User"]+"/"+config["Repo"],:path=>path).content)
|
269
|
+
end
|
270
|
+
|
271
|
+
when scope==ORGS_REPO
|
272
|
+
data=Base64.decode64(client.content(config["Org"]+"/"+config["Repo"],:path=>path).content)
|
273
|
+
when scope==TEAM_REPO
|
274
|
+
data=Base64.decode64(client.content(config["Org"]+"/"+config["Repo"],:path=>path).content)
|
275
|
+
end
|
276
|
+
|
277
|
+
# s=Sys.new()
|
278
|
+
# s.createTempFile(data)
|
279
|
+
# s.execute_bash("vi -R #{data}")
|
280
|
+
puts data
|
281
|
+
|
282
|
+
else
|
283
|
+
puts "#{path} is not a file."
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
def get_files(client,config,path,scope)
|
288
|
+
#Base64.decode64(data['content'])
|
289
|
+
show=true
|
290
|
+
if path.match(/.\./)==nil
|
291
|
+
case
|
292
|
+
when scope==USER_REPO
|
293
|
+
if config["Repo"].split("/").size > 1
|
294
|
+
list=client.content(config["Repo"],:path=>path)
|
295
|
+
else
|
296
|
+
list=client.content(config["User"]+"/"+config["Repo"],:path=>path)
|
297
|
+
end
|
298
|
+
|
299
|
+
when scope==ORGS_REPO
|
300
|
+
list=client.content(config["Org"]+"/"+config["Repo"],:path=>path)
|
301
|
+
when scope==TEAM_REPO
|
302
|
+
list=client.content(config["Org"]+"/"+config["Repo"],:path=>path)
|
303
|
+
end
|
304
|
+
if show!=false
|
305
|
+
self.show_files(list)
|
306
|
+
end
|
307
|
+
else
|
308
|
+
puts "#{path} is not a directory. If you want to open a file try to use cat <path>"
|
309
|
+
end
|
310
|
+
end
|
227
311
|
end
|
data/lib/actions/system.rb
CHANGED
@@ -174,6 +174,27 @@ class Sys
|
|
174
174
|
return config
|
175
175
|
end
|
176
176
|
|
177
|
+
def load_groups(path)
|
178
|
+
if (File.exist?(path))==true
|
179
|
+
if File.exist?("#{path}/groups.json")
|
180
|
+
json = File.read("#{path}/groups.json")
|
181
|
+
else
|
182
|
+
con={:orgs=>[]}
|
183
|
+
File.write("#{path}/groups.json",con.to_json)
|
184
|
+
json = File.read("#{path}/groups.json")
|
185
|
+
end
|
186
|
+
else
|
187
|
+
#path="/db/assignments.json"
|
188
|
+
#json = File.read(path)
|
189
|
+
end
|
190
|
+
config=JSON.parse(json)
|
191
|
+
return config
|
192
|
+
end
|
193
|
+
|
194
|
+
def save_groups(path,data)
|
195
|
+
File.write("#{path}/groups.json",data.to_json)
|
196
|
+
end
|
197
|
+
|
177
198
|
#creates all ghedsh local stuff
|
178
199
|
def create_config(configure_path)
|
179
200
|
con={:User=>nil,:Org=>nil,:Repo=>nil,:Team=>nil,:TeamID=>nil}
|
@@ -239,6 +260,13 @@ class Sys
|
|
239
260
|
return options
|
240
261
|
end
|
241
262
|
|
263
|
+
def createTempFile(data)
|
264
|
+
tempfile="temp.txt"
|
265
|
+
path="#{ENV['HOME']}/.ghedsh/#{tempfile}"
|
266
|
+
File.write(path,data)
|
267
|
+
return path
|
268
|
+
end
|
269
|
+
|
242
270
|
def showcachelist(list,exp)
|
243
271
|
print "\n"
|
244
272
|
rlist=[]
|
data/lib/actions/teams.rb
CHANGED
@@ -7,10 +7,6 @@ require_rel '.'
|
|
7
7
|
class Teams
|
8
8
|
attr_accessor :teamlist
|
9
9
|
|
10
|
-
def list_team_repos(repos)
|
11
|
-
|
12
|
-
end
|
13
|
-
|
14
10
|
def add_to_team(client,config,path)
|
15
11
|
client.add_team_member(config["TeamID"],path)
|
16
12
|
end
|
@@ -72,4 +68,28 @@ class Teams
|
|
72
68
|
print "\n"
|
73
69
|
end
|
74
70
|
|
71
|
+
def list_groups(client,config)
|
72
|
+
sys=Sys.new()
|
73
|
+
list=sys.load_groups("#{ENV['HOME']}/.ghedsh")
|
74
|
+
groups=list["orgs"].detect{|aux| aux["name"]==config["Org"]}
|
75
|
+
if groups!=nil
|
76
|
+
if groups["groups"].empty?
|
77
|
+
puts "No groups are available yet"
|
78
|
+
else
|
79
|
+
groups["groups"].each do |i|
|
80
|
+
puts i["name"]
|
81
|
+
end
|
82
|
+
end
|
83
|
+
else
|
84
|
+
puts "No groups are available yet"
|
85
|
+
list["orgs"].push({"name"=>config["Org"],"groups"=>[]})
|
86
|
+
sys.save_groups("#{ENV['HOME']}/.ghedsh",list)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def new_group(client,config,name,list)
|
91
|
+
|
92
|
+
|
93
|
+
end
|
94
|
+
|
75
95
|
end
|
data/lib/interface.rb
CHANGED
@@ -29,7 +29,7 @@ class Interface
|
|
29
29
|
|
30
30
|
def initialize
|
31
31
|
@sysbh=Sys.new()
|
32
|
-
@repos_list=[]; @orgs_repos=[]; @teams_repos=[]
|
32
|
+
@repos_list=[]; @orgs_repos=[]; @teams_repos=[]; @orgs_list=[]; @teamlist=[]
|
33
33
|
|
34
34
|
options=@sysbh.parse
|
35
35
|
|
@@ -45,7 +45,7 @@ class Interface
|
|
45
45
|
raise
|
46
46
|
rescue Exception => e
|
47
47
|
puts "exit"
|
48
|
-
|
48
|
+
puts e
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -55,8 +55,8 @@ class Interface
|
|
55
55
|
when @deep == USER then return @config["User"]+"> "
|
56
56
|
when @deep == USER_REPO then return @config["User"]+">"+ "\e[31m#{@config["Repo"]}\e[0m"+"> "
|
57
57
|
when @deep == ORGS then return @config["User"]+">"+ "\e[34m#{@config["Org"]}\e[0m"+"> "
|
58
|
-
when @deep == TEAM then return @config["User"]+">"+"\e[34m#{@config["Org"]}\e[0m"+">"
|
59
|
-
when @deep == TEAM_REPO then return @config["User"]+">"+"\e[34m#{@config["Org"]}\e[0m"+">"
|
58
|
+
when @deep == TEAM then return @config["User"]+">"+"\e[34m#{@config["Org"]}\e[0m"+">"+"\e[32m#{@config["Team"]}\e[0m"+"> "
|
59
|
+
when @deep == TEAM_REPO then return @config["User"]+">"+"\e[34m#{@config["Org"]}\e[0m"+">"+"\e[32m#{@config["Team"]}\e[0m"+">"+"\e[31m#{@config["Repo"]}\e[0m"+"> "
|
60
60
|
when @deep == ORGS_REPO then return @config["User"]+">"+"\e[34m#{@config["Org"]}\e[0m"+">"+"\e[31m#{@config["Repo"]}\e[0m"+"> "
|
61
61
|
end
|
62
62
|
end
|
@@ -110,31 +110,73 @@ class Interface
|
|
110
110
|
#Go to the path, depends with the scope
|
111
111
|
#if you are in user scope, first searchs Orgs then Repos, etc.
|
112
112
|
def cd(path)
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
113
|
+
path_split=path.split("/")
|
114
|
+
if path_split.size==1 ##cd con path simple
|
115
|
+
case
|
116
|
+
when @deep==USER
|
117
|
+
@orgs_list=Organizations.new.read_orgs(@client)
|
118
|
+
aux=@orgs_list
|
119
|
+
if aux.one?{|aux| aux==path}
|
120
|
+
@config["Org"]=path
|
121
|
+
@teamlist=Teams.new.read_teamlist(@client,@config)
|
122
|
+
@sysbh.add_history_str(1,@teamlist)
|
123
|
+
@deep=2
|
124
|
+
else
|
125
|
+
puts "\nNo organization is available with that name"
|
126
|
+
self.set(path)
|
127
|
+
end
|
128
|
+
when @deep == ORGS
|
129
|
+
aux=@teamlist
|
130
|
+
if aux[path]!=nil
|
131
|
+
@config["Team"]=path
|
132
|
+
@config["TeamID"]=@teamlist[path]
|
133
|
+
@deep=TEAM
|
134
|
+
else
|
135
|
+
puts "\nNo team is available with that name"
|
136
|
+
self.set(path)
|
137
|
+
end
|
138
|
+
when @deep == TEAM
|
124
139
|
self.set(path)
|
125
140
|
end
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
@
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
141
|
+
else ##CD con path absoluto
|
142
|
+
case
|
143
|
+
when @deep==USER
|
144
|
+
if @orgs_list.empty?
|
145
|
+
@orgs_list=Organizations.new.read_orgs(@client)
|
146
|
+
end
|
147
|
+
aux=@orgs_list
|
148
|
+
if aux.one?{|aux| aux==path_split[0]}
|
149
|
+
@config["Org"]=path_split[0]
|
150
|
+
@deep=ORGS
|
151
|
+
if @teamlist.empty?
|
152
|
+
@teamlist=Teams.new.read_teamlist(@client,@config)
|
153
|
+
end
|
154
|
+
aux=@teamlist
|
155
|
+
if aux[path_split[1]]!=nil
|
156
|
+
@config["Team"]=path_split[1]
|
157
|
+
@config["TeamID"]=@teamlist[path_split[1]]
|
158
|
+
@deep=TEAM
|
159
|
+
if path_split.size>2
|
160
|
+
self.set(path_split[2])
|
161
|
+
end
|
162
|
+
else
|
163
|
+
puts "\nNo team is available with that name"
|
164
|
+
self.set(path_split[1])
|
165
|
+
end
|
166
|
+
else
|
167
|
+
puts "\nNo organization is available with that name"
|
168
|
+
end
|
169
|
+
when @deep==ORGS
|
170
|
+
if aux[path_split[0]]!=nil
|
171
|
+
@config["Team"]=path_split[0]
|
172
|
+
@config["TeamID"]=@teamlist[path_split[0]]
|
173
|
+
@deep=TEAM
|
174
|
+
self.set(path_split[1])
|
175
|
+
else
|
176
|
+
puts "\nNo team is available with that name"
|
177
|
+
end
|
135
178
|
end
|
136
|
-
|
137
|
-
self.set(path)
|
179
|
+
|
138
180
|
end
|
139
181
|
end
|
140
182
|
|
@@ -168,7 +210,7 @@ class Interface
|
|
168
210
|
when @deep==TEAM
|
169
211
|
@config["Repo"]=path
|
170
212
|
if @teams_repos.empty? == false
|
171
|
-
|
213
|
+
reposlist=@teams_repos
|
172
214
|
else
|
173
215
|
reposlist=reposlist.get_repos_list(@client,@config,@deep)
|
174
216
|
end
|
@@ -196,30 +238,51 @@ class Interface
|
|
196
238
|
end
|
197
239
|
end
|
198
240
|
|
199
|
-
def repos()
|
241
|
+
def repos(all)
|
200
242
|
repo=Repositories.new()
|
201
243
|
case
|
202
244
|
when @deep == USER
|
203
245
|
if @repos_list.empty?
|
204
|
-
|
205
|
-
|
206
|
-
|
246
|
+
if all==false
|
247
|
+
list=repo.show_repos(@client,@config,USER,nil)
|
248
|
+
@sysbh.add_history_str(2,list)
|
249
|
+
@repos_list=list
|
250
|
+
else
|
251
|
+
list=repo.get_repos_list(@client,@config,USER)
|
252
|
+
@sysbh.add_history_str(2,list)
|
253
|
+
@repos_list=list
|
254
|
+
puts list
|
255
|
+
end
|
207
256
|
else
|
208
257
|
@sysbh.showcachelist(@repos_list,nil)
|
209
258
|
end
|
210
259
|
when @deep ==ORGS
|
211
260
|
if @orgs_repos.empty?
|
212
|
-
|
213
|
-
|
214
|
-
|
261
|
+
if all==false
|
262
|
+
list=repo.show_repos(@client,@config,ORGS,nil)
|
263
|
+
@sysbh.add_history_str(2,list)
|
264
|
+
@orgs_repos=list
|
265
|
+
else
|
266
|
+
list=repo.show_repos(@client,@config,ORGS)
|
267
|
+
@sysbh.add_history_str(2,list)
|
268
|
+
@repos_list=list
|
269
|
+
puts list
|
270
|
+
end
|
215
271
|
else
|
216
272
|
@sysbh.showcachelist(@orgs_repos,nil)
|
217
273
|
end
|
218
274
|
when @deep==TEAM
|
219
275
|
if @teams_repos.empty?
|
220
|
-
|
221
|
-
|
222
|
-
|
276
|
+
if all==false
|
277
|
+
list=repo.show_repos(@client,@config,TEAM,nil)
|
278
|
+
@sysbh.add_history_str(2,list)
|
279
|
+
@teams_repos=list
|
280
|
+
else
|
281
|
+
list=repo.show_repos(@client,@config,TEAM)
|
282
|
+
@sysbh.add_history_str(2,list)
|
283
|
+
@repos_list=list
|
284
|
+
puts list
|
285
|
+
end
|
223
286
|
else
|
224
287
|
@sysbh.showcachelist(@teams_repos,nil)
|
225
288
|
end
|
@@ -236,11 +299,8 @@ class Interface
|
|
236
299
|
|
237
300
|
def commits()
|
238
301
|
c=Repositories.new
|
239
|
-
|
240
|
-
|
241
|
-
c.show_commits(@client,@config,1)
|
242
|
-
when @deep==USER_REPO
|
243
|
-
c.show_commits(@client,@config,2)
|
302
|
+
if @deep==ORGS_REPO || @deep==USER_REPO
|
303
|
+
c.show_commits(@client,@config,@deep)
|
244
304
|
end
|
245
305
|
print "\n"
|
246
306
|
end
|
@@ -306,6 +366,10 @@ class Interface
|
|
306
366
|
when op == "commits" then self.commits()
|
307
367
|
when op == "col" then self.collaborators()
|
308
368
|
when op == "forks" then self.show_forks()
|
369
|
+
when op == "groups"
|
370
|
+
if @deep==ORGS
|
371
|
+
t.list_groups(@client,@config)
|
372
|
+
end
|
309
373
|
end
|
310
374
|
|
311
375
|
if opcd[0]=="cd" and opcd[1]!=".."
|
@@ -323,30 +387,34 @@ class Interface
|
|
323
387
|
self.set(opcd[1])
|
324
388
|
end
|
325
389
|
if opcd[0]=="repos" and opcd.size==1
|
326
|
-
self.repos()
|
390
|
+
self.repos(false)
|
327
391
|
end
|
328
392
|
if opcd[0]=="repos" and opcd.size>1 ##Busca con expresion regular, si no esta en la cache realiza la consulta
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
393
|
+
if opcd[1]=="-all" || opcd[1]=="-a"
|
394
|
+
self.repos(true)
|
395
|
+
else
|
396
|
+
case
|
397
|
+
when @deep==USER
|
398
|
+
if @repos_list.empty?
|
399
|
+
r.show_repos(@client,@config,@deep,opcd[1])
|
400
|
+
@repos_list=r.get_repos_list(@client,@config,@deep)
|
401
|
+
else
|
402
|
+
@sysbh.showcachelist(@repos_list,opcd[1])
|
403
|
+
end
|
404
|
+
when @deep==ORGS
|
405
|
+
if @orgs_repos.empty?
|
406
|
+
r.show_repos(@client,@config,@deep,opcd[1])
|
407
|
+
@orgs_repos=r.get_repos_list(@client,@config,@deep)
|
408
|
+
else
|
409
|
+
@sysbh.showcachelist(@orgs_repos,opcd[1])
|
410
|
+
end
|
411
|
+
when @deep==TEAM
|
412
|
+
if @teams_repos.empty?
|
413
|
+
r.show_repos(@client,@config,@deep,opcd[1])
|
414
|
+
@teams_repos=r.get_repos_list(@client,@config,@deep)
|
415
|
+
else
|
416
|
+
@sysbh.showcachelist(@teams_repos,opcd[1])
|
417
|
+
end
|
350
418
|
end
|
351
419
|
end
|
352
420
|
end
|
@@ -378,7 +446,6 @@ class Interface
|
|
378
446
|
r.create_repository_by_teamlist(@client,@config,opcd[1],opcd[2,opcd.size],self.get_teamlist(opcd[2,opcd.size]))
|
379
447
|
end
|
380
448
|
end
|
381
|
-
|
382
449
|
if opcd[0]=="clone" and opcd.size==2
|
383
450
|
r.clone_repo(@client,@config,opcd[1],@deep)
|
384
451
|
end
|
@@ -389,6 +456,16 @@ class Interface
|
|
389
456
|
if opcd[0]=="clone" and opcd.size>2
|
390
457
|
#r.clone_repo(@client,@config,opcd[1])
|
391
458
|
end
|
459
|
+
if opcd[0]=="files"
|
460
|
+
if opcd.size==1
|
461
|
+
r.get_files(@client,@config,'',@deep)
|
462
|
+
else
|
463
|
+
r.get_files(@client,@config,opcd[1],@deep)
|
464
|
+
end
|
465
|
+
end
|
466
|
+
if opcd[0]=="cat" and opcd.size>1
|
467
|
+
r.cat_file(@client,@config,opcd[1],@deep)
|
468
|
+
end
|
392
469
|
end
|
393
470
|
|
394
471
|
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.13
|
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-05-
|
12
|
+
date: 2016-05-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: octokit
|