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
|
# File 'lib/gemstone.rb', line 12
def self.ask_options
options = {}
while options.empty? do
puts "Hi, I'll need some data about your next ruby gem, please answer all questions"
questions = [
[:name , 'gem name?'],
[:author , 'gem author?'],
[:email , 'author email?'],
[:summary , 'gem summary? (be brief)'],
[:description , 'gem description? (not so brief)'],
[:homepage , 'gem homepage URL?'],
[:executable , 'will the gem include an executable? (y/n)']
]
questions.each do |option, question|
puts question
options[option] = gets.chomp
end
options[:executable] = options[:executable].downcase.include?('y')
begin
OptionsValidator.validate!(options)
rescue MissingOption => e
puts "Please answer all questions."
options = {}
end
end
options
end
|