ghedsh 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +33 -0
- data/Gemfile +3 -0
- data/README.md +9 -0
- data/Rakefile +18 -0
- data/ghedsh.gemspec +18 -0
- data/lib/actions/help.rb +51 -0
- data/lib/actions/orgs.rb +47 -0
- data/lib/actions/repo.rb +80 -0
- data/lib/actions/system.rb +62 -0
- data/lib/actions/teams.rb +74 -0
- data/lib/actions/user.rb +13 -0
- data/lib/configure/configure_template.json +1 -0
- data/lib/db/assignments.json +2 -0
- data/lib/interface.rb +285 -0
- data/spec/spec.rb +1 -0
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8f19cc8d047de65df95ed9563bb2352842fee0f
|
4
|
+
data.tar.gz: 81094f97f646294b773fa76bc414977f6156645d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c185d500961d44830416c760d55611f2c0c9f1d3eac6fec9b3d618bbc2041fdcb93f75570ad8fb04f07d4abd7789d7a47f8dd72ccd8b00c6304dad7f429ddf0d
|
7
|
+
data.tar.gz: 194e4e98c1ae01dca95478e1f02a0723c12f6cef66197f76e7bbaa54359db3354cf852405dcb74523a802e51b89d3bfaa4e55e8c303eb5c4bfd17964c2b23391
|
data/.gitignore
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# project specific
|
2
|
+
/lib/configure/configure.json
|
3
|
+
/lib/configure/configure2.json
|
4
|
+
|
5
|
+
*.gem
|
6
|
+
*.rbc
|
7
|
+
.bundle
|
8
|
+
.config
|
9
|
+
coverage
|
10
|
+
Gemfile.lock
|
11
|
+
InstalledFiles
|
12
|
+
lib/bundler/man
|
13
|
+
pkg
|
14
|
+
rdoc
|
15
|
+
spec/reports
|
16
|
+
test/tmp
|
17
|
+
test/version_tmp
|
18
|
+
tmp
|
19
|
+
|
20
|
+
# YARD artifacts
|
21
|
+
.yardoc
|
22
|
+
_yardoc
|
23
|
+
doc/
|
24
|
+
|
25
|
+
# OS generated files #
|
26
|
+
######################
|
27
|
+
.DS_Store
|
28
|
+
.DS_Store?
|
29
|
+
._*
|
30
|
+
.Spotlight-V100
|
31
|
+
.Trashes
|
32
|
+
ehthumbs.db
|
33
|
+
Thumbs.db
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
#GITHUB EDUCATION SHELL
|
2
|
+
|
3
|
+
A command line program following the philosophy of GitHub Education.
|
4
|
+
|
5
|
+
Ir order to run this program, you need to make an Oauth Access token from Github with create and edit scope.
|
6
|
+
|
7
|
+
Rename the file configure_template.json to configure.json in ./lib/configure/. Fill the token field.
|
8
|
+
|
9
|
+
To start using the program, put "rake bash" or "rake" in your command line in the main folder of this program.
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
#require 'rspec/core/rake_task'
|
3
|
+
|
4
|
+
#RSpec::Core::RakeTask.new(:spec)
|
5
|
+
|
6
|
+
task default: :bash
|
7
|
+
|
8
|
+
desc "Run simple interace"
|
9
|
+
task :bash do
|
10
|
+
sh "ruby -Ilib lib/ghedsh.rb"
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
task :publish do
|
15
|
+
sh "rm ghedsh-*.gem"
|
16
|
+
sh "gem build ghedsh.gemspec"
|
17
|
+
sh "gem push ghedsh-*.gem"
|
18
|
+
end
|
data/ghedsh.gemspec
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'ghedsh'
|
3
|
+
s.version = '1.0.6'
|
4
|
+
s.description = "A command line program following the philosophy of GitHub Education."
|
5
|
+
s.summary =""
|
6
|
+
s.authors = ["Javier Clemente", "Casiano Rodriguez-Leon"]
|
7
|
+
s.email = 'nookstyle@gmail.com'
|
8
|
+
s.files = `git ls-files`.split($/)
|
9
|
+
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
10
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
11
|
+
s.homepage = ''
|
12
|
+
s.require_paths = ['lib']
|
13
|
+
s.required_ruby_version = '>= 1.9.3'
|
14
|
+
s.add_dependency 'octokit', '~> 3.3'
|
15
|
+
s.add_dependency 'require_all', '~> 1.3.2'
|
16
|
+
s.add_development_dependency 'rake'
|
17
|
+
s.add_development_dependency 'bundler', '~> 1.5'
|
18
|
+
end
|
data/lib/actions/help.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
|
2
|
+
class HelpM
|
3
|
+
|
4
|
+
def user()
|
5
|
+
self.common_opt
|
6
|
+
print "orgs => show your organizations\n"
|
7
|
+
print "repos => list your repositories\n\n"
|
8
|
+
print "set => move you to a specific repository\n"
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
def org()
|
13
|
+
self.common_opt
|
14
|
+
print "repos => list the repositories of your organization\n"
|
15
|
+
print "set => move you to a specific repository\n"
|
16
|
+
print "members => members of a organization\n"
|
17
|
+
print "teams => teams of a organization\n"
|
18
|
+
print "delete_team => delete a team in you organization. Expected the name of the team\n"
|
19
|
+
print "create_team => create a team in the organization. Expected the name of the team, and/or members given one by one\n\n"
|
20
|
+
end
|
21
|
+
|
22
|
+
def org_repo()
|
23
|
+
self.common_opt
|
24
|
+
print "commits => show the list of commits from the repository\n"
|
25
|
+
print "col => show the list of collaborators from the repository\n\n"
|
26
|
+
end
|
27
|
+
|
28
|
+
def orgs_teams()
|
29
|
+
self.common_opt
|
30
|
+
print "members => members of the team\n"
|
31
|
+
print "add_to_team => add a member in the team\n\n"
|
32
|
+
end
|
33
|
+
|
34
|
+
def user_repo()
|
35
|
+
self.common_opt
|
36
|
+
print "commits => show the list of commits from the repository\n"
|
37
|
+
print "col => show the list of collaborators from the repository\n\n"
|
38
|
+
end
|
39
|
+
|
40
|
+
def common_opt()
|
41
|
+
puts "\nList of commands.\n"
|
42
|
+
print "exit => exit from this program\n"
|
43
|
+
print "help => list of commands available\n"
|
44
|
+
print "cd => go to the path\n"
|
45
|
+
end
|
46
|
+
|
47
|
+
def welcome
|
48
|
+
puts "\nGitHub Education Shell!"
|
49
|
+
puts "_______________________\n\n"
|
50
|
+
end
|
51
|
+
end
|
data/lib/actions/orgs.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'readline'
|
2
|
+
require 'octokit'
|
3
|
+
require 'json'
|
4
|
+
require 'require_all'
|
5
|
+
require_rel '.'
|
6
|
+
|
7
|
+
class Organizations
|
8
|
+
|
9
|
+
attr_accessor :orgslist
|
10
|
+
|
11
|
+
#all asignements stuff
|
12
|
+
def show_organization_members_bs(client,config)
|
13
|
+
orgslist=[]
|
14
|
+
print "\n"
|
15
|
+
mem=client.organization_members(config["Org"])
|
16
|
+
mem.each do |i|
|
17
|
+
m=eval(i.inspect)
|
18
|
+
orgslist.push(m[:login])
|
19
|
+
puts m[:login]
|
20
|
+
end
|
21
|
+
return orgslist
|
22
|
+
end
|
23
|
+
|
24
|
+
def show_orgs(client,config)
|
25
|
+
orgslist=[]
|
26
|
+
print "\n"
|
27
|
+
org=client.organizations
|
28
|
+
org.each do |i|
|
29
|
+
o=eval(i.inspect)
|
30
|
+
puts o[:login]
|
31
|
+
orgslist.push(o[:login])
|
32
|
+
end
|
33
|
+
print "\n"
|
34
|
+
return orgslist
|
35
|
+
end
|
36
|
+
|
37
|
+
def read_orgs(client)
|
38
|
+
orgslist=[]
|
39
|
+
org=client.organizations
|
40
|
+
org.each do |i|
|
41
|
+
o=eval(i.inspect)
|
42
|
+
orgslist.push(o[:login])
|
43
|
+
end
|
44
|
+
return orgslist
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
data/lib/actions/repo.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'readline'
|
2
|
+
require 'octokit'
|
3
|
+
require 'json'
|
4
|
+
require 'require_all'
|
5
|
+
require_rel '.'
|
6
|
+
|
7
|
+
class Repositories
|
8
|
+
|
9
|
+
#scope = 1 -> organization repos
|
10
|
+
#scope = 2 -> user repos
|
11
|
+
#scope = 3 -> team repos
|
12
|
+
|
13
|
+
def show_commits(client,config,scope)
|
14
|
+
print "\n"
|
15
|
+
case
|
16
|
+
when scope==1
|
17
|
+
mem=client.commits(config["Org"]+"/"+config["Repo"],"master")
|
18
|
+
when scope==2
|
19
|
+
mem=client.commits(config["User"]+"/"+config["Repo"],"master")
|
20
|
+
end
|
21
|
+
mem.each do |i|
|
22
|
+
print i[:sha],"\n",i[:commit][:author][:name],"\n",i[:commit][:author][:date],"\n",i[:commit][:message],"\n\n"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def show_repos(client,config,scope)
|
27
|
+
print "\n"
|
28
|
+
reposlist=[]
|
29
|
+
case
|
30
|
+
when scope==1
|
31
|
+
repo=client.repositories
|
32
|
+
when scope==2
|
33
|
+
repo=client.organization_repositories(config["Org"])
|
34
|
+
when scope==3
|
35
|
+
repo=client.team_repositories(config["TeamID"])
|
36
|
+
end
|
37
|
+
repo.each do |i|
|
38
|
+
puts i.name
|
39
|
+
reposlist.push(i.name)
|
40
|
+
end
|
41
|
+
print "\n"
|
42
|
+
return reposlist
|
43
|
+
end
|
44
|
+
|
45
|
+
def show_forks(client,config,scope)
|
46
|
+
print "\n"
|
47
|
+
forklist=[]
|
48
|
+
case
|
49
|
+
when scope==1
|
50
|
+
mem=client.forks(config["Org"]+"/"+config["Repo"])
|
51
|
+
end
|
52
|
+
mem.each do |i|
|
53
|
+
puts i[:owner][:login]
|
54
|
+
forklist.push(i[:owner][:login])
|
55
|
+
end
|
56
|
+
print "\n"
|
57
|
+
return forklist
|
58
|
+
end
|
59
|
+
|
60
|
+
def show_collaborators(client,config,scope)
|
61
|
+
print "\n"
|
62
|
+
collalist=[]
|
63
|
+
case
|
64
|
+
when scope==1
|
65
|
+
mem=client.collaborators(config["Org"]+"/"+config["Repo"])
|
66
|
+
end
|
67
|
+
mem.each do |i|
|
68
|
+
puts i[:author][:login]
|
69
|
+
collalist.push(i[:author][:login])
|
70
|
+
end
|
71
|
+
print "\n"
|
72
|
+
return collalist
|
73
|
+
end
|
74
|
+
|
75
|
+
def fork(client,config,repo)
|
76
|
+
mem=client.fork(repo)
|
77
|
+
return mem
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'readline'
|
2
|
+
require 'octokit'
|
3
|
+
require 'json'
|
4
|
+
require 'require_all'
|
5
|
+
require_rel '.'
|
6
|
+
|
7
|
+
class Sys
|
8
|
+
|
9
|
+
def load_config
|
10
|
+
json = File.read('./lib/configure/configure.json')
|
11
|
+
config=JSON.parse(json)
|
12
|
+
|
13
|
+
if config["User"] == nil
|
14
|
+
return self.set_loguin_data_sh(config)
|
15
|
+
else
|
16
|
+
return config
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def load_assig_db
|
21
|
+
json = File.read('./lib/db/assignments.json')
|
22
|
+
config=JSON.parse(json)
|
23
|
+
if config["Orgs"] == nil
|
24
|
+
return false
|
25
|
+
else
|
26
|
+
return config
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def save_config(data)
|
31
|
+
File.write('./lib/configure/configure.json', data.to_json)
|
32
|
+
end
|
33
|
+
|
34
|
+
def save_db(data)
|
35
|
+
File.write('./lib/db/assignments.json', data.to_json)
|
36
|
+
end
|
37
|
+
|
38
|
+
def get_config
|
39
|
+
end
|
40
|
+
|
41
|
+
def login(token)
|
42
|
+
user=Octokit::Client.new(:access_token =>token)
|
43
|
+
if user==false
|
44
|
+
puts "Oauth error"
|
45
|
+
else
|
46
|
+
return user
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def set_loguin_data_sh(config)
|
51
|
+
puts "Insert you Access Token: "
|
52
|
+
token = gets.chomp
|
53
|
+
us=self.login(token)
|
54
|
+
if us!=nil
|
55
|
+
puts "Login succesful ",us.login
|
56
|
+
config["User"]=us.login
|
57
|
+
config["Token"]=token
|
58
|
+
return config
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'readline'
|
2
|
+
require 'octokit'
|
3
|
+
require 'json'
|
4
|
+
require 'require_all'
|
5
|
+
require_rel '.'
|
6
|
+
|
7
|
+
class Teams
|
8
|
+
attr_accessor :teamlist
|
9
|
+
|
10
|
+
def list_team_repos(repos)
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_to_team(client,config,path)
|
15
|
+
client.add_team_member(config["TeamID"],path)
|
16
|
+
end
|
17
|
+
|
18
|
+
def read_teamlist(client,config)
|
19
|
+
@teamlist=Hash.new
|
20
|
+
mem=client.organization_teams(config["Org"])
|
21
|
+
mem.each do |i|
|
22
|
+
@teamlist[i.name]=i[:id]
|
23
|
+
end
|
24
|
+
return @teamlist
|
25
|
+
end
|
26
|
+
|
27
|
+
def get_teamlist()
|
28
|
+
return @teamlist
|
29
|
+
end
|
30
|
+
|
31
|
+
def create_team(client,config,name)
|
32
|
+
client.create_team(config["Org"],{:name=>name,:permission=>'push'})
|
33
|
+
end
|
34
|
+
|
35
|
+
def create_team_with_members(client,config,name,members)
|
36
|
+
t=self.create_team(client,config,name)
|
37
|
+
config["TeamID"]=t[:id]
|
38
|
+
|
39
|
+
for i in 0..members.size
|
40
|
+
self.add_to_team(client,config,members[i])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def add_to_team(client,config,path)
|
45
|
+
client.add_team_member(config["TeamID"],path)
|
46
|
+
end
|
47
|
+
|
48
|
+
def delete_team(client,name)
|
49
|
+
client.delete_team(name)
|
50
|
+
end
|
51
|
+
|
52
|
+
def show_teams_bs(client,config)
|
53
|
+
print "\n"
|
54
|
+
mem=client.organization_teams(config["Org"])
|
55
|
+
mem.each do |i|
|
56
|
+
puts i.name
|
57
|
+
end
|
58
|
+
print "\n"
|
59
|
+
end
|
60
|
+
|
61
|
+
def show_team_members_bs(client,config)
|
62
|
+
print "\n"
|
63
|
+
memberlist=[]
|
64
|
+
mem=client.team_members(config["TeamID"])
|
65
|
+
mem.each do |i|
|
66
|
+
m=eval(i.inspect)
|
67
|
+
puts m[:login]
|
68
|
+
memberlist.push(m[:login])
|
69
|
+
end
|
70
|
+
print "\n"
|
71
|
+
return memberlist
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
data/lib/actions/user.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"User":null,"Token":null,"Org":null,"Repo":null,"Team":null,"TeamID":null}
|
data/lib/interface.rb
ADDED
@@ -0,0 +1,285 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'require_all'
|
3
|
+
require 'json'
|
4
|
+
require 'readline'
|
5
|
+
require 'octokit'
|
6
|
+
|
7
|
+
require 'actions/help'
|
8
|
+
require 'actions/orgs'
|
9
|
+
require 'actions/repo'
|
10
|
+
require 'actions/system'
|
11
|
+
require 'actions/teams'
|
12
|
+
require 'actions/user'
|
13
|
+
|
14
|
+
class Interface
|
15
|
+
attr_reader :option
|
16
|
+
attr_accessor :config
|
17
|
+
attr_accessor :client
|
18
|
+
attr_accessor :deep
|
19
|
+
attr_accessor :memory
|
20
|
+
attr_accessor :teamlist
|
21
|
+
LIST = ['repos', 'exit', 'orgs','help', 'members','teams', 'cd ', 'commits','forks', 'add_team_member ','create_team ','delete_team '].sort
|
22
|
+
|
23
|
+
def initialize
|
24
|
+
self.run
|
25
|
+
@sysbh=Sys.new()
|
26
|
+
end
|
27
|
+
|
28
|
+
#loading from config file
|
29
|
+
|
30
|
+
def load_config
|
31
|
+
@config=Sys.new.load_config()
|
32
|
+
if @config["User"] == nil
|
33
|
+
return false
|
34
|
+
else
|
35
|
+
@deep=1
|
36
|
+
return true
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
def add_history(value)
|
42
|
+
@memory.push(value)
|
43
|
+
self.write_memory
|
44
|
+
end
|
45
|
+
|
46
|
+
def quit_history(value)
|
47
|
+
@memory.pop(value)
|
48
|
+
self.write_memory
|
49
|
+
end
|
50
|
+
|
51
|
+
def add_history_str(mode,value)
|
52
|
+
if mode==1
|
53
|
+
value.each do |i|
|
54
|
+
@memory.push(i[0])
|
55
|
+
self.write_memory
|
56
|
+
end
|
57
|
+
end
|
58
|
+
if mode==2
|
59
|
+
value.each do |i|
|
60
|
+
@memory.push(i)
|
61
|
+
self.write_memory
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
def write_memory
|
68
|
+
history=(LIST+@memory).sort
|
69
|
+
comp = proc { |s| history.grep( /^#{Regexp.escape(s)}/ ) }
|
70
|
+
Readline.completion_append_character = ""
|
71
|
+
Readline.completion_proc = comp
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
def prompt()
|
76
|
+
case
|
77
|
+
when @deep == 1 then return @config["User"]+"> "
|
78
|
+
when @deep == 10 then return @config["User"]+">"+@config["Repo"]+"> "
|
79
|
+
when @deep == 2 then return @config["User"]+">"+@config["Org"]+"> "
|
80
|
+
when @deep == 4 then return @config["User"]+">"+@config["Org"]+">"+@config["Team"]+"> "
|
81
|
+
when @deep == 5 then return @config["User"]+">"+@config["Org"]+">"+@config["Team"]+">"+@config["Repo"]+"> "
|
82
|
+
when @deep == 3 then return @config["User"]+">"+@config["Org"]+">"+@config["Repo"]+"> "
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def help()
|
87
|
+
case
|
88
|
+
when @deep == 1
|
89
|
+
HelpM.new.user()
|
90
|
+
when @deep == 2
|
91
|
+
HelpM.new.org()
|
92
|
+
when @deep == 3
|
93
|
+
HelpM.new.org_repo()
|
94
|
+
when @deep == 10
|
95
|
+
HelpM.new.user_repo()
|
96
|
+
when @deep == 4
|
97
|
+
HelpM.new.orgs_teams()
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
|
102
|
+
def get_data
|
103
|
+
puts @config
|
104
|
+
end
|
105
|
+
|
106
|
+
def cdback()
|
107
|
+
case
|
108
|
+
#when @deep == 1 then @config["User"]=nil
|
109
|
+
when @deep == 2
|
110
|
+
@config["Org"]=nil
|
111
|
+
@deep=1
|
112
|
+
when @deep == 3
|
113
|
+
@config["Repo"]=nil
|
114
|
+
@deep=2
|
115
|
+
when @deep == 10
|
116
|
+
@config["Repo"]=nil
|
117
|
+
@deep=1
|
118
|
+
when @deep == 4
|
119
|
+
@config["Team"]=nil
|
120
|
+
@config["TeamID"]=nil
|
121
|
+
@deep=2
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def cd(path)
|
126
|
+
case
|
127
|
+
when @deep==1
|
128
|
+
@config["Org"]=path
|
129
|
+
|
130
|
+
@temlist=Hash.new
|
131
|
+
@teamlist=Teams.new.read_teamlist(@client,@config)
|
132
|
+
self.add_history_str(1,@teamlist)
|
133
|
+
@deep=2
|
134
|
+
when @deep == 2
|
135
|
+
@config["Team"]=path
|
136
|
+
@config["TeamID"]=@teamlist[path]
|
137
|
+
@deep=4
|
138
|
+
#self.get_data
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
#set the repo
|
143
|
+
def set(path)
|
144
|
+
case
|
145
|
+
when @deep==1
|
146
|
+
@config["Repo"]=path
|
147
|
+
@deep=10
|
148
|
+
when @deep==2
|
149
|
+
@config["Repo"]=path
|
150
|
+
@deep=3
|
151
|
+
when @deep==4
|
152
|
+
@config["Repo"]=path
|
153
|
+
@deep=5
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
def orgs()
|
158
|
+
case
|
159
|
+
when @deep==1
|
160
|
+
self.add_history_str(2,Organizations.new.show_orgs(@client,@config))
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
def members()
|
165
|
+
case
|
166
|
+
when @deep==2
|
167
|
+
self.add_history_str(2,Organizations.new.show_organization_members_bs(@client,@config))
|
168
|
+
when @deep==4
|
169
|
+
self.add_history_str(2,Teams.new.show_team_members_bs(@client,@config))
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
def repos()
|
174
|
+
repo=Repositories.new()
|
175
|
+
case
|
176
|
+
when @deep == 1
|
177
|
+
list=repo.show_repos(@client,@config,1)
|
178
|
+
self.add_history_str(2,list)
|
179
|
+
when @deep ==2
|
180
|
+
list=repo.show_repos(@client,@config,2)
|
181
|
+
self.add_history_str(2,list)
|
182
|
+
when @deep==4
|
183
|
+
list=repo.show_repos(@client,@config,3)
|
184
|
+
self.add_history_str(2,list)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
def commits()
|
189
|
+
c=Repositories.new
|
190
|
+
case
|
191
|
+
when @deep==3
|
192
|
+
c.show_commits(@client,@config,1)
|
193
|
+
when @deep==10
|
194
|
+
c.show_commits(@client,@config,2)
|
195
|
+
end
|
196
|
+
print "\n"
|
197
|
+
end
|
198
|
+
|
199
|
+
def show_forks()
|
200
|
+
case
|
201
|
+
when @deep==3
|
202
|
+
Repositories.new.show_forks(@client,@config,1)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
def collaborators()
|
207
|
+
case
|
208
|
+
when @deep==3
|
209
|
+
Repositories.show_collaborators(@client,@config,1)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
def run
|
214
|
+
ex=1
|
215
|
+
@memory=[]
|
216
|
+
history=LIST+memory
|
217
|
+
comp = proc { |s| LIST.grep( /^#{Regexp.escape(s)}/ ) }
|
218
|
+
|
219
|
+
Readline.completion_append_character = ""
|
220
|
+
Readline.completion_proc = comp
|
221
|
+
HelpM.new.welcome()
|
222
|
+
t=Teams.new
|
223
|
+
|
224
|
+
if self.load_config == true
|
225
|
+
self.load_config
|
226
|
+
@client=Sys.new.login(@config["Token"])
|
227
|
+
self.add_history_str(2,Organizations.new.read_orgs(@client))
|
228
|
+
|
229
|
+
while ex != 0
|
230
|
+
op=Readline.readline(self.prompt,true)
|
231
|
+
opcd=op.split
|
232
|
+
case
|
233
|
+
when op == "exit" then ex=0
|
234
|
+
when op == "help" then self.help()
|
235
|
+
when op == "repos" then self.repos()
|
236
|
+
#when op == "ls -l" then self.lsl()
|
237
|
+
when op == "orgs" then self.orgs()
|
238
|
+
when op == "cd .." then self.cdback()
|
239
|
+
when op == "members" then self.members()
|
240
|
+
when op == "teams" #then self.teams()
|
241
|
+
if @deep==2
|
242
|
+
Teams.new.show_teams_bs(@client,@config)
|
243
|
+
end
|
244
|
+
when op == "commits" then self.commits()
|
245
|
+
when op == "col" then self.collaborators()
|
246
|
+
when op == "forks" then self.show_forks()
|
247
|
+
end
|
248
|
+
if opcd[0]=="cd" and opcd[1]!=".."
|
249
|
+
self.cd(opcd[1])
|
250
|
+
#else
|
251
|
+
# self.cdback()
|
252
|
+
end
|
253
|
+
if opcd[0]=="set"
|
254
|
+
self.set(opcd[1])
|
255
|
+
end
|
256
|
+
if opcd[0]=="add_team_member"
|
257
|
+
t.add_to_team(@client,@config,opcd[1])
|
258
|
+
end
|
259
|
+
if opcd[0]=="create_team" and opcd.size==2
|
260
|
+
t.create_team(@client,@config,opcd[1])
|
261
|
+
@teamlist=t.read_teamlist(@client,@config)
|
262
|
+
self.add_history_str(1,@teamlist)
|
263
|
+
|
264
|
+
end
|
265
|
+
if opcd[0]=="delete_team"
|
266
|
+
t.delete_team(@client,@teamlist[opcd[1]])
|
267
|
+
self.quit_history(@teamlist[opcd[1]])
|
268
|
+
@teamlist=t.read_teamlist(@client,@config)
|
269
|
+
self.add_history_str(1,@teamlist)
|
270
|
+
end
|
271
|
+
if opcd[0]=="create_team" and opcd.size>2
|
272
|
+
t.create_team_with_members(@client,@config,opcd[1],opcd[2..opcd.size])
|
273
|
+
@teamlist=t.read_teamlist(@client,@config)
|
274
|
+
self.add_history_str(1,@teamlist)
|
275
|
+
end
|
276
|
+
|
277
|
+
end
|
278
|
+
else
|
279
|
+
Sys.new.set_loguin_data_sh()
|
280
|
+
end
|
281
|
+
|
282
|
+
Sys.new.save_config(@config)
|
283
|
+
end
|
284
|
+
|
285
|
+
end
|
data/spec/spec.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
#todo
|
metadata
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ghedsh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javier Clemente
|
8
|
+
- Casiano Rodriguez-Leon
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
@@ -73,7 +74,22 @@ executables:
|
|
73
74
|
extensions: []
|
74
75
|
extra_rdoc_files: []
|
75
76
|
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- Gemfile
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
76
81
|
- bin/ghedsh
|
82
|
+
- ghedsh.gemspec
|
83
|
+
- lib/actions/help.rb
|
84
|
+
- lib/actions/orgs.rb
|
85
|
+
- lib/actions/repo.rb
|
86
|
+
- lib/actions/system.rb
|
87
|
+
- lib/actions/teams.rb
|
88
|
+
- lib/actions/user.rb
|
89
|
+
- lib/configure/configure_template.json
|
90
|
+
- lib/db/assignments.json
|
91
|
+
- lib/interface.rb
|
92
|
+
- spec/spec.rb
|
77
93
|
homepage: ''
|
78
94
|
licenses: []
|
79
95
|
metadata: {}
|
@@ -97,4 +113,5 @@ rubygems_version: 2.2.2
|
|
97
113
|
signing_key:
|
98
114
|
specification_version: 4
|
99
115
|
summary: ''
|
100
|
-
test_files:
|
116
|
+
test_files:
|
117
|
+
- spec/spec.rb
|