ghedsh 1.1.3 → 1.1.4

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: c8b0a139348f10866fd417e1e2f24711bdddb996
4
- data.tar.gz: 6cc32b2b29fcd318259fd5531782a228fd461e9d
3
+ metadata.gz: 0aaa03a8f282329e069f71fbdec259e9aa385957
4
+ data.tar.gz: c4514a161b8901749c0265399b05d47916abf97a
5
5
  SHA512:
6
- metadata.gz: 59cc7bb5ee72870148df73d215baa69cf9710b0c71fca8d7ebbb7dc126fbaa2ab1f25b2d7e0f58bbb47a3d1a6160a6b821af9a842e7e7e177f6f34439fc0c4e8
7
- data.tar.gz: 6d3269bc28cd6a270be3c5d4ccd1cbca7fd45d85d4508fdf6586879724be1ed8613f0f2cf6019fac6a45766080251d7ef0a18b51f4b2a6550d1e16197fc4953b
6
+ metadata.gz: bb123a0e77127e55f256134d75e500bdd4d96b7871904dc9992ecb0a20d70f7078319c1821bd457a8422b81b82917c151c09755e03cd9eb4dddb292ab01664d8
7
+ data.tar.gz: 94970e89e0e57507a6507e4170a2f4167b5bee3b5f84fa63d16f01518cdaab15e041919038432b300ae78d4d376a7b80c7e7488288db921bebaa6b7f40d327d0
data/lib/actions/help.rb CHANGED
@@ -5,6 +5,7 @@ class HelpM
5
5
  self.common_opt
6
6
  print "orgs => show your organizations\n"
7
7
  print "repos => list your repositories\n\n"
8
+ print "clone_repo => clone a repository or a list of repositories using a regular expresion"
8
9
  print "create_repository => create a repository in your personal account\n"
9
10
  print "set => move you to a specific repository\n"
10
11
 
@@ -13,6 +14,7 @@ class HelpM
13
14
  def org()
14
15
  self.common_opt
15
16
  print "repos => list the repositories of your organization\n"
17
+ print "clone_repo => clone a repository or a list of repositories using a regular expresion"
16
18
  print "set => move you to a specific repository\n"
17
19
  print "members => members of a organization\n"
18
20
  print "teams => teams of a organization\n"
@@ -30,6 +32,7 @@ class HelpM
30
32
  def orgs_teams()
31
33
  self.common_opt
32
34
  print "members => members of the team\n"
35
+ print "clone_repo => clone a repository or a list of repositories using a regular expresion"
33
36
  print "create_repository => create a repository to this team\n"
34
37
  print "add_to_team => add a member in the team\n\n"
35
38
  end
@@ -51,4 +54,14 @@ class HelpM
51
54
  puts "\nGitHub Education Shell!"
52
55
  puts "_______________________\n\n"
53
56
  end
57
+
58
+ def bin
59
+ puts "\nList of commands\n\n"
60
+ puts "ghedsh"
61
+ puts "Run with default configuration"
62
+ puts "ghedsh --token TOKEN"
63
+ puts "Provides a github access token by argument"
64
+ puts "ghedsh --help"
65
+ puts "Show the executable options"
66
+ end
54
67
  end
data/lib/actions/repo.rb CHANGED
@@ -47,7 +47,7 @@ class Repositories
47
47
  reposlist=[]
48
48
  case
49
49
  when scope==1
50
- repo=client.repositories
50
+ repo=client.all_repositories()
51
51
  when scope==2
52
52
  repo=client.organization_repositories(config["Org"])
53
53
  when scope==3
@@ -8,9 +8,13 @@ require 'version'
8
8
  class Sys
9
9
  attr_accessor :client
10
10
 
11
- def load_config(configure_path)
11
+ def load_config(configure_path,argv_token)
12
12
  if File.exist?(configure_path)
13
- token=File.read("#{configure_path}/ghedsh-token")
13
+ if argv_token==nil
14
+ token=File.read("#{configure_path}/ghedsh-token")
15
+ else
16
+ token=argv_token
17
+ end
14
18
  json = File.read("#{configure_path}/ghedsh-cache.json")
15
19
  config=JSON.parse(json)
16
20
 
@@ -23,7 +27,7 @@ class Sys
23
27
  end
24
28
  else
25
29
  self.create_config(configure_path)
