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
|
# File 'lib/negroku/cli.rb', line 167
def add(key=nil, value=nil)
if !key.nil? && value.nil?
value = ask("Please enter the value for #{key}:")
elsif key.nil? && value.nil?
if File.exist?(".rbenv-vars") && (agree "Do you want to add variables from your local .rbenv-vars file [y/n]", true)
choose do ||
.prompt = "Please choose variable you want to add?".bright()
.select_by = :index
File.readlines(".rbenv-vars").each do |line|
.choice(line.gsub("\n","")) do |command|
key = command.split("=")[0]
value = command.split("=")[1]
end
end
end
else
key = ask("Please enter the variable key:")
value = ask("Please enter the value for #{key}:")
end
end
%x(cap #{options[:stage]} rbenv:vars:add -s key=#{key} -s value=#{value})
end
|