require 'briar' require 'rainbow' require 'ansi/code' require 'ansi/string' require 'ansi/mixin' require 'ansi/columns' # these have been deprecated since 0.1.3 BRIAR_RM_CAL_TARGETS='rm-cal-targets' BRIAR_INSTALL_CALABASH_GEM='calabash-gem' BRIAR_INSTALL_CALABASH_SERVER='calabash-server' BRIAR_INSTALL_GEM='gem' BRIAR_RESIGN_IPA='resign' BRIAR_VERSION_CMD='version' BRIAR_CMD_INSTALL='install' def warn_deprecated(version, msg) puts ANSI.cyan { "deprecated'#{version}' - '#{msg}'" } end def help_warn_destructive Rainbow('# These is are destructive operations! You have been warned.').red.underline end def help_experimental Rainbow('EXPERIMENTAL').underline.magenta end def help_not_available_ruby18 Rainbow('RUBY > 1.8').underline.magenta end def help_deprecated(version, msg) ANSI.cyan { "DEPRECATED #{version} - #{msg}" } end def help_nyi ANSI.yellow { 'NYI' } end def help_command(sig) Rainbow("briar #{sig}").cyan end def help_requires_env_vars Rainbow('REQUIRES ENV VARIABLES').magenta end def help_env_var(name, msg) "#{Rainbow(name).yellow} => #{msg}" end def help_examples 'EXAMPLES' end def help_example_comment(comment) Rainbow("# #{comment}").magenta end def help_example(example) Rainbow("$ briar #{example}").cyan end def help_requires_dot_xamarin Rainbow('REQUIRES adopting .xamarin convention.').magenta end def help_see_dot_xamarin_help "see #{Rainbow('$ briar help .xamarin').yellow} for details" end def help_requires_xtc_profiles Rainbow('REQUIRES xtc-profiles.yml').magenta end def help_see_xtc_profiles_help "see #{Rainbow('$ briar help xtc-profiles').yellow} for details" end def help_customize Rainbow('CUSTOMIZATION').green end def help_requires_cucumber_profiles Rainbow('REQUIRES cucumber profiles').magenta end def help_see_cucumber_reports_help "see #{Rainbow('$ briar help cucumber-reports').yellow} for details" end def print_dot_xamarin_help puts <')} do a clean install of an .ipa on device if #{Rainbow("ENV['IPA_BUILD_SCRIPT']").yellow} is defined, this command will call that script to generate an .ipa. #{help_requires_dot_xamarin} #{help_see_dot_xamarin_help} #{help_requires_env_vars} #{help_env_var(' IPA', 'path to the .ipa you want installed')} #{help_env_var(' BUNDLE_ID', 'bundle id of the app - eg. com.littlejoysoftware.Briar-cal')} #{help_env_var('IDEVICEINSTALLER_BIN', 'path to ideviceinstaller binary')} #{help_env_var(' IPA_BUILD_SCRIPT', '(optional) script that generates the IPA')} #{help_warn_destructive} EOF end def print_console_help puts <')} start a calabash console against a physical device #{help_requires_dot_xamarin} #{help_see_dot_xamarin_help} #{help_examples} #{help_example('console venus')} #{help_customize} #{help_example_comment('you can customize the console using these variables')} #{help_env_var(' SCREENSHOT_PATH', 'where to put console screenshots - defaults to ./screenshots')} #{help_env_var(' DEBUG', 'verbose logging')} #{help_env_var('CALABASH_FULL_CONSOLE_OUTPUT', 'verboser logging')} #{help_env_var(' IRBRC', 'location of custom .irbrc file - defaults to ./.irbrc')} #{help_env_var(' BUNDLE_EXEC', 'start console with bundle exec - defaults to 0')} #{help_not_available_ruby18} EOF end def print_resign_help puts < ')} EOF end def print_cucumber_reports_help puts < html_report: -f 'Calabash::Formatters::Html' -o <%= default_report %> default: -p html_report").yellow} #{help_example_comment('run wip tests on iOS 7 simulator and then open the results')} #{Rainbow('$ cucumber -t @wip').cyan} #{Rainbow('$ briar report').cyan} For a more complete example see: https://github.com/jmoody/briar-ios-example/blob/master/Briar/cucumber.yml #{help_example_comment('run keyboard tests on the iOS 6 simulator using sim launch then open the results')} #{Rainbow('$ cucumber -p sim6 -p launch -t @keyboard').cyan} #{Rainbow('$ briar report').cyan} #{help_example_comment('run table view tests on venus (an iOS 7 iPad 4)then open the the results')} #{Rainbow('$ cucumber -p venus -t @table').cyan} #{Rainbow('$ briar report').cyan} EOF end def print_report_help puts <')} opens the most recent cucumber report generated by a run against < device > in the default browser #{help_requires_dot_xamarin} #{help_see_dot_xamarin_help} EOF end def print_sim_help puts <')} quits the simulator and sets the default simulator to #{help_examples} #{help_example('sim iphone_4in')} #{help_example('sim ipad_r')} #{help_example('sim iphone_4in_64')} EOF end def print_xtc_help puts < [profile]')} #{help_experimental} submits a job to the XTC targeting devices specified in < device-set > if no profile is set, the 'default' profile in the xtc-cucumber.yml will be used #{help_command('xtc [build args]')} #{help_experimental} submits a job to the XTC targeting devices specified in < device-set > using the cucumber profile specified by < profile >. you can optionally pass build arguments to to control your xamarin build script. #{help_requires_env_vars} #{help_env_var(' IPA', 'path to the .ipa you submitting')} #{help_env_var(' XTC_PROFILES', 'cucumber profiles for the XTC')} #{help_env_var(' XTC_ACCOUNT', 'name of a directory in ~/.xamarin/test-cloud/ that contains the api token')} #{help_example_comment('if a build script is defined, the .ipa will be built before submission')} #{help_env_var(' IPA_BUILD_SCRIPT', '(optional) script that generates the IPA')} #{help_example_comment('if you require other gems besides briar')} #{help_env_var(' XTC_OTHER_GEMS_FILE', 'path to a file describing other gems that should be installed on the XTC')} #{help_example_comment("only useful if you are briar developer - defaults to '0'")} #{help_env_var(' XTC_BRIAR_GEM_DEV', "(optional) set to '1' to ensure the local version of briar will be uploaded to the XTC'")} #{help_example_comment("only useful if you are calabash developer - defaults to '0'")} #{help_env_var('XTC_CALABASH_GEM_DEV', "(optional) set to '1' to ensure the local version of calabash will be uploaded to the XTC'")} #{help_env_var(' XTC_STAGING_DIR', 'path to the directory where XTC files will be staged')} #{help_env_var(' XTC_SERIES', '(optional) the XTC series the test results should be displayed in')} #{help_example_comment("defaults to '1' - set to '0' if you want to wait for the XTC to finish (for example in a CI environment)")} #{help_env_var('XTC_WAIT_FOR_RESULTS', '(optional) should briar xtc wait for the XTC job to finish before exiting')} EOF end def print_xtc_profiles_help puts < [profile]').yellow} command, set the #{Rainbow('XTC_PROFILES').cyan} variable to your xtc-profiles.yml EOF end def print_tags_help puts < } #{help_experimental} install { calabash-server | } report [device] resign #{help_experimental} rm { sim-targets | dups [project-name] } sim [{quit | }] #{help_experimental} tags #{help_experimental} version xtc { [ [profile]] | [ [build args] } #{help_experimental} #{Rainbow('ADDITIONAL HELP TOPICS').green} help .xamarin help cucumber-reports help xtc-profiles #{Rainbow('DEPRECATED').yellow} * #{Rainbow(BRIAR_RM_CAL_TARGETS).yellow} #{help_deprecated('0.1.3', 'replaced with $ briar rm sim-targets')} * #{Rainbow("#{BRIAR_CMD_INSTALL} #{BRIAR_INSTALL_GEM}").yellow} #{help_deprecated('0.1.3', 'will be removed')} * #{Rainbow("#{BRIAR_CMD_INSTALL} #{BRIAR_INSTALL_CALABASH_GEM}").yellow} #{help_deprecated('0.1.3', 'will be removed')} EOF end