ohloh_scm 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f4cbf7d314828522ff7a9b64256e889f2f109c7048d751c7d54d707ea085a96
4
- data.tar.gz: aae75e139e32baa7a7eb2fff86a4f11d8a85edc65da8ee03519b6bcc752a2ebf
3
+ metadata.gz: fb6ebfb6e6f3ee258e4e3c5042c3673e3ed94101e3c84f9cdfd751373a4b0ea6
4
+ data.tar.gz: dd605cfd3fca5d5c0720358e71027cf3add2f4bbf4f0eebb6627d4da9efa7bd3
5
5
  SHA512:
6
- metadata.gz: 5eeef15c64ca8f7eb7f0e6953dc30433854b72412a29ccb9a9bf42d136cddca3d8d900fea3cf4f48bbb13cd4b3cdf031b8ecf1fe111372650b7662687f7232c1
7
- data.tar.gz: dcdb7fbbb147a63dc16d7106ab23a404ccad769f24ca96f5e91f110e776b5f368e8b50b00155dca07d2d2040c2f6009b2fbd6404d0874c5e8fc67ac8efc1d65a
6
+ metadata.gz: 9dcfb8c8757ecd79290c483682ab1fbaf349f4a71f54fe26a78e954cbde66584145e90eb762d45d06f8cf1b9179d11e962012a6370dbea714350d390203cb4ff
7
+ data.tar.gz: 712a961eec10b7346b92b4dc851be4b2bfaf1b99c6eeeee23030cb3d99cd7bc147ca1a1d13dfa29160fcbd1632d8efcf00e9cdfc60a1298ea4bb0eafa365ae34
data/Gemfile CHANGED
@@ -11,4 +11,5 @@ group :development do
11
11
  gem 'rubocop', '~> 0.67'
12
12
  gem 'rubocop-performance'
13
13
  gem 'simplecov'
14
+ gem 'rspec'
14
15
  end
@@ -3,6 +3,7 @@ GEM
3
3
  specs:
4
4
  ast (2.4.0)
5
5
  byebug (11.0.1)
6
+ diff-lcs (1.3)
6
7
  docile (1.3.1)
7
8
  jaro_winkler (1.5.2)
8
9
  json (2.2.0)
@@ -19,6 +20,19 @@ GEM
19
20
  psych (3.1.0)
20
21
  rainbow (3.0.0)
21
22
  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)
22
36
  rubocop (0.67.2)
23
37
  jaro_winkler (~> 1.5.1)
24
38
  parallel (~> 1.10)
@@ -46,6 +60,7 @@ DEPENDENCIES
46
60
  mocha
47
61
  nokogiri
48
62
  rake
63
+ rspec
49
64
  rubocop (~> 0.67)
50
65
  rubocop-performance
51
66
  simplecov
@@ -5,14 +5,15 @@ module OhlohScm
5
5
  include OhlohScm::System
6
6
  extend Forwardable
7
7
  def_delegators :@core, :scm, :status
8
- def_delegators :scm, :url
8
+ def_delegators :scm, :url, :temp_dir
9
9
 
10
10
  def initialize(core)
11
11
  @core = core
12
12
  end
13
13
 
14
14
  def log_filename
15
- File.join(Dir.tmpdir, url.gsub(/\W/, '') + '.log')
15
+ tmp_dir = temp_dir || Dir.tmpdir
16
+ File.join(tmp_dir, url.gsub(/\W/, '') + '.log')
16
17
  end
17
18
 
18
19
  def tags; end
@@ -18,5 +18,9 @@ module OhlohScm
18
18
  @status = OhlohScm.const_get(scm_class_name)::Status.new(self)
19
19
  @validation = OhlohScm.const_get(scm_class_name)::Validation.new(self)
20
20
  end
21
+
22
+ def temp_dir=(tmp_dir)
23
+ @scm.temp_dir = tmp_dir
24
+ end
21
25
  end
22
26
  end
@@ -43,8 +43,10 @@ module OhlohScm
43
43
  end
44
44
 
45
45
  def clone_and_create_tracking_branch(remote_scm)
