ghedsh 1.1.36 → 1.1.37

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: 05400700524628b96f27e9cb871e74f39b4327a7
4
- data.tar.gz: 5fdb40a95ceccdad4b6760d953894c15d4d13472
3
+ metadata.gz: c8a23a5d1197103228e5bea247ad7fa410ce2b76
4
+ data.tar.gz: ad4d31c781bbf7019e64e0328e08fd827c8833c0
5
5
  SHA512:
6
- metadata.gz: d03347f2dc1c882cf5e9c7a5613c5bed5c8ee816f37d01ae372c581caaeb52f0e5e2419e913d53f226977d050c2ee3b83b2b63982e2db013df36f0c468607489
7
- data.tar.gz: 6b08af74955bfe2ea8567a1ef1f2ac052413c9ad3ca3394f28190340ccd48d9b7411174dfb8739cd576b0dfeac44556d3ebb74fe0ca71a9f8cfda4aa7a1c7b8f
6
+ metadata.gz: aa9066ed944f65d672e33c6a53363cf69bfa632c6c6ce3dc2762a83bdddd9ae657f77787650820372dd3dcdccd55ea542bd7cbdac8a37f491c90815b978ca824
7
+ data.tar.gz: e84a02d13736d6199a0d90c8db0956cedf1b311fa59f6cdad25878b12e17aa0ef90ad41fdc61876225ab52690411557084405ea8dc492b3bad7f8354400aa5a8
data/lib/actions/help.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'require_all'
2
+ require_rel '.'
1
3
 
2
4
  class HelpM
3
5
  attr_reader :user
@@ -6,86 +8,226 @@ class HelpM
6
8
  attr_reader :user_repo
7
9
  attr_reader :common_opt
8
10
 
