From 34f30a9764fc77a9699e73c3b03a190e5e3dfcf2 Mon Sep 17 00:00:00 2001 From: olegoid Date: Mon, 8 Feb 2016 23:12:41 -0300 Subject: [PATCH] Set conflicting options: * Use conflicting options mechanism for workspace and project paths * Update specs --- lib/gym/options.rb | 8 ++++++++ spec/options_spec.rb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/gym/options.rb b/lib/gym/options.rb index 282f0e9..096a757 100644 --- a/lib/gym/options.rb +++ b/lib/gym/options.rb @@ -21,6 +21,10 @@ def self.plain_options UI.user_error!("Workspace file not found at path '#{v}'") unless File.exist?(v) UI.user_error!("Workspace file invalid") unless File.directory?(v) UI.user_error!("Workspace file is not a workspace, must end with .xcworkspace") unless v.include?(".xcworkspace") + end, + conflicting_options: [:project], + conflict_block: proc do |value| + UI.user_error!("You can only pass either a 'workspace' or a '#{value.key}', not both") end), FastlaneCore::ConfigItem.new(key: :project, short_option: "-p", @@ -32,6 +36,10 @@ def self.plain_options UI.user_error!("Project file not found at path '#{v}'") unless File.exist?(v) UI.user_error!("Project file invalid") unless File.directory?(v) UI.user_error!("Project file is not a project file, must end with .xcodeproj") unless v.include?(".xcodeproj") + end, + conflicting_options: [:workspace], + conflict_block: proc do |value| + UI.user_error!("You can only pass either a 'project' or a '#{value.key}', not both") end), FastlaneCore::ConfigItem.new(key: :scheme, short_option: "-s", diff --git a/spec/options_spec.rb b/spec/options_spec.rb index df65f39..bb24da3 100644 --- a/spec/options_spec.rb +++ b/spec/options_spec.rb @@ -4,7 +4,7 @@ expect do options = { project: "./examples/standard/Example.xcodeproj", workspace: "./examples/cocoapods/Example.xcworkspace" } Gym.config = FastlaneCore::Configuration.create(Gym::Options.available_options, options) - end.to raise_error "You can only pass either a workspace or a project path, not both".red + end.to raise_error "You can only pass either a 'project' or a 'workspace', not both" end it "removes the `ipa` from the output name if given" do