Sha256: 7b84adb0172b3eee5b1060bd7eb35d72b9f8053aff4f3851ab4714ba44eef3c9

Contents?: true

Size: 538 Bytes

Versions: 29

Compression:

Stored size: 538 Bytes

Contents

module KnapsackPro
  module RepositoryAdapters
    class GitAdapter < BaseAdapter
      def commit_hash
        `git -C "#{working_dir}" rev-parse HEAD`.strip
      end

      def branch
        `git -C "#{working_dir}" rev-parse --abbrev-ref HEAD`.strip
      end

      def branches
        str_branches = `git rev-parse --abbrev-ref --branches`
        str_branches.split("\n")
      end

      private

      def working_dir
        dir = KnapsackPro::Config::Env.project_dir
        File.expand_path(dir)
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
knapsack_pro-5.1.2 lib/knapsack_pro/repository_adapters/git_adapter.rb
knapsack_pro-5.1.1 lib/knapsack_pro/repository_adapters/git_adapter.rb
knapsack_pro-5.1.0 lib/knapsack_pro/repository_adapters/git_adapter.rb
knapsack_pro-5.0.0 lib/knapsack_pro/repository_adapters/git_adapter.rb
knapsack_pro-4.1.0 lib/knapsack_pro/repository_adapters/git_adapter.rb
knapsack_pro-4.0.0 lib/knapsack_pro/repository_adapters/git_adapter.rb
knapsack_pro-3.11.0 lib/knapsack_pro/repository_adapters/git_adapter.rb
knapsack_pro-3.10.0 lib/knapsack_pro/repository_adapters/git_adapter.rb
knapsack_pro-3.9.0 lib/knapsack_pro/repository_adapters/git_adapter.rb
knapsack_pro-3.8.0 lib/knapsack_pro/repository_adapters/git_adapter.rb
knapsack_pro-3.7.0 lib/knapsack_pro/repository_adapters/git_adapter.rb
knapsack_pro-3.6.0 lib/knapsack_pro/repository_adapters/git_adapter.rb
knapsack_pro-3.5.0 lib/knapsack_pro/repository_adapters/git_adapter.rb
knapsack_pro-3.4.2 lib/knapsack_pro/repository_adapters/git_adapter.rb
knapsack_pro-3.4.1 lib/knapsack_pro/repository_adapters/git_adapter.rb
knapsack_pro-3.4.0 lib/knapsack_pro/repository_adapters/git_adapter.rb
knapsack_pro-3.3.1 lib/knapsack_pro/repository_adapters/git_adapter.rb
knapsack_pro-3.3.0 lib/knapsack_pro/repository_adapters/git_adapter.rb
knapsack_pro-3.2.1 lib/knapsack_pro/repository_adapters/git_adapter.rb
knapsack_pro-3.2.0 lib/knapsack_pro/repository_adapters/git_adapter.rb