bin/aipim in aipim-rails-0.0.174 vs bin/aipim in aipim-rails-0.0.179

- old
+ new

@@ -31,47 +31,44 @@ # Bootstrap system('cp '+path+'lib/assets/bootstrap.min.css aipim/html') # jQuery system('cp '+path+'lib/assets/jquery-1.9.1.js aipim/html') + #Copia o arquivo de configuracao + system('cp -n '+path+'config/aipim.yml config') + # resolucao padrĂ£o width = "1366" height = "768" - screenshot = true + # argumentos ARGV.each_with_index do |arg, i| if i > 0 # argumento da resolucao if ARGV[i] == '--resolution' width = ARGV[i+1].split("x")[0] height = ARGV[i+1].split("x")[1] - # argumento do screenshot - elsif ARGV[i] == '--no-screenshot' - screenshot = false end end end - if screenshot - # le o arquivo de configuracao do screenshot - f = File.open(path+'lib/webdriver/screenshot.rb', "r") - # salva tudo numa string - f_str = "" - f.each_line {|line| f_str = f_str + line} - # substitui os valores da resolucao - f_str = f_str.gsub("SCREENSHOT_HEIGHT", height).gsub("SCREENSHOT_WIDTH", width) - f.close - # abre o arquivo de configuracao do screenshot na pasta do cucumber - f = File.open("features/support/screenshot.rb", "w") - # coloca a string nesse arquivo - f.puts f_str - f.close - else - system('rm -f features/support/screenshot.rb') - end + # le o arquivo de configuracao do screenshot + f = File.open(path+'lib/webdriver/screenshot.rb', "r") + # salva tudo numa string + f_str = "" + f.each_line {|line| f_str = f_str + line} + # substitui os valores da resolucao + f_str = f_str.gsub("SCREENSHOT_HEIGHT", height).gsub("SCREENSHOT_WIDTH", width) + f.close + # abre o arquivo de configuracao do screenshot na pasta do cucumber + f = File.open("features/support/screenshot.rb", "w") + # coloca a string nesse arquivo + f.puts f_str + f.close + elsif ARGV[0] == 'html' # remove os htmls antigos %x[rm -f aipim/html/*.feature.html] # pega o nome das features files = get_files @@ -84,6 +81,18 @@ # gera a index do relatorio Html.index(features) # geara o html das features Html.features(features) -end + +elsif ARGV[0] == '--screenshot' + config = YAML.load_file("config/aipim.yml") + config['screenshot'] = true + File.open("config/aipim.yml", 'w') {|file| file.write config.to_yaml } #Store + + +elsif ARGV[0] == '--no-screenshot' + config = YAML.load_file("config/aipim.yml") + config['screenshot'] = false + File.open("config/aipim.yml", 'w') {|file| file.write config.to_yaml } #Store + +end \ No newline at end of file