alfred_git 0.5.3 → 0.5.4
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/.gitignore +3 -3
- data/Gemfile +5 -4
- data/LICENSE +21 -21
- data/README.md +153 -146
- data/Rakefile.rb +2 -2
- data/alfred_git.gemspec +25 -25
- data/bin/alfred_git +8 -8
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/lib/alfred_git.rb +367 -371
- data/lib/alfred_git/version.rb +2 -2
- metadata +3 -3
data/bin/console
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "alfred_git"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "alfred_git"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
set -euo pipefail
|
3
|
-
IFS=$'\n\t'
|
4
|
-
set -vx
|
5
|
-
|
6
|
-
bundle install
|
7
|
-
|
8
|
-
# Do any other automated setup that you need to do here
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
set -euo pipefail
|
3
|
+
IFS=$'\n\t'
|
4
|
+
set -vx
|
5
|
+
|
6
|
+
bundle install
|
7
|
+
|
8
|
+
# Do any other automated setup that you need to do here
|
data/lib/alfred_git.rb
CHANGED
@@ -1,372 +1,368 @@
|
|
1
|
-
require 'YAML'
|
2
|
-
require 'rainbow'
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
@
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
single_space
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
single_space
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
lines_pretty_print "
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
lines_pretty_print
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
lines_pretty_print(string)
|
369
|
-
double_space
|
370
|
-
end
|
371
|
-
end
|
1
|
+
require 'YAML'
|
2
|
+
require 'rainbow'
|
3
|
+
require 'fileutils'
|
4
|
+
require 'find'
|
5
|
+
require 'iamsellek_cl_helper'
|
6
|
+
|
7
|
+
require_relative './alfred_git/version'
|
8
|
+
|
9
|
+
module AlfredGit
|
10
|
+
class AlfredGit
|
11
|
+
include AlfredGitVersion
|
12
|
+
include IamsellekClHelper
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
set_app_directory
|
16
|
+
|
17
|
+
# If there's just one, it's the current version.
|
18
|
+
restore_settings('alfred_git', VERSION) if
|
19
|
+
Dir.glob("#{@app_directory.chomp("/alfred_git-#{VERSION}")}/alfred_git*").length > 1 &&
|
20
|
+
!(File.exists?("#{@app_directory}/lib/config.yaml"))
|
21
|
+
|
22
|
+
config unless File.exists?("#{@app_directory}/lib/config.yaml")
|
23
|
+
config_yaml = YAML.load_file("#{@app_directory}/lib/config.yaml")
|
24
|
+
|
25
|
+
@repo_locations = config_yaml['repos']
|
26
|
+
@name = config_yaml['name'].nil? ? 'Wayne' : config_yaml['name']
|
27
|
+
@gender = config_yaml['gender'].nil? ? 'sir' : config_yaml['gender']
|
28
|
+
end
|
29
|
+
|
30
|
+
def alfred(arguments)
|
31
|
+
@arguments = arguments
|
32
|
+
alfred_command
|
33
|
+
command = command_to_git_command
|
34
|
+
repos = repos_string_to_array
|
35
|
+
|
36
|
+
repos.each do |repo|
|
37
|
+
lines_pretty_print Rainbow("Repo #{repo}:").yellow
|
38
|
+
bash(@repo_locations[repo], command)
|
39
|
+
|
40
|
+
single_space
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def alfred_command
|
45
|
+
case @arguments[0]
|
46
|
+
when nil, ''
|
47
|
+
lines_pretty_print Rainbow("I need a command to run, Master #{@name}.").red
|
48
|
+
|
49
|
+
abort
|
50
|
+
when 'list_repo', 'list_repos', 'listrepo', 'listrepos'
|
51
|
+
lines_pretty_print "Here are your repos and their locations, Master #{@name}:"
|
52
|
+
|
53
|
+
single_space
|
54
|
+
|
55
|
+
list_repos_and_locations
|
56
|
+
|
57
|
+
single_space
|
58
|
+
|
59
|
+
abort
|
60
|
+
when 'add_repo', 'addrepo', 'ar'
|
61
|
+
if second_argument_missing?(@arguments)
|
62
|
+
lines_pretty_print Rainbow("I need a repo name for the new repo, Master #{@name}.").red
|
63
|
+
|
64
|
+
abort
|
65
|
+
end
|
66
|
+
|
67
|
+
add_repo
|
68
|
+
|
69
|
+
abort
|
70
|
+
when 'delete_repo', 'deleterepo', 'deletrepo', 'dr'
|
71
|
+
if second_argument_missing?(@arguments)
|
72
|
+
lines_pretty_print Rainbow("I need a repo name to know which repo I'm deleting, Master #{@name}.").red
|
73
|
+
|
74
|
+
abort
|
75
|
+
end
|
76
|
+
|
77
|
+
delete_repo
|
78
|
+
|
79
|
+
abort
|
80
|
+
when 'repo_add_directory', 'rad'
|
81
|
+
|
82
|
+
if second_argument_missing?(@arguments)
|
83
|
+
lines_pretty_print Rainbow("I need a directory path to know which repos to add, Master #{@name}.").red
|
84
|
+
|
85
|
+
abort
|
86
|
+
end
|
87
|
+
|
88
|
+
repo_add_directory
|
89
|
+
|
90
|
+
abort
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def list_repos_and_locations
|
95
|
+
@repo_locations.each do |repo, location|
|
96
|
+
lines_pretty_print Rainbow("#{repo}:").yellow + " #{location}"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def add_repo
|
101
|
+
repo_name = @arguments[1]
|
102
|
+
|
103
|
+
single_space
|
104
|
+
|
105
|
+
lines_pretty_print "I can add the #{repo_name} repo straight away, #{@gender}. Where is that repository? "\
|
106
|
+
'Please paste the full path.'
|
107
|
+
|
108
|
+
repo_path = STDIN.gets.strip!
|
109
|
+
|
110
|
+
single_space
|
111
|
+
|
112
|
+
config_yaml = YAML.load_file("#{@app_directory}/lib/config.yaml")
|
113
|
+
config_file = File.open("#{@app_directory}/lib/config.yaml", 'w')
|
114
|
+
|
115
|
+
config_yaml['repos'][repo_name] = repo_path
|
116
|
+
YAML.dump(config_yaml, config_file)
|
117
|
+
|
118
|
+
lines_pretty_print Rainbow("I've added that repository successfully, #{@gender}!").green
|
119
|
+
|
120
|
+
single_space
|
121
|
+
end
|
122
|
+
|
123
|
+
def delete_repo
|
124
|
+
repo_name = @arguments[1]
|
125
|
+
|
126
|
+
single_space
|
127
|
+
|
128
|
+
config_yaml = YAML.load_file("#{@app_directory}/lib/config.yaml")
|
129
|
+
config_file = File.open("#{@app_directory}/lib/config.yaml", 'w')
|
130
|
+
|
131
|
+
if repo_name == 'all'
|
132
|
+
config_yaml['repos'] = {}
|
133
|
+
lines_pretty_print Rainbow("I've deleted all repositories successfully, #{@gender}!").green
|
134
|
+
elsif config_yaml['repos'].keys.include?(repo_name)
|
135
|
+
config_yaml['repos'].delete(repo_name)
|
136
|
+
|
137
|
+
lines_pretty_print Rainbow("I've deleted that repository successfully, #{@gender}!").green
|
138
|
+
else
|
139
|
+
lines_pretty_print Rainbow("Sorry, #{@gender}, that is not a repository that is currently in my list. "\
|
140
|
+
'If you\'d *really* like to delete it, please add it first using the '\
|
141
|
+
'\'add_repo\' command.').red
|
142
|
+
end
|
143
|
+
|
144
|
+
YAML.dump(config_yaml, config_file)
|
145
|
+
|
146
|
+
single_space
|
147
|
+
end
|
148
|
+
|
149
|
+
def repo_add_directory
|
150
|
+
single_space
|
151
|
+
|
152
|
+
if @arguments[1] == '.'
|
153
|
+
rootDir = Dir.pwd
|
154
|
+
else
|
155
|
+
rootDir = @arguments[1]
|
156
|
+
end
|
157
|
+
|
158
|
+
repo_paths = []
|
159
|
+
|
160
|
+
Find.find(rootDir) do |path|
|
161
|
+
already_found_repo = false
|
162
|
+
puts path
|
163
|
+
|
164
|
+
repo_paths.each do |repo_path|
|
165
|
+
already_found_repo = path.include?(repo_path)
|
166
|
+
end
|
167
|
+
|
168
|
+
next if already_found_repo
|
169
|
+
|
170
|
+
if path =~ /.*\.git$/ && !already_found_repo
|
171
|
+
repo_paths << path[0...-5]
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
config_yaml = YAML.load_file("#{@app_directory}/lib/config.yaml")
|
176
|
+
config_file = File.open("#{@app_directory}/lib/config.yaml", 'w')
|
177
|
+
|
178
|
+
lines_pretty_print Rainbow("I've added the following repositories successfully, #{@gender}").green
|
179
|
+
|
180
|
+
single_space
|
181
|
+
|
182
|
+
repo_paths.each do |path|
|
183
|
+
repo = path.split('/').last
|
184
|
+
location = rootDir
|
185
|
+
|
186
|
+
if config_yaml['repos'][repo] == nil
|
187
|
+
config_yaml['repos'][repo] = path
|
188
|
+
lines_pretty_print Rainbow(repo + ":").yellow + path
|
189
|
+
else
|
190
|
+
altPath = path
|
191
|
+
altPath.slice! rootDir + "/"
|
192
|
+
config_yaml['repos'][altPath] = rootDir + "/" + path
|
193
|
+
lines_pretty_print Rainbow(altPath + ":").yellow + rootDir + "/" + path
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
YAML.dump(config_yaml, config_file)
|
198
|
+
end
|
199
|
+
|
200
|
+
def command_to_git_command
|
201
|
+
command = ''
|
202
|
+
|
203
|
+
case @arguments[0]
|
204
|
+
when 'pull'
|
205
|
+
command = 'git pull'
|
206
|
+
|
207
|
+
delete_arguments(@arguments, 1)
|
208
|
+
when 'push'
|
209
|
+
command = 'git push'
|
210
|
+
|
211
|
+
delete_arguments(@arguments, 1)
|
212
|
+
when 'checkout'
|
213
|
+
if second_argument_missing?(@arguments)
|
214
|
+
lines_pretty_print Rainbow('I need a branch name to execute the \'checkout\' command, Master '\
|
215
|
+
"#{@name}.").red
|
216
|
+
|
217
|
+
abort
|
218
|
+
end
|
219
|
+
|
220
|
+
command = "git checkout #{@arguments[1]}"
|
221
|
+
|
222
|
+
delete_arguments(@arguments, 2)
|
223
|
+
when 'commit'
|
224
|
+
if second_argument_missing?(@arguments)
|
225
|
+
lines_pretty_print Rainbow('I need a commit message to execute the \'commit\' command, Master '\
|
226
|
+
"#{@name}.").red
|
227
|
+
|
228
|
+
abort
|
229
|
+
end
|
230
|
+
|
231
|
+
command = %Q[git commit -m "#{@arguments[1]}"]
|
232
|
+
|
233
|
+
delete_arguments(@arguments, 2)
|
234
|
+
when 'status'
|
235
|
+
command = 'git status'
|
236
|
+
|
237
|
+
delete_arguments(@arguments, 1)
|
238
|
+
when 'branches', 'branch'
|
239
|
+
command = 'git rev-parse --abbrev-ref HEAD'
|
240
|
+
|
241
|
+
delete_arguments(@arguments, 1)
|
242
|
+
when 'woa', 'wielder_of_anor', 'wielderofanor'
|
243
|
+
if second_argument_missing?(@arguments)
|
244
|
+
lines_pretty_print Rainbow("I need a commit message to pass to wielder_of_anor, Master #{@name}.").red
|
245
|
+
|
246
|
+
abort
|
247
|
+
end
|
248
|
+
|
249
|
+
if @arguments[2] && @arguments[2] == '1'
|
250
|
+
command = %Q[wielder_of_anor "#{@arguments[1]}" 1]
|
251
|
+
|
252
|
+
delete_arguments(@arguments, 3)
|
253
|
+
else
|
254
|
+
command = %Q[wielder_of_anor "#{@arguments[1]}"]
|
255
|
+
|
256
|
+
delete_arguments(@arguments, 2)
|
257
|
+
end
|
258
|
+
else
|
259
|
+
command = @arguments[0] # Allow users to send any command to all repos.
|
260
|
+
|
261
|
+
delete_arguments(@arguments, 1)
|
262
|
+
end
|
263
|
+
|
264
|
+
command
|
265
|
+
end
|
266
|
+
|
267
|
+
# All other arguments are deleted before we get here, so this should be just the repo list.
|
268
|
+
def repos_string_to_array
|
269
|
+
if @arguments[0].nil?|| @arguments[0] == ''
|
270
|
+
lines_pretty_print Rainbow("I need at least one repository to work with, Master #{@name}.").red
|
271
|
+
|
272
|
+
abort
|
273
|
+
elsif @arguments[0] == 'all'
|
274
|
+
return @repo_locations.keys
|
275
|
+
else
|
276
|
+
return @arguments
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
def config
|
281
|
+
config_file = File.open("#{@app_directory}/lib/config.yaml", 'w')
|
282
|
+
|
283
|
+
lines_pretty_print 'Good evening, Master Wayne. Thank you for utilizing my abilities. Please enter your '\
|
284
|
+
'last name if you\'d like me to address you as something other than Wayne.'
|
285
|
+
lines_pretty_print Rainbow('(Just hit enter to stick with \'Master Wayne\'.)').yellow
|
286
|
+
|
287
|
+
name = STDIN.gets.strip!
|
288
|
+
|
289
|
+
name = name == '' ? 'Wayne' : name
|
290
|
+
|
291
|
+
single_space
|
292
|
+
|
293
|
+
lines_pretty_print 'Thank you, sir. You...are a sir, correct?'
|
294
|
+
|
295
|
+
gender_set = false
|
296
|
+
|
297
|
+
until gender_set
|
298
|
+
gender = STDIN.gets.strip!
|
299
|
+
|
300
|
+
single_space
|
301
|
+
|
302
|
+
if gender == 'yes' || gender == 'y'
|
303
|
+
gender = 'sir'
|
304
|
+
gender_set = true
|
305
|
+
elsif gender == 'no' || gender == 'n'
|
306
|
+
gender = 'madam'
|
307
|
+
gender_set = true
|
308
|
+
else
|
309
|
+
lines_pretty_print "Very funny, Master #{name}."
|
310
|
+
lines_pretty_print Rainbow('Please input either \'yes\' or \'no\'.').yellow
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
lines_pretty_print "Yes, of course. My apologies. Please do not take offense, #{gender}. I am, after "\
|
315
|
+
'all, a simple computer program. Don\'t have eyes, you see. Now, let\'s gather a '\
|
316
|
+
'list of the code repositories you work with, shall we?'
|
317
|
+
|
318
|
+
single_space
|
319
|
+
|
320
|
+
repos = {}
|
321
|
+
done = false
|
322
|
+
repo_count = 0
|
323
|
+
|
324
|
+
until done do
|
325
|
+
first = repo_count > 0 ? 'next' : 'first'
|
326
|
+
|
327
|
+
lines_pretty_print "What is the 'friendly' name you'd like to give your #{first} repository? This is the "\
|
328
|
+
'name you will type when sending me commands. If you are done adding them, please '\
|
329
|
+
'enter \'x211\' as your input instead.'
|
330
|
+
|
331
|
+
repo_name = STDIN.gets.strip!
|
332
|
+
|
333
|
+
if repo_name == 'x211'
|
334
|
+
done = true
|
335
|
+
single_space
|
336
|
+
next
|
337
|
+
end
|
338
|
+
|
339
|
+
single_space
|
340
|
+
|
341
|
+
lines_pretty_print "Thank you, #{gender}. Now, where is that repository? Please paste the full path."
|
342
|
+
|
343
|
+
repo_path = STDIN.gets.strip!
|
344
|
+
|
345
|
+
single_space
|
346
|
+
|
347
|
+
repos[repo_name] = repo_path
|
348
|
+
repo_count += 1
|
349
|
+
|
350
|
+
lines_pretty_print Rainbow("I've added that repository successfully, #{gender}!").green
|
351
|
+
|
352
|
+
single_space
|
353
|
+
end
|
354
|
+
|
355
|
+
YAML.dump({ 'name' => name, 'gender' => gender, 'repos' => repos }, config_file)
|
356
|
+
config_file.close
|
357
|
+
|
358
|
+
lines_pretty_print "Thank you for helping me set things up, Master #{name}. Feel free to run me whenever "\
|
359
|
+
'you need.'
|
360
|
+
|
361
|
+
abort
|
362
|
+
end
|
363
|
+
|
364
|
+
def set_app_directory
|
365
|
+
@app_directory = File.expand_path(File.dirname(__FILE__)).chomp('/lib')
|
366
|
+
end
|
367
|
+
end
|
372
368
|
end
|