Sha256: 269e262728ccd7abd4888db15c54af7c5b61791803523f861bdfbb6f29bd9e2f

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

module Kaya
  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 Kaya::Support::Configuration.use_git?
          if Kaya::Database::MongoConnector.last_commit != (last_repo_commit  = Kaya::Support::Git.last_commit)
            $K_LOG.debug "Git has been changed. Perform code update" if $K_LOG
            Kaya::Support::Git.reset_hard_and_pull
            Kaya::Database::MongoConnector.insert_commit(last_repo_commit)
            $K_LOG.debug "Commit log updated on database" if $K_LOG
            true
          else
            $K_LOG.debug "No git changes" if $K_LOG
            false
          end
        else
          true
        end
      end

      def self.is_there_gemfile_lock?
        begin
          IO.read("#{Dir.pwd}/Gemfile.lock")
        rescue
          false
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
kaya-0.0.10 lib/kaya/support/change_inspector.rb
kaya-0.0.9 lib/kaya/support/change_inspector.rb
kaya-0.0.8 lib/kaya/support/change_inspector.rb
kaya-0.0.7 lib/kaya/support/change_inspector.rb
kaya-0.0.6 lib/kaya/support/change_inspector.rb
kaya-0.0.5 lib/kaya/support/change_inspector.rb
kaya-0.0.4 lib/kaya/support/change_inspector.rb