#!/usr/bin/env ruby $LOAD_PATH.push File.expand_path('../../lib', __FILE__) require 'fastlane' require 'commander' require 'dotenv' require 'fastlane/new_action' HighLine.track_eof = false class FastlaneApplication include Commander::Methods def run program :version, Fastlane::VERSION program :description, 'CLI for \'fastlane\' - Connect all iOS deployment tools into one streamlined workflow' program :help, 'Author', 'Felix Krause ' program :help, 'Website', 'https://fastlane.tools' program :help, 'GitHub', 'https://github.com/krausefx/fastlane' program :help_formatter, :compact always_trace! command :run do |c| c.syntax = 'fastlane run [lane]' c.description = 'Drive the fastlane for a specific environment.' c.option '--env STRING', String, 'Add environment to use with `dotenv`' c.action do |args, _options| FastlaneCore::UpdateChecker.start_looking_for_update('fastlane') if Fastlane::FastlaneFolder.path Fastlane::LaneManager.cruise_lanes(args, _options.env) else create = agree('Could not find fastlane in current directory. Would you like to set it up? (y/n)'.yellow, true) Fastlane::Setup.new.run if create end FastlaneCore::UpdateChecker.show_update_status('fastlane', Fastlane::VERSION) end end command :init do |c| c.syntax = 'fastlane init' c.description = 'Helps you setting up fastlane based on your existing tools.' c.action do |_args, _options| FastlaneCore::UpdateChecker.start_looking_for_update('fastlane') Fastlane::Setup.new.run FastlaneCore::UpdateChecker.show_update_status('fastlane', Fastlane::VERSION) end end command :new_action do |c| c.syntax = 'fastlane new_action' c.description = 'Create a new custom action for fastlane.' c.action do |_args, _options| Fastlane::NewAction.run end end default_command :run run! end end FastlaneApplication.new.run