11
+ def context(name,scope)
12
+ name=name.join("_")
13
+ begin
14
+ self.send(:"#{name}",scope)
15
+ rescue
16
+ puts "There is no command with that name"
17
+ end
18
+ end
19
+
20
+ def repos(scope)
21
+ case
22
+ when scope==USER
23
+ print "\trepos\t\t\tList your repositories\n"
24
+ when scope==ORGS
25
+ print "\trepos\t\t\tList the repositories of your organization\n"
26
+ when scope==TEAM
27
+ print "\trepos\t\t\tList the team's repositories\n"
28
+ end
29
+ print "\t\t\t\tYou can use a RegExp to improve the search using the \/ parameter \n"
30
+ print "\t\t\t\t->\trepos /[RegExp]/\n\n"
31
+ end
32
+
33
+ def new_repository(scope)
34
+ case
35
+ when scope==USER
36
+ print "\tnew repository\t\tCreate a repository in your personal account\n"
37
+ when scope==ORGS
38
+ print "\tnew repository\t\tCreate a repository in a organization\n"
39
+ when scope==TEAM
40
+ print "\tnew repository\t\tCreate a repository to this team\n"
41
+ end
42
+ print "\t\t\t\t->\tnew repository [name of the repository]\n\n"
43
+ end
44
+
45
+ def rm_repository(scope)
46
+ case
47
+ when scope==USER
48
+ print "\trm repository\t\tDelete a repository in your personal account\n"
49
+ when scope==ORGS
50
+ print "\trm repository\t\tDelete a repository in a organization\n"
51
+ when scope==TEAM
52
+ print "\trm repository\t\tDelete a repository of a team\n"
53
+ end
54
+ print "\t\t\t\t->\trm repository [name of the repository]\n\n"
55
+ end
56
+
57
+ def open(scope)
58
+ case
59
+ when scope==USER
60
+ print "\topen\t\t\tOpen the user's url of github in your web browser.\n"
61
+ when scope==ORGS
62
+ print "\topen\t\t\tOpen the organization's url of github in your web browser.\n"
63
+ print "\t\t\t\tIf you have added the aditional .csv information with, you can open an specific github profile.\n"
64
+ print "\t\t\t\t->\topen [user]\n\n"
65
+ print "\t\t\t\tYou can open an specific field if its contains an url.\n"
66
+ print "\t\t\t\t->\topen [user] [fieldname]\n\n"
67
+ print "\t\t\t\tIf you don't want to put the whole field, you can open the url contained with \"/\" parameter.\n"
68
+ print "\t\t\t\t->\topen [user] /[part of the url]/\n\n"
69
+ when scope==ORGS_REPO
70
+ print "\topen\t\t\tOpen the repository's url of github in your web browser.\n"
71
+ when scope==TEAM
72
+ print "\topen\t\t\tOpen the team's url of github in your web browser.\n"
73
+ when scope==TEAM_REPO
74
+ print "\topen\t\t\tOpen the repository's url of github in your web browser.\n"
75
+ when scope==ASSIG
76
+ print "\topen\t\t\topen the github assignment repositories disposition\n"
77
+ end
78
+ end
79
+
80
+ def people(scope)
81
+ case
82
+ when scope==ORGS
83
+ print "\tpeople\t\t\tMembers of the organization\n"
84
+ print "\t\t\t\t->\tpeople\n\n"
85
+ print "\t\t\t\tIf you add the parameter 'info', the extended information will be showed\n"
86
+ print "\t\t\t\t->\tpeople info\n\n"
87
+ print "\t\t\t\tTo find a specific member extended info, you can give the github id as parameter.\n"
88
+ print "\t\t\t\t->\tpeople info [github id]\n\n"
89
+ print "\t\t\t\tTo use a RegExp search in each field of the information, you can use the parameter /.\n"
90
+ print "\t\t\t\t->\tpeople info /[RegExp]/\n\n"
91
+ when scope==TEAM
92
+ print "\tpeople\t\t\tMembers of the team\n"
93
+ end
94
+ end
95
+ alias_method :people_info, :people
96
+
97
+ def cd(scope)
98
+ print "\tcd\t\t\tGo to the path. Could be an assignment, an organization, a team or a repository\n"
99
+ print "\t\t\t\t->\tcd [path]\n\n"
100
+ print "\t\t\t\tFor going to the user root path use cd without argument:\n"
101
+ print "\t\t\t\t->\tcd\n\n"
102
+ print "\t\t\t\tYou can go back to the previous level with the argument ".."\n"
103
+ print "\t\t\t\t->\tcd [..]\n\n"
104
+ print "\t\t\t\tDefault search look for repositories at the end of the queue.\n"
105
+ print "\t\t\t\tIf you want to look for an specific repository use: \n"
106
+ print "\t\t\t\t->\tcd repo [name] \n\n"
107
+ end
108
+
109
+ def groups(scope)
110
+ case
111
+ when scope==ORGS
112
+ print "\tgroups\t\t\tShow the list of groups with each team and user that it has\n"
113
+ print "\tgroup\t\t\tShow the information of an specific group\n"
114
+ print "\t\t\t\t->\tgroup [name of the group]\n\n"
115
+ print "\tnew group\t\tCreate a new group. Expected the name and teams given one by one\n"
116
+ print "\t\t\t\t->\tnew group [name of the group] [team1] [team2] [team3] ... \n\n"
117
+ print "\t\t\t\tIf you want to import the teams from a file, use the parameter -f\n"
118
+ print "\t\t\t\t->\tnew group -f [name of the group] [file]\n\n"
119
+ print "\trm group\t\tDelete a created group\n"
120
+ print "\t\t\t\t->\trm group [name of the group]\n\n"
121
+ end
122
+ end
123
+ alias_method :group,:groups
124
+ alias_method :new_group,:groups
125
+ alias_method :rm_group,:groups
126
+
127
+ def teams(scope)
128
+ case
129
+ when scope==ORGS
130
+ print "\tteams\t\t\tTeams of a organization\n"
131
+ print "\trm team\t\t\tDelete a team in you organization. Expected the name of the team\n"
132
+ print "\t\t\t\t->\trm team [name of the team]\n\n"
133
+ print "\tnew team\t\tCreate a team in the organization. Expected the name of the team, and/or members given one by one\n"
134
+ print "\t\t\t\t->\tnew team [name of the team] [member1] [member2] [member3] ... \n\n"
135
+ end
136
+ end
137
+ alias_method :rm_team, :teams
138
+ alias_method :new_team, :teams
139
+
140
+ def assignments(scope)
141
+ case
142
+ when scope==ORGS
143
+ print "\tassignments\t\tShow the list of assignments created\n"
144
+ print "\tnew assignment\t\tCreate an Assignment in your organization\n"
145
+ print "\t\t\t\t->\tnew assignment [name of the assignment]\n\n"
146
+ end
147
+ end
148
+ alias_method :new_assignment, :assignments
149
+
150
+ def issues(scope)
151
+ if scope==ORGS_REPO || scope==TEAM_REPO || scope==USER_REPO
152
+ print "\tnew issue\t\tCreates a new issue\n"
153
+ print "\tissues\t\t\tShow the list of issues from the repository\n"
154
+ print "\tissue\t\t\tShow the issue and its comments\n"
155
+ print "\t\t\t\t->\tissue [Id of the issue]\n\n"
156
+ print "\tnew issue comment\tAdd a comment in a specific issue\n"
157
+ print "\t\t\t\t->\tnew issue comment [Id of the issue]\n\n"
158
+ print "\topen issue\t\tOpen a closed issue\n"
159
+ print "\t\t\t\t->\topen issue [Id of the issue]\n\n"
160
+ print "\tclose issue\t\tClose an opened issue\n"
161
+ print "\t\t\t\t->\tclose issue [Id of the issue]\n\n"
162
+ end
163
+ end
164
+ alias_method :new_issue,:issues
165
+ alias_method :issue,:issues
166
+ alias_method :open_issue,:issues
167
+ alias_method :close_issue,:issues
168
+
169
+ def new_people_info(scope)
170
+ if scope==ORGS
171
+ print "\tnew relation\t\tSet a relation for the extendend information between Github ID and an email from a .csv file\n"
172
+ print "\t\t\t\t->\tnew relation [name of the file]\n\n"
173
+ print "\tnew people info\t\tGet extended information from a .csv file founded in the excecute path\n"
174
+ print "\t\t\t\t->\tnew people info [name of the file]\n\n"
175
+ print "\trm people info\t\tDelete the extended information\n"
176
+ end
177
+ end
178
+ alias_method :new_relation,:new_people_info
179
+ alias_method :rm_people_info,:new_people_info
180
+
181
+ def info(scope)
182
+
183
+ if scope==USER
184
+ end
185
+ if scope==USER_REPO || scope==ORGS_REPO || scope==TEAM_REPO
186
+ print "\tinfo\t\t\tShow information about the repository\n"
187
+ end
188
+ if scope==ASSIG
189
+ print "\tinfo\t\t\t\Show information about the assignment\n"
190
+ end
191
+ end
192
+
9
193
  def user()
