Class: Pantograph::Actions::EnsureGitStatusCleanAction
Overview
Raises an exception and stop the lane execution if the repo is not in a clean state
Constant Summary
Pantograph::Action::AVAILABLE_CATEGORIES, Pantograph::Action::RETURN_TYPES
Class Method Summary
collapse
action_name, authors, deprecated_notes, lane_context, method_missing, other_action, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.author ⇒ Object
39
40
41
|
# File 'pantograph/lib/pantograph/actions/ensure_git_status_clean.rb', line 39
def self.author
['lmirosevic', 'antondomashnev', 'johnknapprs']
end
|
.available_options ⇒ Object
52
53
54
|
# File 'pantograph/lib/pantograph/actions/ensure_git_status_clean.rb', line 52
def self.available_options
[]
end
|
.category ⇒ Object
56
57
58
|
# File 'pantograph/lib/pantograph/actions/ensure_git_status_clean.rb', line 56
def self.category
:source_control
end
|
.description ⇒ Object
26
27
28
|
# File 'pantograph/lib/pantograph/actions/ensure_git_status_clean.rb', line 26
def self.description
'Raises error if there are uncommitted git changes'
end
|
.details ⇒ Object
30
31
|
# File 'pantograph/lib/pantograph/actions/ensure_git_status_clean.rb', line 30
def self.details
end
|
.example_code ⇒ Object
43
44
45
46
47
48
49
50
|
# File 'pantograph/lib/pantograph/actions/ensure_git_status_clean.rb', line 43
def self.example_code
[
'before_all do
# Prevent pantograph from running lanes when git is in a dirty state
ensure_git_status_clean
end'
]
end
|
.is_supported?(platform) ⇒ Boolean
60
61
62
|
# File 'pantograph/lib/pantograph/actions/ensure_git_status_clean.rb', line 60
def self.is_supported?(platform)
true
end
|
.output ⇒ Object
33
34
35
36
37
|
# File 'pantograph/lib/pantograph/actions/ensure_git_status_clean.rb', line 33
def self.output
[
['ENSURE_GIT_STATUS_CLEAN', 'Returns `true` if status clean when executed']
]
end
|
.run(params) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'pantograph/lib/pantograph/actions/ensure_git_status_clean.rb', line 9
def self.run(params)
repo_status = Helper::Git.repo_status
if repo_status.empty?
UI.success('Git status is clean, all good! 💪')
Actions.lane_context[SharedValues::ENSURE_GIT_STATUS_CLEAN] = true
else
error_message = [
'Git repository is dirty! Please ensure the repo is in a clean state by committing/stashing/discarding all changes first.',
'Uncommitted changes:',
repo_status
].join("\n")
UI.user_error!(error_message)
end
end
|