ghedsh 1.1.8 → 1.1.9

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: 795e50156da5bbd4b65d02b78b68e562b917aaed
4
- data.tar.gz: 72c10d473d46533a7a03c2813abc6d45401f07cc
3
+ metadata.gz: b45f745ce7322d75cd57b4cea2c8603d4f9d01d9
4
+ data.tar.gz: 466f5140ece8a4dc12f15f8baaedd9610278b1cb
5
5
  SHA512:
6
- metadata.gz: 570b29365da102cb9219ec346c8fd8bf1dbe1cf7edc07e4b2804fa865ddb2f18022645f8178e7c808cc86659d8b77ac018c826346033b202cefd48dcd30074cc
7
- data.tar.gz: 5dc6213d74416b216a552b0198c6e7d3a30cd0da8cd2c075091fb2bcb2b78578b17b335d6f141b41b66526eafe64d30045cf0349638606b5d27ab03a53034c79
6
+ metadata.gz: 583065f321a6aaddb70cddd84835fe4598c74d18407d9923369664c41ccf815059f9364b3bd2d34872fa0182313b011d14eb93a0409d5d04bf4b2ed919c11b85
7
+ data.tar.gz: 828fda9f6005bcf315f8987fbf220cbe5e8b119de0d7fc6e399eeab72682c04a75b6f6ca89dd355a679f143a487bf8dde079b7468c93fcb008e1a8d74bd58d46
data/lib/actions/repo.rb CHANGED
@@ -33,7 +33,7 @@ class Repositories
33
33
  case
34
34
  when scope==1
35
35
  #options[:affiliation]="organization_member"
36
- repo=client.repositories(config["User"],options)
36
+ repo=client.repositories(options) #config["User"]
37
37
  listorgs=o.read_orgs(client)
38
38
  #self.show_user_orgs_repos(client,config,listorgs)
39
39
 
@@ -72,12 +72,13 @@ class Sys
72
72
  end
73
73
 
74
74
  def login(token)
75
- user=Octokit::Client.new(:access_token =>token, per_page:100)
76
- if user==false
75
+ begin
76
+ user=Octokit::Client.new(:access_token =>token) #per_page:100
77
+ user.auto_paginate=true #show all pages of any query
78
+ rescue
77
79
  puts "Oauth error"
78
- else
79
- return user
80
80
  end
81
+ return user
81
82
  end
82
83
 
83
84
  def set_loguin_data_sh(config,configure_path)
data/lib/interface.rb CHANGED
@@ -19,7 +19,8 @@ class Interface
19
19
  attr_accessor :client
20
20
  attr_accessor :deep
21
21
  attr_accessor :memory
22
- attr_accessor :teamlist
22
+ attr_reader :teamlist
23
+ attr_reader :orgs_list
23
24
  LIST = ['repos', 'exit', 'orgs','help', 'members','teams', 'cd ', 'commits','forks', 'add_team_member ','create_team ','delete_team ','create_repository ','clone_repo '].sort
24
25
 
25
26
  def initialize
@@ -94,11 +95,6 @@ class Interface
94
95
  end
95
96
  end
96
97
 
97
-
98
- def get_data
99
- puts @config
100
- end
101
-
102
98
  def cdback()
103
99
  case
104
100
  when @deep == 2
@@ -120,32 +116,49 @@ class Interface
120
116
  def cd(path)
121
117
  case
122
118
  when @deep==1
123
- @config["Org"]=path
124
-
125
- @temlist=Hash.new
126
- @teamlist=Teams.new.read_teamlist(@client,@config)
127
- self.add_history_str(1,@teamlist)
128
- @deep=2
119
+ @orgs_list=Organizations.new.read_orgs(@client)
120
+ aux=@orgs_list
121
+ if aux.one?{|aux| aux==path}
122
+ @config["Org"]=path
123
+ @teamlist=Teams.new.read_teamlist(@client,@config)
124
+ self.add_history_str(1,@teamlist)
125
+ @deep=2
126
+ else
127
+ puts "No organization is available with that name"
128
+ end
129
129
  when @deep == 2
130
- @config["Team"]=path
131
- @config["TeamID"]=@teamlist[path]
132
- @deep=4
130
+ aux=@teamlist
131
+ if aux[path]!=nil
132
+ @config["Team"]=path
133
+ @config["TeamID"]=@teamlist[path]
134
+ @deep=4
135
+ else
136
+ puts "No team is available with that name"
137
+ end
133
138
  end
134
139
  end
135
140
 
136
141
  #set the repo
137
142
  def set(path)
143
+ reposlist=Repositories.new()
138
144
  case
139
145
  when @deep==1
140
146
  @config["Repo"]=path
141
- @deep=10
147
+ if reposlist.get_repos_list(@client,@config,@deep).one?{|aux| aux==path}
148
+ @deep=10
149
+ end
142
150
  when @deep==2
143
151
  @config["Repo"]=path
144
- @deep=3
152
+ if reposlist.get_repos_list(@client,@config,@deep).one?{|aux| aux==path}
153
+ @deep=3
154
+ end
145
155
  when @deep==4
146
156
  @config["Repo"]=path
147
- @deep=5
157
+ if reposlist.get_repos_list(@client,@config,@deep).one?{|aux| aux==path}
158
+ @deep=5
159
+ end
148
160
  end
161
+ if @deep==1 || @deep==2 || @deep==4 then puts "No repository is available with that name" end
149
162
  end
150
163
 
151
164
  def orgs()
@@ -221,6 +234,7 @@ class Interface
221
234
  Readline.completion_append_character = ""
222
235
  Readline.completion_proc = comp
223
236
  HelpM.new.welcome()
237
+
224
238
  t=Teams.new
225
239
  r=Repositories.new
226
240
  s=Sys.new
@@ -260,6 +274,7 @@ class Interface
260
274
  when op == "col" then self.collaborators()
261
275
  when op == "forks" then self.show_forks()
262
276
  end
277
+
263
278
  if opcd[0]=="cd" and opcd[1]!=".."
264
279
  self.cd(opcd[1])
265
280
  #else
@@ -313,8 +328,9 @@ class Interface
313
328
  if opcd[0]=="clone_repo" and opcd.size==2
314
329
  r.clone_repo(@client,@config,opcd[1],@deep)
315
330
  end
316
- if opcd[0]=="!"
317
- s.execute_bash(opcd[1])
331
+ if op.match(/^!/)
332
+ op=op.split("!")
333
+ s.execute_bash(op[1])
318
334
  end
319
335
  if opcd[0]=="clone_repo" and opcd.size>2
320
336
  #r.clone_repo(@client,@config,opcd[1])
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ghedsh
2
- VERSION='1.1.8'
2
+ VERSION='1.1.9'
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.8
4
+ version: 1.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Clemente