ghedsh 1.1.11 → 1.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d284d3044a823a0685dc8000446c04121025c9b5
4
- data.tar.gz: c1d9b80bd3e9b7212b33901493221ac90ead897a
3
+ metadata.gz: 8f4dcc6a2dbae9b352b9894bf2a7ef7f84887249
4
+ data.tar.gz: a63dccdd412919b01e57fcd267cdf87a64bd439b
5
5
  SHA512:
6
- metadata.gz: 800d79a32bdfd1aeeecd14a4d72ac930d7a9d624f626c59b51c6cb10638bbf7adeffa37e34caeea1a782787f9b2b2b501301a4d72c49df827bf63f6ce2c37a5a
7
- data.tar.gz: efa095937b48289ee543e081f37a5f201a93042b5a98be524524bb22df986ad51d63582706bf2f40b38bcc54da3129d9d38cca79f3af743eb8ccfd2d96e9694d
6
+ metadata.gz: 5fafc80b7cd0c38c52d8726c99e09be30847c4f7b1f01dbfed79bd56ece3e75ca22777ad5b50ef867e4bf74cf22ef0026c787b615ab718cfe458e687d10174d6
7
+ data.tar.gz: ccdee0c1a494cfd079d4f6aed60c33971bf0dce7ceff53161531ab60e099c9cae8e4da1075cfe462f04fea20b02acf24192f0c973ca5d36300d639ac3b21ab57
data/lib/actions/repo.rb CHANGED
@@ -54,7 +54,7 @@ class Repositories
54
54
 
55
55
  when scope==2
56
56
  repo=client.organization_repositories(config["Org"])
57
- when scope==3
57
+ when scope==4
58
58
  repo=client.team_repositories(config["TeamID"])
59
59
  end
60
60
 
@@ -183,7 +183,7 @@ class Repositories
183
183
  repo=client.repositories
184
184
  when scope==2
185
185
  repo=client.organization_repositories(config["Org"])
186
- when scope==3
186
+ when scope==4
187
187
  repo=client.team_repositories(config["TeamID"])
188
188
  end
189
189
  repo.each do |i|
@@ -239,4 +239,51 @@ class Sys
239
239
  return options
240
240
  end
241
241
 
