ghedsh 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8cafa31023034edca7c245e01c4d9ad36dcf5791
4
- data.tar.gz: 1cc53a75262240334c5aeef94505c535f9e45c1f
3
+ metadata.gz: be6e68f989bd1d023f7e401fc56b1adce41da600
4
+ data.tar.gz: 014b2b4b915dbb77ba60b5180ceb78c9252aa2b0
5
5
  SHA512:
6
- metadata.gz: 5e5aa39a9d02e6c27e7c1da5b11a8092132f00e620cde69958d91e04837db54fd75d7d046fd84ad4b8699dc6462b3d5e706ada160fa9232f03e853c6700f651d
7
- data.tar.gz: b1b7439783c2f2bd8d45c3f53fb4a687477ad9914e915b7e0414ba2e308979756d4b4f2701b2d36404e38c712bb61ad3a6316d68ab6cfad6a7925a04e35a2737
6
+ metadata.gz: dd3b1a82a5c3d3fb634efe00114ccf7567a1e7479d8de37c93a3fa50d1b91cc243e2a04cd64f824e4c097a0d3c44a220640a68bc99d3c1fe2930a627fa7172dd
7
+ data.tar.gz: 3fbcf04d03b0629205f75eab50862e3923db66711e4bee17453bb19518d17ac836bb70749407804f8f624e9f804094c4bedc193abf274122d31504838f62c65f
data/.gitignore CHANGED
@@ -1,6 +1,8 @@
1
1
  # project specific
2
2
  /lib/configure/configure.json
3
3
  /lib/configure/configure2.json
4
+ /lib/pruebas.rb
5
+ /lib/db/assignments2.json
4
6
 
5
7
  *.gem
6
8
  *.rbc
data/README.md CHANGED
@@ -2,8 +2,42 @@
2
2
 
3
3
  A command line program following the philosophy of GitHub Education.
4
4
 
5
- Ir order to run this program, you need to make an Oauth Access token from Github with create and edit scope.
5
+ ##How does it works?
6
6
 
7
- Rename the file configure_template.json to configure.json in ./lib/configure/. Fill the token field.
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
 
