File tree Expand file tree Collapse file tree 5 files changed +12
-16
lines changed
lib/octocatalog-diff/catalog-util
spec/octocatalog-diff/tests/catalog-util Expand file tree Collapse file tree 5 files changed +12
-16
lines changed Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
3- require 'rugged '
3+ require 'git '
44
55require_relative '../errors'
66require_relative '../util/scriptrunner'
@@ -64,8 +64,8 @@ def self.branch_sha(options = {})
6464 if dir . nil? || !File . directory? ( dir )
6565 raise Errno ::ENOENT , "Git directory #{ dir . inspect } does not exist"
6666 end
67- repo = Rugged :: Repository . new ( dir )
68- repo . branches [ branch ] . target_id
67+ repo = :: Git . open ( dir )
68+ repo . branch ( branch ) . gcommit . sha
6969 end
7070 end
7171 end
Original file line number Diff line number Diff line change 2929 s . add_runtime_dependency 'httparty' , '>= 0.21.0'
3030 s . add_runtime_dependency 'hashdiff' , '>= 0.3.0'
3131 s . add_runtime_dependency 'parallel' , '>= 1.12.0'
32- s . add_runtime_dependency 'rugged ' , '>= 0.25.0b2 '
32+ s . add_runtime_dependency 'git ' , '~> 4 '
3333 s . add_runtime_dependency 'puppet' , puppet_version
3434 s . add_development_dependency 'puppet' , puppet_version
3535 s . add_development_dependency 'rspec' , '~> 3.4.0'
Original file line number Diff line number Diff line change 11require 'erb'
22require 'optparse'
3- require 'rugged'
43
54require_relative '../lib/octocatalog-diff/cli/options'
65require_relative '../lib/octocatalog-diff/version'
Original file line number Diff line number Diff line change 44require OctocatalogDiff ::Spec . require_path ( '/catalog-util/cached_master_directory' )
55
66require 'fileutils'
7+ require 'git'
78require 'json'
89require 'open3'
9- require 'rugged'
1010require 'tmpdir'
1111
1212describe OctocatalogDiff ::CatalogUtil ::CachedMasterDirectory do
6666
6767 it 'should have the expected SHA returned by rugged' do
6868 pending 'repository checkout fixture missing' unless File . directory? ( @default_options [ :basedir ] )
69- repo = Rugged :: Repository . new ( @default_options [ :basedir ] )
70- test_rugged_sha = repo . branches [ 'master' ] . target_id
71- expect ( test_rugged_sha ) . to eq ( @master_sha )
69+ repo = Git . open ( @default_options [ :basedir ] )
70+ test_git_sha = repo . branch ( 'master' ) . gcommit . sha
71+ expect ( test_git_sha ) . to eq ( @master_sha )
7272 end
7373 end
7474
Original file line number Diff line number Diff line change 1313 @logger , @logger_str = OctocatalogDiff ::Spec . setup_logger
1414 allow ( File ) . to receive ( :'directory?' ) . with ( '/tmp/foo' ) . and_return ( false )
1515 allow ( File ) . to receive ( :'directory?' ) . with ( '/tmp/bar' ) . and_return ( true )
16+ allow ( File ) . to receive ( :'directory?' ) . with ( '.' ) . and_return ( true )
1617 end
1718
1819 describe '#check_out_git_archive' do
9394 end
9495
9596 context 'with valid directory' do
96- it 'should return the sha from rugged' do
97- opts = { branch : 'foo' , basedir : '/tmp/bar' }
98- expect ( Rugged ::Repository ) . to receive ( :new ) . with ( '/tmp/bar' )
99- . and_return ( OpenStruct . new ( branches : {
100- 'foo' => OpenStruct . new ( target_id : 'abcdef012345' )
101- } ) )
97+ it 'should return the sha' do
98+ opts = { branch : 'master' , basedir : '.' }
10299 result = described_class . branch_sha ( opts )
103- expect ( result ) . to eq ( 'abcdef012345' )
100+ expect ( result ) . to match ( /^[0-9a-f]+$/ )
104101 end
105102 end
106103 end
You can’t perform that action at this time.
0 commit comments