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
|
# File 'lib/commands/create.rb', line 35
def run
local_config_path = "./Gb.yml"
if File.exist?(local_config_path)
raise Error.new("'#{local_config_path}' exists.")
end
if @config_url.nil?
path = File.expand_path("../../Gb.yml", File.dirname(__FILE__))
if File.exist?(path)
gb_config = GbConfig.load_file(path)
else
raise Error.new("'#{path}' not found.")
end
else
yml_response = nil
open(@config_url) do |http|
yml_response = http.read
end
gb_config = GbConfig.load_yml(yml_response)
end
if @private_token.nil?
begin
print "Input GitLab private token: "
private_token = STDIN.gets.chomp
end until private_token.length > 0
@private_token = private_token
end
gb_config.gitlab.private_token = @private_token
File.open("./Gb.yml", 'w') do |file|
Psych.dump(gb_config.to_dictionary, file)
end
end
|