10
194
  self.common_opt
11
195
  puts " Users options:"
12
196
  print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
13
197
  print "\torgs\t\t\tShow your organizations\n"
14
- print "\topen\t\t\tOpen the user's url of github in your web browser.\n"
15
- print "\trepos\t\t\tList your repositories\n"
198
+ self.open(USER)
199
+ self.repos(USER)
16
200
  print "\tclone\t\t\tClone a repository or a list of repositories using a regular expresion\n"
17
- print "\tnew repository\t\tCreate a repository in your personal account\n"
18
- print "\t\t\t\t->\tnew repository [name of the repository]\n\n"
19
- print "\trm repository\t\tDelete a repository in your personal account\n"
20
- print "\t\t\t\t->\trm repository [name of the repository]\n\n"
201
+ self.new_repository(USER)
202
+ self.rm_repository(USER)
21
203
  print "\tset\t\t\tMove you to a specific repository\n"
22
-
23
204
  end
24
205
 
25
206
  def org()
26
207
  self.common_opt
27
208
  puts " Organization options:"
28
209
  print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
29
- print "\trepos\t\t\tList the repositories of your organization\n"
30
- print "\tnew repository\t\tCreate a repository in a organization\n"
31
- print "\t\t\t\t->\tnew repository [name of the repository]\n\n"
32
- print "\trm repository\t\tDelete a repository in a organization\n"
33
- print "\t\t\t\t->\trm repository [name of the repository]\n\n"
34
- print "\topen\t\t\tOpen the organization's url of github in your web browser.\n"
35
- print "\t\t\t\tIf you have added the aditional .csv information with, you can open an specific github profile.\n"
36
- print "\t\t\t\t->\topen [user]\n\n"
210
+ self.repos(ORGS)
211
+ self.new_repository(ORGS)
212
+ self.rm_repository(ORGS)
213
+ self.open(ORGS)
37
214
  print "\tclone\t\t\tClone a repository or a list of repositories using a regular expresion\n"
