Class: Fastlane::Actions::EnsureGitStatusCleanAction
Overview
Raises an exception and stop the lane execution if the repo is not in a clean state
Constant Summary
Fastlane::Action::AVAILABLE_CATEGORIES
Class Method Summary
collapse
action_name, authors, available_options, lane_context, method_missing, other_action, return_value, sample_return_value, sh, step_text
Class Method Details
.author ⇒ Object
40
41
42
|
# File 'lib/fastlane/actions/ensure_git_status_clean.rb', line 40
def self.author
"lmirosevic"
end
|
.category ⇒ Object
48
49
50
|
# File 'lib/fastlane/actions/ensure_git_status_clean.rb', line 48
def self.category
:source_control
end
|
.description ⇒ Object
20
21
22
|
# File 'lib/fastlane/actions/ensure_git_status_clean.rb', line 20
def self.description
"Raises an exception if there are uncommited git changes"
end
|
.details ⇒ Object
24
25
26
27
28
29
30
31
32
|
# File 'lib/fastlane/actions/ensure_git_status_clean.rb', line 24
def self.details
[
'A sanity check to make sure you are working in a repo that is clean. Especially',
'useful to put at the beginning of your Fastfile in the `before_all` block, if',
'some of your other actions will touch your filesystem, do things to your git repo,',
'or just as a general reminder to save your work. Also needed as a prerequisite for',
'some other actions like `reset_git_repo`.'
].join("\n")
end
|
.example_code ⇒ Object
44
45
46
|
# File 'lib/fastlane/actions/ensure_git_status_clean.rb', line 44
def self.example_code
['ensure_git_status_clean']
end
|
.is_supported?(platform) ⇒ Boolean
52
53
54
|
# File 'lib/fastlane/actions/ensure_git_status_clean.rb', line 52
def self.is_supported?(platform)
true
end
|
.output ⇒ Object
34
35
36
37
38
|
# File 'lib/fastlane/actions/ensure_git_status_clean.rb', line 34
def self.output
[
['GIT_REPO_WAS_CLEAN_ON_START', 'Stores the fact that the git repo was clean at some point']
]
end
|
.run(params) ⇒ Object
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/fastlane/actions/ensure_git_status_clean.rb', line 9
def self.run(params)
repo_clean = `git status --porcelain`.empty?
if repo_clean
UI.success('Git status is clean, all good! 💪')
Actions.lane_context[SharedValues::GIT_REPO_WAS_CLEAN_ON_START] = true
else
UI.user_error!("Git repository is dirty! Please ensure the repo is in a clean state by commiting/stashing/discarding all changes first.")
end
end
|