Sha256: 486c251adf3dc40cb5801abf81ea7f21f0fa4c0116a4ba56a9676f4a48b09fe4

Contents?: true

Size: 1.68 KB

Versions: 106

Compression:

Stored size: 1.68 KB

Contents

module Fastlane
  module Actions
    module SharedValues
      GIT_REPO_WAS_CLEAN_ON_START = :GIT_REPO_WAS_CLEAN_ON_START
    end

    # Raises an exception and stop the lane execution if the repo is not in a clean state
    class EnsureGitStatusCleanAction < Action
      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

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

      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

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

      def self.author
        "lmirosevic"
      end

      def self.example_code
        ['ensure_git_status_clean']
      end

      def self.category
        :source_control
      end

      def self.is_supported?(platform)
        true
      end
    end
  end
end

Version data entries

106 entries across 106 versions & 1 rubygems

Version Path
fastlane-2.21.0.beta.20170320010043 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-2.21.0.beta.20170319010027 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-2.21.0.beta.20170318010107 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-2.21.0.beta.20170317010039 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-2.21.0.beta.20170316010039 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-2.20.0 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-2.20.0.beta.20170315010053 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-2.20.0.beta.20170314010029 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-2.20.0.beta.20170313010048 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-2.20.0.beta.20170312010035 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-2.20.0.beta.20170311010030 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-2.20.0.beta.20170310010058 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-2.20.0.beta.20170309010049 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-2.20.0.beta.20170308010036 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-2.19.3 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-2.20.0.beta.20170307010029 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-2.19.2 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-2.20.0.beta.20170306010752 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-2.20.0.beta.20170305010057 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb
fastlane-2.20.0.beta.20170304010023 fastlane/lib/fastlane/actions/ensure_git_status_clean.rb