46
- run "rm -rf '#{url}'"
47
- run "git clone -q -n '#{remote_scm.url}' '#{url}'"
46
+ unless status.scm_dir_exist?
47
+ run "rm -rf '#{url}'"
48
+ run "git clone -q -n '#{remote_scm.url}' '#{url}'"
49
+ end
48
50
  create_tracking_branch(remote_scm.branch_name) # ensure the correct branch exists locally
49
51
  clean_and_checkout_branch # switch to the correct branch
50
52
  end
@@ -3,7 +3,7 @@
3
3
  module OhlohScm
4
4
  module GitSvn
5
5
  class Activity < OhlohScm::Activity
6
- def_delegators :scm, :url
6
+ def_delegators :scm, :url, :temp_dir
7
7
 
8
8
  def commit_count(opts = {})
9
9
  cmd = "#{after_revision(opts)} | grep -E -e '^r[0-9]+.*lines$' | wc -l"
@@ -49,7 +49,8 @@ module OhlohScm
49
49
  end
50
50
 
51
51
  def log_filename
52
- File.join('/tmp', url.gsub(/\W/, '') + '.log')
52
+ tmp_dir = temp_dir || '/tmp'
53
+ File.join(tmp_dir, url.gsub(/\W/, '') + '.log')
53
54
  end
54
55
 
55
56
  def after_revision(opts)
@@ -6,7 +6,7 @@ module OhlohScm
6
6
  extend Forwardable
7
7
  def_delegators :@core, :status, :activity
8
8
  attr_reader :url, :username, :password
9
- attr_accessor :branch_name
9
+ attr_accessor :branch_name, :temp_dir
10
10
 
11
11
  def initialize(core:, url:, branch_name: nil, username: nil, password: nil)
12
12
  @core = core
@@ -2,7 +2,7 @@
2
2
 
3
3
  module OhlohScm
4
4
  module Version
5
- STRING = '3.0.2'
5
+ STRING = '3.0.3'
6
6
  GIT = '2.17.1'
7
7
  SVN = '1.9.7'
8
8
  CVSNT = '2.5.04'
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe 'Activity' do
6
+ describe 'log_filename' do
7
+ it 'should return system tmp dir path' do
8
+ core = get_core(:git)
9
+ scm = OhlohScm::Activity.new(core)
10
+ scm.log_filename.must_equal "#{Dir.tmpdir}/foobar.log"
11
+ end
12
+
13
+ it 'should return temp folder path' do
14
+ core = get_core(:git)
15
+ core.temp_dir = '/test'
16
+ scm = OhlohScm::Activity.new(core)
17
+ scm.log_filename.must_equal '/test/foobar.log'
18
+ end
19
+ end
20
+ 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: 3.0.2
4
+ version: 3.0.3
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-07-17 00:00:00.000000000 Z
11
+ date: 2019-07-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |-
14
14
  The OpenHub source control management library for \
@@ -103,6 +103,7 @@ files:
103
103
  - spec/helpers/generic_helper.rb
104
104
  - spec/helpers/repository_helper.rb
105
105
  - spec/helpers/system_helper.rb
106
+ - spec/ohloh_scm/activity_spec.rb
106
107
  - spec/ohloh_scm/bzr/activity_spec.rb
107
108
  - spec/ohloh_scm/bzr/scm_spec.rb
108
109
  - spec/ohloh_scm/bzr/validation_spec.rb
@@ -189,8 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
190
  - !ruby/object:Gem::Version
190
191
  version: '0'
191
192
  requirements: []
192
- rubyforge_project:
193
- rubygems_version: 2.7.6
193
+ rubygems_version: 3.0.2
194
194
  signing_key:
195
195
  specification_version: 4
196
196
  summary: Source Control Management
@@ -203,6 +203,7 @@ test_files:
203
203
  - spec/helpers/generic_helper.rb
204
204
  - spec/helpers/repository_helper.rb
205
205
  - spec/helpers/system_helper.rb
206
+ - spec/ohloh_scm/activity_spec.rb
206
207
  - spec/ohloh_scm/bzr/activity_spec.rb
207
208
  - spec/ohloh_scm/bzr/scm_spec.rb
208
209
  - spec/ohloh_scm/bzr/validation_spec.rb