rake-funnel 0.16.0 → 0.16.1
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/lib/rake/funnel/tasks/bin_path.rb +8 -3
- data/lib/rake/funnel/version.rb +1 -1
- data/spec/rake/funnel/tasks/bin_path_spec.rb +32 -16
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15c93cd453fd3a4cb44ff99fecb8b9e12501bab0
|
4
|
+
data.tar.gz: 2b6ccf54a20198fb9b1c05cdb8c6ae9425b53040
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cabea259d82d608fdf27acfdc6e24f2ff085805abf698dbb5b58c15d2281857d56fff1af83c7b463967f9f0478caff3732436fc436fecf18546ee5dd68cf45b
|
7
|
+
data.tar.gz: 6d3f30c6d8570a6c4f501d00c998add9dc75142aa50b933f38891a0dfa4f2a5131885a0b46b4dc8a9dd97c888b8ae0cbd2619648a85239688cdf9602b2eaf262
|
@@ -24,8 +24,11 @@ module Rake
|
|
24
24
|
task(name, *args) do |_, task_args|
|
25
25
|
task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
|
26
26
|
|
27
|
+
next unless paths.any?
|
28
|
+
|
29
|
+
add_pattern_to_path_environment(paths)
|
27
30
|
Rake.rake_output_message 'Added the following paths to the PATH environment variable:'
|
28
|
-
|
31
|
+
paths.each do |p|
|
29
32
|
Rake.rake_output_message " - #{p}"
|
30
33
|
end
|
31
34
|
end
|
@@ -33,9 +36,11 @@ module Rake
|
|
33
36
|
self
|
34
37
|
end
|
35
38
|
|
36
|
-
def
|
37
|
-
paths
|
39
|
+
def paths
|
40
|
+
@paths ||= Dir[*search_pattern].map { |path| File.expand_path(path) }.sort
|
41
|
+
end
|
38
42
|
|
43
|
+
def add_pattern_to_path_environment(paths)
|
39
44
|
ENV['PATH'] = ([] << paths << ENV['PATH']).flatten.join(File::PATH_SEPARATOR)
|
40
45
|
paths
|
41
46
|
end
|
data/lib/rake/funnel/version.rb
CHANGED
@@ -20,33 +20,49 @@ describe Rake::Funnel::Tasks::BinPath do
|
|
20
20
|
allow(Rake).to receive(:rake_output_message)
|
21
21
|
}
|
22
22
|
|
23
|
-
before {
|
24
|
-
allow(Dir).to receive(:[]).with(*search_pattern).and_return(search_pattern)
|
25
|
-
}
|
26
|
-
|
27
23
|
subject {
|
28
24
|
described_class.new do |t|
|
29
25
|
t.search_pattern = search_pattern
|
30
26
|
end
|
31
27
|
}
|
32
28
|
|
33
|
-
|
34
|
-
|
35
|
-
|
29
|
+
context 'paths to add' do
|
30
|
+
before {
|
31
|
+
allow(Dir).to receive(:[]).with(*search_pattern).and_return(search_pattern)
|
32
|
+
}
|
36
33
|
|
37
|
-
|
38
|
-
|
34
|
+
before {
|
35
|
+
Task[subject.name].invoke
|
36
|
+
}
|
39
37
|
|
40
|
-
|
41
|
-
|
38
|
+
it 'should prepend sorted matching folders to the PATH environment variable' do
|
39
|
+
paths = search_pattern.map { |path| File.expand_path(path) }.sort.join(File::PATH_SEPARATOR)
|
40
|
+
|
41
|
+
expect(ENV).to have_received(:[]=).with('PATH',/^#{paths}/)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should append original PATH environment variable' do
|
45
|
+
expect(ENV).to have_received(:[]=).with('PATH', /#{default_path}$/)
|
46
|
+
end
|
42
47
|
|
43
|
-
|
44
|
-
|
48
|
+
it 'should report added paths' do
|
49
|
+
expect(Rake).to have_received(:rake_output_message).with(%r|/foo$|)
|
50
|
+
expect(Rake).to have_received(:rake_output_message).with(%r|/bar$|)
|
51
|
+
end
|
45
52
|
end
|
46
53
|
|
47
|
-
|
48
|
-
|
49
|
-
|
54
|
+
context 'no paths to add' do
|
55
|
+
before {
|
56
|
+
allow(Dir).to receive(:[]).with(*search_pattern).and_return([])
|
57
|
+
}
|
58
|
+
|
59
|
+
before {
|
60
|
+
Task[subject.name].invoke
|
61
|
+
}
|
62
|
+
|
63
|
+
it 'should not print message' do
|
64
|
+
expect(Rake).not_to have_received(:rake_output_message)
|
65
|
+
end
|
50
66
|
end
|
51
67
|
end
|
52
68
|
end
|
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.16.
|
4
|
+
version: 0.16.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Groß
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -301,3 +301,4 @@ test_files:
|
|
301
301
|
- spec/rake/funnel/tasks/timing_spec.rb
|
302
302
|
- spec/rake/funnel/tasks/zip_spec.rb
|
303
303
|
- spec/spec_helper.rb
|
304
|
+
has_rdoc:
|