Sha256: 70ffb1989597a7a5383c82668dc1e69d12be95ab053f0b93b2359d1636d67f98

Contents?: true

Size: 644 Bytes

Versions: 8

Compression:

Stored size: 644 Bytes

Contents

# frozen_string_literal: true

module Admin
  # Git Handler
  class GitHandler
    def installed?
      branch_name = `git rev-parse --abbrev-ref HEAD`
      branch_name.blank? ? false : true
    rescue StandardError
      false
    end

    def current_branch
      `git rev-parse --abbrev-ref HEAD`
    rescue StandardError
      false
    end

    def changes_count
      changes = `git diff --stat HEAD`
      status_color = changes.blank? ? '#12c752' : '#f98105'
      changes = changes.blank? ? 'No changes' : changes.split("\n").last
      { changes: changes, color: status_color }
    rescue StandardError
      false
    end
  end
end

Version data entries

8 entries across 7 versions & 1 rubygems

Version Path
keppler-2.1.22 installer/core/app/services/admin/git_handler.rb
keppler-2.1.21 installer/core/app/services/admin/git_handler.rb
keppler-2.1.20 installer/core/app/services/admin/git_handler.rb
keppler-2.1.19 installer/core/app/services/admin/git_handler.rb
keppler-2.1.18 testing-with-2.1.18/app/services/admin/git_handler.rb
keppler-2.1.18 installer/core/app/services/admin/git_handler.rb
keppler-2.1.17 installer/core/app/services/admin/git_handler.rb
keppler-2.1.16 installer/core/app/services/admin/git_handler.rb