Class: Fastlane::Actions::EnsureNoChangesAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::EnsureNoChangesAction
- Defined in:
- lib/fastlane/plugin/menigit/actions/ensure_no_changes.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
61 62 63 |
# File 'lib/fastlane/plugin/menigit/actions/ensure_no_changes.rb', line 61 def self. ["Marcin Stepnowski"] end |
.available_options ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/fastlane/plugin/menigit/actions/ensure_no_changes.rb', line 26 def self. [ FastlaneCore::ConfigItem.new(key: :path, env_name: "ENSURE_NO_CHANGES_PATH", description: "Path for directory/file that you want check for diff", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :show_diff, env_name: "ENSURE_NO_CHANGES_SHOW_DIFF", description: "The flag whether to show the git diff if the repo is dirty", optional: true, default_value: false, type: Boolean), FastlaneCore::ConfigItem.new(key: :error_message, env_name: "ENSURE_NO_CHANGES_ERROR_MESSAGE", description: "Error message that will be show instead of default one based on path", optional: true, type: String) ] end |
.category ⇒ Object
53 54 55 |
# File 'lib/fastlane/plugin/menigit/actions/ensure_no_changes.rb', line 53 def self.category :source_control end |
.description ⇒ Object
22 23 24 |
# File 'lib/fastlane/plugin/menigit/actions/ensure_no_changes.rb', line 22 def self.description "Raises an exception if there are uncommitted git changes at path" end |
.example_code ⇒ Object
47 48 49 50 51 |
# File 'lib/fastlane/plugin/menigit/actions/ensure_no_changes.rb', line 47 def self.example_code [ 'ensure_no_changes(path: "fastlane/Fastfile", show_diff: true)' ] end |
.is_supported?(platform) ⇒ Boolean
57 58 59 |
# File 'lib/fastlane/plugin/menigit/actions/ensure_no_changes.rb', line 57 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_no_changes.rb', line 6 def self.run(params) path = params[:path] git_diff = Actions.sh("git diff #{path}") no_changes = git_diff.empty? if no_changes UI.success("Git diff for #{path} is clean, all good! 💪") else = params[:error_message] ||= "Git diff for #{path} is dirty! Please ensure the repo is in a clean state by committing/stashing/discarding all changes first." if params[:show_diff] += "\nGit diff:\n#{git_diff}" end UI.user_error!() end end |