Sha256: cb3e11b361fc16a426f362e32e47d1afd393b32fcd7a7082f97831db80e33421

Contents?: true

Size: 1.08 KB

Versions: 8

Compression:

Stored size: 1.08 KB

Contents

# encoding: utf-8
module Mutx
  module Support
    module ChangeInspector

      # Evaluates if code has been changed. If yes, performs a git reset hard and git pull
      # Update commit log into Database and return true
      # Returns true if there is a change in code.
      # Consider true if git usage is false
      # @return [Boolean]

      def self.is_there_a_change?
        if Mutx::Support::Configuration.use_git?
          if Mutx::Database::MongoConnector.last_commit != (last_repo_commit  = Mutx::Support::Git.last_remote_commit)
            Mutx::Support::Log.debug "Git has been changed. Perform code update" if Mutx::Support::Log
            Mutx::Support::Git.reset_hard_and_pull
            Mutx::Database::MongoConnector.insert_commit(last_repo_commit)
            Mutx::Support::Log.debug "Commit log updated on database" if Mutx::Support::Log
            true
          else
            Mutx::Support::Log.debug "No git changes" if Mutx::Support::Log
            false
          end
        else
          true
        end
      end

    end # ChangeInspector
  end # Support
end # Mutx

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mutx-0.2.7 lib/mutx/support/change_inspector.rb
mutx-0.2.6 lib/mutx/support/change_inspector.rb
mutx-0.2.5 lib/mutx/support/change_inspector.rb
mutx-0.2.4 lib/mutx/support/change_inspector.rb
mutx-0.2.3 lib/mutx/support/change_inspector.rb
mutx-0.2.2 lib/mutx/support/change_inspector.rb
mutx-0.2.1 lib/mutx/support/change_inspector.rb
mutx-0.2.0 lib/mutx/support/change_inspector.rb