Skip to content

Commit eb6c568

Browse files
authored
Merge pull request #115 from blackducksoftware/hotfix
exist? must rely on raising exceptions like in v2
2 parents 2cc336a + 1dc62da commit eb6c568

File tree

6 files changed

+12
-16
lines changed

6 files changed

+12
-16
lines changed

lib/ohloh_scm/status.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ def initialize(core)
1212
end
1313

1414
def exist?
15-
return unless scm_dir_exist?
16-
1715
!activity.head_token.to_s.empty?
16+
rescue RuntimeError
17+
logger.debug { $ERROR_INFO.inspect }
18+
false
1819
end
1920

2021
def scm_dir_exist?

lib/ohloh_scm/validation.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ def validate
2020

2121
private
2222

23-
def validate_server_connection
24-
return unless valid?
25-
end
23+
def validate_server_connection; end
2624

2725
# rubocop:disable Metrics/AbcSize
2826
def validate_attributes

lib/ohloh_scm/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module OhlohScm
44
module Version
5-
STRING = '3.0.1'
5+
STRING = '3.0.2'
66
GIT = '2.17.1'
77
SVN = '1.9.7'
88
CVSNT = '2.5.04'

spec/ohloh_scm/bzr/scm_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
with_bzr_repository('bzr') do |src|
88
tmpdir do |dest_dir|
99
core = OhlohScm::Factory.get_core(scm_type: :bzr, url: dest_dir)
10-
refute core.status.exist?
10+
refute core.status.scm_dir_exist?
1111

1212
core.scm.pull(src.scm, TestCallback.new)
13+
assert core.status.scm_dir_exist?
1314
assert core.status.exist?
1415
end
1516
end

spec/ohloh_scm/git/scm_spec.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
with_git_repository('git') do |src_core|
66
tmpdir do |dest_dir|
77
core = OhlohScm::Factory.get_core(scm_type: :git, url: dest_dir)
8-
refute core.status.exist?
8+
refute core.status.scm_dir_exist?
99

1010
core.scm.pull(src_core.scm, TestCallback.new)
11+
assert core.status.scm_dir_exist?
1112
assert core.status.exist?
1213
end
1314
end
@@ -19,7 +20,7 @@
1920
with_git_repository('git_with_multiple_branch', 'test') do |src_core|
2021
tmpdir do |dest_dir|
2122
core = OhlohScm::Factory.get_core(scm_type: :git, url: dest_dir, branch_name: 'test')
22-
refute core.status.exist?
23+
refute core.status.scm_dir_exist?
2324
core.scm.pull(src_core.scm, TestCallback.new)
2425

2526
remote_master_branch_sha = `cd #{dest_dir} && git rev-parse origin/master`
@@ -36,8 +37,9 @@
3637
with_cvs_repository('cvs', 'simple') do |src_core|
3738
tmpdir do |dest_dir|
3839
core = OhlohScm::Factory.get_core(scm_type: :git, url: dest_dir)
39-
refute core.status.exist?
40+
refute core.status.scm_dir_exist?
4041
core.scm.pull(src_core.scm, TestCallback.new)
42+
assert core.status.scm_dir_exist?
4143
assert core.status.exist?
4244

4345
dest_commits = core.activity.commits

spec/ohloh_scm/git/validation_spec.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
require 'spec_helper'
22

33
describe 'Git::Validation' do
4-
it 'must handle non existent remote source' do
5-
core = OhlohScm::Factory.get_core(scm_type: :git, url: 'https://github.com/Person/foobar')
6-
core.validate
7-
core.errors.wont_be :empty?
8-
end
9-
104
it 'wont have errors for valid url' do
115
core = OhlohScm::Factory.get_core(scm_type: :git, url: 'https://github.com/ruby/ruby')
126
core.validation.send(:validate_attributes)

0 commit comments

Comments
 (0)