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
|
# File 'lib/appscrolls/command.rb', line 10
def new(name)
if options[:scrolls]
run_template(name, options[:scrolls], options[:template])
else
@scrolls = []
question = "#{bold}Which scroll would you like to add/remove? #{clear}#{yellow}(blank to finish)#{clear}"
while (scroll = ask(scrolls_message + question)) != ''
if @scrolls.include?(scroll)
@scrolls.delete(scroll)
puts
puts "> #{yellow}Removed '#{scroll}' from template.#{clear}"
elsif AppScrollsScrolls::Scrolls.list.include?(scroll)
@scrolls << scroll
puts
puts "> #{green}Added '#{scroll}' to template.#{clear}"
else
puts
puts "> #{red}Invalid scroll, please try again.#{clear}"
end
end
run_template(name, @scrolls)
end
end
|