242
+ def showcachelist(list,exp)
243
+ print "\n"
244
+ rlist=[]
245
+ options=Hash.new
246
+ o=Organizations.new
247
+ regex=false
248
+
249
+ if exp!=nil
250
+ if exp.match(/^\//)
251
+ regex=true
252
+ sp=exp.split('/')
253
+ exp=Regexp.new(sp[1],sp[2])
254
+ end
255
+ end
256
+ counter=0
257
+ allpages=true
258
+
259
+ list.each do |i|
260
+ if regex==false
261
+ if counter==100 && allpages==true
262
+ op=Readline.readline("\nThere are more results. Show next repositories (press any key) or Show all repositories (press a): ",true)
263
+ if op=="a"
264
+ allpages=false
265
+ end
266
+ counter=0
267
+ end
268
+ puts i
269
+ rlist.push(i)
270
+ counter=counter+1
271
+ else
272
+
273
+ if i.match(exp)
274
+ puts i
275
+ rlist.push(i)
276
+ counter=counter+1
277
+ end
278
+ end
279
+ end
280
+
281
+ if rlist.empty?
282
+ puts "No repository matches with that expression"
283
+ else
284
+ print "\n"
285
+ puts "Repositories found: #{rlist.size}"
286
+ end
287
+ end
288
+
242
289
  end
data/lib/actions/teams.rb CHANGED
@@ -69,6 +69,7 @@ class Teams
69
69
  end
70
70
  print "\n"
71
71
  return memberlist
72
+ print "\n"
72
73
  end
73
74
 
74
75
  end
data/lib/interface.rb CHANGED
@@ -26,11 +26,10 @@ class Interface
26
26
  attr_accessor :deep
27
27
  attr_accessor :memory
28
28
  attr_reader :orgs_list,:repos_list, :teamlist, :orgs_repos, :teams_repos
29
- LIST = ['repos', 'exit', 'orgs','help', 'people','teams', 'cd ', 'cd repo ','commits','forks', 'add_team_member ','new_team ','rm_team ','new_repository ','new_assignment ','clone '].sort
30
29
 
31
30
  def initialize
32
31
  @sysbh=Sys.new()
33
- @repos_list=[]; @orgs_repos=[]
32
+ @repos_list=[]; @orgs_repos=[]; @teams_repos=[]
34
33
 
35
34
  options=@sysbh.parse
36
35
 
@@ -46,7 +45,7 @@ class Interface
46
45
  raise
47
46
  rescue Exception => e
48
47
  puts "exit"
49
- puts e
48
+ # puts e
50
49
  end
51
50
  end
52
51
  end
@@ -56,7 +55,7 @@ class Interface
56
55
  when @deep == USER then return @config["User"]+"> "
57
56
  when @deep == USER_REPO then return @config["User"]+">"+ "\e[31m#{@config["Repo"]}\e[0m"+"> "
58
57
  when @deep == ORGS then return @config["User"]+">"+ "\e[34m#{@config["Org"]}\e[0m"+"> "
59
- when @deep == TEAM then return @config["User"]+">"+@config["Org"]+">"+@config["Team"]+"> "
58
+ when @deep == TEAM then return @config["User"]+">"+"\e[34m#{@config["Org"]}\e[0m"+">"+@config["Team"]+"> "
60
59
  when @deep == TEAM_REPO then return @config["User"]+">"+"\e[34m#{@config["Org"]}\e[0m"+">"+@config["Team"]+">"+"\e[31m#{@config["Repo"]}\e[0m"+"> "
61
60
  when @deep == ORGS_REPO then return @config["User"]+">"+"\e[34m#{@config["Org"]}\e[0m"+">"+"\e[31m#{@config["Repo"]}\e[0m"+"> "
62
61
  end
@@ -85,6 +84,7 @@ class Interface
85
84
  when @deep == ORGS
86
85
  @config["Org"]=nil
87
86
  @deep=1
87
+ @orgs_repos=[]
88
88
  when @deep == ORGS_REPO
89
89
  @config["Repo"]=nil
90
90
  @deep=2
@@ -94,6 +94,7 @@ class Interface
94
94
  when @deep == TEAM
95
95
  @config["Team"]=nil
96
96
  @config["TeamID"]=nil
97
+ @teams_repos=[]
97
98
  @deep=2
98
99
  end
99
100
  else
@@ -102,6 +103,7 @@ class Interface
102
103
  @config["Team"]=nil
103
104
  @config["TeamID"]=nil
104
105
  @deep=1
106
+ @orgs_repos=[]; @teams_repos=[]
105
107
  end
106
108
  end
107
109
 
@@ -115,7 +117,6 @@ class Interface
115
117
  if aux.one?{|aux| aux==path}
116
118
  @config["Org"]=path
117
119
  @teamlist=Teams.new.read_teamlist(@client,@config)
118
- #self.add_history_str(1,@teamlist)
119
120
  @sysbh.add_history_str(1,@teamlist)
120
121
  @deep=2
121
122
  else
@@ -169,7 +170,7 @@ class Interface
169
170
  if @teams_repos.empty? == false
170
171
  repostlist=@teams_repos
171
172
  else
172
- repostlist.get_repos_list(@client,@config,@deep)
173
+ reposlist=reposlist.get_repos_list(@client,@config,@deep)
173
174
  end
174
175
  if reposlist.one?{|aux| aux==path}
175
176
  @deep=TEAM_REPO
@@ -182,7 +183,6 @@ class Interface
182
183
  def orgs()
183
184
  case
184
185
  when @deep==USER
185
- #self.add_history_str(2,Organizations.new.show_orgs(@client,@config))
186
186
  @sysbh.add_history_str(2,Organizations.new.show_orgs(@client,@config))
187
187
  end
188
188
  end
@@ -190,11 +190,9 @@ class Interface
190
190
  def people()
191
191
  case
192
192
  when @deep==ORGS
193
- #self.add_history_str(2,Organizations.new.show_organization_members_bs(@client,@config))
194
193
  @sysbh.add_history_str(2,Organizations.new.show_organization_members_bs(@client,@config))
195
194
  when @deep==TEAM
196
- #self.add_history_str(2,Teams.new.show_team_members_bs(@client,@config))
197
- @sysbh.add_history_str(2,Organizations.new.show_organization_members_bs(@client,@config))
195
+ @sysbh.add_history_str(2,Teams.new.show_team_members_bs(@client,@config))
198
196
  end
199
197
  end
200
198
 
@@ -204,28 +202,26 @@ class Interface
204
202
  when @deep == USER
205
203
  if @repos_list.empty?
206
204
  list=repo.show_repos(@client,@config,USER,nil)
207
- #self.add_history_str(2,list)
208
205
  @sysbh.add_history_str(2,list)
209
206
  @repos_list=list
210
207
  else
211
- puts @repos_list
208
+ @sysbh.showcachelist(@repos_list,nil)
212
209
  end
213
210
  when @deep ==ORGS
214
211
  if @orgs_repos.empty?
215
212
  list=repo.show_repos(@client,@config,ORGS,nil)
216
- #self.add_history_str(2,list)
217
213
  @sysbh.add_history_str(2,list)
218
214
  @orgs_repos=list
219
215
  else
220
- puts @orgs_repos
216
+ @sysbh.showcachelist(@orgs_repos,nil)
221
217
  end
222
218
  when @deep==TEAM
223
219
  if @teams_repos.empty?
224
220
  list=repo.show_repos(@client,@config,TEAM,nil)
225
- self.add_history_str(2,list)
221
+ @sysbh.add_history_str(2,list)
226
222
  @teams_repos=list
227
223
  else
228
- puts @teams_repos
224
+ @sysbh.showcachelist(@teams_repos,nil)
229
225
  end
230
226
  end
231
227
  end
@@ -289,7 +285,6 @@ class Interface
289
285
 
290
286
  @deep=USER
291
287
  if @client!=nil
292
- #self.add_history_str(2,Organizations.new.read_orgs(@client))
293
288
  @sysbh.add_history_str(2,Organizations.new.read_orgs(@client))
294
289
  end
295
290
 
@@ -330,8 +325,30 @@ class Interface
330
325
  if opcd[0]=="repos" and opcd.size==1
331
326
  self.repos()
332
327
  end
333
- if opcd[0]=="repos" and opcd.size>1
334
- r.show_repos(@client,@config,@deep,opcd[1])
328
+ if opcd[0]=="repos" and opcd.size>1 ##Busca con expresion regular, si no esta en la cache realiza la consulta
329
+ case
330
+ when @deep==USER
331
+ if @repos_list.empty?
332
+ r.show_repos(@client,@config,@deep,opcd[1])
333
+ @repos_list=r.get_repos_list(@client,@config,@deep)
334
+ else
335
+ @sysbh.showcachelist(@repos_list,opcd[1])
336
+ end
337
+ when @deep==ORGS
338
+ if @orgs_repos.empty?
339
+ r.show_repos(@client,@config,@deep,opcd[1])
340
+ @orgs_repos=r.get_repos_list(@client,@config,@deep)
341
+ else
342
+ @sysbh.showcachelist(@orgs_repos,opcd[1])
343
+ end
344
+ when @deep==TEAM
345
+ if @teams_repos.empty?
346
+ r.show_repos(@client,@config,@deep,opcd[1])
347
+ @teams_repos=r.get_repos_list(@client,@config,@deep)
348
+ else
349
+ @sysbh.showcachelist(@teams_repos,opcd[1])
350
+ end
351
+ end
335
352
  end
336
353
  if opcd[0]=="add_team_member"
337
354
  t.add_to_team(@client,@config,opcd[1])
@@ -339,18 +356,18 @@ class Interface
339
356
  if opcd[0]=="new_team" and opcd.size==2
340
357
  t.create_team(@client,@config,opcd[1])
341
358
  @teamlist=t.read_teamlist(@client,@config)
342
- self.add_history_str(1,@teamlist)
359
+ @sysbh.add_history_str(1,@teamlist)
343
360
  end
344
361
  if opcd[0]=="rm_team"
345
362
  t.delete_team(@client,@teamlist[opcd[1]])
346
363
  self.quit_history(@teamlist[opcd[1]])
347
364
  @teamlist=t.read_teamlist(@client,@config)
348
- self.add_history_str(1,@teamlist)
365
+ @sysbh.add_history_str(1,@teamlist)
349
366
  end
350
367
  if opcd[0]=="new_team" and opcd.size>2
351
368
  t.create_team_with_members(@client,@config,opcd[1],opcd[2..opcd.size])
352
369
  @teamlist=t.read_teamlist(@client,@config)
353
- self.add_history_str(1,@teamlist)
370
+ @sysbh.add_history_str(1,@teamlist)
354
371
  end
355
372
  if opcd[0]=="new_repository" and opcd.size==2
356
373
  r.create_repository(@client,@config,opcd[1],@deep)
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ghedsh
2
- VERSION='1.1.11'
2
+ VERSION='1.1.12'
3
3
  end
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.11
4
+ version: 1.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Clemente