Class: Fastlane::CommandsGenerator
- Inherits:
-
Object
- Object
- Fastlane::CommandsGenerator
- Includes:
- Commander::Methods
- Defined in:
- lib/fastlane/commands_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#ensure_fastfile ⇒ Object
Makes sure a Fastfile is available Shows an appropriate message to the user if that’s not the case return true if the Fastfile is available.
-
#run ⇒ Object
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength.
Class Method Details
.start ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/fastlane/commands_generator.rb', line 10 def self.start FastlaneCore::UpdateChecker.start_looking_for_update('fastlane') Fastlane.load_actions self.new.run ensure FastlaneCore::UpdateChecker.show_update_status('fastlane', Fastlane::VERSION) end |
Instance Method Details
#ensure_fastfile ⇒ Object
Makes sure a Fastfile is available Shows an appropriate message to the user if that’s not the case return true if the Fastfile is available
182 183 184 185 186 187 188 |
# File 'lib/fastlane/commands_generator.rb', line 182 def ensure_fastfile return true if Fastlane::FastlaneFolder.setup? create = UI.confirm('Could not find fastlane in current directory. Would you like to set it up?') Fastlane::Setup.new.run if create return false end |
#run ⇒ Object
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/fastlane/commands_generator.rb', line 20 def run program :version, Fastlane::VERSION program :description, [ "CLI for 'fastlane' - #{Fastlane::DESCRIPTION}\n", "\tRun using `fastlane [platform] [lane_name]`", "\tTo pass values to the lanes use `fastlane [platform] [lane_name] key:value key2:value2`"].join("\n") program :help, 'Author', 'Felix Krause <[email protected]>' program :help, 'Website', 'https://fastlane.tools' program :help, 'GitHub', 'https://github.com/fastlane/fastlane' program :help_formatter, :compact global_option('--verbose') { $verbose = true } always_trace! command :trigger do |c| c.syntax = 'fastlane [lane]' c.description = 'Run a sepcific lane. Pass the lane name and optionally the platform first.' c.option '--env STRING', String, 'Add environment to use with `dotenv`' c.action do |args, | if ensure_fastfile Fastlane::CommandLineHandler.handle(args, ) end end end command :init do |c| c.syntax = 'fastlane init' c.description = 'Helps you with your initial fastlane setup' c.action do |args, | Fastlane::Setup.new.run end end command :new_action do |c| c.syntax = 'fastlane new_action' c.description = 'Create a new custom action for fastlane.' c.option '--name STRING', String, 'Name of your new action' c.action do |args, | Fastlane::NewAction.run(new_action_name: .name) end end command :lanes do |c| c.syntax = 'fastlane lanes' c.description = 'Lists all available lanes and shows their description' c.option "-j", "--json", "Output the lanes in JSON instead of text" c.action do |args, | if ensure_fastfile require 'fastlane/lane_list' path = File.join(Fastlane::FastlaneFolder.fastfile_path) if .json Fastlane::LaneList.output_json(path) else Fastlane::LaneList.output(path) end end end end command :list do |c| c.syntax = 'fastlane list' c.description = 'Lists all available lanes without description' c.action do |args, | if ensure_fastfile ff = Fastlane::FastFile.new(Fastlane::FastlaneFolder.fastfile_path) UI. "Available lanes:" ff.runner.available_lanes.each do |lane| UI. "- #{lane}" end UI.important "Execute using `fastlane [lane_name]`" end end end command :docs do |c| c.syntax = 'fastlane docs' c.description = 'Generate a markdown based documentation based on the Fastfile' c.option '-f', '--force', 'Overwrite the existing README.md in the ./fastlane folder' c.action do |args, | if ensure_fastfile ff = Fastlane::FastFile.new(File.join(Fastlane::FastlaneFolder.path || '.', 'Fastfile')) UI. "You don't need to run `fastlane docs` manually any more, this will be done automatically for you." Fastlane::DocsGenerator.run(ff) end end end command :run do |c| c.syntax = 'fastlane run [action] key1:value1 key2:value2' c.description = 'Run a fastlane one-off action without a full lane' c.action do |args, | require 'fastlane/one_off' result = Fastlane::OneOff.execute(args: args) UI.success "Result: #{result}" if result end end command :actions do |c| c.syntax = 'fastlane actions' c.description = 'Lists all available fastlane actions' c.option '--platform STRING', String, 'Only show actions available on the given platform' c.action do |args, | require 'fastlane/documentation/actions_list' Fastlane::ActionsList.run(filter: args.first, platform: .platform) end end command :action do |c| c.syntax = 'fastlane action [tool_name]' c.description = 'Shows more information for a specific command' c.action do |args, | require 'fastlane/documentation/actions_list' Fastlane::ActionsList.run(filter: args.first) end end command :enable_crash_reporting do |c| c.syntax = 'fastlane enable_crash_reporting' c.description = 'Enable crash reporting to improve fastlane' c.action do |args, | FastlaneCore::CrashReporting.enable end end command :disable_crash_reporting do |c| c.syntax = 'fastlane disable_crash_reporting' c.description = 'Disable crash reporting' c.action do |args, | FastlaneCore::CrashReporting.disable end end command :enable_auto_complete do |c| c.syntax = 'fastlane enable_auto_complete' c.description = 'Enable tab auto completion' c.action do |args, | require 'fastlane/auto_complete' Fastlane::AutoComplete.execute end end default_command :trigger run! end |