38
215
  print "\tset\t\t\tMove you to a specific repository\n"
39
- print "\tpeople\t\t\tShow the members of an organization\n"
40
- print "\t\t\t\t->\tpeople\n\n"
41
- print "\t\t\t\tIf you add the parameter 'info', the extended information will be showed\n"
42
- print "\t\t\t\t->\tpeople info\n\n"
43
- print "\t\t\t\tTo find a specific member extended info, you can give the github id as parameter.\n"
44
- print "\t\t\t\t->\tpeople info [github id]\n\n"
45
- print "\t\t\t\tTo use a RegExp search in each field of the information, you can use the parameter /.\n"
46
- print "\t\t\t\t->\tpeople info /[RegExp]/\n\n"
47
- print "\tteams\t\t\tTeams of a organization\n"
48
- print "\tnew relation\t\tSet a relation for the extendend information between Github ID and an email from a .csv file\n"
49
- print "\t\t\t\t->\tnew relation [name of the file]\n\n"
50
- print "\tnew people info\t\tGet extended information from a .csv file founded in the excecute path\n"
51
- print "\t\t\t\t->\tnew people info [name of the file]\n\n"
52
- print "\trm people info\t\tDelete the extended information\n"
53
- print "\tassignments\t\tShow the list of assignments created\n"
54
- print "\tnew assignment\t\tCreate an Assignment in your organization\n"
55
- print "\t\t\t\t->\tnew assignment [name of the assignment]\n\n"
56
- print "\tgroups\t\t\tShow the list of groups with each team and user that it has\n"
57
- print "\tgroup\t\t\tShow the information of an specific group\n"
58
- print "\t\t\t\t->\tgroup [name of the group]\n\n"
59
- print "\tnew group\t\tCreate a new group. Expected the name and teams given one by one\n"
60
- print "\t\t\t\t->\tnew group [name of the group] [team1] [team2] [team3] ... \n\n"
61
- print "\t\t\t\tIf you want to import the teams from a file, use the parameter -f\n"
62
- print "\t\t\t\t->\tnew group -f [name of the group] [file]\n\n"
63
- print "\trm group\t\tDelete a created group\n"
64
- print "\t\t\t\t->\trm group [name of the group]\n\n"
65
- print "\trm team\t\t\tDelete a team in you organization. Expected the name of the team\n"
66
- print "\t\t\t\t->\trm team [name of the team]\n\n"
67
- print "\tnew team\t\tCreate a team in the organization. Expected the name of the team, and/or members given one by one\n"
68
- print "\t\t\t\t->\tnew team [name of the team] [member1] [member2] [member3] ... \n\n"
69
-
216
+ self.people(ORGS)
217
+ self.new_people_info(ORGS)
218
+ self.assignments(ORGS)
219
+ self.groups(ORGS)
220
+ self.teams(ORGS)
70
221
  end
71
222
 
72
223
  def org_repo()
73
224
  self.common_opt
74
225
  puts " Repository options:"
75
226
  print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
76
- print "\tinfo\t\t\tShow information about the repository\n"
77
- print "\topen\t\t\tOpen the repository's url of github in your web browser.\n"
227
+ self.info(ORGS_REPO)
228
+ self.open(ORGS_REPO)
78
229
  print "\tcommits\t\t\tShow the list of commits from the repository\n"
79
- print "\tnew issue\t\tCreates a new issue\n"
80
- print "\tissues\t\t\tShow the list of issues from the repository\n"
81
- print "\tissue\t\t\tShow the issue and its comments\n"
82
- print "\t\t\t\t->\tissue [Id of the issue]\n\n"
83
- print "\tnew issue comment\tAdd a comment in a specific issue\n"
84
- print "\t\t\t\t->\tnew issue comment [Id of the issue]\n\n"
85
- print "\topen issue\t\tOpen a closed issue\n"
86
- print "\t\t\t\t->\topen issue [Id of the issue]\n\n"
87
- print "\tclose issue\t\tClose an opened issue\n"
88
- print "\t\t\t\t->\tclose issue [Id of the issue]\n\n"
230
+ self.issues(ORGS_REPO)
89
231
  print "\tfiles\t\t\tShow the files of the repository path given\n"
