rake-funnel 0.9.1.pre → 0.10.0.pre
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31d63ccc013d1d0d30b8ffdadf10ca032863a551
|
4
|
+
data.tar.gz: 289eaa803667f90ac64813689ba365652528ff4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c732f352b946d9ac6ad642e89f0898763e34a63b0ad4acef6e8c40eb4fe1a90a8f9403c5ba0821b5881bd6782058ccf74956144d81bd1906eddd6ee2fbbacf6
|
7
|
+
data.tar.gz: 1d51ff492ae68c9e0aa17336d421520b444bdba2818d67c92c4f2a84092fe010441d4294146ba8d009caa2da851c7628b93c24b7dddf5a2b3aa66e521e1f6098
|
@@ -2,16 +2,37 @@ module Rake
|
|
2
2
|
module Funnel
|
3
3
|
module Integration
|
4
4
|
module TeamCity
|
5
|
-
|
5
|
+
PROJECT_ENV_VAR = 'TEAMCITY_PROJECT_NAME'
|
6
|
+
JRE_ENV_VAR = 'TEAMCITY_JRE'
|
6
7
|
|
7
8
|
class << self
|
8
9
|
def running?
|
9
|
-
ENV.include?(
|
10
|
+
ENV.include?(PROJECT_ENV_VAR)
|
10
11
|
end
|
11
12
|
|
12
13
|
def rake_runner?
|
13
14
|
running? && Object.const_defined?('Rake') && Rake.const_defined?('TeamCityApplication')
|
14
15
|
end
|
16
|
+
|
17
|
+
def with_java_runtime(&block)
|
18
|
+
return unless block_given?
|
19
|
+
|
20
|
+
begin
|
21
|
+
original_path = ENV['PATH']
|
22
|
+
|
23
|
+
ENV['PATH'] = ([] << ENV['PATH'] << teamcity_jre).compact.join(File::PATH_SEPARATOR)
|
24
|
+
|
25
|
+
block.call
|
26
|
+
ensure
|
27
|
+
ENV['PATH'] = original_path
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
def teamcity_jre
|
33
|
+
return nil unless ENV.include?(JRE_ENV_VAR)
|
34
|
+
File.join(ENV[JRE_ENV_VAR], 'bin')
|
35
|
+
end
|
15
36
|
end
|
16
37
|
end
|
17
38
|
end
|
data/lib/rake/funnel/version.rb
CHANGED
@@ -1,34 +1,102 @@
|
|
1
1
|
describe Rake::Funnel::Integration::TeamCity do
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
describe 'runner detection' do
|
3
|
+
before {
|
4
|
+
allow(ENV).to receive(:include?).with(described_class::PROJECT_ENV_VAR).and_return(teamcity_running?)
|
5
|
+
}
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
context 'when running outside TeamCity' do
|
8
|
+
let(:teamcity_running?) { false }
|
8
9
|
|
9
|
-
|
10
|
-
|
10
|
+
it 'should not detect TeamCity' do
|
11
|
+
expect(described_class.running?).to eq(false)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should not detect TeamCity's rake runner" do
|
15
|
+
expect(described_class.rake_runner?).to eq(false)
|
16
|
+
end
|
11
17
|
end
|
12
18
|
|
13
|
-
|
14
|
-
|
19
|
+
context 'when running inside TeamCity' do
|
20
|
+
let(:teamcity_running?) { true }
|
21
|
+
|
22
|
+
it 'should detect TeamCity' do
|
23
|
+
expect(described_class.running?).to eq(true)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should detect TeamCity's rake runner" do
|
27
|
+
module Rake
|
28
|
+
module TeamCityApplication
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
expect(described_class.rake_runner?).to eq(true)
|
33
|
+
end
|
15
34
|
end
|
16
35
|
end
|
17
36
|
|
18
|
-
|
19
|
-
let(:
|
37
|
+
describe '#with_java_runtime' do
|
38
|
+
let(:original_path) { 'original path environment variable contents' }
|
39
|
+
let(:jre) { nil }
|
40
|
+
|
41
|
+
before {
|
42
|
+
allow(ENV).to receive(:[]=)
|
43
|
+
|
44
|
+
allow(ENV).to receive(:[]).with('PATH').and_return(original_path)
|
45
|
+
|
46
|
+
allow(ENV).to receive(:include?).with(described_class::JRE_ENV_VAR).and_return(!jre.nil?)
|
47
|
+
allow(ENV).to receive(:[]).with(described_class::JRE_ENV_VAR).and_return(jre)
|
48
|
+
}
|
20
49
|
|
21
|
-
|
22
|
-
|
50
|
+
context 'without block' do
|
51
|
+
it 'should not modify environment variables' do
|
52
|
+
described_class.with_java_runtime
|
53
|
+
|
54
|
+
expect(ENV).not_to have_received(:[]=)
|
55
|
+
end
|
23
56
|
end
|
24
57
|
|
25
|
-
|
26
|
-
|
27
|
-
|
58
|
+
context 'with block' do
|
59
|
+
context 'Java runtime environment variable does not exists' do
|
60
|
+
let(:jre) { nil }
|
61
|
+
|
62
|
+
it 'should yield to block' do
|
63
|
+
expect { |b| described_class.with_java_runtime(&b) }.to yield_with_no_args
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'should not modify path' do
|
67
|
+
described_class.with_java_runtime {}
|
68
|
+
|
69
|
+
expect(ENV).not_to have_received(:[]=).with('PATH')
|
28
70
|
end
|
29
71
|
end
|
30
72
|
|
31
|
-
|
73
|
+
context 'Java runtime environment variable exists' do
|
74
|
+
let(:jre) { 'path/to/JRE' }
|
75
|
+
|
76
|
+
it 'should yield to block' do
|
77
|
+
expect { |b| described_class.with_java_runtime(&b) }.to yield_with_no_args
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'should add JRE to path' do
|
81
|
+
described_class.with_java_runtime {}
|
82
|
+
|
83
|
+
expect(ENV).to have_received(:[]=).with('PATH', /#{original_path}.#{jre}/)
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'should reset path' do
|
87
|
+
described_class.with_java_runtime {}
|
88
|
+
|
89
|
+
expect(ENV).to have_received(:[]=).with('PATH', original_path)
|
90
|
+
end
|
91
|
+
|
92
|
+
context 'block error' do
|
93
|
+
it 'should reset path' do
|
94
|
+
expect { described_class.with_java_runtime { fail 'with some error' } }.to raise_error
|
95
|
+
|
96
|
+
expect(ENV).to have_received(:[]=).with('PATH', original_path)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
32
100
|
end
|
33
101
|
end
|
34
102
|
end
|
@@ -202,7 +202,6 @@ describe Rake::Funnel::Tasks::MSDeploy do
|
|
202
202
|
}
|
203
203
|
|
204
204
|
it 'should quote the string' do
|
205
|
-
args = '"path to/msdeploy" -"simple key":"simple value" -hash:"hash key 1"="hash value 1","hash key 2"="hash value 2" -array:"array value 1" -array:"array value 2" -"some flag"'
|
206
205
|
args = %w(
|
207
206
|
"path to/msdeploy"
|
208
207
|
-"simple key":"simple value"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake-funnel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Groß
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|