train 0.31.1 → 0.32.0

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
  SHA1:
3
- metadata.gz: 45cc6cfd826d49507368b99a990fed0eeba925af
4
- data.tar.gz: b1dd4839b1a46ac0c246cdd0d7a00e8adda03150
3
+ metadata.gz: 6fc74b66a02b98fd67a644a04eb0e5f2186a1826
4
+ data.tar.gz: 131969604ad1bc09e8189c341fbbcca6d27c2315
5
5
  SHA512:
6
- metadata.gz: ab1770e2b5e06c10cc21dfb327c934acc4b9a2a38f8a016584e426a0d1da27b4cfcf794da4777bda6c51d251092848b538de98236b03d55d30dce0cfdd9b53e9
7
- data.tar.gz: 3c98eba3d01ab9f934e613a4d9ce6bd566f7a97fefa38b4e7986f1894e1e8428ac52807e3c9ace7dfe1cf2cacb0364eb3fda9735676ac1aa8d6a8a0040d92cb5
6
+ metadata.gz: 291bcb6b64d9d02da399f3f99e6d7dbde34cf5049601712559e79b7d4118bf55d78201c9d70564f5f90c7e88ef516f7f59b19ac0046a21c2c1202eb144201a8c
7
+ data.tar.gz: e8f7a849c58abfc84bdd01e282b43bef1d6fc2766d26293c9eee414a136ad8b8875b6b0f464cd682a29df81692bfbdc7c13014622442159b51cbac94a13a2611
data/CHANGELOG.md CHANGED
@@ -1,10 +1,23 @@
1
1
  # Change Log
2
2
 