90
232
  print "\tcat\t\t\tShow data from a file\n"
91
233
  print "\t\t\t\t->\tcat [file]\n\n"
@@ -98,11 +240,10 @@ class HelpM
98
240
  self.common_opt
99
241
  puts " Organization team options:"
100
242
  print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
101
- print "\tpeople\t\t\tMembers of the team\n"
102
- print "\topen\t\t\tOpen the team's url of github in your web browser.\n"
243
+ self.repos(TEAM)
244
+ self.people(TEAM)
245
+ self.open(TEAM)
103
246
  print "\tclone\t\t\tClone a repository or a list of repositories using a regular expresion\n"
104
- print "\tnew repository\t\tCreate a repository to this team\n"
105
- print "\t\t\t\t->\tnew repository [name]\n\n"
106
247
  print "\tadd team member\t\tAdd a member in the team\n\n"
107
248
  print "\t\t\t\t->\tadd team member [new member]\n\n"
108
249
  end
@@ -111,19 +252,10 @@ class HelpM
111
252
  self.common_opt
112
253
  puts " Repository options:"
113
254
  print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
114
- print "\tinfo\t\t\tShow information about the repository\n"
115
- print "\topen\t\t\tOpen the repository's url of github in your web browser.\n"
255
+ self.info(USER_REPO)
256
+ self.open(USER_REPO)
116
257
  print "\tcommits\t\t\tShow the list of commits from the repository\n"
117
- print "\tnew issue\t\tCreates a new issue\n"
118
- print "\tissues\t\t\tShow the list of issues from the repository\n"
119
- print "\tissue\t\t\tShow the issue and its comments\n"
120
- print "\t\t\t\t->\tissue [Id of the issue]\n\n"
121
- print "\tnew issue comment\tAdd a comment in a specific issue\n"
122
- print "\t\t\t\->\tnew issue comment [Id of the issue]\n\n"
123
- print "\topen issue\t\tOpen a closed issue\n"
124
- print "\t\t\t\t->\topen issue [Id of the issue]\n\n"
125
- print "\tclose issue\t\tClose an opened issue\n"
126
- print "\t\t\t\t->\tclose issue [Id of the issue]\n\n"
258
+ self.issues(USER_REPO)
127
259
  print "\tfiles\t\t\tShow the files of the repository path given\n"
128
260
  print "\tcat\t\t\tShow data from a file\n"
129
261
  print "\t\t\t\t->\tcat [file]\n\n"
@@ -137,7 +269,7 @@ class HelpM
137
269
  self.common_opt
138
270
  puts " Assignment options:"
139
271
  print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
140
- print "\tinfo\t\t\t\Show information about the assignment\n"
272
+ self.info(ASSIG)
141
273
  print "\tadd repo\t\tAdd or create the repository of the assignment\n"
142
274
  print "\tchange repo\t\tChange a repository of the assignment\n"
143
275
  print "\t\t\t\t->\tchange repo [number of the repo]\n\n"
@@ -150,7 +282,7 @@ class HelpM
150
282
  print "\t\t\t\t->\trm group [name]\n\n"
151
283
  print "\t\t\t\tTo delete all the groups list, use the parameter -all.\n"
152
284
  print "\t\t\t\t->\trm group -all\n\n"
153
- print "\topen\t\t\topen the github assignment repositories disposition\n"
285
+ self.open(ASSIG)
154
286
  print "\tadd students\t\tAdd new students to the assignment\n"
155
287
  print "\trm student\t\tDelete a student from the assignment list.\n"
156
288
  print "\t\t\t\t->\trm student [name]\n\n"
@@ -163,19 +295,10 @@ class HelpM
163
295
  self.common_opt
164
296
  puts " Repository options:"
165
297
  print "\n\tCOMMAND\t\t\tDESCRIPTION\n\n"
