class Fastlane::Actions::TwineValidateAction

Public Class Methods

action_name() click to toggle source
# File lib/fastlane/plugin/twine/actions/twine_validate_action.rb, line 56
def self.action_name
  name.split('::').last.gsub('Action', '').fastlane_underscore
end
authors() click to toggle source
# File lib/fastlane/plugin/twine/actions/twine_validate_action.rb, line 44
def self.authors
  ['Jonas Rottmann']
end
available_options() click to toggle source
# File lib/fastlane/plugin/twine/actions/twine_validate_action.rb, line 23
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :configuration_path,
                                 env_name: 'TWINE_CONFIGURATION_PATH',
                                 description: 'Location to json file with configuration information',
                                 is_string: true,
                                 optional: false),
    FastlaneCore::ConfigItem.new(key: :pedantic,
                                 env_name: 'TWINE_VALIDATE_PEDANTIC',
                                 description: 'Run the validation using twines `pedantic` flag',
                                 is_string: false,
                                 optional: true,
                                 default_value: false),
    FastlaneCore::ConfigItem.new(key: :use_bundle_exec,
                                 env_name: "TWINE_USE_BUNDLE_EXEC",
                                 description: "Use bundle exec when there is a Gemfile presented",
                                 is_string: false,
                                 default_value: true)
  ]
end
category() click to toggle source
# File lib/fastlane/plugin/twine/actions/twine_validate_action.rb, line 52
def self.category
  :building
end
description() click to toggle source
# File lib/fastlane/plugin/twine/actions/twine_validate_action.rb, line 19
def self.description
  'Validates all twine files mentioned in the config file'
end
is_supported?(_platform) click to toggle source
# File lib/fastlane/plugin/twine/actions/twine_validate_action.rb, line 48
def self.is_supported?(_platform)
  true
end
run(params) click to toggle source
# File lib/fastlane/plugin/twine/actions/twine_validate_action.rb, line 4
def self.run(params)
  Actions.verify_gem!('twine')
  Helper::TwineConfigParser.parse(params).map(&:source_path).uniq.each do |source_path|
    if !File.exist?(source_path)
      UI.user_error!("Source file #{source_path} not found")
    else
      cmd = Helper::TwineCommandHelper.validate_command(source_path, params[:pedantic])
      cmd.prepend('bundle exec ') if params[:use_bundle_exec] && shell_out_should_use_bundle_exec?
      Actions.sh(cmd, error_callback: lambda { |result|
        UI.build_failure!(result)
      })
    end
  end
end