Skip to content

Commit 5912a01

Browse files
author
karthik
authored
Merge pull request #117 from blackducksoftware/leverage_env
Leverage OhlohScm environment variable to pass temp folder option
2 parents c47ecfc + 56b337d commit 5912a01

File tree

6 files changed

+8
-13
lines changed

6 files changed

+8
-13
lines changed

lib/ohloh_scm/activity.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ class Activity
55
include OhlohScm::System
66
extend Forwardable
77
def_delegators :@core, :scm, :status
8-
def_delegators :scm, :url, :temp_dir
8+
def_delegators :scm, :url
99

1010
def initialize(core)
1111
@core = core
1212
end
1313

1414
def log_filename
15-
tmp_dir = temp_dir || Dir.tmpdir
16-
File.join(tmp_dir, url.gsub(/\W/, '') + '.log')
15+
File.join(temp_folder, url.gsub(/\W/, '') + '.log')
1716
end
1817

1918
def tags; end

lib/ohloh_scm/core.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,5 @@ def initialize(scm_type, url, branch_name, username, password)
1818
@status = OhlohScm.const_get(scm_class_name)::Status.new(self)
1919
@validation = OhlohScm.const_get(scm_class_name)::Validation.new(self)
2020
end
21-
22-
def temp_dir=(tmp_dir)
23-
@scm.temp_dir = tmp_dir
24-
end
2521
end
2622
end

lib/ohloh_scm/git_svn/activity.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module OhlohScm
44
module GitSvn
55
class Activity < OhlohScm::Activity
6-
def_delegators :scm, :url, :temp_dir
6+
def_delegators :scm, :url
77

88
def commit_count(opts = {})
99
cmd = "#{after_revision(opts)} | grep -E -e '^r[0-9]+.*lines$' | wc -l"
@@ -49,8 +49,7 @@ def open_log_file(opts = {})
4949
end
5050

5151
def log_filename
52-
tmp_dir = temp_dir || '/tmp'
53-
File.join(tmp_dir, url.gsub(/\W/, '') + '.log')
52+
File.join(temp_folder, url.gsub(/\W/, '') + '.log')
5453
end
5554

5655
def after_revision(opts)

lib/ohloh_scm/scm.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Scm
66
extend Forwardable
77
def_delegators :@core, :status, :activity
88
attr_reader :url, :username, :password
9-
attr_accessor :branch_name, :temp_dir
9+
attr_accessor :branch_name
1010

1111
def initialize(core:, url:, branch_name: nil, username: nil, password: nil)
1212
@core = core

lib/ohloh_scm/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module OhlohScm
44
module Version
5-
STRING = '3.0.3'
5+
STRING = '3.0.4'
66
GIT = '2.17.1'
77
SVN = '1.9.7'
88
CVSNT = '2.5.04'

spec/ohloh_scm/activity_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
end
1212

1313
it 'should return temp folder path' do
14+
ENV['OHLOH_SCM_TEMP_FOLDER_PATH'] = '/test'
1415
core = get_core(:git)
15-
core.temp_dir = '/test'
1616
scm = OhlohScm::Activity.new(core)
1717
scm.log_filename.must_equal '/test/foobar.log'
18+
ENV['OHLOH_SCM_TEMP_FOLDER_PATH'] = ''
1819
end
1920
end
2021
end

0 commit comments

Comments
 (0)