bin/calabash-ios-build.rb in calabash-cucumber-0.9.67 vs bin/calabash-ios-build.rb in calabash-cucumber-0.9.68
- old
+ new
@@ -1,16 +1,19 @@
+def ensure_build_dir(options={:build_dir => "Calabash"})
+ if !File.exist?(options[:build_dir])
+ FileUtils.mkdir_p options[:build_dir]
+ end
+end
def build(options={:build_dir=>"Calabash",
:configuration => "Debug",
:sdk => "iphonesimulator",
:dstroot => "Calabash/build",
:wrapper_name => "Calabash.app"})
#Follow Pete's .xcconfig-based approach with zero-config
- if !File.exist?(options[:build_dir])
- FileUtils.mkdir_p options[:build_dir]
- end
+ ensure_build_dir(options)
if !File.exists?("#{options[:build_dir]}/cal.xcconfig")
FileUtils.cp(File.join(File.dirname(__FILE__),"cal.xcconfig"),"#{options[:build_dir]}/cal.xcconfig")
end
@@ -30,15 +33,17 @@
cmd << %Q[DSTROOT="#{options[:dstroot]}"]
cmd << %Q[WRAPPER_NAME="#{options[:wrapper_name]}"]
+ res =nil
msg("Calabash Build") do
cmd_s = cmd.join(" ")
puts cmd_s
- system(cmd_s)
+ res=system(cmd_s)
end
+ res
end
def console(options={:script => "irb_ios5.sh"})
if !File.exists?(".irbrc")
puts "Copying calabash-ios .irbrc file to current directory..."
@@ -49,5 +54,38 @@
FileUtils.cp(File.join(@source_dir,options[:script]), ".")
end
puts "Running irb with ./.irbrc..."
system("./#{options[:script]}")
end
+
+
+def run(options={:build_dir=>"Calabash",
+ :configuration => "Debug",
+ :sdk => "iphonesimulator",
+ :dstroot => "Calabash/build",
+ :wrapper_name => "Calabash.app"})
+ if ENV['NO_DOWNLOAD'] != "1"
+ if !File.directory?("calabash.framework")
+ calabash_download(ARGV)
+ end
+ end
+
+ if ENV['NO_BUILD'] != "1"
+ if !build(options)
+ msg("Info") do
+ puts "Build failed. Please consult logs. Aborting."
+ end
+ end
+ end
+
+ if ENV["NO_GEN"] != "1"
+ if !File.directory?("features")
+ calabash_scaffold
+ end
+ end
+
+ default_path = "#{options[:dstroot]}/#{options[:wrapper_name]}"
+ cmd = %Q[APP_BUNDLE_PATH="#{ENV['APP_BUNDLE_PATH'] || default_path}" cucumber]
+ puts cmd
+ system(cmd)
+ puts "Done..."
+end
\ No newline at end of file