class Fastlane::Actions::RakeAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/maintenance/actions/rake_action.rb, line 58
def authors
  ["Jimmy Dee"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/maintenance/actions/rake_action.rb, line 30
def available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :task,
      description: "Rake task to build",
      is_string: false
    ),
    FastlaneCore::ConfigItem.new(
      key: :rakefile,
      description: "Rakefile to use",
      type: String,
      optional: true,
      default_value: "Rakefile",
      verify_block: ->(path) { File.open(path); true }
    ),
    FastlaneCore::ConfigItem.new(
      key: :options,
      description: "Options for task",
      is_string: false,
      optional: true
    )
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/maintenance/actions/rake_action.rb, line 54
def description
  "General-purpose rake action to invoke tasks from a Rakefile or elsewhere."
end
example_code() click to toggle source
# File lib/fastlane/plugin/maintenance/actions/rake_action.rb, line 62
def example_code
  [
    "rake task: :release",
    "rake task: :default",
    %(rake task: :default, rakefile: "Rakefile")
  ]
end
run(params) click to toggle source
# File lib/fastlane/plugin/maintenance/actions/rake_action.rb, line 10
def run(params)
  if File.exist?(params[:rakefile])
    # Can't require. Because no .rb?
    # rubocop: disable Security/Eval
    eval File.read(params[:rakefile])
    # rubocop: enable Security/Eval
  end

  case params[:options]
  when Array
    # Can pass multiple options as an array
    args = *params[:options]
  else
    args = params[:options]
  end

  UI.header "rake #{params[:task]}"
  Rake::Task[params[:task]].invoke args
end