3
- ## [0.31.1](https://github.com/chef/train/tree/0.31.1) (2017-12-06)
4
- [Full Changelog](https://github.com/chef/train/compare/v0.31.0...0.31.1)
3
+ ## [0.32.0](https://github.com/chef/train/tree/0.32.0) (2018-01-04)
4
+ [Full Changelog](https://github.com/chef/train/compare/v0.31.1...0.32.0)
5
+
6
+ **Fixed bugs:**
7
+
8
+ - platform names should be lower case [\#191](https://github.com/chef/train/issues/191)
9
+ - Return platform name that is lower case and underscored [\#228](https://github.com/chef/train/pull/228) ([jquick](https://github.com/jquick))
10
+
11
+ **Merged pull requests:**
12
+
13
+ - Set mock transport to use the platform instance variable [\#230](https://github.com/chef/train/pull/230) ([jquick](https://github.com/jquick))
14
+
15
+ ## [v0.31.1](https://github.com/chef/train/tree/v0.31.1) (2017-12-06)
16
+ [Full Changelog](https://github.com/chef/train/compare/v0.31.0...v0.31.1)
5
17
 
6
18
  **Merged pull requests:**
7
19
 
20
+ - Release 0.31.1 [\#226](https://github.com/chef/train/pull/226) ([adamleff](https://github.com/adamleff))
8
21
  - Allow runner specifications for local connections [\#225](https://github.com/chef/train/pull/225) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
9
22
 
10
23
  ## [v0.31.0](https://github.com/chef/train/tree/v0.31.0) (2017-12-05)
@@ -25,7 +25,16 @@ module Train::Platforms
25
25
  def name
26
26
  # Override here incase a updated name was set
27
27
  # during the detect logic
28
- @platform[:name] || @name
28
+ clean_name
29
+ end
30
+
31
+ def clean_name(force: false)
32
+ @cleaned_name = nil if force
33
+ @cleaned_name ||= begin
34
+ name = (@platform[:name] || @name)
35
+ name.downcase!.tr!(' ', '_') if name =~ /[A-Z ]/
36
+ name
37
+ end
29
38
  end
30
39
 
31
40
  # This is for backwords compatability with
@@ -53,6 +62,10 @@ module Train::Platforms
53
62
  # This is done later to add any custom
54
63
  # families/properties that were created
55
64
  def add_platform_methods
65
+ # Redo clean name if there is a detect override
66
+ clean_name(force: true) unless @platform[:name].nil?
67
+
68
+ # Add in family methods
56
69
  family_list = Train::Platforms.families
57
70
  family_list.each_value do |k|
58
71
  next if respond_to?(k.name + '?')
@@ -70,9 +83,9 @@ module Train::Platforms
70
83
  end
71
84
 
72
85
  # Create method for name if its not already true
73
- plat_name = name.downcase.tr(' ', '_') + '?'
74
- return if respond_to?(plat_name)
75
- define_singleton_method(plat_name) do
86
+ m = name + '?'
87
+ return if respond_to?(m)
88
+ define_singleton_method(m) do
76
89
  true
77
90
  end
78
91
  end
@@ -57,8 +57,6 @@ end
57
57
 
58
58
  class Train::Transports::Mock
59
59
  class Connection < BaseConnection
60
- attr_reader :os
61
-
62
60
  def initialize(conf = nil)
63
61
  super(conf)
64
62
  mock_os
@@ -80,7 +78,7 @@ class Train::Transports::Mock
80
78
  platform.family_hierarchy = mock_os_hierarchy(platform).flatten
81
79
  platform.platform = value
82
80
  platform.add_platform_methods
83
- @os = platform
81
+ @platform = platform
84
82
  end
85
83
 
86
84
  def mock_os_hierarchy(plat)
data/lib/train/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
4
4
 
5
5
  module Train
6
- VERSION = '0.31.1'.freeze
6
+ VERSION = '0.32.0'.freeze
7
7
  end
@@ -34,13 +34,19 @@ describe 'platform' do
34
34
  plat.title.must_equal('The Best Mock')
35
35
  end
36
36
 
37
+ it 'clean init name' do
38
+ plat = mock_platform_family('Mo ck')
39
+ plat.name.must_equal('mo_ck')
40
+ end
41
+
37
42
  it 'set name and name override' do
38
43
  plat = mock_platform_family('mock')
39
44
  plat.name.must_equal('mock')
40
45
  plat[:name].must_equal('mock')
41
- plat.platform[:name] = 'mock2020'
42
- plat.name.must_equal('mock2020')
43
- plat[:name].must_equal('mock2020')
46
+ plat.platform[:name] = 'Mock 2020'
47
+ plat.add_platform_methods
48
+ plat.name.must_equal('mock_2020')
49
+ plat[:name].must_equal('mock_2020')
44
50
  end
45
51
 
46
52
  it 'check families' do
@@ -83,6 +83,7 @@ describe 'mock transport' do
83
83
  describe 'when accessing a mocked os' do
84
84
  it 'has the default mock os faily set to mock' do
85
85
  connection.os[:name].must_equal 'mock'
86
+ connection.platform[:name].must_equal 'mock'
86
87
  end
87
88
 
88
89
  it 'sets the OS to the mocked value' do
@@ -25,7 +25,7 @@ describe 'windows local command' do
25
25
 
26
26
  it 'verify os' do
27
27
  os = conn.os
28
- os[:name].must_equal 'Windows Server 2012 R2 Datacenter'
28
+ os[:name].must_equal 'windows_server_2012_r2_datacenter'
29
29
  os[:family].must_equal "windows"
30
30
  os[:release].must_equal '6.3.9600'
31
31
  os[:arch].must_equal 'x86_64'
@@ -27,7 +27,7 @@ describe 'windows winrm command' do
27
27
 
28
28
  it 'verify os' do
29
29
  os = conn.os
30
- os[:name].must_equal 'Windows Server 2012 R2 Datacenter'
30
+ os[:name].must_equal 'windows_server_2012_r2_datacenter'
31
31
  os[:family].must_equal 'windows'
32
32
  os[:release].must_equal '6.3.9600'
33
33
  os[:arch].must_equal 'x86_64'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: train
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.1
4
+ version: 0.32.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Richter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-06 00:00:00.000000000 Z
11
+ date: 2018-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json