ohloh_scm 3.0.6 → 3.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a355a0742b48e9e0205d3bd3c4ffb6dee5e2eafcbadf6f38104455a807f2142f
4
- data.tar.gz: a33e29534f3587b6434f496d702aefae3ea203747890402380cb7ecdd7fc4ad0
3
+ metadata.gz: cb22e846629bf5c28b1fe9cff788eaf8911e2fff2084909bdade85271540822c
4
+ data.tar.gz: 15337965a2be09e7bb21a3cac07d5124f9142dee4bb34aee3c9f55b008010f3e
5
5
  SHA512:
6
- metadata.gz: b3c17e75d2c59625f815d5b8b59a490b815dfcc1ec7d1031ee95040340a7b67d0be67b1b4012fc1953cd8705ea2c9289710986caacf21c6bc788800af882d8fe
7
- data.tar.gz: 5d3db3fd91b90b1491b3144eee0936121394ce7e61f9f83fcc216eee3dc1a08414ba86315f3bd52a96a21d43677717cb813142aa9150e6d98ceafe967658be33
6
+ metadata.gz: c50fdce652b21742d4d73e0ec8c800cdbca176f9e464d5ad2ad9ca7c85bff6cb44581cbe7ad8996d481999ac30a2ace6a860054f8a4d09bb29ee1a5f0a34bacf
7
+ data.tar.gz: 1bfc619bb9eb7b43d11c6403ba763a1e1878b02c849067226fd42773e81a822625002f595814105f84c9826a633cb352fd715c9edc2d3b6e769512f2821df42d
data/Gemfile CHANGED
@@ -11,5 +11,4 @@ group :development do
11
11
  gem 'rubocop', '~> 0.67'
12
12
  gem 'rubocop-performance'
13
13
  gem 'simplecov'
14
- gem 'rspec'
15
14
  end
@@ -3,7 +3,6 @@ GEM
3
3
  specs:
4
4
  ast (2.4.0)
5
5
  byebug (11.0.1)
6
- diff-lcs (1.3)
7
6
  docile (1.3.1)
8
7
  jaro_winkler (1.5.2)
9
8
  json (2.2.0)
@@ -20,19 +19,6 @@ GEM
20
19
  psych (3.1.0)
21
20
  rainbow (3.0.0)
22
21
  rake (12.3.2)
23
- rspec (3.8.0)
24
- rspec-core (~> 3.8.0)
25
- rspec-expectations (~> 3.8.0)
26
- rspec-mocks (~> 3.8.0)
27
- rspec-core (3.8.2)
28
- rspec-support (~> 3.8.0)
29
- rspec-expectations (3.8.4)
30
- diff-lcs (>= 1.2.0, < 2.0)
31
- rspec-support (~> 3.8.0)
32
- rspec-mocks (3.8.1)
33
- diff-lcs (>= 1.2.0, < 2.0)
34
- rspec-support (~> 3.8.0)
35
- rspec-support (3.8.2)
36
22
  rubocop (0.67.2)
37
23
  jaro_winkler (~> 1.5.1)
38
24
  parallel (~> 1.10)
@@ -60,7 +46,6 @@ DEPENDENCIES
60
46
  mocha
61
47
  nokogiri
62
48
  rake
63
- rspec
64
49
  rubocop (~> 0.67)
65
50
  rubocop-performance
66
51
  simplecov
@@ -23,7 +23,7 @@ module OhlohScm
23
23
  # rubocop:enable Metrics/MethodLength
24
24
 
25
25
  def export_tag(dest_dir, tag_name)
26
- run "cd '#{path}' && bzr export -r #{tag_name} #{dest_dir}"
26
+ run "cd '#{url}' && bzr export -r #{tag_name} #{dest_dir}"
27
27
  end
28
28
 
29
29
  def export(dest_dir, token = head_token)
@@ -2,7 +2,7 @@
2
2
 
3
3
  module OhlohScm
4
4
  module Git
5
- class Scm < OhlohScm::Scm # rubocop:disable Metrics/ClassLength
5
+ class Scm < OhlohScm::Scm
6
6
  def initialize(core:, url:, branch_name:, username:, password:)
7
7
  super
8
8
  @branch_name = branch_name || 'master'
@@ -27,7 +27,7 @@ module OhlohScm
27
27
 
28
28
  def clone_or_fetch(remote_scm, callback)
29
29
  callback.update(0, 1)
30
- if status.branch?(branch_name)
30
+ if status.exist? && status.branch?(branch_name)
31
31
  clean_and_checkout_branch # must be on correct branch, but we want to be careful.
32
32
  fetch_new_commits(remote_scm)
