ghedsh 1.1.21 → 1.1.22

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: 91993b0a9f8bd97edbb09612f1c1ce4924436b22
4
- data.tar.gz: 3f8ae8fadc7bc61d17fc0c2f454272620c05e297
3
+ metadata.gz: 3e6a1aa39eb28e77a453ffd27bd0a5eb3ba41003
4
+ data.tar.gz: 0b4b7a21e90573c14f588c4ca82849ed3b0b3d78
5
5
  SHA512:
6
- metadata.gz: 7694cc5fe678e4c7ea228b6adcfcad7f10d62437f6d4de9711e8fdd3d2b7bbcaebf149bf64cb4cebfe30e8c422eda0d119f1774b2baf527bdae315f9fac98904
7
- data.tar.gz: 4401a6bcb3041ef9c4454cd4e85bb6bbe965b4c378ab8c266e26a0e29726889241bf86100ead09fc28719aa2d99f1527e577f792a2f7b0ff6efc7bf51f59947c
6
+ metadata.gz: 573c4ae20362c0ca25a5a7a5b55823e85a63e0c2ec5b8a226deca62da789a5c0378dadb47bd99dd39415223462d3fb8cdce5d8f3e3ed3c1d812871eb53dea84a
7
+ data.tar.gz: 7f4e4b70fc9afcdeba7efbaf7091bb59eaa93931c9f2a8659d4d1f5c177f04182c28d8ec38a581cf09e3b554fefebd6ef00084d9b6dcba7c030161485fcfc159
data/lib/actions/orgs.rb CHANGED
@@ -28,11 +28,10 @@ class Organizations
28
28
  assig["assigs"].each do |i|
29
29
  puts "\n"
30
30
  puts i["name_assig"]
31
- puts "Repository: #{i["repo"]}"
32
- print "Groups: "
31
+ puts "\tRepository: #{i["repo"]}"
32
+ puts "\tGroups: "
33
33
  i["groups"].each do |y|
34
- print y
35
- print " "
34
+ puts "\t\t#{y}"
36
35
  end
37
36
  print "\n"
38
37
  end
@@ -82,7 +81,7 @@ class Organizations
82
81
  end
83
82
  if reponame!=""
84
83
  if client.repository?("#{reponame}")==false
85
- puts "The repository #{reponame} doesn't exist\n"
84
+ puts "\e[31m The repository #{reponame} doesn't exist\n \e[0m"
86
85
  puts "\nName of the repository (To skip and add the repository later, only press enter): "
87
86
  if reponame==""
88
87
  ex2=true
@@ -96,13 +95,13 @@ class Organizations
96
95
  if op=="2"
97
96
  ex2=false
98
97
  until ex2==true
99
- ex2=Repositories.new().create_repository(client,config,reponame,false,ORGS)
100
- if ex2==false
101
- puts "Name of the repository (To skip and add the repository later, press enter): "
102
- reponame=gets.chomp
103
- if reponame==""
104
- ex2=true
105
- end
98
+ puts "Name of the repository (To skip and add the repository later, press enter): "
99
+ reponame=gets.chomp
100
+ if reponame==""
101
+ ex2=true
102
+ else
103
+ ex2=Repositories.new().create_repository(client,config,reponame,false,ORGS)
104
+ reponame="#{config["Org"]}/#{reponame}"
106
105
  end
107
106
  end
108
107
  end
@@ -119,7 +118,10 @@ class Organizations
119
118
 
120
119
  puts "\n"
121
120
  puts "Groups currently available:\n\n"
122
- puts groupslist
121
+ groupslist.each do |aux|
122
+ puts "\t#{aux}"
123
+ end
124
+ #puts groupslist
123
125
  puts "\nAdd groups to your assignment (Press enter to skip): "
124
126
  op=gets.chomp
125
127
  if op==""
@@ -134,11 +136,11 @@ class Organizations
134
136
  name="Group-#{time.ctime}"
135
137
  name=name.split(" ").join("-")
136
138
  end
137
- puts "Teams currently available:\n\n"
139
+ puts "\nTeams currently available:\n\n"
138
140
  teamlist.each do |aux|
139
- print "#{aux[0]} "
141
+ puts "\t#{aux[0]}"
140
142
  end
141
- puts "\n\nPut a list of Teams: "
143
+ puts "\nPut a list of Teams: "
142
144
 
143
145
  list=gets.chomp
144
146
  list=list.split(" ")
@@ -185,7 +187,7 @@ class Organizations
185
187
  assig=list["orgs"].detect{|aux| aux["name"]==config["Org"]}
186
188
  if assig!=nil
187
189
  if assig["assigs"].empty?
