ohloh_scm 4.0.5 → 5.0.0
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/.rubocop.yml +14 -3
- data/.ruby-version +1 -1
- data/Dockerfile +8 -8
- data/Gemfile +1 -1
- data/Gemfile.lock +48 -33
- data/lib/ohloh_scm/activity.rb +1 -1
- data/lib/ohloh_scm/bzr/activity.rb +12 -12
- data/lib/ohloh_scm/bzr/validation.rb +1 -1
- data/lib/ohloh_scm/commit.rb +2 -4
- data/lib/ohloh_scm/core.rb +2 -1
- data/lib/ohloh_scm/cvs/activity.rb +74 -60
- data/lib/ohloh_scm/cvs/scm.rb +12 -12
- data/lib/ohloh_scm/cvs/status.rb +1 -1
- data/lib/ohloh_scm/cvs/validation.rb +3 -3
- data/lib/ohloh_scm/diff.rb +1 -1
- data/lib/ohloh_scm/factory.rb +7 -1
- data/lib/ohloh_scm/git/activity.rb +111 -55
- data/lib/ohloh_scm/git/scm.rb +6 -8
- data/lib/ohloh_scm/git/status.rb +1 -1
- data/lib/ohloh_scm/git/validation.rb +1 -1
- data/lib/ohloh_scm/git_svn/activity.rb +5 -5
- data/lib/ohloh_scm/git_svn/scm.rb +5 -5
- data/lib/ohloh_scm/hg/activity.rb +13 -13
- data/lib/ohloh_scm/hg/scm.rb +3 -3
- data/lib/ohloh_scm/hg/validation.rb +1 -1
- data/lib/ohloh_scm/parser/branch_number.rb +7 -6
- data/lib/ohloh_scm/parser/bzr_xml_parser.rb +15 -15
- data/lib/ohloh_scm/parser/cvs_parser.rb +7 -6
- data/lib/ohloh_scm/parser/git_parser.rb +18 -15
- data/lib/ohloh_scm/parser/hg_parser.rb +8 -6
- data/lib/ohloh_scm/parser/svn_parser.rb +7 -6
- data/lib/ohloh_scm/py_bridge/hg_client.rb +1 -1
- data/lib/ohloh_scm/svn/activity.rb +17 -18
- data/lib/ohloh_scm/svn/scm.rb +4 -6
- data/lib/ohloh_scm/svn/validation.rb +2 -2
- data/lib/ohloh_scm/system.rb +1 -1
- data/lib/ohloh_scm/validation.rb +2 -4
- data/lib/ohloh_scm/version.rb +1 -1
- data/ohloh_scm.gemspec +5 -5
- data/spec/.rubocop.yml +2 -5
- data/spec/benchmarks/process_spawn_benchmark.rb +1 -1
- data/spec/helpers/assert_scm_attr_helper.rb +4 -4
- data/spec/helpers/generic_helper.rb +2 -2
- data/spec/helpers/repository_helper.rb +1 -1
- data/spec/ohloh_scm/activity_spec.rb +2 -2
- data/spec/ohloh_scm/bzr/activity_spec.rb +60 -60
- data/spec/ohloh_scm/bzr/validation_spec.rb +1 -1
- data/spec/ohloh_scm/cvs/activity_spec.rb +20 -21
- data/spec/ohloh_scm/cvs/scm_spec.rb +36 -36
- data/spec/ohloh_scm/cvs/validation_spec.rb +4 -4
- data/spec/ohloh_scm/factory_spec.rb +2 -2
- data/spec/ohloh_scm/git/activity_spec.rb +111 -110
- data/spec/ohloh_scm/git/scm_spec.rb +11 -11
- data/spec/ohloh_scm/git/status_spec.rb +3 -3
- data/spec/ohloh_scm/git/validation_spec.rb +7 -7
- data/spec/ohloh_scm/git_svn/activity_spec.rb +14 -14
- data/spec/ohloh_scm/git_svn/scm_spec.rb +1 -1
- data/spec/ohloh_scm/hg/activity_spec.rb +99 -99
- data/spec/ohloh_scm/hg/scm_spec.rb +5 -5
- data/spec/ohloh_scm/hg/validation_spec.rb +1 -1
- data/spec/ohloh_scm/parser/array_writer_spec.rb +7 -7
- data/spec/ohloh_scm/parser/branch_number_spec.rb +3 -3
- data/spec/ohloh_scm/parser/cvs_parser_spec.rb +31 -31
- data/spec/ohloh_scm/parser/git_parser_spec.rb +29 -32
- data/spec/ohloh_scm/parser/hg_parser_spec.rb +60 -60
- data/spec/ohloh_scm/svn/activity_spec.rb +11 -12
- data/spec/ohloh_scm/svn/scm_spec.rb +24 -24
- data/spec/ohloh_scm/svn/validation_spec.rb +6 -6
- data/spec/ohloh_scm/svn_parser_spec.rb +29 -29
- data/spec/ohloh_scm/system_spec.rb +5 -5
- data/spec/ohloh_scm/version_spec.rb +1 -1
- data/spec/string_encoder_spec.rb +4 -4
- metadata +5 -79
@@ -10,8 +10,8 @@ module OhlohScm
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def format
|
13
|
-
"format:'__BEGIN_COMMIT__%nCommit: %H%nAuthor: %an%nAuthorEmail:"\
|
14
|
-
"
|
13
|
+
"format:'__BEGIN_COMMIT__%nCommit: %H%nAuthor: %an%nAuthorEmail: " \
|
14
|
+
"%ae%nDate: %aD%n__BEGIN_COMMENT__%n%s%n%b%n__END_COMMENT__%n'"
|
15
15
|
end
|
16
16
|
|
17
17
|
ANONYMOUS = '(no author)' unless defined?(ANONYMOUS)
|
@@ -30,19 +30,21 @@ module OhlohScm
|
|
30
30
|
# is missing for this commit, and we need to fix up our state.
|
31
31
|
state = :key_values if state == :diffs && line =~ /^Commit: ([a-z0-9]+)$/
|
32
32
|
|
33
|
-
|
34
|
-
|
33
|
+
case state
|
34
|
+
when :key_values
|
35
|
+
case line
|
36
|
+
when /^Commit: ([a-z0-9]+)$/
|
35
37
|
sha1 = Regexp.last_match(1)
|
36
38
|
yield e if e
|
37
39
|
e = build_commit(sha1)
|
38
|
-
|
40
|
+
when /^Author: (.+)$/
|
39
41
|
e.author_name = Regexp.last_match(1)
|
40
|
-
|
42
|
+
when /^Date: (.*)$/
|
41
43
|
# MUST be RFC2822 format to parse properly, else defaults to epoch time
|
42
44
|
e.author_date = parse_date(Regexp.last_match(1))
|
43
|
-
|
45
|
+
when '__BEGIN_COMMENT__'
|
44
46
|
state = :message
|
45
|
-
|
47
|
+
when /^AuthorEmail: (.+)$/
|
46
48
|
e.author_email = Regexp.last_match(1)
|
47
49
|
# In the rare case that the Git repository does not contain any names,
|
48
50
|
# we use the email instead (see OpenEmbedded for example).
|
@@ -51,7 +53,7 @@ module OhlohScm
|
|
51
53
|
end
|
52
54
|
end
|
53
55
|
|
54
|
-
|
56
|
+
when :message
|
55
57
|
if line == '__END_COMMENT__'
|
56
58
|
state = :diffs
|
57
59
|
elsif line != '<unknown>'
|
@@ -62,13 +64,14 @@ module OhlohScm
|
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
65
|
-
|
66
|
-
|
67
|
+
when :diffs
|
68
|
+
case line
|
69
|
+
when '__BEGIN_COMMIT__'
|
67
70
|
state = :key_values
|
68
71
|
# Ref: https://git-scm.com/docs/git-diff-index#Documentation/git-diff-index.txt-git-diff-filesltpatterngt82308203
|
69
|
-
|
72
|
+
when /:([0-9]+) ([0-9]+) ([a-z0-9]+) ([a-z0-9]+) ([A-Z])\t"?(.+)"?$/
|
70
73
|
add_generic_diff(e, Regexp.last_match)
|
71
|
-
|
74
|
+
when /:([0-9]+) ([0-9]+) ([a-z0-9]+) ([a-z0-9]+) (R[0-9]+)\t"?(.+)"?$/
|
72
75
|
add_rename_edit_diff(e, Regexp.last_match)
|
73
76
|
end
|
74
77
|
else
|
@@ -92,7 +95,7 @@ module OhlohScm
|
|
92
95
|
end
|
93
96
|
|
94
97
|
def add_generic_diff(commit, match_data)
|
95
|
-
src_mode, dst_mode, parent_sha1, sha1, action, path = match_data[1
|
98
|
+
src_mode, dst_mode, parent_sha1, sha1, action, path = match_data[1..]
|
96
99
|
|
97
100
|
return if path == '.gitmodules' # contains submodule path config.
|
98
101
|
# Submodules have a file mode of '160000'(gitlink). We ignore submodules completely.
|
@@ -103,7 +106,7 @@ module OhlohScm
|
|
103
106
|
end
|
104
107
|
|
105
108
|
def add_rename_edit_diff(commit, match_data)
|
106
|
-
src_mode, dst_mode, parent_sha1, sha1, _, path = match_data[1
|
109
|
+
src_mode, dst_mode, parent_sha1, sha1, _, path = match_data[1..]
|
107
110
|
|
108
111
|
return if src_mode == '160000' || dst_mode == '160000'
|
109
112
|
|
@@ -23,14 +23,15 @@ module OhlohScm
|
|
23
23
|
|
24
24
|
buffer.each_line do |line|
|
25
25
|
next_state = state
|
26
|
-
|
26
|
+
case state
|
27
|
+
when :data
|
27
28
|
case line
|
28
29
|
when /^changeset:\s+([0-9a-f]+)/
|
29
30
|
e = build_commit(Regexp.last_match(1))
|
30
31
|
when /^user:\s+(.+?)(\s+<(.+)>)?$/
|
31
32
|
e.committer_name = Regexp.last_match(1)
|
32
33
|
e.committer_email = Regexp.last_match(3)
|
33
|
-
when /^date:\s+([\d
|
34
|
+
when /^date:\s+([\d.]+)/
|
34
35
|
time = Regexp.last_match(1)
|
35
36
|
e.committer_date = Time.at(time.to_f).utc
|
36
37
|
when "__BEGIN_FILES__\n"
|
@@ -42,15 +43,16 @@ module OhlohScm
|
|
42
43
|
e = nil
|
43
44
|
end
|
44
45
|
|
45
|
-
|
46
|
-
|
46
|
+
when :files
|
47
|
+
case line
|
48
|
+
when "__END_FILES__\n"
|
47
49
|
next_state = :data
|
48
|
-
|
50
|
+
when /^([MAD]) (.+)$/
|
49
51
|
e.diffs << OhlohScm::Diff.new(action: Regexp.last_match(1),
|
50
52
|
path: Regexp.last_match(2))
|
51
53
|
end
|
52
54
|
|
53
|
-
|
55
|
+
when :long_comment
|
54
56
|
if line == "__END_COMMENT__\n"
|
55
57
|
next_state = :data
|
56
58
|
elsif e.message
|
@@ -14,7 +14,8 @@ module OhlohScm
|
|
14
14
|
buffer.each_line do |l|
|
15
15
|
l.chomp!
|
16
16
|
next_state = state
|
17
|
-
|
17
|
+
case state
|
18
|
+
when :data
|
18
19
|
if l =~ /^r(\d+) \| (.*) \| (\d+-\d+-\d+ .*) \(.*\) \| .*/
|
19
20
|
yield e if e && block_given?
|
20
21
|
|
@@ -35,8 +36,8 @@ module OhlohScm
|
|
35
36
|
e.message << l
|
36
37
|
end
|
37
38
|
|
38
|
-
|
39
|
-
if l =~ /^ (\w) ([
|
39
|
+
when :diffs
|
40
|
+
if l =~ /^ (\w) ([^()]+)( \(from (.+):(\d+)\))?$/
|
40
41
|
e.diffs ||= []
|
41
42
|
e.diffs << OhlohScm::Diff.new(action: Regexp.last_match(1),
|
42
43
|
path: Regexp.last_match(2),
|
@@ -51,12 +52,12 @@ module OhlohScm
|
|
51
52
|
# confuses the parser. I am not sure whether only Wireshark does this, but I suspect it
|
52
53
|
# happens because there is a tool out there somewhere to generate
|
53
54
|
# these embedded log comments.
|
54
|
-
|
55
|
+
when :log_embedded_within_comment
|
55
56
|
e.message << "\n"
|
56
57
|
e.message << l
|
57
|
-
next_state = :comment if
|
58
|
+
next_state = :comment if /============================ .* log end =+/.match?(l)
|
58
59
|
|
59
|
-
|
60
|
+
when :comment
|
60
61
|
if /------------------------------------------------------------------------/.match?(l)
|
61
62
|
next_state = :data
|
62
63
|
elsif /============================ .* log start =+/.match?(l)
|
@@ -13,7 +13,7 @@ module OhlohScm
|
|
13
13
|
def cat_file(revision, file)
|
14
14
|
send_command("CAT_FILE\t#{revision}\t#{file}")
|
15
15
|
rescue RuntimeError => e
|
16
|
-
raise unless
|
16
|
+
raise unless /not found in manifest/.match?(e.message) # File does not exist.
|
17
17
|
end
|
18
18
|
|
19
19
|
def parent_tokens(revision)
|
@@ -16,25 +16,26 @@ module OhlohScm
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def ls(path = nil, revision = 'HEAD')
|
19
|
-
stdout = run "svn ls --trust-server-cert --non-interactive -r #{revision} "\
|
20
|
-
|
21
|
-
|
19
|
+
stdout = run "svn ls --trust-server-cert --non-interactive -r #{revision} " \
|
20
|
+
"#{username_and_password_opts} " \
|
21
|
+
"'#{uri_encode(File.join(root.to_s, scm.branch_name.to_s,
|
22
|
+
path.to_s))}@#{revision}'"
|
22
23
|
collect_files(stdout)
|
23
24
|
rescue StandardError => e
|
24
25
|
logger.error(e.message) && nil
|
25
26
|
end
|
26
27
|
|
27
28
|
def export(dest_dir, commit_id = 'HEAD')
|
28
|
-
FileUtils.mkdir_p(File.dirname(dest_dir))
|
29
|
-
run 'svn export --trust-server-cert --non-interactive --ignore-externals --force '\
|
30
|
-
|
31
|
-
|
29
|
+
FileUtils.mkdir_p(File.dirname(dest_dir))
|
30
|
+
run 'svn export --trust-server-cert --non-interactive --ignore-externals --force ' \
|
31
|
+
"-r #{commit_id} '#{uri_encode(File.join(root.to_s, scm.branch_name.to_s))}' " \
|
32
|
+
"'#{dest_dir}'"
|
32
33
|
end
|
33
34
|
|
34
35
|
def export_tag(dest_dir, tag_name)
|
35
36
|
tag_url = "#{base_path}/tags/#{tag_name}"
|
36
|
-
run 'svn export --trust-server-cert --non-interactive --ignore-externals --force'\
|
37
|
-
|
37
|
+
run 'svn export --trust-server-cert --non-interactive --ignore-externals --force ' \
|
38
|
+
"'#{tag_url}' '#{dest_dir}'"
|
38
39
|
end
|
39
40
|
|
40
41
|
# Svn root is not usable here since several projects are nested in subfolders.
|
@@ -42,9 +43,8 @@ module OhlohScm
|
|
42
43
|
# http://svn.apache.org/repos/asf/httpd/httpd/trunk
|
43
44
|
# http://svn.apache.org/repos/asf/maven/plugin-testing/trunk
|
44
45
|
# all have the same root value(https://svn.apache.org/repos/asf)
|
45
|
-
# rubocop:disable Metrics/AbcSize
|
46
46
|
def tags
|
47
|
-
doc = Nokogiri::XML(`svn ls --xml #{
|
47
|
+
doc = Nokogiri::XML(`svn ls --xml #{base_path}/tags`)
|
48
48
|
doc.xpath('//lists/list/entry').map do |entry|
|
49
49
|
tag_name = entry.xpath('name').text
|
50
50
|
revision = entry.xpath('commit').attr('revision').text
|
@@ -53,7 +53,6 @@ module OhlohScm
|
|
53
53
|
[tag_name, revision, date_string]
|
54
54
|
end
|
55
55
|
end
|
56
|
-
# rubocop:enable Metrics/AbcSize
|
57
56
|
|
58
57
|
def head_token
|
59
58
|
return unless info =~ /^Revision: (\d+)$/
|
@@ -73,18 +72,18 @@ module OhlohScm
|
|
73
72
|
def info(path = nil, revision = 'HEAD')
|
74
73
|
@info ||= {}
|
75
74
|
uri = path ? File.join(root, scm.branch_name.to_s, path) : url
|
76
|
-
@info[[path, revision]] ||=
|
77
|
-
|
75
|
+
@info[[path, revision]] ||=
|
76
|
+
run 'svn info --trust-server-cert --non-interactive -r ' \
|
77
|
+
"#{revision} #{username_and_password_opts} '#{uri_encode(uri)}@#{revision}'"
|
78
78
|
end
|
79
79
|
|
80
80
|
# Because uri(with branch) may have characters(e.g. space) that break the shell command.
|
81
81
|
def uri_encode(uri)
|
82
82
|
# URI.encode is declared obsolete, however we couldn't find an alternative.
|
83
|
-
# URI.encode('foo bar') => foo%20bar # `svn log svn://...foo%20bar` works.
|
84
83
|
# CGI.escape('foo bar') => foo+bar # `svn log svn://...foo+bar` won't work.
|
85
|
-
#
|
86
|
-
URI.
|
87
|
-
|
84
|
+
# URI.encode('foo bar') => foo%20bar # `svn log svn://...foo%20bar` works in ruby 2.x
|
85
|
+
# URI::DEFAULT_PARSER.escape('foo bar') => foo%20bar # This works in ruby 3.x
|
86
|
+
URI::DEFAULT_PARSER.escape(uri)
|
88
87
|
end
|
89
88
|
|
90
89
|
def base_path
|
data/lib/ohloh_scm/svn/scm.rb
CHANGED
@@ -17,10 +17,10 @@ module OhlohScm
|
|
17
17
|
# From the given URL, determine which part of it is the root and
|
18
18
|
# which part of it is the branch_name. The current branch_name is overwritten.
|
19
19
|
def recalc_branch_name
|
20
|
-
@branch_name = url ? url[activity.root.length
|
20
|
+
@branch_name = url ? url[activity.root.length..] : branch_name
|
21
21
|
rescue RuntimeError => e
|
22
22
|
pattern = /(svn:*is not a working copy|Unable to open an ra_local session to URL)/
|
23
|
-
@branch_name = '' if e.message
|
23
|
+
@branch_name = '' if e.message&.match?(pattern) # we have a file system
|
24
24
|
ensure
|
25
25
|
clean_branch_name
|
26
26
|
branch_name
|
@@ -41,7 +41,6 @@ module OhlohScm
|
|
41
41
|
#
|
42
42
|
# The url and branch_name of this object will be updated with the selected location.
|
43
43
|
# The url will be unmodified if there is a problem connecting to the server.
|
44
|
-
# rubocop:disable Metrics/AbcSize
|
45
44
|
def restrict_url_to_trunk
|
46
45
|
return url if url.match?(%r{/trunk/?$})
|
47
46
|
|
@@ -50,13 +49,12 @@ module OhlohScm
|
|
50
49
|
|
51
50
|
if list.include? 'trunk/'
|
52
51
|
update_url_and_branch_with_trunk
|
53
|
-
elsif list.size == 1 && list.first[-1
|
52
|
+
elsif list.size == 1 && list.first[-1..] == '/'
|
54
53
|
update_url_and_branch_with_subdir(list)
|
55
54
|
return restrict_url_to_trunk
|
56
55
|
end
|
57
56
|
url
|
58
57
|
end
|
59
|
-
# rubocop:enable Metrics/AbcSize
|
60
58
|
|
61
59
|
private
|
62
60
|
|
@@ -88,7 +86,7 @@ module OhlohScm
|
|
88
86
|
def prefix_file_for_local_path(path)
|
89
87
|
return if path.empty?
|
90
88
|
|
91
|
-
%r{://}.match?(url) ? url :
|
89
|
+
%r{://}.match?(url) ? url : "file://#{File.expand_path(path)}"
|
92
90
|
end
|
93
91
|
end
|
94
92
|
end
|
@@ -15,7 +15,7 @@ module OhlohScm
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def public_url_regex
|
18
|
-
/^(http|https|svn):\/\/[A-Za-z0-9_
|
18
|
+
/^(http|https|svn):\/\/[A-Za-z0-9_\-.]+(:\d+)?(\/[A-Za-z0-9_\-.\/+%^~ ]*)?$/
|
19
19
|
end
|
20
20
|
|
21
21
|
# Subversion usernames have been relaxed from the abstract rules.
|
@@ -25,7 +25,7 @@ module OhlohScm
|
|
25
25
|
|
26
26
|
if scm.username.length > 32
|
27
27
|
[:username, 'The username must not be longer than 32 characters.']
|
28
|
-
elsif !scm.username.match?(/^\w[\w
|
28
|
+
elsif !scm.username.match?(/^\w[\w@.+\-]*$/)
|
29
29
|
[:username, 'The username contains illegal characters.']
|
30
30
|
end
|
31
31
|
end
|
data/lib/ohloh_scm/system.rb
CHANGED
data/lib/ohloh_scm/validation.rb
CHANGED
@@ -33,7 +33,6 @@ module OhlohScm
|
|
33
33
|
end
|
34
34
|
# rubocop:enable Metrics/AbcSize
|
35
35
|
|
36
|
-
# rubocop:disable Metrics/AbcSize
|
37
36
|
def url_errors
|
38
37
|
error = if scm.url.nil? || scm.url.empty?
|
39
38
|
"The URL can't be blank."
|
@@ -45,12 +44,11 @@ module OhlohScm
|
|
45
44
|
|
46
45
|
[:url, error] if error
|
47
46
|
end
|
48
|
-
# rubocop:enable Metrics/AbcSize
|
49
47
|
|
50
48
|
def branch_name_errors
|
51
49
|
if scm.branch_name.length > 80
|
52
50
|
[:branch_name, 'The branch name must not be longer than 80 characters.']
|
53
|
-
elsif !scm.branch_name.match?(/^[\w
|
51
|
+
elsif !scm.branch_name.match?(/^[\w^\-+.\/\ ]+$/)
|
54
52
|
[:branch_name, "The branch name may contain only letters, numbers, \
|
55
53
|
spaces, and the special characters '_', '-', '+', '/', '^', and '.'"]
|
56
54
|
end
|
@@ -67,7 +65,7 @@ module OhlohScm
|
|
67
65
|
def password_errors
|
68
66
|
if scm.password.length > 32
|
69
67
|
[:password, 'The password must not be longer than 32 characters.']
|
70
|
-
elsif !scm.password.match?(/^[\w
|
68
|
+
elsif !scm.password.match?(/^[\w!@\#$%^&*(){}\[\];?|+\-=]*$/)
|
71
69
|
[:password, 'The password contains illegal characters']
|
72
70
|
end
|
73
71
|
end
|
data/lib/ohloh_scm/version.rb
CHANGED
data/ohloh_scm.gemspec
CHANGED
@@ -15,11 +15,11 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.license = 'GPL-2.0'
|
16
16
|
|
17
17
|
gem.files = `git ls-files -z`.split("\x0")
|
18
|
-
gem.test_files = gem.files.grep(/^spec\//)
|
19
18
|
gem.require_paths = %w[lib]
|
20
|
-
gem.
|
21
|
-
|
22
|
-
"
|
23
|
-
"#{OhlohScm::Version::
|
19
|
+
gem.required_ruby_version = '>= 3.0.0'
|
20
|
+
gem.post_install_message = "Ohloh SCM is depending on Git #{OhlohScm::Version::GIT}, " \
|
21
|
+
"SVN #{OhlohScm::Version::SVN}, CVSNT #{OhlohScm::Version::CVSNT}, " \
|
22
|
+
"Mercurial #{OhlohScm::Version::HG} and Bazaar " \
|
23
|
+
"#{OhlohScm::Version::BZR}. If the installed version is different, " \
|
24
24
|
'Ohloh SCM may not operate as expected.'
|
25
25
|
end
|
data/spec/.rubocop.yml
CHANGED
@@ -3,16 +3,13 @@ inherit_from: ../.rubocop.yml
|
|
3
3
|
Style/FrozenStringLiteralComment:
|
4
4
|
Enabled: false
|
5
5
|
|
6
|
-
|
6
|
+
Layout/LineLength:
|
7
7
|
Max: 120
|
8
8
|
|
9
9
|
Metrics/AbcSize:
|
10
10
|
Enabled: false
|
11
11
|
|
12
|
-
ClassLength:
|
13
|
-
Enabled: false
|
14
|
-
|
15
|
-
AbcSize:
|
12
|
+
Metrics/ClassLength:
|
16
13
|
Enabled: false
|
17
14
|
|
18
15
|
Metrics/MethodLength:
|
@@ -8,24 +8,24 @@ module AssertScmAttrHelper
|
|
8
8
|
def assert_url_error(scm_type, *urls)
|
9
9
|
urls.each do |url|
|
10
10
|
core = get_core(scm_type, url: url)
|
11
|
-
core.validation.send(:url_errors)
|
11
|
+
refute_empty core.validation.send(:url_errors)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
def assert_url_valid(scm_type, url)
|
16
16
|
core = get_core(scm_type, url: url)
|
17
|
-
core.validation.send(:url_errors)
|
17
|
+
assert_nil core.validation.send(:url_errors)
|
18
18
|
end
|
19
19
|
|
20
20
|
def assert_branch_name_error(scm_type, *branches)
|
21
21
|
branches.each do |branch_name|
|
22
22
|
core = get_core(scm_type, url: ':pserver:cvs:cvs@cvs.test.org:/test', branch_name: branch_name)
|
23
|
-
core.validation.send(:branch_name_errors)
|
23
|
+
refute_empty core.validation.send(:branch_name_errors)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
def assert_branch_name_valid(scm_type, branch_name)
|
28
28
|
core = get_core(scm_type, url: ':pserver:cvs:cvs@cvs.test.org:/test', branch_name: branch_name)
|
29
|
-
core.validation.send(:branch_name_errors)
|
29
|
+
assert_nil core.validation.send(:branch_name_errors)
|
30
30
|
end
|
31
31
|
end
|
@@ -8,14 +8,14 @@ describe 'Activity' do
|
|
8
8
|
ENV['OHLOH_SCM_TEMP_FOLDER_PATH'] = nil
|
9
9
|
core = get_core(:git)
|
10
10
|
scm = OhlohScm::Activity.new(core)
|
11
|
-
scm.log_filename
|
11
|
+
assert_equal scm.log_filename, "#{Dir.tmpdir}/foobar.log"
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'should return temp folder path' do
|
15
15
|
ENV['OHLOH_SCM_TEMP_FOLDER_PATH'] = '/test'
|
16
16
|
core = get_core(:git)
|
17
17
|
scm = OhlohScm::Activity.new(core)
|
18
|
-
scm.log_filename
|
18
|
+
assert_equal scm.log_filename, '/test/foobar.log'
|
19
19
|
ENV['OHLOH_SCM_TEMP_FOLDER_PATH'] = ''
|
20
20
|
end
|
21
21
|
end
|