166
- print "\tinfo\t\t\tShow information about the repository\n"
167
- print "\topen\t\t\tOpen the repository's url of github in your web browser.\n"
298
+ self.info(TEAM_REPO)
299
+ self.open(TEAM_REPO)
168
300
  print "\tcommits\t\t\tShow the list of commits from the repository\n"
169
- print "\tnew issue\t\tCreates a new issue\n"
170
- print "\tissues\t\t\tShow the list of issues from the repository\n"
171
- print "\tissue\t\t\tShow the issue and its comments\n"
172
- print "\tnew issue comment\tAdd a comment in a specific issue\n"
173
- print "\t\t\t\t->\tnew issue comment [Id of the issue]\n\n"
174
- print "\t\t\t\t->\tissue [Id of the issue]\n\n"
175
- print "\topen issue\t\tOpen a closed issue\n"
176
- print "\t\t\t\t->\topen issue [Id of the issue]\n\n"
177
- print "\tclose issue\t\tClose an opened issue\n"
178
- print "\t\t\t\t->\tclose issue [Id of the issue]\n\n"
301
+ self.issues(TEAM_REPO)
179
302
  print "\tfiles\t\t\tShow the files of the repository path given\n"
180
303
  print "\tcat\t\t\tShow data from a file\n"
181
304
  print "\t\t\t\t->\tcat [file]\n\n"
@@ -194,15 +317,7 @@ class HelpM
194
317
  print "\t\t\t\t->\tdo [filename]\n\n"
195
318
  print "\texit\t\t\tExit from this program\n"
196
319
  print "\thelp\t\t\tList of commands available\n"
197
- print "\tcd\t\t\tGo to the path. Could be an assignment, an organization, a team or a repository\n"
198
- print "\t\t\t\t->\tcd [path]\n\n"
199
- print "\t\t\t\tFor going to the user root path use cd without argument:\n"
200
- print "\t\t\t\t->\tcd\n\n"
201
- print "\t\t\t\tYou can go back to the previous level with the argument ".."\n"
202
- print "\t\t\t\t->\tcd [..]\n\n"
203
- print "\t\t\t\tDefault search look for repositories at the end of the queue.\n"
204
- print "\t\t\t\tIf you want to look for an specific repository use: \n"
205
- print "\t\t\t\t->\tcd repo [name] \n\n"
320
+ self.cd(1)
206
321
  print "\t!\t\t\tExecute a bash command\n\n"
207
322
  end
208
323
 
data/lib/actions/orgs.rb CHANGED
@@ -69,17 +69,17 @@ class Organizations
69
69
  puts "\n"
70
70
  puts "Assignment: #{name}"
71
71
  puts "1) Add a repository already created "
72
- # puts "2) Create a new empty repository"
73
- puts "2) Don't assign a repository yet"
72
+ puts "2) Create a new empty repository"
73
+ puts "3) Don't assign a repository yet"
74
74
  print "option => "
75
75
  op=gets.chomp
76
76
  puts "\n"
77
- if op=="1" or op=="2"
77
+ if op=="1" or op=="2" or op=="3"
78
78
  ex=true
79
79
  end
80
80
  end
81
81
  case
82
- when op=="1"
82
+ when op=="1" || op=="2"
83
83
 
84
84
  if op=="1"
85
85
  ex2=false
@@ -111,7 +111,25 @@ class Organizations
111
111
  end
112
112
  end
113
113
  end
114
- when op=="2" then reponame=""
114
+ if op=="2"
115
+ ex2=false
116
+ until ex2==true
117
+ puts "Name of the repository (To skip and add the repository later, press enter): "
118
+ reponame=gets.chomp
119
+ if reponame==""
120
+ ex2=true
121
+ else
122
+ # ex2=Repositories.new().create_repository(client,config,reponame,false,ORGS)
123
+ if client.repository?("#{config["Org"]}/#{reponame}")
124
+ puts "\e[31m Already exists a repository with that name in #{config["Org"]}\e[0m"
125
+ else
126
+ reponame="#{config["Org"]}/#{reponame}"
127
+ ex2=true
128
+ end
129
+ end
130
+ end
131
+ end
132
+ when op=="3" then reponame=""
115
133
  end
116
134
  return reponame
117
135
  end
@@ -373,12 +391,21 @@ class Organizations
373
391
  sys.create_temp("#{ENV['HOME']}/.ghedsh/temp")
