Class: Fastlane::Actions::HgEnsureCleanStatusAction

Inherits:
Fastlane::Action show all
Defined in:
lib/fastlane/actions/hg_ensure_clean_status.rb

Overview

Raises an exception and stop the lane execution if the repo is not in a clean state

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, authors, available_options, details, sh, step_text

Class Method Details

.authorObject



29
30
31
32
# File 'lib/fastlane/actions/hg_ensure_clean_status.rb', line 29

def self.author
  # credits to lmirosevic for original git version
  "sjrmanning"
end

.descriptionObject



19
20
21
# File 'lib/fastlane/actions/hg_ensure_clean_status.rb', line 19

def self.description
  "Raises an exception if there are uncommited hg changes"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/fastlane/actions/hg_ensure_clean_status.rb', line 34

def self.is_supported?(platform)
  true
end

.outputObject



23
24
25
26
27
# File 'lib/fastlane/actions/hg_ensure_clean_status.rb', line 23

def self.output
  [
    ['HG_REPO_WAS_CLEAN_ON_START', 'Stores the fact that the hg repo was clean at some point']
  ]
end

.run(params) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/fastlane/actions/hg_ensure_clean_status.rb', line 8

def self.run(params)
  repo_clean = `hg status`.empty?

  if repo_clean
    Helper.log.info 'Mercurial status is clean, all good! 😎'.green
    Actions.lane_context[SharedValues::HG_REPO_WAS_CLEAN_ON_START] = true
  else
    raise 'Mercurial repository is dirty! Please ensure the repo is in a clean state by commiting/stashing/discarding all changes first.'.red
  end
end