ghedsh 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/actions/help.rb +13 -0
- data/lib/actions/repo.rb +1 -1
- data/lib/actions/system.rb +7 -3
- data/lib/interface.rb +25 -30
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0aaa03a8f282329e069f71fbdec259e9aa385957
|
4
|
+
data.tar.gz: c4514a161b8901749c0265399b05d47916abf97a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
data/lib/actions/system.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
31
|
-
|
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
|
-
|
37
|
-
|
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
|
-
|
93
|
+
h.user()
|
91
94
|
when @deep == 2
|
92
|
-
|
95
|
+
h.org()
|
93
96
|
when @deep == 3
|
94
|
-
|
97
|
+
h.org_repo()
|
95
98
|
when @deep == 10
|
96
|
-
|
99
|
+
h.user_repo()
|
97
100
|
when @deep == 4
|
98
|
-
|
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
|
-
|
237
|
-
|
238
|
-
|
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
|
-
|
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