ghedsh 1.0.9 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/ghedsh.gemspec +4 -2
- data/lib/actions/repo.rb +38 -0
- data/lib/actions/system.rb +32 -9
- data/lib/interface.rb +21 -1
- data/lib/version.rb +3 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab0a6161c9c84b5a36a2f56e6fce1aa2c242d2f9
|
4
|
+
data.tar.gz: def800f3eb68ceb0319a21ec688a4dc144a2d575
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 294b7a5de1cd94fdf38696b75c6e9e6b8751add689da677b0ada55e6cc8d9df4fc52b5026f516448a6d59215dce50d9f98f41e929155a0515492c933bf965db7
|
7
|
+
data.tar.gz: 49d714cdf531fb7179b9ad04a4399ccbdf81f81f792b59e8aaf5a62a13c1e32fde83fa09db4e9add73336846f80b9af10e942473b4fc3980a200d4fdc3964e2d
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
A command line program following the philosophy of GitHub Education.
|
4
4
|
|
5
|
-
##How does it
|
5
|
+
##How does it work?
|
6
6
|
|
7
7
|
This program give you an interaction with Github like you was using your command line simulating a tree structure. Each level on the tree gives you several options of managing your Github account or your Organization.
|
8
8
|
|
data/ghedsh.gemspec
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
require './lib/version'
|
2
|
+
|
1
3
|
Gem::Specification.new do |s|
|
2
4
|
s.name = 'ghedsh'
|
3
|
-
s.version =
|
5
|
+
s.version = Ghedsh::VERSION
|
4
6
|
s.summary ="A command line program following the philosophy of GitHub Education."
|
5
|
-
s.description = "
|
7
|
+
s.description = "Visit https://github.com/ULL-ESIT-GRADOII-TFG/ghedsh"
|
6
8
|
s.authors = ["Javier Clemente", "Casiano Rodriguez-Leon"]
|
7
9
|
s.email = 'nookstyle@gmail.com'
|
8
10
|
s.licenses = ['MIT']
|
data/lib/actions/repo.rb
CHANGED
@@ -42,6 +42,25 @@ class Repositories
|
|
42
42
|
return reposlist
|
43
43
|
end
|
44
44
|
|
45
|
+
def show_repos_smart(client,config,exp,scope)
|
46
|
+
reposlist=[]
|
47
|
+
case
|
48
|
+
when scope==1
|
49
|
+
repo=client.repositories
|
50
|
+
when scope==2
|
51
|
+
repo=client.organization_repositories(config["Org"])
|
52
|
+
when scope==3
|
53
|
+
repo=client.team_repositories(config["TeamID"])
|
54
|
+
end
|
55
|
+
repo.each do |i|
|
56
|
+
reposlist.push(i.name)
|
57
|
+
end
|
58
|
+
|
59
|
+
reposlist=Sys.new.search_rexp(reposlist,exp)
|
60
|
+
puts reposlist
|
61
|
+
return reposlist
|
62
|
+
end
|
63
|
+
|
45
64
|
def show_forks(client,config,scope)
|
46
65
|
print "\n"
|
47
66
|
forklist=[]
|
@@ -110,4 +129,23 @@ class Repositories
|
|
110
129
|
y=y+1
|
111
130
|
end
|
112
131
|
end
|
132
|
+
|
133
|
+
def clone_repo(client,config,list,exp,scope)
|
134
|
+
web="https://github.com/"
|
135
|
+
web2="git@github.com:"
|
136
|
+
|
137
|
+
list=Sys.new.search_rexp(list,exp)
|
138
|
+
if (list.empty?) == false
|
139
|
+
case
|
140
|
+
when scope==1
|
141
|
+
command = "git clone #{web}#{@config["User"]}/#{list[i]}.git"
|
142
|
+
system(command)
|
143
|
+
when scope==2
|
144
|
+
command = "git clone #{web}#{@config["Org"]}/#{list[i]}.git"
|
145
|
+
system(command)
|
146
|
+
end
|
147
|
+
else
|
148
|
+
puts "No repositories found it with the parameters given"
|
149
|
+
end
|
150
|
+
end
|
113
151
|
end
|
data/lib/actions/system.rb
CHANGED
@@ -1,19 +1,27 @@
|
|
1
1
|
require 'readline'
|
2
2
|
require 'octokit'
|
3
3
|
require 'json'
|
4
|
-
require '
|
5
|
-
|
4
|
+
require 'actions/system'
|
5
|
+
require 'version'
|
6
6
|
|
7
7
|
class Sys
|
8
8
|
|
9
9
|
def load_config(configure_path)
|
10
|
-
|
11
|
-
|
10
|
+
if (File.exist?(configure_path))==true
|
11
|
+
json = File.read(configure_path)
|
12
|
+
config=JSON.parse(json)
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
if config["User"] == nil
|
15
|
+
return self.set_loguin_data_sh(config)
|
16
|
+
else
|
17
|
+
return config
|
18
|
+
end
|
15
19
|
else
|
16
|
-
|
20
|
+
configure_path="#{ENV['GEM_HOME']}/gems/ghedsh-#{Ghedsh::VERSION}/lib/configure/configure.json"
|
21
|
+
if (File.exist?(configure_path))==false
|
22
|
+
self.create_config(configure_path)
|
23
|
+
end
|
24
|
+
load_config(configure_path)
|
17
25
|
end
|
18
26
|
end
|
19
27
|
|
@@ -27,8 +35,17 @@ class Sys
|
|
27
35
|
#end
|
28
36
|
end
|
29
37
|
|
38
|
+
def create_config(path)
|
39
|
+
con={:User=>nil,:Token=>nil,:Org=>nil,:Repo=>nil,:Team=>nil,:TeamID=>nil}
|
40
|
+
File.write(path,con.to_json)
|
41
|
+
end
|
42
|
+
|
30
43
|
def save_config(data)
|
31
|
-
File.
|
44
|
+
if (File.exist?('./lib/configure/configure.json'))==true
|
45
|
+
File.write('./lib/configure/configure.json', data.to_json)
|
46
|
+
else
|
47
|
+
File.write("#{ENV['GEM_HOME']}/gems/ghedsh-#{Ghedsh::VERSION}/lib/configure/configure.json", data.to_json)
|
48
|
+
end
|
32
49
|
end
|
33
50
|
|
34
51
|
def save_db(data)
|
@@ -52,11 +69,17 @@ class Sys
|
|
52
69
|
token = gets.chomp
|
53
70
|
us=self.login(token)
|
54
71
|
if us!=nil
|
55
|
-
puts "Login succesful
|
72
|
+
puts "Login succesful as #{us.login}"
|
56
73
|
config["User"]=us.login
|
57
74
|
config["Token"]=token
|
58
75
|
return config
|
59
76
|
end
|
60
77
|
end
|
61
78
|
|
79
|
+
def search_rexp(list,exp)
|
80
|
+
list= list.select{|o| o.match(/#{exp}/)}
|
81
|
+
#puts list
|
82
|
+
return list
|
83
|
+
end
|
84
|
+
|
62
85
|
end
|
data/lib/interface.rb
CHANGED
@@ -245,7 +245,7 @@ class Interface
|
|
245
245
|
case
|
246
246
|
when op == "exit" then ex=0
|
247
247
|
when op == "help" then self.help()
|
248
|
-
when op == "repos" then self.repos()
|
248
|
+
#when op == "repos" then self.repos()
|
249
249
|
#when op == "ls -l" then self.lsl()
|
250
250
|
when op == "orgs" then self.orgs()
|
251
251
|
when op == "cd .." then self.cdback()
|
@@ -266,6 +266,19 @@ class Interface
|
|
266
266
|
if opcd[0]=="set"
|
267
267
|
self.set(opcd[1])
|
268
268
|
end
|
269
|
+
if opcd[0]=="repos" and opcd.size==1
|
270
|
+
self.repos()
|
271
|
+
end
|
272
|
+
if opcd[0]=="repos" and opcd.size>1
|
273
|
+
case
|
274
|
+
when @deep==1
|
275
|
+
r.show_repos_smart(@client,@config,opcd[1],1)
|
276
|
+
when @deep==2
|
277
|
+
r.show_repos_smart(@client,@config,opcd[1],2)
|
278
|
+
when @deep==3
|
279
|
+
r.show_repos_smart(@client,@config,opcd[1],3)
|
280
|
+
end
|
281
|
+
end
|
269
282
|
if opcd[0]=="add_team_member"
|
270
283
|
t.add_to_team(@client,@config,opcd[1])
|
271
284
|
end
|
@@ -301,6 +314,13 @@ class Interface
|
|
301
314
|
r.create_repository_by_teamlist(@client,@config,opcd[1],opcd[2,opcd.size],self.get_teamlist(opcd[2,opcd.size]))
|
302
315
|
end
|
303
316
|
end
|
317
|
+
|
318
|
+
if opcd[0]=="clone_repo" and opcd.size==2
|
319
|
+
end
|
320
|
+
|
321
|
+
if opcd[0]=="clone_repo" and opcd.size>2
|
322
|
+
#r.clone_repo(@client,@confing,opcd[1])
|
323
|
+
end
|
304
324
|
end
|
305
325
|
else
|
306
326
|
Sys.new.set_loguin_data_sh()
|
data/lib/version.rb
ADDED
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.0
|
4
|
+
version: 1.1.0
|
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-04-
|
12
|
+
date: 2016-04-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: octokit
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '1.5'
|
70
|
-
description:
|
70
|
+
description: Visit https://github.com/ULL-ESIT-GRADOII-TFG/ghedsh
|
71
71
|
email: nookstyle@gmail.com
|
72
72
|
executables:
|
73
73
|
- ghedsh
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- lib/configure/configure_template.json
|
90
90
|
- lib/db/assignments.json
|
91
91
|
- lib/interface.rb
|
92
|
+
- lib/version.rb
|
92
93
|
- spec/spec.rb
|
93
94
|
homepage: https://github.com/ULL-ESIT-GRADOII-TFG/ghedsh
|
94
95
|
licenses:
|