9
- To start using the program, put "rake bash" or "rake" in your command line in the main folder of this program.
9
+ Following the philosophy of Github Education, you can use this application to managing your own organization as a classroom where you can make assignments to your students using repository strategies.
10
+
11
+ ##First step: Oauth requirements.
12
+
13
+ Ir order to run this program, you need to make an **Access token** from Github with create and edit scope. When you run the program, it asks you the access token to identify yourself with no need to use your user and password.
14
+
15
+ ##Running the program in your computer
16
+
17
+ You can run this program downloading this repository directly, but you need to setting the configure file. Rename the file *configure_template.json* to *configure.json* in **./lib/configure/.**
18
+
19
+ To start using the program, put "rake bash" or "rake" in your command line in the main folder of this program. You can invoke the binary file using the command *ghedsh*.
20
+
21
+ ##Using the gem
22
+ Instead of download the program from the repository, you can download the gem **ghdesh** from rubygem.
23
+
24
+ ``gem install ghdesh``
25
+
26
+ To run the app you need to call the binary file "ghesh" in your command line after install it.
27
+
28
+ ##Basic usage
29
+ Logged in our app you start set in your personal profile. There you can list your repositories, create repositories, see your organizations and other options that you can see using the command *help* in your command line. You can go inside of a specific organization with the command *cd* and start to managing itself. Its possible to create task for the members your organization, create teamworks and many options that you can see again with *help*. You can move and go back in the tree directory as it is possible in the github structure.
30
+
31
+ ```
32
+ Levels
33
+ └── User
34
+    ├── Organizations
35
+    │   ├── Teams
36
+ │  │  └── Team Repositories
37
+    │   ├── Assignments
38
+    │   └── Organization Repositories
39
+    └── User Repositories
40
+ ```
41
+
42
+ ##Aditional information
43
+ [Github Education](https://education.github.com/)
data/Rakefile CHANGED
@@ -11,6 +11,7 @@ task :bash do
11
11
  end
12
12
 
13
13
 
14
+ desc "publish gem"
14
15
  task :publish do
15
16
  sh "rm ghedsh-*.gem"
16
17
  sh "gem build ghedsh.gemspec"
data/ghedsh.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ghedsh'
3
- s.version = '1.0.7'
3
+ s.version = '1.0.8'
4
4
  s.summary ="A command line program following the philosophy of GitHub Education."
5
5
  s.description = s.summary
6
6
  s.authors = ["Javier Clemente", "Casiano Rodriguez-Leon"]
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 "create_repository => create a repository in your personal account\n"
8
9
  print "set => move you to a specific repository\n"
9
10
 
10
11
  end
@@ -15,6 +16,7 @@ class HelpM
15
16
  print "set => move you to a specific repository\n"
16
17
  print "members => members of a organization\n"
17
18
  print "teams => teams of a organization\n"
19
+ print "create_repository => create a repository in your organization\n"
18
20
  print "delete_team => delete a team in you organization. Expected the name of the team\n"
19
21
  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
22
  end
@@ -28,6 +30,7 @@ class HelpM
28
30
  def orgs_teams()
29
31
  self.common_opt
30
32
  print "members => members of the team\n"
33
+ print "create_repository => create a repository to this team\n"
31
34
  print "add_to_team => add a member in the team\n\n"
32
35
  end
33
36
 
data/lib/actions/orgs.rb CHANGED
@@ -7,8 +7,36 @@ require_rel '.'
7
7
  class Organizations
8
8
 
9
9
  attr_accessor :orgslist
10
+ attr_accessor :assiglist
11
+
12
+
13
+ def load_assig()
14
+ @assiglist=Hash.new()
15
+ @assiglist=Sys.new.load_assig_db()
16
+ return @assiglist
17
+ end
18
+
19
+ def show_assignements() #client,orgs
20
+ @assiglist["Organization"].each do |org|
21
+ puts org["name"]
22
+
23
+ org["assignements"].each do |assig|
24
+ puts assig["name"]
25
+ end
26
+
27
+ end
28
+ end
29
+ def get_assig()
30
+ return @assiglist
31
+ end
32
+
33
+ def create_assig(client,config,data)
34
+ end
35
+
36
+ def add_team_to_assig(client,config,data)
37
+ end
38
+ #------------End assig. stuff------------
10
39
 
11
- #all asignements stuff
12
40
  def show_organization_members_bs(client,config)
13
41
  orgslist=[]
14
42
  print "\n"
data/lib/actions/repo.rb CHANGED
@@ -77,4 +77,37 @@ class Repositories
77
77
  return mem
78
78
  end
79
79
 
80
+ def create_repository(client,config,repo,scope)
81
+ options=Hash.new
82
+ case
83
+ when scope==2
84
+ puts "created repository in org"
85
+ options[:organization]=config["Org"]
86
+ client.create_repository(repo,options)
87
+ when scope==1
88
+ puts "created repository in user"
89
+ client.create_repository(repo)
90
+ when scope==4
91
+ puts "created repository in org team"
92
+ options[:team_id]=config["TeamID"]
93
+ options[:organization]=config["Org"]
94
+ client.create_repository(config["Team"]+"/"+repo,options)
95
+ end
96
+ end
97
+
98
+ def create_repository_by_teamlist(client,config,repo,list,list_id)
99
+ options=Hash.new
100
+ options[:organization]=config["Org"]
101
+ #puts list_id
102
+ y=0
103
+ list.each do |i|
104
+ options[:team_id]=list_id[y]
105
+ # puts i, list_id[y]
106
+ # puts repo
107
+ # puts options
108
+ # puts "\n"
109
+ client.create_repository(i+"/"+repo,options)
110
+ y=y+1
111
+ end
112
+ end
80
113
  end
@@ -6,8 +6,8 @@ require_rel '.'
6
6
 
7
7
  class Sys
8
8
 
9
- def load_config
10
- json = File.read('./lib/configure/configure.json')
9
+ def load_config(configure_path)
10
+ json = File.read(configure_path)
11
11
  config=JSON.parse(json)
12
12
 
13
13
  if config["User"] == nil
@@ -20,11 +20,11 @@ class Sys
20
20
  def load_assig_db
21
21
  json = File.read('./lib/db/assignments.json')
22
22
  config=JSON.parse(json)
23
- if config["Orgs"] == nil
24
- return false
25
- else
23
+ #if config["Orgs"] == nil
24
+ #return false
25
+ #else
26
26
  return config
27
- end
27
+ #end
28
28
  end
29
29
 
30
30
  def save_config(data)
@@ -1,2 +1 @@
1
- {
2
- }
1
+ {"Organization":[{"name":null,"assignements":[{"name":null,"teams":{"teamid":null}}]}]}
data/lib/interface.rb CHANGED
@@ -18,7 +18,7 @@ class Interface
18
18
  attr_accessor :deep
19
19
  attr_accessor :memory
20
20
  attr_accessor :teamlist
21
- LIST = ['repos', 'exit', 'orgs','help', 'members','teams', 'cd ', 'commits','forks', 'add_team_member ','create_team ','delete_team '].sort
21
+ LIST = ['repos', 'exit', 'orgs','help', 'members','teams', 'cd ', 'commits','forks', 'add_team_member ','create_team ','delete_team ','create_repository '].sort
22
22
 
23
23
  def initialize
24
24
  self.run
@@ -27,8 +27,9 @@ class Interface
27
27
 
28
28
  #loading from config file
29
29
 
30
- def load_config
31
- @config=Sys.new.load_config()
30
+ # './lib/configure/configure.json')
31
+ def load_config(config_path)
32
+ @config=Sys.new.load_config(config_path)
32
33
  if @config["User"] == nil
33
34
  return false
34
35
  else
@@ -185,6 +186,15 @@ class Interface
185
186
  end
186
187
  end
187
188
 
189
+ def get_teamlist(data)
190
+ list=Array.new
191
+ for i in 0..data.size-1
192
+ list.push(@teamlist[data[i]])
193
+ #puts @teamlist[data[i]]
194
+ end
195
+ return list
196
+ end
197
+
188
198
  def commits()
189
199
  c=Repositories.new
190
200
  case
@@ -220,9 +230,12 @@ class Interface
220
230
  Readline.completion_proc = comp
221
231
  HelpM.new.welcome()
222
232
  t=Teams.new
233
+ r=Repositories.new
223
234
 
224
- if self.load_config == true
225
- self.load_config
235
+ # orden de búsqueda: ~/.ghedsh.json ./ghedsh.json ENV["ghedsh"] --configpath path/to/file.json
236
+ config_path = './lib/configure/configure.json'
237
+ if self.load_config(config_path) == true
238
+ self.load_config(config_path)
226
239
  @client=Sys.new.login(@config["Token"])
227
240
  self.add_history_str(2,Organizations.new.read_orgs(@client))
228
241
 
@@ -238,9 +251,9 @@ class Interface
238
251
  when op == "cd .." then self.cdback()
239
252
  when op == "members" then self.members()
240
253
  when op == "teams" #then self.teams()
241
- if @deep==2
242
- Teams.new.show_teams_bs(@client,@config)
243
- end
254
+ if @deep==2
255
+ Teams.new.show_teams_bs(@client,@config)
256
+ end
244
257
  when op == "commits" then self.commits()
245
258
  when op == "col" then self.collaborators()
246
259
  when op == "forks" then self.show_forks()
@@ -260,7 +273,6 @@ class Interface
260
273
  t.create_team(@client,@config,opcd[1])
261
274
  @teamlist=t.read_teamlist(@client,@config)
262
275
  self.add_history_str(1,@teamlist)
263
-
264
276
  end
265
277
  if opcd[0]=="delete_team"
266
278
  t.delete_team(@client,@teamlist[opcd[1]])
@@ -273,7 +285,22 @@ class Interface
273
285
  @teamlist=t.read_teamlist(@client,@config)
274
286
  self.add_history_str(1,@teamlist)
275
287
  end
276
-
288
+ if opcd[0]=="create_repository" and opcd.size==2
289
+ case
290
+ when @deep==1
291
+ r.create_repository(@client,@config,opcd[1],1)
292
+ when @deep==2
293
+ r.create_repository(@client,@config,opcd[1],2)
294
+ when @deep==4
295
+ r.create_repository(@client,@config,opcd[1],4)
296
+ end
297
+ end
298
+ if opcd[0]=="create_repository" and opcd.size>2
299
+ case
300
+ when @deep==2
301
+ r.create_repository_by_teamlist(@client,@config,opcd[1],opcd[2,opcd.size],self.get_teamlist(opcd[2,opcd.size]))
302
+ end
303
+ end
277
304
  end
278
305
  else
279
306
  Sys.new.set_loguin_data_sh()
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.7
4
+ version: 1.0.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-05 00:00:00.000000000 Z
12
+ date: 2016-04-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: octokit