fastlane 1.111.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +76 -111
- data/bin/bin-proxy +19 -0
- data/cert/README.md +163 -0
- data/cert/lib/cert.rb +18 -0
- data/cert/lib/cert/commands_generator.rb +51 -0
- data/cert/lib/cert/options.rb +67 -0
- data/cert/lib/cert/runner.rb +181 -0
- data/credentials_manager/README.md +62 -0
- data/credentials_manager/lib/credentials_manager.rb +12 -0
- data/credentials_manager/lib/credentials_manager/account_manager.rb +104 -0
- data/credentials_manager/lib/credentials_manager/appfile_config.rb +186 -0
- data/credentials_manager/lib/credentials_manager/cli.rb +65 -0
- data/deliver/README.md +271 -0
- data/deliver/lib/assets/DeliverfileDefault +10 -0
- data/deliver/lib/assets/ScreenshotsHelp +7 -0
- data/deliver/lib/assets/summary.html.erb +210 -0
- data/deliver/lib/deliver.rb +31 -0
- data/deliver/lib/deliver/app_screenshot.rb +226 -0
- data/deliver/lib/deliver/commands_generator.rb +150 -0
- data/deliver/lib/deliver/detect_values.rb +69 -0
- data/deliver/lib/deliver/download_screenshots.rb +46 -0
- data/deliver/lib/deliver/generate_summary.rb +9 -0
- data/deliver/lib/deliver/html_generator.rb +58 -0
- data/deliver/lib/deliver/loader.rb +18 -0
- data/deliver/lib/deliver/options.rb +269 -0
- data/deliver/lib/deliver/runner.rb +99 -0
- data/deliver/lib/deliver/setup.rb +78 -0
- data/deliver/lib/deliver/submit_for_review.rb +87 -0
- data/deliver/lib/deliver/upload_assets.rb +22 -0
- data/deliver/lib/deliver/upload_metadata.rb +191 -0
- data/deliver/lib/deliver/upload_price_tier.rb +21 -0
- data/deliver/lib/deliver/upload_screenshots.rb +110 -0
- data/fastlane/README.md +193 -0
- data/{lib → fastlane/lib}/assets/Actions.md.erb +0 -0
- data/{lib → fastlane/lib}/assets/AppfileTemplate +0 -0
- data/{lib → fastlane/lib}/assets/AppfileTemplateAndroid +0 -0
- data/{lib → fastlane/lib}/assets/AvailablePlugins.md.erb +0 -0
- data/{lib → fastlane/lib}/assets/DefaultFastfileTemplate +2 -2
- data/{lib → fastlane/lib}/assets/FastfileTemplateAndroid +2 -2
- data/{lib → fastlane/lib}/assets/completions/completion.bash +0 -0
- data/{lib → fastlane/lib}/assets/completions/completion.sh +0 -0
- data/{lib → fastlane/lib}/assets/completions/completion.zsh +0 -0
- data/{lib → fastlane/lib}/assets/custom_action_template.rb +0 -0
- data/{lib → fastlane/lib}/assets/mailgun_html_template.erb +0 -0
- data/{lib → fastlane/lib}/assets/report_template.xml.erb +0 -0
- data/{lib → fastlane/lib}/assets/s3_html_template.erb +0 -0
- data/{lib → fastlane/lib}/assets/s3_plist_template.erb +0 -0
- data/{lib → fastlane/lib}/assets/s3_version_template.erb +0 -0
- data/{lib → fastlane/lib}/fastlane.rb +3 -3
- data/{lib → fastlane/lib}/fastlane/action.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/action_collector.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/README.md +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/actions_helper.rb +16 -0
- data/{lib → fastlane/lib}/fastlane/actions/adb.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/adb_devices.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/add_git_tag.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/app_store_build_number.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/appaloosa.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/appetize.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/appetize_viewing_url_generator.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/appium.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/appledoc.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/appstore.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/apteligent.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/artifactory.rb +2 -0
- data/{lib → fastlane/lib}/fastlane/actions/backup_file.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/backup_xcarchive.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/badge.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/build_and_upload_to_appetize.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/bundle_install.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/carthage.rb +1 -1
- data/{lib → fastlane/lib}/fastlane/actions/cert.rb +0 -4
- data/{lib → fastlane/lib}/fastlane/actions/changelog_from_git_commits.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/chatwork.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/clean_build_artifacts.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/clean_cocoapods_cache.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/clear_derived_data.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/clipboard.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/cloc.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/cocoapods.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/commit_version_bump.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/copy_artifacts.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/crashlytics.rb +2 -0
- data/{lib → fastlane/lib}/fastlane/actions/create_keychain.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/create_pull_request.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/danger.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/debug.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/default_platform.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/delete_keychain.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/deliver.rb +0 -4
- data/{lib → fastlane/lib}/fastlane/actions/deploygate.rb +34 -19
- data/{lib → fastlane/lib}/fastlane/actions/device_grid/README.md +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/dotgpg_environment.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/download.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/download_dsyms.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/dsym_zip.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/ensure_git_branch.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/ensure_git_status_clean.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/ensure_no_debug_code.rb +10 -2
- data/{lib → fastlane/lib}/fastlane/actions/ensure_xcode_version.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/erb.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/fastlane_version.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/flock.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/frameit.rb +6 -10
- data/{lib → fastlane/lib}/fastlane/actions/gcovr.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/get_build_number.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/get_build_number_repository.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/get_github_release.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/get_info_plist_value.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/get_ipa_info_plist_value.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/get_version_number.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/git_add.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/git_branch.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/git_commit.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/git_pull.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/git_tag_exists.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/gradle.rb +0 -0
- data/fastlane/lib/fastlane/actions/gym.rb +84 -0
- data/{lib → fastlane/lib}/fastlane/actions/hg_add_tag.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/hg_commit_version_bump.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/hg_ensure_clean_status.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/hg_push.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/hipchat.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/hockey.rb +37 -11
- data/{lib → fastlane/lib}/fastlane/actions/ifttt.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/import.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/import_certificate.rb +2 -0
- data/{lib → fastlane/lib}/fastlane/actions/import_from_git.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/increment_build_number.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/increment_version_number.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/install_on_device.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/install_xcode_plugin.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/installr.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/ipa.rb +12 -4
- data/{lib → fastlane/lib}/fastlane/actions/is_ci.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/jazzy.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/jira.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/lane_context.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/last_git_commit.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/last_git_tag.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/latest_testflight_build_number.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/lcov.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/mailgun.rb +2 -0
- data/{lib → fastlane/lib}/fastlane/actions/make_changelog_from_jenkins.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/match.rb +3 -9
- data/{lib → fastlane/lib}/fastlane/actions/nexus_upload.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/notification.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/notify.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/number_of_commits.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/oclint.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/onesignal.rb +3 -0
- data/{lib → fastlane/lib}/fastlane/actions/opt_out_usage.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/pem.rb +9 -15
- data/{lib → fastlane/lib}/fastlane/actions/pilot.rb +6 -12
- data/{lib → fastlane/lib}/fastlane/actions/pod_lib_lint.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/pod_push.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/podio_item.rb +2 -0
- data/{lib → fastlane/lib}/fastlane/actions/produce.rb +7 -11
- data/{lib → fastlane/lib}/fastlane/actions/prompt.rb +5 -2
- data/{lib → fastlane/lib}/fastlane/actions/push_git_tags.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/push_to_git_remote.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/puts.rb +8 -0
- data/{lib → fastlane/lib}/fastlane/actions/read_podspec.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/recreate_schemes.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/register_devices.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/reset_git_repo.rb +0 -0
- data/fastlane/lib/fastlane/actions/reset_simulator_contents.rb +62 -0
- data/{lib → fastlane/lib}/fastlane/actions/resign.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/restore_file.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/rocket.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/rsync.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/s3.rb +2 -1
- data/{lib → fastlane/lib}/fastlane/actions/say.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/scan.rb +0 -4
- data/{lib → fastlane/lib}/fastlane/actions/scp.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/screengrab.rb +7 -13
- data/{lib → fastlane/lib}/fastlane/actions/set_build_number_repository.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/set_changelog.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/set_github_release.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/set_info_plist_value.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/set_pod_key.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/setup_jenkins.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/sigh.rb +9 -15
- data/{lib → fastlane/lib}/fastlane/actions/skip_docs.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/slack.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/slather.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/snapshot.rb +5 -11
- data/{lib → fastlane/lib}/fastlane/actions/sonar.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/splunkmint.rb +3 -0
- data/{lib → fastlane/lib}/fastlane/actions/ssh.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/supply.rb +9 -13
- data/{lib → fastlane/lib}/fastlane/actions/swiftlint.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/team_id.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/team_name.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/testfairy.rb +28 -9
- data/{lib → fastlane/lib}/fastlane/actions/testflight.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/tryouts.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/twitter.rb +4 -0
- data/{lib → fastlane/lib}/fastlane/actions/typetalk.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/unlock_keychain.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/update_app_group_identifiers.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/update_app_identifier.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/update_fastlane.rb +1 -20
- data/{lib → fastlane/lib}/fastlane/actions/update_icloud_container_identifiers.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/update_info_plist.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/update_project_code_signing.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/update_project_provisioning.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/update_project_team.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/update_urban_airship_configuration.rb +4 -0
- data/{lib → fastlane/lib}/fastlane/actions/update_url_schemes.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/upload_symbols_to_crashlytics.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/upload_symbols_to_sentry.rb +2 -0
- data/{lib → fastlane/lib}/fastlane/actions/verify_build.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/verify_pod_keys.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/verify_xcode.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/version_bump_podspec.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/version_get_podspec.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/xcode_install.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/xcode_select.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/xcode_server_get_assets.rb +1 -0
- data/{lib → fastlane/lib}/fastlane/actions/xcodebuild.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/xcov.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/xctool.rb +1 -1
- data/{lib → fastlane/lib}/fastlane/actions/xcversion.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/actions/zip.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/auto_complete.rb +0 -0
- data/fastlane/lib/fastlane/cli_tools_distributor.rb +125 -0
- data/{lib → fastlane/lib}/fastlane/command_line_handler.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/commands_generator.rb +5 -4
- data/{lib → fastlane/lib}/fastlane/configuration_helper.rb +0 -1
- data/{lib → fastlane/lib}/fastlane/core_ext/bundler_monkey_patch.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/documentation/actions_list.rb +1 -1
- data/{lib → fastlane/lib}/fastlane/documentation/docs_generator.rb +1 -1
- data/{lib → fastlane/lib}/fastlane/documentation/markdown_docs_generator.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/environment_printer.rb +1 -1
- data/{lib → fastlane/lib}/fastlane/erb_template_helper.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/fast_file.rb +1 -1
- data/{lib → fastlane/lib}/fastlane/fastlane_require.rb +27 -3
- data/{lib → fastlane/lib}/fastlane/features.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/helper/README.md +0 -0
- data/{lib → fastlane/lib}/fastlane/helper/adb_helper.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/helper/cocoapod_helper.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/helper/crashlytics_helper.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/helper/gem_helper.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/helper/git_helper.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/helper/gradle_helper.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/helper/podspec_helper.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/helper/sh_helper.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/helper/xcversion_helper.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/junit_generator.rb +1 -1
- data/{lib → fastlane/lib}/fastlane/lane.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/lane_list.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/lane_manager.rb +25 -6
- data/{lib → fastlane/lib}/fastlane/markdown_table_formatter.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/new_action.rb +1 -1
- data/{lib → fastlane/lib}/fastlane/one_off.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/other_action.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/plugin_fetcher.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/plugin_generator.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/plugin_generator_ui.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/plugin_info.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/plugin_info_collector.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/plugin_manager.rb +4 -4
- data/{lib → fastlane/lib}/fastlane/plugins/plugin_search.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/plugin_update_manager.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/plugins.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/template/%gem_name%.gemspec.erb +3 -0
- data/{lib → fastlane/lib}/fastlane/plugins/template/.gitignore +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/template/.rspec +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/template/.rubocop.yml +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/template/.travis.yml +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/template/Gemfile +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/template/LICENSE.erb +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/template/README.md.erb +2 -2
- data/{lib → fastlane/lib}/fastlane/plugins/template/Rakefile +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/template/circle.yml +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/template/fastlane/Fastfile.erb +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/template/fastlane/Pluginfile.erb +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/template/lib/fastlane/plugin/%plugin_name%.rb.erb +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/template/lib/fastlane/plugin/%plugin_name%/actions/%plugin_name%_action.rb.erb +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/template/lib/fastlane/plugin/%plugin_name%/helper/%plugin_name%_helper.rb.erb +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/template/lib/fastlane/plugin/%plugin_name%/version.rb.erb +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/template/spec/%plugin_name%_action_spec.rb.erb +0 -0
- data/{lib → fastlane/lib}/fastlane/plugins/template/spec/spec_helper.rb.erb +0 -0
- data/{lib → fastlane/lib}/fastlane/runner.rb +25 -2
- data/{lib → fastlane/lib}/fastlane/setup/crashlytics_beta.rb +1 -1
- data/{lib → fastlane/lib}/fastlane/setup/crashlytics_beta_command_line_handler.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/setup/crashlytics_beta_info.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/setup/crashlytics_beta_info_collector.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/setup/crashlytics_beta_ui.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/setup/crashlytics_beta_user_email_fetcher.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/setup/crashlytics_project_parser.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/setup/setup.rb +2 -2
- data/{lib → fastlane/lib}/fastlane/setup/setup_android.rb +2 -2
- data/{lib → fastlane/lib}/fastlane/setup/setup_ios.rb +3 -3
- data/{lib → fastlane/lib}/fastlane/supported_platforms.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/tools.rb +0 -0
- data/{lib → fastlane/lib}/fastlane/version.rb +2 -2
- data/fastlane_core/README.md +54 -0
- data/fastlane_core/lib/assets/XMLTemplate.xml.erb +12 -0
- data/fastlane_core/lib/fastlane_core.rb +48 -0
- data/fastlane_core/lib/fastlane_core/cert_checker.rb +94 -0
- data/fastlane_core/lib/fastlane_core/command_executor.rb +98 -0
- data/fastlane_core/lib/fastlane_core/configuration/commander_generator.rb +82 -0
- data/fastlane_core/lib/fastlane_core/configuration/config_item.rb +133 -0
- data/fastlane_core/lib/fastlane_core/configuration/configuration.rb +266 -0
- data/fastlane_core/lib/fastlane_core/configuration/configuration_file.rb +82 -0
- data/fastlane_core/lib/fastlane_core/core_ext/string.rb +17 -0
- data/fastlane_core/lib/fastlane_core/device_manager.rb +231 -0
- data/fastlane_core/lib/fastlane_core/env.rb +9 -0
- data/{lib/fastlane → fastlane_core/lib/fastlane_core}/fastlane_folder.rb +1 -11
- data/fastlane_core/lib/fastlane_core/feature/feature.rb +49 -0
- data/fastlane_core/lib/fastlane_core/features.rb +2 -0
- data/fastlane_core/lib/fastlane_core/helper.rb +240 -0
- data/fastlane_core/lib/fastlane_core/ipa_file_analyser.rb +55 -0
- data/fastlane_core/lib/fastlane_core/ipa_upload_package_builder.rb +44 -0
- data/fastlane_core/lib/fastlane_core/itunes_search_api.rb +48 -0
- data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +409 -0
- data/fastlane_core/lib/fastlane_core/keychain_importer.rb +27 -0
- data/fastlane_core/lib/fastlane_core/languages.rb +11 -0
- data/fastlane_core/lib/fastlane_core/pkg_file_analyser.rb +42 -0
- data/fastlane_core/lib/fastlane_core/pkg_upload_package_builder.rb +44 -0
- data/fastlane_core/lib/fastlane_core/print_table.rb +63 -0
- data/fastlane_core/lib/fastlane_core/project.rb +450 -0
- data/fastlane_core/lib/fastlane_core/provisioning_profile.rb +69 -0
- data/fastlane_core/lib/fastlane_core/string_filters.rb +34 -0
- data/fastlane_core/lib/fastlane_core/tool_collector.rb +179 -0
- data/fastlane_core/lib/fastlane_core/ui/disable_colors.rb +17 -0
- data/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb +190 -0
- data/fastlane_core/lib/fastlane_core/ui/github_issue_inspector_reporter.rb +50 -0
- data/fastlane_core/lib/fastlane_core/ui/implementations/shell.rb +122 -0
- data/fastlane_core/lib/fastlane_core/ui/interface.rb +159 -0
- data/fastlane_core/lib/fastlane_core/ui/ui.rb +26 -0
- data/fastlane_core/lib/fastlane_core/update_checker/changelog.rb +37 -0
- data/fastlane_core/lib/fastlane_core/update_checker/update_checker.rb +198 -0
- data/fastlane_core/lib/fastlane_core/xcodebuild_list_output_parser.rb +28 -0
- data/frameit/README.md +284 -0
- data/frameit/lib/assets/empty.png +0 -0
- data/frameit/lib/frameit.rb +52 -0
- data/frameit/lib/frameit/commands_generator.rb +99 -0
- data/frameit/lib/frameit/config_parser.rb +98 -0
- data/frameit/lib/frameit/dependency_checker.rb +20 -0
- data/frameit/lib/frameit/device_types.rb +13 -0
- data/frameit/lib/frameit/editor.rb +351 -0
- data/frameit/lib/frameit/frame_downloader.rb +71 -0
- data/frameit/lib/frameit/mac_editor.rb +32 -0
- data/frameit/lib/frameit/offsets.rb +19 -0
- data/frameit/lib/frameit/options.rb +46 -0
- data/frameit/lib/frameit/runner.rb +45 -0
- data/frameit/lib/frameit/screenshot.rb +89 -0
- data/frameit/lib/frameit/strings_parser.rb +35 -0
- data/frameit/lib/frameit/template_finder.rb +36 -0
- data/gym/README.md +288 -0
- data/gym/lib/assets/GymfileTemplate +13 -0
- data/gym/lib/assets/package_application_patches/0001_codesign_args_patch.diff +38 -0
- data/gym/lib/assets/package_application_patches/0002_no_strict_parameter_patch.diff +42 -0
- data/gym/lib/assets/package_application_patches/PackageApplication_MD5 +2 -0
- data/gym/lib/assets/wrap_xcodebuild/xcbuild-safe.sh +58 -0
- data/gym/lib/gym.rb +49 -0
- data/gym/lib/gym/commands_generator.rb +62 -0
- data/gym/lib/gym/detect_values.rb +105 -0
- data/gym/lib/gym/error_handler.rb +186 -0
- data/gym/lib/gym/generators/README.md +1 -0
- data/gym/lib/gym/generators/build_command_generator.rb +136 -0
- data/gym/lib/gym/generators/package_command_generator.rb +58 -0
- data/gym/lib/gym/generators/package_command_generator_legacy.rb +102 -0
- data/gym/lib/gym/generators/package_command_generator_xcode7.rb +191 -0
- data/gym/lib/gym/manager.rb +17 -0
- data/gym/lib/gym/options.rb +254 -0
- data/gym/lib/gym/runner.rb +256 -0
- data/gym/lib/gym/xcode.rb +21 -0
- data/gym/lib/gym/xcodebuild_fixes/README.md +9 -0
- data/gym/lib/gym/xcodebuild_fixes/generic_archive_fix.rb +32 -0
- data/gym/lib/gym/xcodebuild_fixes/package_application_fix.rb +53 -0
- data/gym/lib/gym/xcodebuild_fixes/swift_fix.rb +99 -0
- data/gym/lib/gym/xcodebuild_fixes/watchkit2_fix.rb +35 -0
- data/gym/lib/gym/xcodebuild_fixes/watchkit_fix.rb +40 -0
- data/match/README.md +414 -0
- data/match/lib/assets/MatchfileTemplate +9 -0
- data/match/lib/assets/READMETemplate.md +49 -0
- data/match/lib/match.rb +57 -0
- data/match/lib/match/change_password.rb +30 -0
- data/match/lib/match/commands_generator.rb +120 -0
- data/match/lib/match/encrypt.rb +93 -0
- data/match/lib/match/generator.rb +74 -0
- data/match/lib/match/git_helper.rb +139 -0
- data/match/lib/match/nuke.rb +190 -0
- data/match/lib/match/options.rb +124 -0
- data/match/lib/match/runner.rb +172 -0
- data/match/lib/match/setup.rb +20 -0
- data/match/lib/match/spaceship_ensure.rb +78 -0
- data/match/lib/match/table_printer.rb +43 -0
- data/match/lib/match/utils.rb +59 -0
- data/pem/README.md +175 -0
- data/pem/lib/pem.rb +21 -0
- data/pem/lib/pem/commands_generator.rb +41 -0
- data/pem/lib/pem/manager.rb +93 -0
- data/pem/lib/pem/options.rb +79 -0
- data/pilot/README.md +285 -0
- data/pilot/lib/pilot.rb +22 -0
- data/pilot/lib/pilot/build_manager.rb +209 -0
- data/pilot/lib/pilot/commands_generator.rb +136 -0
- data/pilot/lib/pilot/features.rb +0 -0
- data/pilot/lib/pilot/manager.rb +71 -0
- data/pilot/lib/pilot/options.rb +161 -0
- data/pilot/lib/pilot/tester_exporter.rb +37 -0
- data/pilot/lib/pilot/tester_importer.rb +51 -0
- data/pilot/lib/pilot/tester_manager.rb +212 -0
- data/pilot/lib/pilot/tester_util.rb +23 -0
- data/produce/README.md +232 -0
- data/produce/lib/produce.rb +21 -0
- data/produce/lib/produce/available_default_languages.rb +36 -0
- data/produce/lib/produce/commands_generator.rb +134 -0
- data/produce/lib/produce/developer_center.rb +58 -0
- data/produce/lib/produce/group.rb +89 -0
- data/produce/lib/produce/itunes_connect.rb +87 -0
- data/produce/lib/produce/manager.rb +11 -0
- data/produce/lib/produce/options.rb +114 -0
- data/produce/lib/produce/service.rb +227 -0
- data/scan/README.md +219 -0
- data/scan/lib/assets/ScanfileTemplate +13 -0
- data/scan/lib/scan.rb +40 -0
- data/scan/lib/scan/commands_generator.rb +61 -0
- data/scan/lib/scan/detect_values.rb +184 -0
- data/scan/lib/scan/error_handler.rb +43 -0
- data/scan/lib/scan/manager.rb +17 -0
- data/scan/lib/scan/options.rb +189 -0
- data/scan/lib/scan/report_collector.rb +70 -0
- data/scan/lib/scan/runner.rb +103 -0
- data/scan/lib/scan/slack_poster.rb +59 -0
- data/scan/lib/scan/test_command_generator.rb +130 -0
- data/scan/lib/scan/test_result_parser.rb +21 -0
- data/screengrab/README.md +190 -0
- data/screengrab/lib/assets/ScreengrabfileTemplate +15 -0
- data/screengrab/lib/screengrab.rb +32 -0
- data/screengrab/lib/screengrab/android_environment.rb +88 -0
- data/screengrab/lib/screengrab/commands_generator.rb +60 -0
- data/screengrab/lib/screengrab/dependency_checker.rb +56 -0
- data/screengrab/lib/screengrab/detect_values.rb +16 -0
- data/screengrab/lib/screengrab/options.rb +109 -0
- data/screengrab/lib/screengrab/page.html.erb +206 -0
- data/screengrab/lib/screengrab/runner.rb +336 -0
- data/screengrab/lib/screengrab/setup.rb +16 -0
- data/sigh/README.md +256 -0
- data/sigh/lib/assets/resign.sh +774 -0
- data/sigh/lib/sigh.rb +19 -0
- data/sigh/lib/sigh/commands_generator.rb +133 -0
- data/sigh/lib/sigh/download_all.rb +36 -0
- data/sigh/lib/sigh/local_manage.rb +140 -0
- data/sigh/lib/sigh/manager.rb +44 -0
- data/sigh/lib/sigh/options.rb +117 -0
- data/sigh/lib/sigh/repair.rb +30 -0
- data/sigh/lib/sigh/resign.rb +201 -0
- data/sigh/lib/sigh/runner.rb +235 -0
- data/snapshot/README.md +400 -0
- data/snapshot/lib/assets/SnapfileTemplate +36 -0
- data/snapshot/lib/assets/SnapshotHelper.swift +138 -0
- data/snapshot/lib/assets/SnapshotHelper2-3.swift +140 -0
- data/snapshot/lib/snapshot.rb +59 -0
- data/snapshot/lib/snapshot/collector.rb +92 -0
- data/snapshot/lib/snapshot/commands_generator.rb +108 -0
- data/snapshot/lib/snapshot/dependency_checker.rb +50 -0
- data/snapshot/lib/snapshot/detect_values.rb +53 -0
- data/snapshot/lib/snapshot/error_handler.rb +22 -0
- data/snapshot/lib/snapshot/fixes/README.md +5 -0
- data/snapshot/lib/snapshot/fixes/hardware_keyboard_fix.rb +14 -0
- data/snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb +25 -0
- data/snapshot/lib/snapshot/latest_os_version.rb +31 -0
- data/snapshot/lib/snapshot/options.rb +161 -0
- data/snapshot/lib/snapshot/page.html.erb +206 -0
- data/snapshot/lib/snapshot/reports_generator.rb +64 -0
- data/snapshot/lib/snapshot/reset_simulators.rb +88 -0
- data/snapshot/lib/snapshot/runner.rb +294 -0
- data/snapshot/lib/snapshot/screenshot_flatten.rb +18 -0
- data/snapshot/lib/snapshot/screenshot_rotate.rb +38 -0
- data/snapshot/lib/snapshot/setup.rb +35 -0
- data/snapshot/lib/snapshot/test_command_generator.rb +118 -0
- data/snapshot/lib/snapshot/update.rb +29 -0
- data/spaceship/README.md +191 -0
- data/spaceship/lib/assets/languageMapping.json +240 -0
- data/spaceship/lib/assets/languageMappingReadable.json +30 -0
- data/spaceship/lib/spaceship.rb +31 -0
- data/spaceship/lib/spaceship/babosa_fix.rb +30 -0
- data/spaceship/lib/spaceship/base.rb +236 -0
- data/spaceship/lib/spaceship/client.rb +487 -0
- data/spaceship/lib/spaceship/commands_generator.rb +48 -0
- data/spaceship/lib/spaceship/du/du_client.rb +122 -0
- data/spaceship/lib/spaceship/du/upload_file.rb +56 -0
- data/spaceship/lib/spaceship/du/utilities.rb +81 -0
- data/spaceship/lib/spaceship/helper/net_http_generic_request.rb +14 -0
- data/spaceship/lib/spaceship/helper/plist_middleware.rb +15 -0
- data/spaceship/lib/spaceship/launcher.rb +94 -0
- data/spaceship/lib/spaceship/playground.rb +72 -0
- data/spaceship/lib/spaceship/portal/app.rb +148 -0
- data/spaceship/lib/spaceship/portal/app_group.rb +77 -0
- data/spaceship/lib/spaceship/portal/app_service.rb +278 -0
- data/spaceship/lib/spaceship/portal/certificate.rb +333 -0
- data/spaceship/lib/spaceship/portal/device.rb +192 -0
- data/spaceship/lib/spaceship/portal/portal.rb +8 -0
- data/spaceship/lib/spaceship/portal/portal_base.rb +13 -0
- data/spaceship/lib/spaceship/portal/portal_client.rb +491 -0
- data/spaceship/lib/spaceship/portal/provisioning_profile.rb +467 -0
- data/spaceship/lib/spaceship/portal/spaceship.rb +112 -0
- data/spaceship/lib/spaceship/portal/ui/select_team.rb +83 -0
- data/spaceship/lib/spaceship/spaceauth_runner.rb +50 -0
- data/spaceship/lib/spaceship/tunes/app_details.rb +139 -0
- data/spaceship/lib/spaceship/tunes/app_image.rb +55 -0
- data/spaceship/lib/spaceship/tunes/app_ratings.rb +107 -0
- data/spaceship/lib/spaceship/tunes/app_screenshot.rb +17 -0
- data/spaceship/lib/spaceship/tunes/app_status.rb +60 -0
- data/spaceship/lib/spaceship/tunes/app_submission.rb +136 -0
- data/spaceship/lib/spaceship/tunes/app_trailer.rb +68 -0
- data/spaceship/lib/spaceship/tunes/app_version.rb +766 -0
- data/spaceship/lib/spaceship/tunes/app_version_common.rb +33 -0
- data/spaceship/lib/spaceship/tunes/app_version_generated_promocodes.rb +35 -0
- data/spaceship/lib/spaceship/tunes/app_version_history.rb +59 -0
- data/spaceship/lib/spaceship/tunes/app_version_promocodes.rb +34 -0
- data/spaceship/lib/spaceship/tunes/app_version_ref.rb +19 -0
- data/spaceship/lib/spaceship/tunes/app_version_states_history.rb +34 -0
- data/spaceship/lib/spaceship/tunes/application.rb +437 -0
- data/spaceship/lib/spaceship/tunes/build.rb +269 -0
- data/spaceship/lib/spaceship/tunes/build_details.rb +48 -0
- data/spaceship/lib/spaceship/tunes/build_train.rb +182 -0
- data/spaceship/lib/spaceship/tunes/device_type.rb +14 -0
- data/spaceship/lib/spaceship/tunes/language_converter.rb +63 -0
- data/spaceship/lib/spaceship/tunes/language_item.rb +56 -0
- data/spaceship/lib/spaceship/tunes/pricing_tier.rb +81 -0
- data/spaceship/lib/spaceship/tunes/recovery_device.rb +69 -0
- data/spaceship/lib/spaceship/tunes/spaceship.rb +34 -0
- data/spaceship/lib/spaceship/tunes/tester.rb +283 -0
- data/spaceship/lib/spaceship/tunes/transit_app_file.rb +27 -0
- data/spaceship/lib/spaceship/tunes/tunes.rb +35 -0
- data/spaceship/lib/spaceship/tunes/tunes_base.rb +15 -0
- data/spaceship/lib/spaceship/tunes/tunes_client.rb +1068 -0
- data/spaceship/lib/spaceship/tunes/user_detail.rb +19 -0
- data/spaceship/lib/spaceship/tunes/version_set.rb +35 -0
- data/spaceship/lib/spaceship/two_step_client.rb +195 -0
- data/spaceship/lib/spaceship/ui.rb +27 -0
- data/supply/README.md +214 -0
- data/supply/lib/supply.rb +29 -0
- data/supply/lib/supply/apk_listing.rb +14 -0
- data/supply/lib/supply/client.rb +345 -0
- data/supply/lib/supply/commands_generator.rb +62 -0
- data/supply/lib/supply/listing.rb +32 -0
- data/supply/lib/supply/options.rb +135 -0
- data/supply/lib/supply/setup.rb +102 -0
- data/supply/lib/supply/uploader.rb +221 -0
- metadata +699 -428
- data/bin//360/237/232/200 +0 -5
- data/lib/.DS_Store +0 -0
- data/lib/assets/.DS_Store +0 -0
- data/lib/assets/completions/.DS_Store +0 -0
- data/lib/fastlane/.DS_Store +0 -0
- data/lib/fastlane/actions/gym.rb +0 -90
- data/lib/fastlane/actions/reset_simulators.rb +0 -44
- data/lib/fastlane/cli_tools_distributor.rb +0 -100
- data/lib/fastlane/setup/.DS_Store +0 -0
@@ -0,0 +1,94 @@
|
|
1
|
+
module FastlaneCore
|
2
|
+
# This class checks if a specific certificate is installed on the current mac
|
3
|
+
class CertChecker
|
4
|
+
def self.installed?(path)
|
5
|
+
UI.user_error!("Could not find file '#{path}'") unless File.exist?(path)
|
6
|
+
|
7
|
+
ids = installed_identies
|
8
|
+
finger_print = sha1_fingerprint(path)
|
9
|
+
|
10
|
+
return ids.include? finger_print
|
11
|
+
end
|
12
|
+
|
13
|
+
# Legacy Method, use `installed?` instead
|
14
|
+
def self.is_installed?(path)
|
15
|
+
installed?(path)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.installed_identies
|
19
|
+
install_wwdr_certificate unless wwdr_certificate_installed?
|
20
|
+
|
21
|
+
available = list_available_identities
|
22
|
+
# Match for this text against word boundaries to avoid edge cases around multiples of 10 identities!
|
23
|
+
if /\b0 valid identities found\b/ =~ available
|
24
|
+
UI.error([
|
25
|
+
"There are no local code signing identities found.",
|
26
|
+
"You can run `security find-identity -v -p codesigning` to get this output.",
|
27
|
+
"This Stack Overflow thread has more information: http://stackoverflow.com/q/35390072/774.",
|
28
|
+
"(Check in Keychain Access for an expired WWDR certificate: http://stackoverflow.com/a/35409835/774 has more info.)"
|
29
|
+
].join(' '))
|
30
|
+
end
|
31
|
+
|
32
|
+
ids = []
|
33
|
+
available.split("\n").each do |current|
|
34
|
+
next if current.include? "REVOKED"
|
35
|
+
begin
|
36
|
+
(ids << current.match(/.*\) ([[:xdigit:]]*) \".*/)[1])
|
37
|
+
rescue
|
38
|
+
# the last line does not match
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
return ids
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.list_available_identities
|
46
|
+
`security find-identity -v -p codesigning`
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.wwdr_certificate_installed?
|
50
|
+
certificate_name = "Apple Worldwide Developer Relations Certification Authority"
|
51
|
+
keychain = wwdr_keychain
|
52
|
+
response = Helper.backticks("security find-certificate -c '#{certificate_name}' #{keychain.shellescape}", print: $verbose)
|
53
|
+
return response.include?("attributes:")
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.install_wwdr_certificate
|
57
|
+
Dir.chdir('/tmp') do
|
58
|
+
url = 'https://developer.apple.com/certificationauthority/AppleWWDRCA.cer'
|
59
|
+
filename = File.basename(url)
|
60
|
+
keychain = wwdr_keychain
|
61
|
+
keychain = "-k #{keychain.shellescape}" unless keychain.empty?
|
62
|
+
Helper.backticks("curl -O #{url} && security import #{filename} #{keychain}", print: $verbose)
|
63
|
+
UI.user_error!("Could not install WWDR certificate") unless $?.success?
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.wwdr_keychain
|
68
|
+
priority = [
|
69
|
+
"security list-keychains -d user",
|
70
|
+
"security default-keychain -d user"
|
71
|
+
]
|
72
|
+
priority.each do |command|
|
73
|
+
keychains = Helper.backticks(command, print: $verbose).split("\n")
|
74
|
+
unless keychains.empty?
|
75
|
+
# Select first keychain name from returned keychains list
|
76
|
+
return keychains[0].strip.tr('"', '')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
return ""
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.sha1_fingerprint(path)
|
83
|
+
result = `openssl x509 -in "#{path}" -inform der -noout -sha1 -fingerprint`
|
84
|
+
begin
|
85
|
+
result = result.match(/SHA1 Fingerprint=(.*)/)[1]
|
86
|
+
result.delete!(':')
|
87
|
+
return result
|
88
|
+
rescue
|
89
|
+
UI.message(result)
|
90
|
+
UI.user_error!("Error parsing certificate '#{path}'")
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
module FastlaneCore
|
2
|
+
# Executes commands and takes care of error handling and more
|
3
|
+
class CommandExecutor
|
4
|
+
class << self
|
5
|
+
# Cross-platform way of finding an executable in the $PATH. Respects the $PATHEXT, which lists
|
6
|
+
# valid file extensions for executables on Windows.
|
7
|
+
#
|
8
|
+
# which('ruby') #=> /usr/bin/ruby
|
9
|
+
#
|
10
|
+
# Derived from http://stackoverflow.com/a/5471032/3005
|
11
|
+
def which(cmd)
|
12
|
+
# PATHEXT contains the list of file extensions that Windows considers executable, semicolon separated.
|
13
|
+
# e.g. ".COM;.EXE;.BAT;.CMD"
|
14
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
15
|
+
|
16
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
17
|
+
exts.each do |ext|
|
18
|
+
cmd_path = File.join(path, "#{cmd}#{ext}")
|
19
|
+
return cmd_path if File.executable?(cmd_path) && !File.directory?(cmd_path)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
return nil
|
24
|
+
end
|
25
|
+
|
26
|
+
# @param command [String] The command to be executed
|
27
|
+
# @param print_all [Boolean] Do we want to print out the command output while running?
|
28
|
+
# @param print_command [Boolean] Should we print the command that's being executed
|
29
|
+
# @param error [Block] A block that's called if an error occurs
|
30
|
+
# @param prefix [Array] An array containg a prefix + block which might get applied to the output
|
31
|
+
# @param loading [String] A loading string that is shown before the first output
|
32
|
+
# @return [String] All the output as string
|
33
|
+
def execute(command: nil, print_all: false, print_command: true, error: nil, prefix: nil, loading: nil)
|
34
|
+
print_all = true if $verbose
|
35
|
+
prefix ||= {}
|
36
|
+
|
37
|
+
output = []
|
38
|
+
command = command.join(" ") if command.kind_of?(Array)
|
39
|
+
UI.command(command) if print_command
|
40
|
+
|
41
|
+
if print_all and loading # this is only used to show the "Loading text"...
|
42
|
+
UI.command_output(loading)
|
43
|
+
end
|
44
|
+
|
45
|
+
begin
|
46
|
+
PTY.spawn(command) do |stdin, stdout, pid|
|
47
|
+
begin
|
48
|
+
stdin.each do |l|
|
49
|
+
line = l.strip # strip so that \n gets removed
|
50
|
+
output << line
|
51
|
+
|
52
|
+
next unless print_all
|
53
|
+
|
54
|
+
# Prefix the current line with a string
|
55
|
+
prefix.each do |element|
|
56
|
+
line = element[:prefix] + line if element[:block] && element[:block].call(line)
|
57
|
+
end
|
58
|
+
|
59
|
+
UI.command_output(line)
|
60
|
+
end
|
61
|
+
rescue Errno::EIO
|
62
|
+
# This is expected on some linux systems, that indicates that the subcommand finished
|
63
|
+
# and we kept trying to read, ignore it
|
64
|
+
ensure
|
65
|
+
Process.wait(pid)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
rescue => ex
|
69
|
+
# This could happen when the environment is wrong:
|
70
|
+
# > invalid byte sequence in US-ASCII (ArgumentError)
|
71
|
+
output << ex.to_s
|
72
|
+
o = output.join("\n")
|
73
|
+
puts o
|
74
|
+
if error
|
75
|
+
error.call(o, nil)
|
76
|
+
else
|
77
|
+
raise ex
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Exit status for build command, should be 0 if build succeeded
|
82
|
+
status = $?.exitstatus
|
83
|
+
if status != 0
|
84
|
+
o = output.join("\n")
|
85
|
+
puts o # the user has the right to see the raw output
|
86
|
+
UI.error "Exit status: #{status}"
|
87
|
+
if error
|
88
|
+
error.call(o, status)
|
89
|
+
else
|
90
|
+
UI.user_error!("Exit status: #{status}")
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
return output.join("\n")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'commander'
|
2
|
+
|
3
|
+
module FastlaneCore
|
4
|
+
class CommanderGenerator
|
5
|
+
include Commander::Methods
|
6
|
+
|
7
|
+
# Calls the appropriate methods for commander to show the available parameters
|
8
|
+
def generate(options)
|
9
|
+
# First, enable `always_trace`, to show the stack trace
|
10
|
+
always_trace!
|
11
|
+
|
12
|
+
used_switches = []
|
13
|
+
options.each do |option|
|
14
|
+
next if option.description.to_s.empty? # "private" options
|
15
|
+
|
16
|
+
short_switch = option.short_option
|
17
|
+
key = option.key
|
18
|
+
validate_short_switch(used_switches, short_switch, key)
|
19
|
+
|
20
|
+
type = option.data_type
|
21
|
+
|
22
|
+
# This is an important bit of trickery to solve the boolean option situation.
|
23
|
+
#
|
24
|
+
# Typically, boolean command line flags do not accept trailing values. If the flag
|
25
|
+
# is present, the value is true, if it is missing, the value is false. fastlane
|
26
|
+
# supports this style of flag. For example, you can specify a flag like `--clean`,
|
27
|
+
# and the :clean option will be true.
|
28
|
+
#
|
29
|
+
# However, fastlane also supports another boolean flag style that accepts trailing
|
30
|
+
# values much like options for Strings and other value types. That looks like
|
31
|
+
# `--include_bitcode false` The problem is that this does not work out of the box
|
32
|
+
# for Commander and OptionsParser. So, we need to get tricky.
|
33
|
+
#
|
34
|
+
# The value_appendix below acts as a placeholder in the switch definition that
|
35
|
+
# states that we expect to have a trailing value for our options. When an option
|
36
|
+
# declares a data type, we use the name of that data type in all caps like:
|
37
|
+
# "--devices ARRAY". When the data type is nil, this implies that we're going
|
38
|
+
# to be doing some special handling on that value. One special thing we do
|
39
|
+
# automatically in Configuration is to coerce special Strings into boolean values.
|
40
|
+
#
|
41
|
+
# If the data type is nil, the trick we do is to specify a value placeholder, but
|
42
|
+
# we wrap it in [] brackets to mark it as optional. That means that the trailing
|
43
|
+
# value may or may not be present for this flag. If the flag is present, but the
|
44
|
+
# value is not, we get a value of `true`. Perfect for the boolean flag base-case!
|
45
|
+
# If the value is there, we'll actually get it back as a String, which we can
|
46
|
+
# later coerce into a boolean.
|
47
|
+
#
|
48
|
+
# In this way we support handling boolean flags with or without trailing values.
|
49
|
+
value_appendix = (type || '[VALUE]').to_s.upcase
|
50
|
+
long_switch = "--#{option.key} #{value_appendix}"
|
51
|
+
|
52
|
+
description = option.description
|
53
|
+
description += " (#{option.env_name})" unless option.env_name.to_s.empty?
|
54
|
+
|
55
|
+
# We compact this array here to remove the short_switch variable if it is nil.
|
56
|
+
# Passing a nil value to global_option has been shown to create problems with
|
57
|
+
# option parsing!
|
58
|
+
#
|
59
|
+
# See: https://github.com/fastlane/fastlane_core/pull/89
|
60
|
+
#
|
61
|
+
# If we don't have a data type for this option, we tell it to act like a String.
|
62
|
+
# This allows us to get a reasonable value for boolean options that can be
|
63
|
+
# automatically coerced or otherwise handled by the ConfigItem for others.
|
64
|
+
args = [short_switch, long_switch, (type || String), description].compact
|
65
|
+
|
66
|
+
# This is the call to Commander to set up the option we've been building.
|
67
|
+
global_option(*args)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def validate_short_switch(used_switches, short_switch, key)
|
72
|
+
return if short_switch.nil?
|
73
|
+
|
74
|
+
UI.user_error!("Short option #{short_switch} already taken for key #{key}") if used_switches.include?(short_switch)
|
75
|
+
UI.user_error!("-v is already used for the version (key #{key})") if short_switch == "-v"
|
76
|
+
UI.user_error!("-h is already used for the help screen (key #{key})") if short_switch == "-h"
|
77
|
+
UI.user_error!("-t is already used for the trace screen (key #{key})") if short_switch == "-t"
|
78
|
+
|
79
|
+
used_switches << short_switch
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
module FastlaneCore
|
2
|
+
class ConfigItem
|
3
|
+
attr_accessor :key, :env_name, :description, :short_option, :default_value, :verify_block, :optional, :conflicting_options, :conflict_block, :deprecated, :sensitive
|
4
|
+
|
5
|
+
# Creates a new option
|
6
|
+
# @param key (Symbol) the key which is used as command paramters or key in the fastlane tools
|
7
|
+
# @param env_name (String) the name of the environment variable, which is only used if no other values were found
|
8
|
+
# @param description (String) A description shown to the user
|
9
|
+
# @param short_option (String) A string of length 1 which is used for the command parameters (e.g. -f)
|
10
|
+
# @param default_value the value which is used if there was no given values and no environment values
|
11
|
+
# @param verify_block an optional block which is called when a new value is set.
|
12
|
+
# Check value is valid. This could be type checks or if a folder/file exists
|
13
|
+
# You have to raise a specific exception if something goes wrong. Append .red after the string
|
14
|
+
# @param is_string *DEPRECATED: Use `type` instead* (Boolean) is that parameter a string? Defaults to true. If it's true, the type string will be verified.
|
15
|
+
# @param type (Class) the data type of this config item. Takes precedence over `is_string`
|
16
|
+
# @param optional (Boolean) is false by default. If set to true, also string values will not be asked to the user
|
17
|
+
# @param conflicting_options ([]) array of conflicting option keys(@param key). This allows to resolve conflicts intelligently
|
18
|
+
# @param conflict_block an optional block which is called when options conflict happens
|
19
|
+
# @param deprecated (String) Set if the option is deprecated. A deprecated option should be optional and is made optional if the parameter isn't set, and fails otherwise
|
20
|
+
# @param sensitive (Boolean) Set if the variable is sensitive, such as a password or API token, to prevent echoing when prompted for the parameter
|
21
|
+
def initialize(key: nil, env_name: nil, description: nil, short_option: nil, default_value: nil, verify_block: nil, is_string: true, type: nil, optional: nil, conflicting_options: nil, conflict_block: nil, deprecated: nil, sensitive: nil)
|
22
|
+
UI.user_error!("key must be a symbol") unless key.kind_of? Symbol
|
23
|
+
UI.user_error!("env_name must be a String") unless (env_name || '').kind_of? String
|
24
|
+
|
25
|
+
if short_option
|
26
|
+
UI.user_error!("short_option must be a String of length 1") unless short_option.kind_of? String and short_option.delete('-').length == 1
|
27
|
+
end
|
28
|
+
if description
|
29
|
+
UI.user_error!("Do not let descriptions end with a '.', since it's used for user inputs as well") if description[-1] == '.'
|
30
|
+
end
|
31
|
+
|
32
|
+
if conflicting_options
|
33
|
+
conflicting_options.each do |conflicting_option_key|
|
34
|
+
UI.user_error!("Conflicting option key must be a symbol") unless conflicting_option_key.kind_of? Symbol
|
35
|
+
end
|
36
|
+
end
|
37
|
+
if deprecated
|
38
|
+
# deprecated options are automatically optional
|
39
|
+
optional = true if optional.nil?
|
40
|
+
UI.crash!("Deprecated option must be optional") unless optional
|
41
|
+
# deprecated options are marked deprecated in their description
|
42
|
+
description = "[DEPRECATED!] #{deprecated} - #{description}"
|
43
|
+
end
|
44
|
+
optional = false if optional.nil?
|
45
|
+
|
46
|
+
sensitive = false if sensitive.nil?
|
47
|
+
|
48
|
+
@key = key
|
49
|
+
@env_name = env_name
|
50
|
+
@description = description
|
51
|
+
@short_option = short_option
|
52
|
+
@default_value = default_value
|
53
|
+
@verify_block = verify_block
|
54
|
+
@is_string = is_string
|
55
|
+
@data_type = type
|
56
|
+
@optional = optional
|
57
|
+
@conflicting_options = conflicting_options
|
58
|
+
@conflict_block = conflict_block
|
59
|
+
@deprecated = deprecated
|
60
|
+
@sensitive = sensitive
|
61
|
+
end
|
62
|
+
|
63
|
+
# This will raise an exception if the value is not valid
|
64
|
+
def verify!(value)
|
65
|
+
UI.user_error!("Invalid value '#{value}' for option '#{self}'") unless valid?(value)
|
66
|
+
true
|
67
|
+
end
|
68
|
+
|
69
|
+
# Make sure, the value is valid (based on the verify block)
|
70
|
+
# Returns false if that's not the case
|
71
|
+
def valid?(value)
|
72
|
+
# we also allow nil values, which do not have to be verified.
|
73
|
+
if value
|
74
|
+
# Verify that value is the type that we're expecting, if we are expecting a type
|
75
|
+
if data_type && !value.kind_of?(data_type)
|
76
|
+
UI.user_error!("'#{self.key}' value must be a #{data_type}! Found #{value.class} instead.")
|
77
|
+
end
|
78
|
+
|
79
|
+
if @verify_block
|
80
|
+
begin
|
81
|
+
@verify_block.call(value)
|
82
|
+
rescue => ex
|
83
|
+
UI.error "Error setting value '#{value}' for option '#{@key}'"
|
84
|
+
raise Interface::FastlaneError.new, ex.to_s
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
true
|
90
|
+
end
|
91
|
+
|
92
|
+
# Returns an updated value type (if necessary)
|
93
|
+
def auto_convert_value(value)
|
94
|
+
return nil if value.nil?
|
95
|
+
|
96
|
+
if data_type == Array
|
97
|
+
return value.split(',') if value.kind_of?(String)
|
98
|
+
elsif data_type == Integer
|
99
|
+
return value.to_i if value.to_i.to_s == value.to_s
|
100
|
+
elsif data_type == Float
|
101
|
+
return value.to_f if value.to_f.to_s == value.to_s
|
102
|
+
else
|
103
|
+
# Special treatment if the user specified true, false or YES, NO
|
104
|
+
# There is no boolean type, so we just do it here
|
105
|
+
if %w(YES yes true TRUE).include?(value)
|
106
|
+
return true
|
107
|
+
elsif %w(NO no false FALSE).include?(value)
|
108
|
+
return false
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
return value # fallback to not doing anything
|
113
|
+
end
|
114
|
+
|
115
|
+
# Determines the defined data type of this ConfigItem
|
116
|
+
def data_type
|
117
|
+
if @data_type
|
118
|
+
@data_type
|
119
|
+
else
|
120
|
+
(@is_string ? String : nil)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# Replaces the attr_accessor, but maintains the same interface
|
125
|
+
def string?
|
126
|
+
data_type == String
|
127
|
+
end
|
128
|
+
|
129
|
+
def to_s
|
130
|
+
[@key, @description].join(": ")
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
@@ -0,0 +1,266 @@
|
|
1
|
+
require 'fastlane_core/configuration/config_item'
|
2
|
+
require 'fastlane_core/configuration/commander_generator'
|
3
|
+
require 'fastlane_core/configuration/configuration_file'
|
4
|
+
|
5
|
+
module FastlaneCore
|
6
|
+
class Configuration
|
7
|
+
attr_accessor :available_options
|
8
|
+
|
9
|
+
attr_accessor :values
|
10
|
+
|
11
|
+
# @return [Array] An array of symbols which are all available keys
|
12
|
+
attr_reader :all_keys
|
13
|
+
|
14
|
+
# @return [String] The name of the configuration file (not the path). Optional!
|
15
|
+
attr_accessor :config_file_name
|
16
|
+
|
17
|
+
def self.create(available_options, values)
|
18
|
+
UI.user_error!("values parameter must be a hash") unless values.kind_of?(Hash)
|
19
|
+
v = values.dup
|
20
|
+
v.each do |key, val|
|
21
|
+
v[key] = val.dup if val.kind_of?(String) # this is necessary when fetching a value from an environment variable
|
22
|
+
end
|
23
|
+
|
24
|
+
if v.kind_of?(Hash) && available_options.kind_of?(Array) # we only want to deal with the new configuration system
|
25
|
+
# Now see if --verbose would be a valid input
|
26
|
+
# If not, it might be because it's an action and not a tool
|
27
|
+
unless available_options.find { |a| a.kind_of?(ConfigItem) && a.key == :verbose }
|
28
|
+
v.delete(:verbose) # as this is being processed by commander
|
29
|
+
end
|
30
|
+
end
|
31
|
+
Configuration.new(available_options, v)
|
32
|
+
end
|
33
|
+
|
34
|
+
#####################################################
|
35
|
+
# @!group Setting up the configuration
|
36
|
+
#####################################################
|
37
|
+
|
38
|
+
def initialize(available_options, values)
|
39
|
+
self.available_options = available_options || []
|
40
|
+
self.values = values || {}
|
41
|
+
|
42
|
+
verify_input_types
|
43
|
+
verify_value_exists
|
44
|
+
verify_no_duplicates
|
45
|
+
verify_conflicts
|
46
|
+
verify_default_value_matches_verify_block
|
47
|
+
end
|
48
|
+
|
49
|
+
def verify_input_types
|
50
|
+
UI.user_error!("available_options parameter must be an array of ConfigItems but is #{@available_options.class}") unless @available_options.kind_of? Array
|
51
|
+
@available_options.each do |item|
|
52
|
+
UI.user_error!("available_options parameter must be an array of ConfigItems. Found #{item.class}.") unless item.kind_of? ConfigItem
|
53
|
+
end
|
54
|
+
UI.user_error!("values parameter must be a hash") unless @values.kind_of?(Hash)
|
55
|
+
end
|
56
|
+
|
57
|
+
def verify_value_exists
|
58
|
+
# Make sure the given value keys exist
|
59
|
+
@values.each do |key, value|
|
60
|
+
next if key == :trace # special treatment
|
61
|
+
option = option_for_key(key)
|
62
|
+
if option
|
63
|
+
@values[key] = option.auto_convert_value(value)
|
64
|
+
UI.deprecated("Using deprecated option: '--#{key}' (#{option.deprecated})") if option.deprecated
|
65
|
+
option.verify!(@values[key]) # Call the verify block for it too
|
66
|
+
else
|
67
|
+
UI.user_error!("Could not find option '#{key}' in the list of available options: #{@available_options.collect(&:key).join(', ')}")
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def verify_no_duplicates
|
73
|
+
# Make sure a key was not used multiple times
|
74
|
+
@available_options.each do |current|
|
75
|
+
count = @available_options.count { |option| option.key == current.key }
|
76
|
+
UI.user_error!("Multiple entries for configuration key '#{current.key}' found!") if count > 1
|
77
|
+
|
78
|
+
unless current.short_option.to_s.empty?
|
79
|
+
count = @available_options.count { |option| option.short_option == current.short_option }
|
80
|
+
UI.user_error!("Multiple entries for short_option '#{current.short_option}' found!") if count > 1
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def verify_conflicts
|
86
|
+
option_keys = @values.keys
|
87
|
+
|
88
|
+
option_keys.each do |current|
|
89
|
+
index = @available_options.find_index { |item| item.key == current }
|
90
|
+
current = @available_options[index]
|
91
|
+
|
92
|
+
# ignore conflicts because option value is nil
|
93
|
+
next if @values[current.key].nil?
|
94
|
+
|
95
|
+
next if current.conflicting_options.nil?
|
96
|
+
|
97
|
+
conflicts = current.conflicting_options & option_keys
|
98
|
+
next if conflicts.nil?
|
99
|
+
|
100
|
+
conflicts.each do |conflicting_option_key|
|
101
|
+
index = @available_options.find_index { |item| item.key == conflicting_option_key }
|
102
|
+
conflicting_option = @available_options[index]
|
103
|
+
|
104
|
+
# ignore conflicts because because value of conflict option is nil
|
105
|
+
next if @values[conflicting_option.key].nil?
|
106
|
+
|
107
|
+
if current.conflict_block
|
108
|
+
begin
|
109
|
+
current.conflict_block.call(conflicting_option)
|
110
|
+
rescue => ex
|
111
|
+
UI.error("Error resolving conflict between options: '#{current.key}' and '#{conflicting_option.key}'")
|
112
|
+
raise ex
|
113
|
+
end
|
114
|
+
else
|
115
|
+
UI.user_error!("Unresolved conflict between options: '#{current.key}' and '#{conflicting_option.key}'")
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
# Verifies the default value is also valid
|
122
|
+
def verify_default_value_matches_verify_block
|
123
|
+
@available_options.each do |item|
|
124
|
+
next unless item.verify_block && item.default_value
|
125
|
+
|
126
|
+
begin
|
127
|
+
unless @values[item.key] # this is important to not verify if there already is a value there
|
128
|
+
item.verify_block.call(item.default_value)
|
129
|
+
end
|
130
|
+
rescue => ex
|
131
|
+
UI.error(ex)
|
132
|
+
UI.user_error!("Invalid default value for #{item.key}, doesn't match verify_block")
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
# This method takes care of parsing and using the configuration file as values
|
138
|
+
# Call this once you know where the config file might be located
|
139
|
+
# Take a look at how `gym` uses this method
|
140
|
+
#
|
141
|
+
# @param config_file_name [String] The name of the configuration file to use (optional)
|
142
|
+
# @param block_for_missing [Block] A ruby block that is called when there is an unkonwn method
|
143
|
+
# in the configuration file
|
144
|
+
def load_configuration_file(config_file_name = nil, block_for_missing = nil)
|
145
|
+
return unless config_file_name
|
146
|
+
|
147
|
+
self.config_file_name = config_file_name
|
148
|
+
|
149
|
+
paths = []
|
150
|
+
paths += Dir["./fastlane/#{self.config_file_name}"]
|
151
|
+
paths += Dir["./.fastlane/#{self.config_file_name}"]
|
152
|
+
paths += Dir["./#{self.config_file_name}"]
|
153
|
+
paths += Dir["./fastlane_core/spec/fixtures/#{self.config_file_name}"] if Helper.is_test?
|
154
|
+
return if paths.count == 0
|
155
|
+
|
156
|
+
path = paths.first
|
157
|
+
configuration_file = ConfigurationFile.new(self, path, block_for_missing)
|
158
|
+
verify_conflicts # important, since user can set conflicting options in configuration file
|
159
|
+
configuration_file
|
160
|
+
end
|
161
|
+
|
162
|
+
#####################################################
|
163
|
+
# @!group Actually using the class
|
164
|
+
#####################################################
|
165
|
+
|
166
|
+
# Returns the value for a certain key. fastlane_core tries to fetch the value from different sources
|
167
|
+
# if 'ask' is true and the value is not present, the user will be prompted to provide a value
|
168
|
+
def fetch(key, ask: true)
|
169
|
+
UI.user_error!("Key '#{key}' must be a symbol. Example :app_id.") unless key.kind_of?(Symbol)
|
170
|
+
|
171
|
+
option = option_for_key(key)
|
172
|
+
UI.user_error!("Could not find option for key :#{key}. Available keys: #{@available_options.collect(&:key).join(', ')}") unless option
|
173
|
+
|
174
|
+
value = @values[key]
|
175
|
+
|
176
|
+
value = option.auto_convert_value(value)
|
177
|
+
|
178
|
+
# `if value == nil` instead of ||= because false is also a valid value
|
179
|
+
if value.nil? and option.env_name and ENV[option.env_name]
|
180
|
+
|
181
|
+
# We want to inform the user that we took the value
|
182
|
+
# from an environment variable
|
183
|
+
# however we don't print the actual value, as it may contain sensitive information
|
184
|
+
# The user can easily find the actual value by print out the environment
|
185
|
+
UI.verbose("Taking value for '#{key}' from environment variable '#{option.env_name}'")
|
186
|
+
|
187
|
+
value = option.auto_convert_value(ENV[option.env_name].dup)
|
188
|
+
option.verify!(value) if value
|
189
|
+
end
|
190
|
+
|
191
|
+
value = option.default_value if value.nil?
|
192
|
+
value = nil if value.nil? and !option.string? # by default boolean flags are false
|
193
|
+
|
194
|
+
return value unless value.nil? # we already have a value
|
195
|
+
return value if option.optional # as this value is not required, just return what we have
|
196
|
+
|
197
|
+
return value unless ask
|
198
|
+
|
199
|
+
# fallback to asking
|
200
|
+
if Helper.is_test? or !UI.interactive?
|
201
|
+
# Since we don't want to be asked on tests, we'll just call the verify block with no value
|
202
|
+
# to raise the exception that is shown when the user passes an invalid value
|
203
|
+
set(key, '')
|
204
|
+
# If this didn't raise an exception, just raise a default one
|
205
|
+
UI.user_error!("No value found for '#{key}'")
|
206
|
+
end
|
207
|
+
|
208
|
+
while value.nil?
|
209
|
+
UI.important("To not be asked about this value, you can specify it using '#{option.key}'")
|
210
|
+
value = option.sensitive ? UI.password("#{option.description}: ") : UI.input("#{option.description}: ")
|
211
|
+
# Also store this value to use it from now on
|
212
|
+
begin
|
213
|
+
set(key, value)
|
214
|
+
rescue => ex
|
215
|
+
puts ex
|
216
|
+
value = nil
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
value
|
221
|
+
end
|
222
|
+
|
223
|
+
# Overwrites or sets a new value for a given key
|
224
|
+
# @param key [Symbol] Must be a symbol
|
225
|
+
def set(key, value)
|
226
|
+
UI.user_error!("Key '#{key}' must be a symbol. Example :#{key}.") unless key.kind_of? Symbol
|
227
|
+
option = option_for_key(key)
|
228
|
+
|
229
|
+
unless option
|
230
|
+
UI.user_error!("Could not find option '#{key}' in the list of available options: #{@available_options.collect(&:key).join(', ')}")
|
231
|
+
end
|
232
|
+
|
233
|
+
option.verify!(value)
|
234
|
+
|
235
|
+
@values[key] = value
|
236
|
+
true
|
237
|
+
end
|
238
|
+
|
239
|
+
# see fetch
|
240
|
+
def values(ask: true)
|
241
|
+
# As the user accesses all values, we need to iterate through them to receive all the values
|
242
|
+
@available_options.each do |option|
|
243
|
+
@values[option.key] = fetch(option.key, ask: ask) unless @values[option.key]
|
244
|
+
end
|
245
|
+
@values
|
246
|
+
end
|
247
|
+
|
248
|
+
# Direct access to the values, without iterating through all items
|
249
|
+
def _values
|
250
|
+
@values
|
251
|
+
end
|
252
|
+
|
253
|
+
def all_keys
|
254
|
+
@available_options.collect(&:key)
|
255
|
+
end
|
256
|
+
|
257
|
+
# Returns the config_item object for a given key
|
258
|
+
def option_for_key(key)
|
259
|
+
@available_options.find { |o| o.key == key }
|
260
|
+
end
|
261
|
+
|
262
|
+
# Aliases `[key]` to `fetch(key)` because Ruby can do it.
|
263
|
+
alias [] fetch
|
264
|
+
alias []= set
|
265
|
+
end
|
266
|
+
end
|