374
392
  puts repo
375
393
  if repolist.size>1
376
- sufix="sufix#{point}"
377
- sufix="-#{assig["#{sufix}"]}"
394
+ if point>1 || assig.has_key?("sufix1")
395
+ sufix="sufix#{point}"
396
+ sufix="-#{assig["#{sufix}"]}"
397
+ else
398
+ sufix=""
399
+ end
378
400
  else
379
401
  sufix=""
380
402
  end
381
403
  point=point+1
404
+ if !client.repository?(repo)
405
+ aux=repo.split("/")
406
+ aux=aux[1]
407
+ r.create_repository(client,config,aux,false,ORGS)
408
+ end
382
409
  system("git clone #{web2}#{repo}.git #{ENV['HOME']}/.ghedsh/temp/#{repo}")
383
410
  if assig["groups"]!=[]
384
411
  assig["groups"].each do |i|
@@ -689,10 +716,6 @@ class Organizations
689
716
  else
690
717
  list["orgs"].detect{|aux| aux["name"]==config["Org"]}["assigs"].detect{|aux2| aux2["name_assig"]==assig}["repo#{reponumber}"]=reponame
691
718
  list["orgs"].detect{|aux| aux["name"]==config["Org"]}["assigs"].detect{|aux2| aux2["name_assig"]==assig}["#{sufix}"]=sufixname
692
- if sufix=="sufix2" and change==nil
693
- sufixname=self.assignment_repo_sufix("1",2)
694
- list["orgs"].detect{|aux| aux["name"]==config["Org"]}["assigs"].detect{|aux2| aux2["name_assig"]==assig}["sufix1"]=sufixname
695
- end
696
719
  Sys.new.save_assigs("#{ENV['HOME']}/.ghedsh",list)
697
720
  end
698
721
  end
@@ -870,15 +893,26 @@ class Organizations
870
893
  puts "No github web profile in the aditional information"
871
894
  end
872
895
  else
873
- if inuser.keys.include?(field.downcase)
874
- if inuser[field.downcase].include?("https://") or inuser[field.downcase].include?("http://")
875
- url=inuser["#{field.downcase}"]
876
- else
877
- url="http://"+inuser["#{field.downcase}"]
896
+ if field.downcase.start_with?("/") and field.downcase.end_with?("/") ##regexp
897
+ field=field.delete("/")
898
+ inuser.each_value do |j|
899
+ if j.include?(field)
900
+ if j.include?("https://") || j.include?("http://")
901
+ Sys.new.open_url(j)
902
+ end
903
+ end
878
904
  end
879
- Sys.new.open_url(url)
880
905
  else
881
- puts "No field found with that name"
906
+ if inuser.keys.include?(field.downcase)
907
+ if inuser[field.downcase].include?("https://") or inuser[field.downcase].include?("http://")
908
+ url=inuser["#{field.downcase}"]
909
+ else
910
+ url="http://"+inuser["#{field.downcase}"]
911
+ end
912
+ Sys.new.open_url(url)
913
+ else
914
+ puts "No field found with that name"
915
+ end
882
916
  end
883
917
  end
884
918
  end
@@ -351,8 +351,10 @@ class Sys
351
351
  yes=false
352
352
  list.each do |i|
353
353
  i.each do |j|
