rake-funnel 0.11.0.pre → 0.12.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: 8136031a5dcf41921fe9ef6e60a00a2b330b7666
4
- data.tar.gz: 7e042e981473b5e97bd791892086eb23f5963a04
3
+ metadata.gz: 56bac75630655218368ec2766ffb96bac889e2ae
4
+ data.tar.gz: e073088cbdf589d3b9b5324b5a5e94ca910bd7f3
5
5
  SHA512:
6
- metadata.gz: 074af6f609bab49ee4a6c98a761bf7cb1fb60574fa2b22d65e8fa550aac7c6ba47260babf4f944b2656654bc347df9e97760e75784709121860051238d5e5a52
7
- data.tar.gz: 882b78b313bb24ff7b545c2790f7ed0e57944c06f4ebb25a6da33d2c58c29314e3cb46c509d9eaaeedad4aa13b06465d3757136292cb4fa07d0908557a008b3d
6
+ metadata.gz: 47c4be285e4c7b52db8250a4f2c4517d24cfd734affd44135966e4f7caeed992a223bc1316718fb86463701b9a0adad8beffd499f762bd2fb792bdf0721b2cf9
7
+ data.tar.gz: 01d64a7f8f98b43cc027f28424318621fd95a49499f547e600adc5bbc3738170a8a4317cb32e8873683620566103dce5e755e7941a4a0f681460596018bbcee5
@@ -11,7 +11,7 @@ module Rake
11
11
  include InstantiateSymbol
12
12
  instantiate AssemblyVersion
13
13
 
14
- def initialize(type = :FromVersionFiles, args = {})
14
+ def initialize(type = :from_version_files, args = {})
15
15
  @type = create(type, args)
16
16
  end
17
17
 
@@ -20,17 +20,22 @@ module Rake
20
20
  def create(sym, *args)
21
21
  return sym unless sym.is_a?(Symbol)
22
22
 
23
- begin
24
- type = self.class.module.const_get(sym)
25
- rescue NameError
26
- raise NameError, "Unknown type to instantiate: #{sym.inspect}. Available types are: #{available.inspect}"
27
- end
23
+ found = [sym, sym.pascalize.to_sym]
24
+ .select { |candidate| mod.constants.include?(candidate) }
25
+ .first
26
+
27
+ raise NameError, "Unknown type to instantiate: #{sym.inspect}. Available types are: #{available.inspect}" if found.nil?
28
28
 
29
+ type = mod.const_get(found)
29
30
  type.new(*args)
30
31
  end
31
32
 
32
33
  def available
33
- self.class.module.constants.sort
34
+ mod.constants.sort
35
+ end
36
+
37
+ def mod
38
+ self.class.module
34
39
  end
35
40
  end
36
41
  end
@@ -10,7 +10,7 @@ module Rake
10
10
  include InstantiateSymbol
11
11
  instantiate Styles
12
12
 
13
- def initialize(style = :Default)
13
+ def initialize(style = :default)
14
14
  raise "You cannot use the 'nil' mapper style. Available mappers are: #{available.inspect}" if style.nil?
15
15
 
16
16
  @style = create(style)
@@ -9,7 +9,7 @@ module Rake
9
9
 
10
10
  require 'win32/registry'
11
11
 
