#!/usr/bin/env ruby require 'fileutils' features_dir = File.join( FileUtils.pwd, "features" ) source_dir = File.join( File.dirname(__FILE__), '..', 'features-skeleton' ) if File.exists?( features_dir ) if (ARGV.length == 1 && ARGV[0] == 'update') features_dir = File.join( FileUtils.pwd, "features_template") if File.exists?( features_dir ) puts "Working directory #{features_dir} already exist." puts "Please move it and run calabash update again to continue." exit 2 end FileUtils.cp_r( source_dir, features_dir) puts < ----------------------------------- EOS exit else puts "A features directory already exists. I won't overwrite it. Giving up." puts "Run calabash update for update instructions." end exit 1 else puts "I'm about to create a subdirectory called features." puts "features will contain all your calabash tests." puts "Please hit return to confirm that's what you want." exit 2 unless STDIN.gets.chomp == '' FileUtils.cp_r( source_dir, features_dir ) puts "features subdirectory created. Try starting you app in the iOS simulator " puts "using the Calabash target (see calabash-ios-server for how to create the target).\n" puts "Then try executing \n\nSTEP_PAUSE=2 OS=ios5 DEVICE=iphone cucumber" puts "\n (replace ios5 with ios4 if running iOS 4.x simulator.\nReplace iphone with ipad if running iPad simulator.).\n" end