ohloh_scm 4.0.3 → 4.0.5
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 +4 -4
- data/lib/ohloh_scm/cvs/validation.rb +2 -2
- data/lib/ohloh_scm/git/scm.rb +5 -1
- data/lib/ohloh_scm/git/status.rb +7 -0
- data/lib/ohloh_scm/status.rb +2 -0
- data/lib/ohloh_scm/validation.rb +2 -2
- data/lib/ohloh_scm/version.rb +1 -1
- data/security.md +30 -0
- data/spec/helpers/repository_helper.rb +5 -1
- data/spec/ohloh_scm/cvs/activity_spec.rb +1 -1
- data/spec/ohloh_scm/cvs/validation_spec.rb +1 -1
- data/spec/ohloh_scm/git/activity_spec.rb +4 -4
- data/spec/ohloh_scm/git/scm_spec.rb +6 -1
- data/spec/ohloh_scm/git/status_spec.rb +15 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9173a903d32cdd9d100594a9077f7528d473a8cb9c7f1dcf7172745184f2f2f0
|
4
|
+
data.tar.gz: d6b967d7648cb2bdbc5c594d8c119c8f533d945b3b608aaef87bd2f4b8c67322
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 904efa77cf2a35d8de044afc5c8fb16f9266465e8d4fdf04ef403ccc093983a16fb76b0a40791f6033c4e767c2c598df0c79dfcb15f33e29e6fee4d00a3f9a6d
|
7
|
+
data.tar.gz: cd232f7a7bff3c4384160e04952cddf0ac54680d34c4e84ad44bc7874be6cec4d42d5007a8d41513a1e54afb1c3a1b9be8b32b021e76308b2a3992a8712ea7b4
|
@@ -17,8 +17,8 @@ module OhlohScm
|
|
17
17
|
def branch_name_errors
|
18
18
|
if scm.branch_name.to_s.empty?
|
19
19
|
[:branch_name, "The branch name can't be blank."]
|
20
|
-
elsif scm.branch_name.length >
|
21
|
-
[:branch_name, 'The branch name must not be longer than
|
20
|
+
elsif scm.branch_name.length > 200
|
21
|
+
[:branch_name, 'The branch name must not be longer than 200 characters.']
|
22
22
|
elsif !scm.branch_name.match?(/^[\w\-\+\.\/\ ]+$/)
|
23
23
|
[:branch_name, "The branch name may contain only letters,
|
24
24
|
numbers, spaces, and the special characters '_', '-', '+', '/', and '.'"]
|
data/lib/ohloh_scm/git/scm.rb
CHANGED
@@ -5,7 +5,7 @@ module OhlohScm
|
|
5
5
|
class Scm < OhlohScm::Scm
|
6
6
|
def initialize(core:, url:, branch_name:, username:, password:)
|
7
7
|
super
|
8
|
-
@branch_name = branch_name
|
8
|
+
@branch_name = branch_name
|
9
9
|
end
|
10
10
|
|
11
11
|
# == Example:
|
@@ -28,6 +28,10 @@ module OhlohScm
|
|
28
28
|
run "cd #{url} && git checkout $(git ls-files #{filenames})"
|
29
29
|
end
|
30
30
|
|
31
|
+
def branch_name_or_default
|
32
|
+
branch_name || 'master'
|
33
|
+
end
|
34
|
+
|
31
35
|
private
|
32
36
|
|
33
37
|
def clone_or_fetch(remote_scm, callback)
|
data/lib/ohloh_scm/git/status.rb
CHANGED
@@ -8,6 +8,13 @@ module OhlohScm
|
|
8
8
|
|
9
9
|
activity.branches.include?(name)
|
10
10
|
end
|
11
|
+
|
12
|
+
def default_branch
|
13
|
+
return scm.branch_name_or_default unless exist?
|
14
|
+
|
15
|
+
name = run("git remote show '#{scm.url}' | grep 'HEAD branch' | awk '{print $3}'").strip
|
16
|
+
name.to_s.empty? ? scm.branch_name_or_default : name
|
17
|
+
end
|
11
18
|
end
|
12
19
|
end
|
13
20
|
end
|
data/lib/ohloh_scm/status.rb
CHANGED
data/lib/ohloh_scm/validation.rb
CHANGED
@@ -37,8 +37,8 @@ module OhlohScm
|
|
37
37
|
def url_errors
|
38
38
|
error = if scm.url.nil? || scm.url.empty?
|
39
39
|
"The URL can't be blank."
|
40
|
-
elsif scm.url.length >
|
41
|
-
'The URL must not be longer than
|
40
|
+
elsif scm.url.length > 200
|
41
|
+
'The URL must not be longer than 200 characters.'
|
42
42
|
elsif !scm.url.match?(public_url_regex)
|
43
43
|
'The URL does not appear to be a valid server connection string.'
|
44
44
|
end
|
data/lib/ohloh_scm/version.rb
CHANGED
data/security.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
## Security
|
2
|
+
The Black Duck Vulnerability Disclosure Process is executed by the Product Security Incident Response Team (PSIRT). The Black Duck process is based on well-known industry standards, such as NIST-SP-800-61, ISO 29147, and ISO 30111.
|
3
|
+
|
4
|
+
The Black Duck PSIRT coordinates the response and, if necessary, disclosure of security incidents related to Black Duck products and associated software. Black Duck PSIRT's primary objective is to minimize the risks associated with security incidents in a timely, secure, and responsible manner.
|
5
|
+
|
6
|
+
Black Duck will investigate all reports for Black Duck products/platforms that are currently supported; accepted reports will be prioritized based on severity and other environmental factors.
|
7
|
+
|
8
|
+
If you believe you have found a security vulnerability in any repository that meets Black duck's definition of a security vulnerability, please report it to us as described below.
|
9
|
+
|
10
|
+
## Reporting Security Issues
|
11
|
+
**Please do not report security vulnerabilities through public GitHub issues.**
|
12
|
+
|
13
|
+
Instead, please report them to the Black Duck PSIRT team through email psirt@blackduck.com.
|
14
|
+
|
15
|
+
Contact Black Duck within 24 hours if you encounter any end user data. Do not view, alter, save, store, transfer, or otherwise access the data, and immediately purge any local information upon reporting the vulnerability to Black Duck.
|
16
|
+
|
17
|
+
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
18
|
+
|
19
|
+
- Affected Product/Platform and Version
|
20
|
+
- Technical description of the issue
|
21
|
+
- Detailed steps to reproduce and/or sample code used to exploit the vulnerability
|
22
|
+
- Contact information and optional name for acknowledgments
|
23
|
+
- Proposed disclosure plans
|
24
|
+
This information will help us triage your report more quickly.
|
25
|
+
|
26
|
+
## Preferred Languages
|
27
|
+
We prefer all communications to be in English.
|
28
|
+
|
29
|
+
## Policy
|
30
|
+
Black Duck follows the principle of [Coordinated Vulnerability Disclosure.](https://www.blackduck.com/company/legal/vulnerability-disclosure-policy.html)
|
@@ -1,12 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module RepositoryHelper
|
4
|
-
%w[
|
4
|
+
%w[svn git_svn cvs hg bzr].each do |scm_type|
|
5
5
|
define_method("with_#{scm_type}_repository") do |name, branch_name = nil, &block|
|
6
6
|
with_repository(scm_type, name, branch_name) { |core| block.call(core) }
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
+
def with_git_repository(name, branch_name = 'master', &block)
|
11
|
+
with_repository('git', name, branch_name) { |core| block.call(core) }
|
12
|
+
end
|
13
|
+
|
10
14
|
private
|
11
15
|
|
12
16
|
def with_repository(scm_type, name, branch_name = nil)
|
@@ -59,7 +59,7 @@ describe 'Cvs::Activity' do
|
|
59
59
|
it 'must correctly convert commits to git' do
|
60
60
|
with_cvs_repository('cvs', 'simple') do |cvs|
|
61
61
|
tmpdir do |tmp_dir|
|
62
|
-
git_core = OhlohScm::Factory.get_core(url: tmp_dir)
|
62
|
+
git_core = OhlohScm::Factory.get_core(url: tmp_dir, branch_name: 'master')
|
63
63
|
git_core.scm.pull(cvs.scm, TestCallback.new)
|
64
64
|
utc_dates = ['2006-06-29 16:21:07 UTC', '2006-06-29 18:14:47 UTC',
|
65
65
|
'2006-06-29 18:45:29 UTC', '2006-06-29 18:48:54 UTC',
|
@@ -12,7 +12,7 @@ describe 'Cvs::Validation' do
|
|
12
12
|
|
13
13
|
it 'must have errors for invalid branch_name' do
|
14
14
|
get_core(:cvs, branch_name: 'x' * 81).validation.send(:branch_name_errors).must_be_nil
|
15
|
-
get_core(:cvs, branch_name: 'x' *
|
15
|
+
get_core(:cvs, branch_name: 'x' * 201).validation.send(:branch_name_errors).wont_be :empty?
|
16
16
|
get_core(:cvs, branch_name: 'foo@bar').validation.send(:branch_name_errors).wont_be :empty?
|
17
17
|
end
|
18
18
|
|
@@ -329,7 +329,7 @@ describe 'Git::Activity' do
|
|
329
329
|
|
330
330
|
it 'must commit all changes in the working directory' do
|
331
331
|
tmpdir do |dir|
|
332
|
-
core = OhlohScm::Factory.get_core(scm_type: :git, url: dir)
|
332
|
+
core = OhlohScm::Factory.get_core(scm_type: :git, branch_name: 'master', url: dir)
|
333
333
|
|
334
334
|
core.activity.send(:init_db)
|
335
335
|
refute core.activity.send(:anything_to_commit?)
|
@@ -356,7 +356,7 @@ describe 'Git::Activity' do
|
|
356
356
|
|
357
357
|
it 'must test that no token returns nil' do
|
358
358
|
tmpdir do |dir|
|
359
|
-
core = OhlohScm::Factory.get_core(scm_type: :git, url: dir)
|
359
|
+
core = OhlohScm::Factory.get_core(scm_type: :git, branch_name: 'master', url: dir)
|
360
360
|
refute core.activity.read_token
|
361
361
|
core.activity.send(:init_db)
|
362
362
|
refute core.activity.read_token
|
@@ -365,7 +365,7 @@ describe 'Git::Activity' do
|
|
365
365
|
|
366
366
|
it 'must test write and read token' do
|
367
367
|
tmpdir do |dir|
|
368
|
-
core = OhlohScm::Factory.get_core(scm_type: :git, url: dir)
|
368
|
+
core = OhlohScm::Factory.get_core(scm_type: :git, branch_name: 'master', url: dir)
|
369
369
|
core.activity.send(:init_db)
|
370
370
|
core.activity.send(:write_token, 'FOO')
|
371
371
|
refute core.activity.read_token # Token not valid until committed
|
@@ -376,7 +376,7 @@ describe 'Git::Activity' do
|
|
376
376
|
|
377
377
|
it 'must test that commit_all includes write token' do
|
378
378
|
tmpdir do |dir|
|
379
|
-
core = OhlohScm::Factory.get_core(scm_type: :git, url: dir)
|
379
|
+
core = OhlohScm::Factory.get_core(scm_type: :git, branch_name: 'master', url: dir)
|
380
380
|
core.activity.send(:init_db)
|
381
381
|
c = OhlohScm::Commit.new
|
382
382
|
c.token = 'BAR'
|
@@ -93,7 +93,7 @@ describe 'Git::Scm' do
|
|
93
93
|
it 'must test the basic conversion to git' do
|
94
94
|
with_cvs_repository('cvs', 'simple') do |src_core|
|
95
95
|
tmpdir do |dest_dir|
|
96
|
-
core = OhlohScm::Factory.get_core(scm_type: :git, url: dest_dir)
|
96
|
+
core = OhlohScm::Factory.get_core(scm_type: :git, branch_name: 'master', url: dest_dir)
|
97
97
|
refute core.status.scm_dir_exist?
|
98
98
|
core.scm.pull(src_core.scm, TestCallback.new)
|
99
99
|
assert core.status.scm_dir_exist?
|
@@ -126,4 +126,9 @@ describe 'Git::Scm' do
|
|
126
126
|
assert system("ls #{dir}/Godeps/Godeps.json > /dev/null")
|
127
127
|
end
|
128
128
|
end
|
129
|
+
|
130
|
+
it 'must return master when branch_name is null' do
|
131
|
+
core = OhlohScm::Factory.get_core(scm_type: :git, url: 'foobar')
|
132
|
+
_(core.scm.branch_name_or_default).must_equal 'master'
|
133
|
+
end
|
129
134
|
end
|
@@ -4,8 +4,22 @@ describe 'Git::Status' do
|
|
4
4
|
it 'branch?' do
|
5
5
|
with_git_repository('git') do |git|
|
6
6
|
git.activity.send(:branches).must_equal %w[develop master]
|
7
|
-
assert git.status.branch?
|
7
|
+
assert git.status.branch?('master')
|
8
8
|
assert git.status.branch?('develop')
|
9
9
|
end
|
10
10
|
end
|
11
|
+
|
12
|
+
describe 'default_branch' do
|
13
|
+
it 'must return default branch when repository doesnt exist' do
|
14
|
+
git = OhlohScm::Factory.get_core(scm_type: :git, url: 'foobar')
|
15
|
+
git.status.stubs(:exist?)
|
16
|
+
_(git.status.default_branch).must_equal 'master'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'must return default branch when no HEAD branch is found in remote' do
|
20
|
+
git = OhlohScm::Factory.get_core(scm_type: :git, url: 'foobar')
|
21
|
+
git.status.stubs(:exist?).returns(true)
|
22
|
+
git.status.default_branch.must_equal 'master'
|
23
|
+
end
|
24
|
+
end
|
11
25
|
end
|
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: 4.0.
|
4
|
+
version: 4.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenHub Team at Synopsys
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
The OpenHub source control management library for \
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- lib/ohloh_scm/validation.rb
|
98
98
|
- lib/ohloh_scm/version.rb
|
99
99
|
- ohloh_scm.gemspec
|
100
|
+
- security.md
|
100
101
|
- spec/.rubocop.yml
|
101
102
|
- spec/benchmarks/hg_bzr_bash_vs_py_api.rb
|
102
103
|
- spec/benchmarks/process_spawn_benchmark.rb
|
@@ -192,8 +193,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
193
|
- !ruby/object:Gem::Version
|
193
194
|
version: '0'
|
194
195
|
requirements: []
|
195
|
-
rubygems_version: 3.0.
|
196
|
-
signing_key:
|
196
|
+
rubygems_version: 3.0.9
|
197
|
+
signing_key:
|
197
198
|
specification_version: 4
|
198
199
|
summary: Source Control Management
|
199
200
|
test_files:
|