Skip to content

Commit

Permalink
Fix not showing the lane list and selection when not passing any argu…
Browse files Browse the repository at this point in the history
…ments (#7549)

Introduced with 7e40156 with wrongly nested if/else blocks

cc @milch
  • Loading branch information
KrauseFx committed Dec 16, 2016
1 parent acdd458 commit 21af59c
Showing 1 changed file with 31 additions and 33 deletions.
64 changes: 31 additions & 33 deletions fastlane/lib/fastlane/cli_tools_distributor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,42 +23,40 @@ def take_off

tool_name = process_emojis(tool_name)

if tool_name
if Fastlane::TOOLS.include?(tool_name.to_sym) && !available_lanes.include?(tool_name.to_sym)
# Triggering a specific tool
# This happens when the users uses things like
#
# fastlane sigh
# fastlane snapshot
#
require tool_name
begin
# First, remove the tool's name from the arguments
# Since it will be parsed by the `commander` at a later point
# and it must not contain the binary name
ARGV.shift
if tool_name && Fastlane::TOOLS.include?(tool_name.to_sym) && !available_lanes.include?(tool_name.to_sym)
# Triggering a specific tool
# This happens when the users uses things like
#
# fastlane sigh
# fastlane snapshot
#
require tool_name
begin
# First, remove the tool's name from the arguments
# Since it will be parsed by the `commander` at a later point
# and it must not contain the binary name
ARGV.shift

# Import the CommandsGenerator class, which is used to parse
# the user input
require File.join(tool_name, "commands_generator")
# Import the CommandsGenerator class, which is used to parse
# the user input
require File.join(tool_name, "commands_generator")

# Call the tool's CommandsGenerator class and let it do its thing
Object.const_get(tool_name.fastlane_module)::CommandsGenerator.start
rescue LoadError
# This will only happen if the tool we call here, doesn't provide
# a CommandsGenerator class yet
# When we launch this feature, this should never be the case
abort("#{tool_name} can't be called via `fastlane #{tool_name}`, run '#{tool_name}' directly instead".red)
end
elsif tool_name == "fastlane-credentials"
require 'credentials_manager'
ARGV.shift
CredentialsManager::CLI.new.run
else
# Triggering fastlane to call a lane
require "fastlane/commands_generator"
Fastlane::CommandsGenerator.start
# Call the tool's CommandsGenerator class and let it do its thing
Object.const_get(tool_name.fastlane_module)::CommandsGenerator.start
rescue LoadError
# This will only happen if the tool we call here, doesn't provide
# a CommandsGenerator class yet
# When we launch this feature, this should never be the case
abort("#{tool_name} can't be called via `fastlane #{tool_name}`, run '#{tool_name}' directly instead".red)
end
elsif tool_name == "fastlane-credentials"
require 'credentials_manager'
ARGV.shift
CredentialsManager::CLI.new.run
else
# Triggering fastlane to call a lane
require "fastlane/commands_generator"
Fastlane::CommandsGenerator.start
end
end

Expand Down

0 comments on commit 21af59c

Please sign in to comment.