Skip to content

Commit acb3c5a

Browse files
authored
Merge pull request #106 from blackducksoftware/v3
Version 3 rewrite
2 parents 17ae2ad + e952ccc commit acb3c5a

File tree

655 files changed

+6448
-15785
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

655 files changed

+6448
-15785
lines changed
File renamed without changes.

.bin/check_scm_version

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#! /usr/bin/env ruby
2+
$LOAD_PATH.push File.expand_path('../../lib', __FILE__)
3+
4+
require 'open3'
5+
require_relative '../lib/ohloh_scm/version'
6+
7+
SCM_CLI_LIST = %w[git svn cvsnt hg bzr].freeze
8+
9+
def match_scm_cli(scm_type)
10+
scm_version = get_scm_version(scm_type)
11+
major_version = Object.const_get('OhlohScm::Version::' + scm_type.upcase)
12+
return if scm_version.nil? || major_version.to_i == scm_version.to_i
13+
STDERR.puts "warning: Ohloh SCM is compatible with #{scm_type} v#{major_version.to_i}.x.x. "\
14+
"The installed #{scm_type} version is #{scm_version}."
15+
end
16+
17+
def get_scm_version(scm_type)
18+
out, _err, _status = Open3.capture3("#{scm_type} --version --quiet")
19+
out, _err, _status = Open3.capture3("#{scm_type} --version") if out.empty?
20+
out.match(/(\d+\.)(\d+\.)(\d+)/).to_s
21+
rescue => exception
22+
STDERR.puts exception
23+
nil
24+
end
25+
26+
SCM_CLI_LIST.each do |scm_type|
27+
match_scm_cli(scm_type)
28+
end

.bin/run-test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#! /usr/bin/env bash
2+
3+
bundle exec ruby -Ispec $1 --name /.*$2.*/

.bin/run-tests

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#! /usr/bin/env bash
2+
3+
bundle exec ruby -Ispec $@
File renamed without changes.

.git_hooks/pre-commit

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#! /usr/bin/env bash
2+
3+
echo-color() { echo " $@ "; }
4+
modified_files=$(git diff --cached --name-only | grep '.*.rb$')
5+
6+
# Run Rubocop
7+
[ -z "$modified_files" ] && exit 0
8+
echo-color 'Running rubocop on cached ruby files:'
9+
bundle exec rubocop $modified_files || exit 1
10+
11+
test_files=()
12+
for filepath in $modified_files; do
13+
testpath=$(echo $filepath | sed 's/^lib/spec/' | sed 's/\.rb$/_spec.rb/')
14+
[ -e $testpath ] && test_files+=($testpath)
15+
done
16+
17+
# Run tests
18+
[ -z "$test_files" ] && exit 0
19+
echo-color 'Running related tests for cached ruby files:'
20+
.bin/run-tests $test_files

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
*.swp
2-
*.pyc
3-
pkg/
4-
*.cache
51
.byebug*
2+
coverage

.rubocop.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
require: rubocop-performance
2+
3+
AllCops:
4+
TargetRubyVersion: 2.5
5+
6+
Metrics/LineLength:
7+
Max: 99
8+
9+
Documentation:
10+
Enabled: false
11+
12+
Style/RegexpLiteral:
13+
Enabled: false

.ruby-version

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
2.2.5
2-
1+
2.5.3

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ language: generic
22
services:
33
- docker
44
before_install:
5-
- docker pull notalex/ohloh_scm:ubuntu18
6-
script: docker run -P -w /home/app/ohloh_scm -v $(pwd):/home/app/ohloh_scm -ti notalex/ohloh_scm:ubuntu18 /bin/sh -c "/etc/init.d/ssh start; LANG=en_US.UTF-8 rake test 2> /dev/null"
5+
- docker pull notalex/oh_scm:ubuntu18
6+
script:
7+
- docker run -P -v $(pwd):/home/app/ohloh_scm -ti notalex/oh_scm:ubuntu18 /bin/sh -c "/etc/init.d/ssh start; rubocop && LANG=en_US.UTF-8 rake test 2> /dev/null"

0 commit comments

Comments
 (0)