Class: Fastlane::Actions::TwineValidateAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/twine/actions/twine_validate_action.rb

Class Method Summary collapse

Class Method Details

.action_nameObject



56
57
58
# File 'lib/fastlane/plugin/twine/actions/twine_validate_action.rb', line 56

def self.action_name
  name.split('::').last.gsub('Action', '').fastlane_underscore
end

.authorsObject



44
45
46
# File 'lib/fastlane/plugin/twine/actions/twine_validate_action.rb', line 44

def self.authors
  ['Jonas Rottmann']
end

.available_optionsObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# 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

.categoryObject



52
53
54
# File 'lib/fastlane/plugin/twine/actions/twine_validate_action.rb', line 52

def self.category
  :building
end

.descriptionObject



19
20
21
# 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) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/fastlane/plugin/twine/actions/twine_validate_action.rb', line 48

def self.is_supported?(_platform)
  true
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 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