188
- puts "No assignments are available yet"
190
+ puts "\e[31m No assignments are available yet\e[0m"
189
191
  else
190
192
  assig["assigs"].each do |i|
191
193
  assiglist.push(i["name_assig"])
@@ -207,15 +209,19 @@ class Organizations
207
209
 
208
210
  def show_assig_info(config,assig)
209
211
  assig=self.get_single_assig(config,assig)
212
+ team=Teams.new()
210
213
  puts "\n"
211
214
  puts assig["name_assig"]
212
- puts "Repository: #{assig["repo"]}"
213
- print "Groups: "
215
+ puts "\tRepository: #{assig["repo"]}"
216
+ puts "\tGroups: "
214
217
  assig["groups"].each do |y|
215
- print y
216
- print " "
218
+ puts "\t\t#{y}"
219
+ t=team.get_single_group(config,y)
220
+ t.each do |z|
221
+ puts "\t\t\t#{z}"
222
+ end
217
223
  end
218
- puts "\n\n"
224
+ puts "\n"
219
225
  end
220
226
 
221
227
  def make_assig(client,config,assig)
@@ -223,13 +229,15 @@ class Organizations
223
229
  web2="git@github.com:"
224
230
  repo=Repositories.new()
225
231
  team=Teams.new()
232
+ sys=Sys.new()
226
233
  teamlist=team.read_teamlist(client,config)
227
234
  assig=self.get_single_assig(config,assig)
228
235
 
229
236
  if assig["repo"]!=""
237
+ sys.create_temp("#{ENV['HOME']}/.ghedsh/temp")
230
238
 
231
239
  #system("git clone #{web2}#{config["Org"]}/#{assig["repo"]}.git #{ENV['HOME']}/.ghedsh/#{assig["repo"]}")
232
- system("git clone #{web2}#{assig["repo"]}.git #{ENV['HOME']}/.ghedsh/#{assig["repo"]}")
240
+ system("git clone #{web2}#{assig["repo"]}.git #{ENV['HOME']}/.ghedsh/temp/#{assig["repo"]}")
233
241
 
234
242
  assig["groups"].each do |i|
235
243
  teamsforgroup=team.get_single_group(config,i)
@@ -237,15 +245,15 @@ class Organizations
237
245
  config["TeamID"]=teamlist["#{y}"]
238
246
  config["Team"]=y
239
247
  repo.create_repository(client,config,"#{y}-#{assig["name_assig"]}",true,TEAM)
240
- system("git -C #{ENV['HOME']}/.ghedsh/#{assig["repo"]} remote rm origin")
241
- system("git -C #{ENV['HOME']}/.ghedsh/#{assig["repo"]} remote add origin #{web2}#{config["Org"]}/#{y}-#{assig["name_assig"]}.git")
248
+ system("git -C #{ENV['HOME']}/.ghedsh/temp/#{assig["repo"]} remote rm origin")
249
+ system("git -C #{ENV['HOME']}/.ghedsh/temp/#{assig["repo"]} remote add origin #{web2}#{config["Org"]}/#{y}-#{assig["name_assig"]}.git")
242
250
 
243
- system("git -C #{ENV['HOME']}/.ghedsh/#{assig["repo"]} push origin --all")
251
+ system("git -C #{ENV['HOME']}/.ghedsh/temp/#{assig["repo"]} push origin --all")
244
252
  end
245
253
  end
246
- system("rm -rf #{ENV['HOME']}/.ghedsh/#{assig["repo"]}")
254
+ #system("rm -rf #{ENV['HOME']}/.ghedsh/temp/#{assig["repo"]}")
247
255
  else
248
- puts "No repository is given for this assignment"
256
+ puts "\e[31m No repository is given for this assignment\e[0m"
249
257
  end
250
258
 
251
259
 
@@ -253,8 +261,6 @@ class Organizations
253
261
 
254
262
  def add_team_to_assig(client,config,assig,data)
255
263
  assig=self.get_single_assig(config,assig)
256
-
257
-
258
264
  end
259
265
 
260
266
  def add_group_to_assig(client,config,assig)
data/lib/actions/repo.rb CHANGED
@@ -184,7 +184,7 @@ class Repositories
184
184
  end
185
185
 
186
186
  if rlist.empty?
187
- puts "No repository matches with that expression"
187
+ puts "\e[31m No repository matches with that expression\e[0m"
188
188
  else
189
189
  print "\n"
190
190
  puts "Repositories found: #{rlist.size}"
@@ -243,7 +243,7 @@ class Repositories
243
243
 
244
244
  if scope==ORGS
245
245
  if client.repository?("#{config["Org"]}/#{repo}")==false