354
- if j[1].match(/#{exp}/)
355
- yes=true
354
+ if j[1]!=nil
355
+ if j[1].match(/#{exp}/)
356
+ yes=true
357
+ end
356
358
  end
357
359
  end
358
360
  if yes==true
data/lib/interface.rb CHANGED
@@ -79,23 +79,27 @@ class Interface
79
79
  end
80
80
  end
81
81
 
82
- def help()
82
+ def help(opcd)
83
83
  h=HelpM.new()
84
- case
85
- when @deep == USER
86
- h.user()
87
- when @deep == ORGS
88
- h.org()
89
- when @deep == ORGS_REPO
90
- h.org_repo()
91
- when @deep == USER_REPO
92
- h.user_repo()
93
- when @deep == TEAM
94
- h.orgs_teams()
95
- when @deep == TEAM_REPO
96
- h.team_repo()
97
- when @deep == ASSIG
98
- h.asssig()
84
+ if opcd.size>1
85
+ h.context(opcd[1..opcd.size-1],@deep)
86
+ else
87
+ case
88
+ when @deep == USER
89
+ h.user()
90
+ when @deep == ORGS
91
+ h.org()
92
+ when @deep == ORGS_REPO
93
+ h.org_repo()
94
+ when @deep == USER_REPO
95
+ h.user_repo()
96
+ when @deep == TEAM
97
+ h.orgs_teams()
98
+ when @deep == TEAM_REPO
99
+ h.team_repo()
100
+ when @deep == ASSIG
101
+ h.asssig()
102
+ end
99
103
  end
100
104
  end
101
105
 
@@ -208,49 +212,6 @@ class Interface
208
212
  when @deep == TEAM
209
213
  self.set(path)
210
214
  end
211
- else ##CD con path absoluto
212
- case
213
- when @deep==USER
214
- if @orgs_list.empty?
215
- @orgs_list=Organizations.new.read_orgs(@client)
216
- end
217
- aux=@orgs_list
218
- if aux.one?{|aux| aux==path_split[0]}
219
- @config["Org"]=path_split[0]
220
- @deep=ORGS
221
- if @teamlist.empty?
222
- @teamlist=Teams.new.read_teamlist(@client,@config)
223
- end
224
- aux=@teamlist
225
- if aux[path_split[1]]!=nil
226
- @config["Team"]=path_split[1]
227
- @config["TeamID"]=@teamlist[path_split[1]]
228
- @deep=TEAM
229
- if path_split.size>2
230
- self.set(path_split[2])
231
- end
232
- else
233
- #puts "\nNo team is available with that name"
234
- self.set(path_split[1])
235
- end
236
- else
237
- #puts "\nNo organization is available with that name"
238
- self.set(path)
239
- end
240
- when @deep==ORGS
241
- if @teamlist==[]
242
- @teamlist=Teams.new.read_teamlist(@client,@config)
243
- end
244
- aux=@teamlist
245
- if aux[path_split[0]]!=nil
246
- @config["Team"]=path_split[0]
247
- @config["TeamID"]=@teamlist[path_split[0]]
248
- @deep=TEAM
249
- self.set(path_split[1])
250
- else
251
- #puts "\nNo team is available with that name"
252
- end
253
- end
254
215
  end
255
216
  end
256
217
 
@@ -479,7 +440,7 @@ class Interface
479
440
  else
480
441
  op=opscript[0]
481
442
  opcd=op.split
482
- opscript.delete(opscript[0])
443
+ opscript.shift
483
444
  end
484
445
 
485
446
  case
@@ -487,7 +448,7 @@ class Interface
487
448
  @sysbh.save_memory(config_path,@config)
488
449
  s.save_cache(config_path,@config)
489
450
  s.remove_temp("#{ENV['HOME']}/.ghedsh/temp")
490
- when op == "help" then self.help()
451
+ when op.include?("help") && opcd[0]=="help" then self.help(opcd)
491
452
  when op == "orgs" then self.orgs()
492
453
  when op == "cd .."
493
454
  if @deep==ORGS then t.clean_groupsteams() end ##cleans groups cache
@@ -691,12 +652,19 @@ class Interface
691
652
  if opcd[1]=="repo" and opcd.size>2
692
653
  self.set(opcd[2])
693
654
  else
694
- self.cd(opcd[1])
655
+ if opcd[1].include?("/")
656
+ cdlist=opcd[1].split("/")
657
+ cdlist.each do |i|
658
+ opscript.push("cd #{i}")
659
+ end
660
+ else
661
+ self.cd(opcd[1])
662
+ end
695
663
  end
696
664
  end
697
665
  end
698
666
  if opcd[0]=="do" and opcd.size>1
699
- # opscript=s.load_script(opcd[1])
667
+ opscript=s.load_script(opcd[1])
700
668
  end
701
669
  if opcd[0]=="set"
702
670
  self.set(opcd[1])
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ghedsh
2
- VERSION='1.1.36'
2
+ VERSION='1.1.37'
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.36
4
+ version: 1.1.37
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: 2017-05-04 00:00:00.000000000 Z
12
+ date: 2017-05-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: octokit