ghedsh 1.1.7 → 1.1.8
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 +4 -4
- data/lib/actions/repo.rb +23 -2
- data/lib/actions/system.rb +35 -1
- data/lib/interface.rb +6 -20
- data/lib/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 795e50156da5bbd4b65d02b78b68e562b917aaed
|
4
|
+
data.tar.gz: 72c10d473d46533a7a03c2813abc6d45401f07cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 570b29365da102cb9219ec346c8fd8bf1dbe1cf7edc07e4b2804fa865ddb2f18022645f8178e7c808cc86659d8b77ac018c826346033b202cefd48dcd30074cc
|
7
|
+
data.tar.gz: 5dc6213d74416b216a552b0198c6e7d3a30cd0da8cd2c075091fb2bcb2b78578b17b335d6f141b41b66526eafe64d30045cf0349638606b5d27ab03a53034c79
|
data/lib/actions/repo.rb
CHANGED
@@ -4,6 +4,7 @@ require 'json'
|
|
4
4
|
require 'require_all'
|
5
5
|
require_rel '.'
|
6
6
|
|
7
|
+
|
7
8
|
class Repositories
|
8
9
|
|
9
10
|
#scope = 1 -> organization repos
|
@@ -26,9 +27,16 @@ class Repositories
|
|
26
27
|
def show_repos(client,config,scope)
|
27
28
|
print "\n"
|
28
29
|
reposlist=[]
|
30
|
+
options=Hash.new
|
31
|
+
o=Organizations.new
|
32
|
+
|
29
33
|
case
|
30
34
|
when scope==1
|
31
|
-
|
35
|
+
#options[:affiliation]="organization_member"
|
36
|
+
repo=client.repositories(config["User"],options)
|
37
|
+
listorgs=o.read_orgs(client)
|
38
|
+
#self.show_user_orgs_repos(client,config,listorgs)
|
39
|
+
|
32
40
|
when scope==2
|
33
41
|
repo=client.organization_repositories(config["Org"])
|
34
42
|
when scope==3
|
@@ -39,15 +47,28 @@ class Repositories
|
|
39
47
|
reposlist.push(i.name)
|
40
48
|
end
|
41
49
|
print "\n"
|
50
|
+
puts "Repositories found: #{reposlist.size}"
|
42
51
|
return reposlist
|
43
52
|
end
|
44
53
|
|
54
|
+
def show_user_orgs_repos(client,config,listorgs)
|
55
|
+
options=Hash.new
|
56
|
+
options[:member]=config["User"]
|
57
|
+
listorgs.each do |i|
|
58
|
+
repo=client.organization_repositories(i,options)
|
59
|
+
repo.each do |y|
|
60
|
+
puts y.name
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
45
65
|
|
46
66
|
def show_repos_smart(client,config,exp,scope)
|
47
67
|
reposlist=[]
|
48
68
|
case
|
49
69
|
when scope==1
|
50
|
-
repo=client.
|
70
|
+
repo=client.repositories(config["User"])
|
71
|
+
#repo=client.all_repositories()
|
51
72
|
when scope==2
|
52
73
|
repo=client.organization_repositories(config["Org"])
|
53
74
|
when scope==3
|
data/lib/actions/system.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'readline'
|
2
2
|
require 'fileutils'
|
3
3
|
require 'octokit'
|
4
|
+
require 'optparse'
|
4
5
|
require 'json'
|
5
6
|
require 'actions/system'
|
6
7
|
require 'version'
|
@@ -71,7 +72,7 @@ class Sys
|
|
71
72
|
end
|
72
73
|
|
73
74
|
def login(token)
|
74
|
-
user=Octokit::Client.new(:access_token =>token)
|
75
|
+
user=Octokit::Client.new(:access_token =>token, per_page:100)
|
75
76
|
if user==false
|
76
77
|
puts "Oauth error"
|
77
78
|
else
|
@@ -140,4 +141,37 @@ class Sys
|
|
140
141
|
return list
|
141
142
|
end
|
142
143
|
|
144
|
+
def parse()
|
145
|
+
options = {:user => nil, :token => nil, :path => nil}
|
146
|
+
|
147
|
+
parser = OptionParser.new do|opts|
|
148
|
+
opts.banner = "Usage: ghedsh [options]\nWith no options it runs with default configuration. Configuration files are being set in #{ENV['HOME']}/.ghedsh\n"
|
149
|
+
opts.on('-t', '--token token', 'Provides a github access token by argument.') do |token|
|
150
|
+
options[:token] = token;
|
151
|
+
end
|
152
|
+
opts.on('-c', '--configpath path', 'Give your own path for GHEDSH configuration files') do |path|
|
153
|
+
options[:configpath] = path;
|
154
|
+
end
|
155
|
+
opts.on('-u', '--user user', 'Change your user from your users list') do |user|
|
156
|
+
options[:user] = user;
|
157
|
+
end
|
158
|
+
opts.on('-v', '--version', 'Show the current version of GHEDSH') do
|
159
|
+
puts "GitHub Education Shell v#{Ghedsh::VERSION}"
|
160
|
+
exit
|
161
|
+
end
|
162
|
+
opts.on('-h', '--help', 'Displays Help') do
|
163
|
+
puts opts
|
164
|
+
exit
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
begin
|
169
|
+
parser.parse!
|
170
|
+
rescue
|
171
|
+
puts "Argument error. Use ghedsh -v or ghedsh --help for more information about the usage of this program"
|
172
|
+
exit
|
173
|
+
end
|
174
|
+
return options
|
175
|
+
end
|
176
|
+
|
143
177
|
end
|
data/lib/interface.rb
CHANGED
@@ -3,6 +3,7 @@ require 'require_all'
|
|
3
3
|
require 'json'
|
4
4
|
require 'readline'
|
5
5
|
require 'octokit'
|
6
|
+
require 'optparse'
|
6
7
|
|
7
8
|
require 'actions/help'
|
8
9
|
require 'actions/orgs'
|
@@ -22,28 +23,13 @@ class Interface
|
|
22
23
|
LIST = ['repos', 'exit', 'orgs','help', 'members','teams', 'cd ', 'commits','forks', 'add_team_member ','create_team ','delete_team ','create_repository ','clone_repo '].sort
|
23
24
|
|
24
25
|
def initialize
|
25
|
-
|
26
|
+
sysbh=Sys.new()
|
27
|
+
options=sysbh.parse
|
26
28
|
|
27
|
-
if
|
28
|
-
|
29
|
-
self.run("#{ENV['HOME']}/.ghedsh",nil,nil)
|
29
|
+
if options[:user]==nil && options[:token]==nil && options[:path]!=nil
|
30
|
+
self.run(options[:path],options[:token],options[:user])
|
30
31
|
else
|
31
|
-
|
32
|
-
when ARGV[0]=="--configpath" || ARGV[0]=="-c"
|
33
|
-
if File.exist?(ARGV[1])
|
34
|
-
self.run(ARGV[1],nil,nil)
|
35
|
-
else
|
36
|
-
puts "the path doesn't exists"
|
37
|
-
end
|
38
|
-
when ARGV[0]=="--help" || ARGV[0]=="-h"
|
39
|
-
HelpM.new.bin()
|
40
|
-
when ARGV[0]=="--token" || ARGV[0]=="-t"
|
41
|
-
self.run("#{ENV['HOME']}/.ghedsh",ARGV[1],nil)
|
42
|
-
when ARGV[0]=="--user" || ARGV[0]=="-u"
|
43
|
-
self.run("#{ENV['HOME']}/.ghedsh",nil,ARGV[1])
|
44
|
-
when ARGV[0]=="--version" || ARGV[0]=="-v"
|
45
|
-
puts "GitHub Education Shell v#{Ghedsh::VERSION}"
|
46
|
-
end
|
32
|
+
self.run("#{ENV['HOME']}/.ghedsh",options[:token],options[:user])
|
47
33
|
end
|
48
34
|
end
|
49
35
|
|
data/lib/version.rb
CHANGED
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.
|
4
|
+
version: 1.1.8
|
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-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: octokit
|
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
version: '0'
|
112
112
|
requirements: []
|
113
113
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
114
|
+
rubygems_version: 2.5.1
|
115
115
|
signing_key:
|
116
116
|
specification_version: 4
|
117
117
|
summary: A command line program following the philosophy of GitHub Education.
|