Sha256: 2555d74eea87efdaf66504123ee8593ff4cab747b9b3577d038be7514e51a2c0

Contents?: true

Size: 1.05 KB

Versions: 63

Compression:

Stored size: 1.05 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
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
mutx-0.1.69 lib/mutx/support/change_inspector.rb
mutx-0.1.68 lib/mutx/support/change_inspector.rb
mutx-0.1.67 lib/mutx/support/change_inspector.rb
mutx-0.1.66 lib/mutx/support/change_inspector.rb
mutx-0.1.65 lib/mutx/support/change_inspector.rb
mutx-0.1.64 lib/mutx/support/change_inspector.rb
mutx-0.1.63 lib/mutx/support/change_inspector.rb
mutx-0.1.62 lib/mutx/support/change_inspector.rb
mutx-0.1.61 lib/mutx/support/change_inspector.rb
mutx-0.1.60 lib/mutx/support/change_inspector.rb
mutx-0.1.59 lib/mutx/support/change_inspector.rb
mutx-0.1.58 lib/mutx/support/change_inspector.rb
mutx-0.1.57 lib/mutx/support/change_inspector.rb
mutx-0.1.56 lib/mutx/support/change_inspector.rb
mutx-0.1.55 lib/mutx/support/change_inspector.rb
mutx-0.1.54 lib/mutx/support/change_inspector.rb
mutx-0.1.53 lib/mutx/support/change_inspector.rb
mutx-0.1.52 lib/mutx/support/change_inspector.rb
mutx-0.1.51 lib/mutx/support/change_inspector.rb
mutx-0.1.50 lib/mutx/support/change_inspector.rb