246
- puts "It doesn't exist a repository with that name in #{config["Org"]}"
246
+ puts "\e[31m It doesn't exist a repository with that name in #{config["Org"]}\e[0m"
247
247
  else
248
248
  ex=false
249
249
  until ex==true
@@ -259,7 +259,7 @@ class Repositories
259
259
  end
260
260
  if scope==USER || scope==TEAM
261
261
  if client.repository?("#{config["User"]}/#{repo}")==false
262
- puts "It doesn't exist a repository with that name in #{config["User"]}"
262
+ puts "\e[31m It doesn't exist a repository with that name in #{config["User"]}\e[0m"
263
263
  else
264
264
  ex=false
265
265
  until ex==true
@@ -291,7 +291,7 @@ class Repositories
291
291
  puts "created repository in #{config["Org"]}"
292
292
  return true
293
293
  else
294
- puts "Already exists a repository with that name in #{config["Org"]}"
294
+ puts "\e[31m Already exists a repository with that name in #{config["Org"]}\e[0m"
295
295
  return false
296
296
  end
297
297
  when scope==USER
@@ -300,7 +300,7 @@ class Repositories
300
300
  puts "created repository #{config["User"]}"
301
301
  return true
302
302
  else
303
- puts "Already exists a repository with that name in #{config["User"]}"
303
+ puts "\e[31m Already exists a repository with that name in #{config["User"]}\e[0m"
304
304
  return false
305
305
  end
306
306
  when scope==TEAM
@@ -313,7 +313,7 @@ class Repositories
313
313
  puts "created repository in #{config["Org"]} for team #{config["Team"]}"
314
314
  return true
315
315
  else
316
- puts "Already exists a repository with that name in #{config["Org"]}"
316
+ puts "\e[31m Already exists a repository with that name in #{config["Org"]}\e[0m"
317
317
  return false
318
318
  end
319
319
  end
@@ -207,6 +207,18 @@ class Sys
207
207
  return config
208
208
  end
209
209
 
210
+ def create_temp(path)
211
+ if (File.exist?(path))==false
212
+ FileUtils.mkdir_p(path)
213
+ end
214
+ end
215
+
216
+ def remove_temp(path)
217
+ if (File.exist?(path))==true
218
+ system("rm -rf #{path}")
219
+ end
220
+ end
221
+
210
222
  def save_groups(path,data)
211
223
  File.write("#{path}/groups.json",data.to_json)
212
224
  end
data/lib/interface.rb CHANGED
@@ -364,9 +364,10 @@ class Interface
364
364
  @sysbh.add_history_str(2,list)
365
365
  @orgs_repos=list
366
366
  else
367
- list=repo.show_repos(@client,@config,ORGS)
367
+ #list=repo.show_repos(@client,@config,ORGS)
368
+ list=repo.get_repos(@client,@config,ORGS)
368
369
  @sysbh.add_history_str(2,list)
369
- @repos_list=list
370
+ @orgs_repos=list
370
371
  puts list
371
372
  end
372
373
  else
@@ -464,6 +465,7 @@ class Interface
464
465
  case
465
466
  when op == "exit" then ex=0
466
467
  s.save_cache(config_path,@config)
468
+ s.remove_temp("#{ENV['HOME']}/.ghedsh/temp")
467
469
  when op == "help" then self.help()
468
470
  when op == "orgs" then self.orgs()
469
471
  when op == "cd .." then self.cdback(false)
@@ -605,6 +607,9 @@ class Interface
605
607
  if opcd[0]=="rm_repository" and opcd.size==2
606
608
  if @deep==ORGS || @deep==USER || @deep==TEAM
607
609
  r.delete_repository(@client,@config,opcd[1],@deep)
610
+ if @deep==ORGS
611
+ @orgs_repos.delete(opcd[1])
612
+ end
608
613
  end
609
614
  end
610
615
  if opcd[0]=="new_team" and opcd.size>2
@@ -620,6 +625,7 @@ class Interface
620
625
  when @deep==ORGS
621
626
  #r.create_repository_by_teamlist(@client,@config,opcd[1],opcd[2,opcd.size],self.get_teamlist(opcd[2,opcd.size]))
622
627
  o.create_assig(@client,@config,opcd[1])
628
+ @sysbh.add_history(opcd[1])
623
629
  end
624
630
  end
625
631
  if opcd[0]=="new_group" and opcd.size>2
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ghedsh
2
- VERSION='1.1.21'
2
+ VERSION='1.1.22'
3
3
  end
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.21
4
+ version: 1.1.22
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-06-22 00:00:00.000000000 Z
12
+ date: 2016-07-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: octokit