26
- load_config(configure_path)
30
+ load_config(configure_path,argv_token)
27
31
  end
28
32
  end
29
33
 
data/lib/interface.rb CHANGED
@@ -21,22 +21,24 @@ class Interface
21
21
  LIST = ['repos', 'exit', 'orgs','help', 'members','teams', 'cd ', 'commits','forks', 'add_team_member ','create_team ','delete_team ','create_repository ','clone_repo '].sort
22
22
 
23
23
  def initialize
24
- self.run
25
24
  @sysbh=Sys.new()
26
- end
27
-
28
- #loading from config file
29
25
 
30
- # './lib/configure/configure.json')
31
- def load_config(config_path)
32
- @config=Sys.new.load_config(config_path)
33
- if @config["User"] == nil
34
- return false
26
+ if ARGV.empty?
27
+ self.run('./.ghedsh',nil)
35
28
  else
36
- @deep=1
37
- return true
29
+ case
30
+ when ARGV[0]=="--configpath"
31
+ if File.exist?(ARGV[1])
32
+ self.run(ARGV[1],nil)
33
+ else
34
+ puts "the path doesn't exists"
35
+ end
36
+ when ARGV[0]=="--help"
37
+ HelpM.new.bin()
38
+ when ARGV[0]=="--token"
39
+ self.run('./.ghedsh',ARGV[1])
40
+ end
38
41
  end
39
-
40
42
  end
41
43
 
42
44
  def add_history(value)
@@ -85,17 +87,18 @@ class Interface
85
87
  end
86
88
 
87
89
  def help()
90
+ h=HelpM.new()
88
91
  case
89
92
  when @deep == 1
90
- HelpM.new.user()
93
+ h.user()
91
94
  when @deep == 2
92
- HelpM.new.org()
95
+ h.org()
93
96
  when @deep == 3
94
- HelpM.new.org_repo()
97
+ h.org_repo()
95
98
  when @deep == 10
96
- HelpM.new.user_repo()
99
+ h.user_repo()
97
100
  when @deep == 4
98
- HelpM.new.orgs_teams()
101
+ h.orgs_teams()
99
102
  end
100
103
  end
101
104
 
@@ -190,7 +193,6 @@ class Interface
190
193
  list=Array.new
191
194
  for i in 0..data.size-1
192
195
  list.push(@teamlist[data[i]])
193
- #puts @teamlist[data[i]]
194
196
  end
195
197
  return list
196
198
  end
@@ -220,7 +222,7 @@ class Interface
220
222
  end
221
223
  end
222
224
 
223
- def run
225
+ def run(config_path, argv_token)
224
226
  ex=1
225
227
  @memory=[]
226
228
  history=LIST+memory
@@ -233,14 +235,11 @@ class Interface
233
235
  r=Repositories.new
234
236
  s=Sys.new
235
237
  # orden de búsqueda: ~/.ghedsh.json ./ghedsh.json ENV["ghedsh"] --configpath path/to/file.json
236
- #config_path = './lib/configure/configure.json'
237
- config_path = './.ghedsh'
238
- # if self.load_config(config_path) == true
239
- #self.load_config(config_path)
240
- @config=s.load_config(config_path)
238
+
239
+
240
+ @config=s.load_config(config_path,argv_token)
241
241
  @client=s.client
242
242
  @deep=1
243
- #@client=Sys.new.login(@config["Token"])
244
243
  self.add_history_str(2,Organizations.new.read_orgs(@client))
245
244
 
246
245
  while ex != 0
@@ -256,7 +255,7 @@ class Interface
256
255
  when op == "members" then self.members()
257
256
  when op == "teams" #then self.teams()
258
257
  if @deep==2
259
- Teams.new.show_teams_bs(@client,@config)
258
+ t.show_teams_bs(@client,@config)
260
259
  end
261
260
  when op == "commits" then self.commits()
262
261
  when op == "col" then self.collaborators()
@@ -320,11 +319,7 @@ class Interface
320
319
  #r.clone_repo(@client,@config,opcd[1])
321
320
  end
322
321
  end
323
- # else
324
- # Sys.new.set_loguin_data_sh()
325
- # end
326
322
 
327
- #Sys.new.save_config(@config)
328
323
  s.save_cache(config_path,@config)
329
324
  end
330
325
 
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ghedsh
2
- VERSION='1.1.3'
2
+ VERSION='1.1.4'
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.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Clemente