33
33
  else
@@ -43,7 +43,7 @@ module OhlohScm
43
43
  end
44
44
 
45
45
  def clone_and_create_tracking_branch(remote_scm)
46
- unless status.scm_dir_exist?
46
+ unless status.scm_dir_exist? || status.exist?
47
47
  run "rm -rf '#{url}'"
48
48
  run "git clone -q -n '#{remote_scm.url}' '#{url}'"
49
49
  end
@@ -54,16 +54,12 @@ module OhlohScm
54
54
  # We need very high reliability and this sequence gets the job done every time.
55
55
  def clean_and_checkout_branch
56
56
  return unless status.scm_dir_exist?
57
- return unless status.branch?(branch_name)
58
57
 
59
58
  run "cd '#{url}' && git clean -f -d -x"
60
- clean_git_lock_file
61
- run "cd '#{url}' && git reset --hard HEAD"
62
- run "cd '#{url}' && git checkout #{branch_name} --"
63
- end
59
+ return unless status.branch?(branch_name)
64
60
 
65
- def clean_git_lock_file
66
- run "rm #{url}/.git/index.lock" if File.exist?("#{url}/.git/index.lock")
61
+ run "cd '#{url}' && git checkout #{branch_name} --"
62
+ run "cd '#{url}' && git reset --hard heads/#{branch_name} --"
67
63
  end
68
64
 
69
65
  def create_tracking_branch(branch_name)
@@ -3,10 +3,16 @@
3
3
  module OhlohScm
4
4
  module Git
5
5
  class Validation < OhlohScm::Validation
6
+ def validate
7
+ super
8
+ @errors << [:branch_name, 'Invalid Branch Name.'] if scm.branch_name.to_s.empty?
9
+ end
10
+
6
11
  private
7
12
 
8
13
  def validate_server_connection
9
- msg = "The server did not respond to the 'git-ls-remote' command. Is the URL correct?"
14
+ msg = "The server did not respond to the 'git-ls-remote' command."
15
+ msg << ' Are the URL and Branch fields correct?'
10
16
  @errors << [:failed, msg] unless status.exist?
11
17
  end
12
18
 
@@ -40,6 +40,10 @@ module OhlohScm
40
40
  cat("#{git_commit(commit)}^", diff.path)
41
41
  end
42
42
 
43
+ def git_commit(commit)
44
+ run("cd #{url} && git svn find-rev r#{commit.token}").strip
45
+ end
46
+
43
47
  private
44
48
 
45
49
  def open_log_file(opts = {})
@@ -72,10 +76,6 @@ module OhlohScm
72
76
  run("cd #{url} && git show #{revision}:#{file_path.shellescape}").strip
73
77
  end
74
78
 
75
- def git_commit(commit)
76
- run("cd #{url} && git svn find-rev r#{commit.token}").strip
77
- end
78
-
79
79
  def git_svn_log_cmd
80
80
  "cd #{url} && git svn log"
81
81
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module OhlohScm
4
4
  module Version
5
- STRING = '3.0.6'
5
+ STRING = '3.0.11'
6
6
  GIT = '2.17.1'
7
7
  SVN = '1.9.7'
8
8
  CVSNT = '2.5.04'
@@ -1,5 +1,4 @@
1
1
  require 'spec_helper'
2
- require 'byebug'
3
2
 
4
3
  describe 'Git::Scm' do
5
4
  it 'must pull git repository' do
@@ -7,6 +7,10 @@ describe 'Git::Validation' do
7
7
  core.errors.must_be :empty?
8
8
  end
9
9
 
10
+ it 'must have errors for no branch_name' do
11
+ get_core(:git, branch_name: '').validation.send(:branch_name_errors).wont_be :empty?
12
+ end
13
+
10
14
  it 'must have errors for invalid branch_name' do
11
15
  get_core(:git, branch_name: 'x' * 81).validation.send(:branch_name_errors).wont_be :empty?
12
16
  get_core(:git, branch_name: 'foo@bar').validation.send(:branch_name_errors).wont_be :empty?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ohloh_scm
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.6
4
+ version: 3.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenHub Team at Synopsys
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-22 00:00:00.000000000 Z
11
+ date: 2020-12-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |-
14
14
  The OpenHub source control management library for \
@@ -190,7 +190,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  - !ruby/object:Gem::Version
191
191
  version: '0'
192
192
  requirements: []
193
- rubygems_version: 3.0.2
193
+ rubyforge_project:
194
+ rubygems_version: 2.7.6
194
195
  signing_key:
195
196
  specification_version: 4
196
197
  summary: Source Control Management