Class: Fastlane::Actions::EnsureTagNotExistsAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



62
63
64
# File 'lib/fastlane/plugin/menigit/actions/ensure_tag_not_exists.rb', line 62

def self.authors
  ["Artur Stępniewski"]
end

.available_optionsObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/fastlane/plugin/menigit/actions/ensure_tag_not_exists.rb', line 26

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :tag,
                   env_name: "FL_ENSURE_TAG_NOT_EXISTS_TAG",
                   description: "The tag name that should be checked",
                   optional: false,
                   type: String),
    FastlaneCore::ConfigItem.new(key: :remote,
                   env_name: "FL_ENSURE_TAG_NOT_EXISTS_TAG_REMOTE",
                   description: "Whether to check remote. Defaults to true",
                   optional: true,
                   default_value: false,
                   type: Boolean),
    FastlaneCore::ConfigItem.new(key: :remote_name,
                    env_name: "FL_ENSURE_TAG_NOT_EXISTS_TAG_REMOTE_NAME",
                    description: "Whether to check remote. Defaults to true",
                    optional: true,
                    default_value: "origin",
                    type: String)
  ]
end

.categoryObject



54
55
56
# File 'lib/fastlane/plugin/menigit/actions/ensure_tag_not_exists.rb', line 54

def self.category
  :source_control
end

.descriptionObject



22
23
24
# File 'lib/fastlane/plugin/menigit/actions/ensure_tag_not_exists.rb', line 22

def self.description
  "Checks if the git tag with the given name not exists in the current repo"
end

.example_codeObject



48
49
50
51
52
# File 'lib/fastlane/plugin/menigit/actions/ensure_tag_not_exists.rb', line 48

def self.example_code
  [
    'ensure_tag_not_exist(tag: "3.2.2", remote: true)'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/fastlane/plugin/menigit/actions/ensure_tag_not_exists.rb', line 58

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fastlane/plugin/menigit/actions/ensure_tag_not_exists.rb', line 6

def self.run(params)
  tag = params[:tag]
  remote = params[:remote]
  remote_name = params[:remote_name]
  if other_action.git_tag_exists(tag: tag, remote: remote, remote_name: remote_name)
    error_message = "Tag #{tag} already exists"
    if remote
      error_message += " in #{remote_name}"
    end
    error_message += "!"
    UI.user_error!(error_message)
  else
    UI.success("Success! Tag #{tag} not exists!")
  end
end