lib/user_interaction.rb in webroar-0.6.1 vs lib/user_interaction.rb in webroar-0.7.0

- old
+ new

@@ -29,38 +29,49 @@ # User input to install WebROaR def user_input return nil, true, @gem_name if choose_gem_version + setup_admin_user + puts "Setting up server specifications ..." + + port = read_port + return port, false, nil + end + + def setup_admin_user puts "Setting up server admin panel ..." username = read_user_name password = read_password write_user(username, password) - - puts "Setting up server specifications ..." - - port = read_port - - return port, false, nil end private def gem_exist? print "Checking for any previous installation of WebROaR ... " - list = Gem.source_index.find_name(/^webroar$/) + + if Gem::Specification.respond_to?('find_all_by_name') + list = Gem::Specification.find_all_by_name(/^webroar$/) + else + list = Gem.source_index.find_name(/^webroar$/) + end unless list puts "not found." return false end - #gem_names = list.collect {|gem| gem.full_name} gem_list = list.collect {|gem| gem.version} - gem_list.each_with_index do |item, index| - gem_list.delete(item) if !File.exist?(File.join(WEBROAR_ROOT,"..","webroar-#{item}","conf","config.yml")) + index = 0 + while gem_list[index] + unless File.exist?(File.join(WEBROAR_ROOT,"..","webroar-#{gem_list[index]}","conf","config.yml")) + gem_list.delete_at(index) + else + index = index + 1 + end end if gem_list.length == 0 puts "not found." return false