12
- %w(12.0 4.0 3.5 2.0).collect { |version|
12
+ %w(14.0 12.0 4.0 3.5 2.0).collect { |version|
13
13
  key = "SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\#{version}"
14
14
 
15
15
  begin
@@ -1,5 +1,5 @@
1
1
  module Rake
2
2
  module Funnel
3
- VERSION = '0.11.0.pre'
3
+ VERSION = '0.12.0.pre'
4
4
  end
5
5
  end
@@ -91,7 +91,7 @@ describe Rake::Funnel::Integration::TeamCity do
91
91
 
92
92
  context 'block error' do
93
93
  it 'should reset path' do
94
- expect { described_class.with_java_runtime { fail 'with some error' } }.to raise_error
94
+ expect { described_class.with_java_runtime { fail 'with some error' } }.to raise_error(/with some error/)
95
95
 
96
96
  expect(ENV).to have_received(:[]=).with('PATH', original_path)
97
97
  end
@@ -10,12 +10,12 @@ describe Rake::Funnel::Support::AssemblyVersionWriter do
10
10
  }
11
11
 
12
12
  it 'should create FromVersionFiles with empty args' do
13
- expect(subject).to have_received(:create).with(:FromVersionFiles, {})
13
+ expect(subject).to have_received(:create).with(:from_version_files, {})
14
14
  end
15
15
  end
16
16
 
17
17
  describe 'custom type' do
18
- let(:source) { :Custom }
18
+ let(:source) { :custom }
19
19
  let(:source_args) { { foo: 42 } }
20
20
 
21
21
  before {
@@ -25,6 +25,20 @@ describe Rake::Funnel::Support::InstantiateSymbol do
25
25
  end
26
26
  end
27
27
 
28
+ module SnakeCase
29
+ class SnakeCase
30
+ end
31
+
32
+ class Snake_Case
33
+ end
34
+ end
35
+
36
+ class SnakeCaseModuleDefinition
37
+ include Rake::Funnel::Support::InstantiateSymbol
38
+
39
+ instantiate SnakeCase
40
+ end
41
+
28
42
  describe 'module methods' do
29
43
  subject {
30
44
  ExplicitModuleDefinition.new
@@ -34,6 +48,7 @@ describe Rake::Funnel::Support::InstantiateSymbol do
34
48
  it 'should not be public' do
35
49
  expect(subject).not_to respond_to(:create)
36
50
  expect(subject).not_to respond_to(:available)
51
+ expect(subject).not_to respond_to(:mod)
37
52
  end
38
53
  end
39
54
 
@@ -107,6 +122,20 @@ describe Rake::Funnel::Support::InstantiateSymbol do
107
122
  end
108
123
  end
109
124
 
125
+ context 'snake cased symbol' do
126
+ subject {
127
+ SnakeCaseModuleDefinition.new
128
+ }
129
+
130
+ it 'should return instance' do
131
+ expect(subject.send(:create, :snake_case)).to be_an_instance_of(SnakeCase::SnakeCase)
132
+ end
133
+
134
+ it 'should prefer explicit type' do
135
+ expect(subject.send(:create, :Snake_Case)).to be_an_instance_of(SnakeCase::Snake_Case)
136
+ end
137
+ end
138
+
110
139
  context 'instantiation fails' do
111
140
  class WillFail
112
141
  include Rake::Funnel::Support::InstantiateSymbol
@@ -6,8 +6,33 @@ describe Rake::Funnel::Support::MSBuild::BuildTool do
6
6
  context 'on Windows', platform: :win32 do
7
7
  let(:windows?) { true }
8
8
 
9
- it 'should find msbuild.exe' do
10
- expect(described_class.find).to match(/msbuild\.exe$/)
9
+ before {
10
+ allow(::Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open).and_yield({ 'MSBuildToolsPath' => 'path'})
11
+ }
12
+
13
+ it 'should search the registry for known MSBuild versions' do
14
+ described_class.find
15
+ expect(::Win32::Registry::HKEY_LOCAL_MACHINE).to have_received(:open).at_least(:once)
16
+ end
17
+
18
+ context 'MSBuild exists' do
19
+ before {
20
+ allow(File).to receive(:exist?).with('path/msbuild.exe').and_return(true)
21
+ }
22
+
23
+ it 'should find msbuild.exe' do
24
+ expect(described_class.find).to eq('path/msbuild.exe')
25
+ end
26
+ end
27
+
28
+ context 'MSBuild does not exist' do
29
+ before {
30
+ allow(File).to receive(:exist?).with('path/msbuild.exe').and_return(false)
31
+ }
32
+
33
+ it 'should not find msbuild.exe' do
34
+ expect(described_class.find).to be_nil
35
+ end
11
36
  end
12
37
  end
13
38
 
@@ -41,7 +41,7 @@ describe Rake::Funnel::Support::TemplateEngine do
41
41
  var = 42
42
42
  template = '<%= var %>'
43
43
 
44
- expect { described_class.render(template) }.to raise_error
44
+ expect { described_class.render(template) }.to raise_error(NameError)
45
45
  end
46
46
  end
47
47
 
@@ -110,7 +110,7 @@ describe Rake::Funnel::Tasks::Paket do
110
110
  }
111
111
 
112
112
  it 'should fail' do
113
- expect { Task[subject.name].invoke }.to raise_error
113
+ expect { Task[subject.name].invoke }.to raise_error(RuntimeError)
114
114
  end
115
115
  end
116
116
  end
@@ -130,7 +130,7 @@ describe Rake::Funnel::Tasks::Paket do
130
130
  end
131
131
 
132
132
  it 'should fail' do
133
- expect { Task[subject.name].invoke }.to raise_error
133
+ expect { Task[subject.name].invoke }.to raise_error(RuntimeError)
134
134
  end
135
135
  end
136
136
  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.11.0.pre
4
+ version: 0.12.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-06-15 00:00:00.000000000 Z
11
+ date: 2015-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -86,7 +86,6 @@ files:
86
86
  - lib/rake/funnel/extensions/disable_colors.rb
87
87
  - lib/rake/funnel/extensions/rexml.rb
88
88
  - lib/rake/funnel/extensions/shell.rb
89
- - lib/rake/funnel/extensions/windows_path.rb
90
89
  - lib/rake/funnel/framework.rb
91
90
  - lib/rake/funnel/integration/progress_report.rb
92
91
  - lib/rake/funnel/integration/sync_output.rb
@@ -151,7 +150,6 @@ files:
151
150
  - spec/rake/funnel/extensions/disable_colors_spec.rb
152
151
  - spec/rake/funnel/extensions/rexml_spec.rb
153
152
  - spec/rake/funnel/extensions/shell_spec.rb
154
- - spec/rake/funnel/extensions/windows_path_spec.rb
155
153
  - spec/rake/funnel/integration/progress_report_spec.rb
156
154
  - spec/rake/funnel/integration/sync_output_spec.rb
157
155
  - spec/rake/funnel/integration/teamcity/nunit_plugin_spec.rb
@@ -228,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
226
  version: 1.3.1
229
227
  requirements: []
230
228
  rubyforge_project:
231
- rubygems_version: 2.0.14
229
+ rubygems_version: 2.0.15
232
230
  signing_key:
233
231
  specification_version: 4
234
232
  summary: The build pipeline
@@ -240,7 +238,6 @@ test_files:
240
238
  - spec/rake/funnel/extensions/disable_colors_spec.rb
241
239
  - spec/rake/funnel/extensions/rexml_spec.rb
242
240
  - spec/rake/funnel/extensions/shell_spec.rb
243
- - spec/rake/funnel/extensions/windows_path_spec.rb
244
241
  - spec/rake/funnel/integration/progress_report_spec.rb
245
242
  - spec/rake/funnel/integration/sync_output_spec.rb
246
243
  - spec/rake/funnel/integration/teamcity/nunit_plugin_spec.rb
@@ -1,15 +0,0 @@
1
- module Rake
2
- module Funnel
3
- module Extensions
4
- module WindowsPath
5
- def to_windows_path
6
- gsub(%r|/|, '\\')
7
- end
8
- end
9
- end
10
- end
11
- end
12
-
13
- class String
14
- include Rake::Funnel::Extensions::WindowsPath
15
- end
@@ -1,5 +0,0 @@
1
- describe Rake::Funnel::Extensions::WindowsPath do
2
- it 'should convert forward slash to backslash' do
3
- expect('C:\Foo/bar/baz'.to_windows_path).to eq('C:\Foo\bar\baz')
4
- end
5
- end