train-core 1.4.29 → 1.4.31

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
  SHA256:
3
- metadata.gz: 873addbef7c16e3ff149dbad280ae61c1913b689adcd50535bd0471ad091f020
4
- data.tar.gz: 0dce14e56c157bb0ab9291a04768b3786cefdbf2e0952401d61bc76e7e5f693f
3
+ metadata.gz: '096ddd9b85e884861709f1bcfffc3b1be99f202f40e506a3e9d07bba59f6b178'
4
+ data.tar.gz: 2a1e7c6376bf4f0a44543b8a1a50d89270ea60ae71bc89cd32d447bb24fdd827
5
5
  SHA512:
6
- metadata.gz: c27449cfdf20762084d4e7c759b08a9da4ff7a78221320c3218059509ac409fc524aa5cfd8f542a85a8518c181613f93eb17c04b003201ace6047c88708413e2
7
- data.tar.gz: ab7334d0c6db00ba245bf8a74bad71ac0bf95d7542b3a904748bd965eaec602e282508d15eb825bb67279af605b26537d3b4a1ff6371e5a8cf7385466eb6c47f
6
+ metadata.gz: db0c6f74250762ef38e5941acc67fe18447cf300443dc7198161108900ea9df78130b842d66640bfcb8fecf8dc5299f2c2b950630b0a6e16551ed5ad690a380a
7
+ data.tar.gz: 47cc525c48959f6f09268ec8637ef9284b5039afcb4c5f2d1bd51d37d3e3705a8dd521a90d37e392cecd13e939909530aeb0948c49b69068248434cc52e34d52
@@ -1,28 +1,34 @@
1
- <!-- latest_release 1.4.29 -->
2
- ## [v1.4.29](https://github.com/inspec/train/tree/v1.4.29) (2018-08-15)
1
+ <!-- latest_release 1.4.31 -->
2
+ ## [v1.4.31](https://github.com/inspec/train/tree/v1.4.31) (2018-08-16)
3
3
 
4
4
  #### Merged Pull Requests
5
- - Add non_interactive support for SSH [#336](https://github.com/inspec/train/pull/336) ([marcparadise](https://github.com/marcparadise))
5
+ - Enable using rubygems as plugins [#335](https://github.com/inspec/train/pull/335) ([clintoncwolfe](https://github.com/clintoncwolfe))
6
6
  <!-- latest_release -->
7
7
 
8
- <!-- release_rollup since=1.4.25 -->
9
- ### Changes since 1.4.25 release
10
-
11
- #### Features & Enhancements
12
- - Pulls file credentials parsing out of Azure class [#324](https://github.com/inspec/train/pull/324) ([dmccown](https://github.com/dmccown)) <!-- 1.4.27 -->
8
+ <!-- release_rollup since=1.4.29 -->
9
+ ### Changes since 1.4.29 release
13
10
 
14
11
  #### Merged Pull Requests
15
- - Add non_interactive support for SSH [#336](https://github.com/inspec/train/pull/336) ([marcparadise](https://github.com/marcparadise)) <!-- 1.4.29 -->
16
- - Require Ruby 2.0 and allow net-ssh 5.0 [#334](https://github.com/inspec/train/pull/334) ([tas50](https://github.com/tas50)) <!-- 1.4.28 -->
17
- - Modify checksum logic to use system binaries [#251](https://github.com/inspec/train/pull/251) ([jerryaldrichiii](https://github.com/jerryaldrichiii)) <!-- 1.4.26 -->
12
+ - Enable using rubygems as plugins [#335](https://github.com/inspec/train/pull/335) ([clintoncwolfe](https://github.com/clintoncwolfe)) <!-- 1.4.31 -->
13
+ - Fixes an issue where the credential file was nil [#337](https://github.com/inspec/train/pull/337) ([dmccown](https://github.com/dmccown)) <!-- 1.4.30 -->
18
14
  <!-- release_rollup -->
19
15
 
20
16
  <!-- latest_stable_release -->
17
+ ## [v1.4.29](https://github.com/inspec/train/tree/v1.4.29) (2018-08-15)
18
+
19
+ #### Features & Enhancements
20
+ - Pulls file credentials parsing out of Azure class [#324](https://github.com/inspec/train/pull/324) ([dmccown](https://github.com/dmccown))
21
+
22
+ #### Merged Pull Requests
23
+ - Modify checksum logic to use system binaries [#251](https://github.com/inspec/train/pull/251) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
24
+ - Require Ruby 2.0 and allow net-ssh 5.0 [#334](https://github.com/inspec/train/pull/334) ([tas50](https://github.com/tas50))
25
+ - Add non_interactive support for SSH [#336](https://github.com/inspec/train/pull/336) ([marcparadise](https://github.com/marcparadise))
26
+ <!-- latest_stable_release -->
27
+
21
28
  ## [v1.4.25](https://github.com/inspec/train/tree/v1.4.25) (2018-08-01)
22
29
 
23
30
  #### Merged Pull Requests
24
31
  - Remove not needed google-cloud dependency (see #328) and correct GCP … [#329](https://github.com/inspec/train/pull/329) ([skpaterson](https://github.com/skpaterson))
25
- <!-- latest_stable_release -->
26
32
 
27
33
  ## [v1.4.24](https://github.com/inspec/train/tree/v1.4.24) (2018-07-26)
28
34
 
data/Gemfile CHANGED
@@ -19,6 +19,13 @@ group :test do
19
19
  gem 'rubocop', '~> 0.36.0'
20
20
  gem 'simplecov', '~> 0.10'
21
21
  gem 'concurrent-ruby', '~> 1.0'
22
+ gem 'pry-byebug'
23
+ gem 'm'
24
+ # This is not a true gem installation
25
+ # (Gem::Specification.find_by_path('train-gem-fixture') will return nil)
26
+ # but it's close enough to show the gempath handler can find a plugin
27
+ # See test/unit/
28
+ gem 'train-gem-fixture', path: 'test/fixtures/gempath/gems'
22
29
  end
23
30
 
24
31
  group :integration do
@@ -36,16 +36,29 @@ module Train
36
36
  #
37
37
  # @param [String] name of the plugin
38
38
  # @return [Train::Transport] the transport plugin
39
- def self.load_transport(name)
40
- res = Train::Plugins.registry[name.to_s]
41
- return res unless res.nil?
42
-
43
- # if the plugin wasnt loaded yet:
44
- require 'train/transports/' + name.to_s
45
- Train::Plugins.registry[name.to_s]
39
+ def self.load_transport(transport_name)
40
+ transport_name = transport_name.to_s
41
+ transport_class = Train::Plugins.registry[transport_name]
42
+ return transport_class unless transport_class.nil?
43
+
44
+ # Try to load the transport name from the core transports...
45
+ require 'train/transports/' + transport_name
46
+ return Train::Plugins.registry[transport_name]
46
47
  rescue LoadError => _
47
- raise Train::UserError,
48
- "Can't find train plugin #{name.inspect}. Please install it first."
48
+ begin
49
+ # If it's not in the core transports, try loading from a train plugin gem.
50
+ gem_name = 'train-' + transport_name
51
+ require gem_name
52
+ return Train::Plugins.registry[transport_name]
53
+ # rubocop: disable Lint/HandleExceptions
54
+ rescue LoadError => _
55
+ # rubocop: enable Lint/HandleExceptions
56
+ # Intentionally empty rescue - we're handling it below anyway
57
+ end
58
+
59
+ ex = Train::PluginLoadError.new("Can't find train plugin #{transport_name}. Please install it first.")
60
+ ex.transport_name = transport_name
61
+ raise ex
49
62
  end
50
63
 
51
64
  # Resolve target configuration in URI-scheme into
@@ -23,6 +23,11 @@ module Train
23
23
  # errors.
24
24
  class UserError < Error; end
25
25
 
26
+ # We could not load a plugin, because of a user error
27
+ class PluginLoadError < UserError
28
+ attr_accessor :transport_name
29
+ end
30
+
26
31
  # Base exception class for all exceptions that are caused by incorrect use
27
32
  # of an API.
28
33
  class ClientError < Error; end
@@ -5,7 +5,7 @@ require 'train/platforms/detect/helpers/os_windows'
5
5
  require 'rbconfig'
6
6
 
7
7
  module Train::Platforms::Detect::Helpers
8
- module OSCommon # rubocop:disable Metrics/ModuleLength
8
+ module OSCommon
9
9
  include Train::Platforms::Detect::Helpers::Linux
10
10
  include Train::Platforms::Detect::Helpers::Windows
11
11
 
@@ -77,7 +77,7 @@ class Train::Plugins::Transport
77
77
  false
78
78
  end
79
79
 
80
- def direct_platform(name, platform_details = nil)
80
+ def force_platform!(name, platform_details = nil)
81
81
  plat = Train::Platforms.name(name)
82
82
  plat.backend = self
83
83
  plat.platform = platform_details unless platform_details.nil?
@@ -86,6 +86,8 @@ class Train::Plugins::Transport
86
86
  plat
87
87
  end
88
88
 
89
+ alias direct_platform force_platform!
90
+
89
91
  def family_hierarchy(plat)
90
92
  plat.families.each_with_object([]) do |(k, _v), memo|
91
93
  memo << k.name
@@ -3,5 +3,5 @@
3
3
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
4
4
 
5
5
  module Train
6
- VERSION = '1.4.29'.freeze
6
+ VERSION = '1.4.31'.freeze
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: train-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.29
4
+ version: 1.4.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Richter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-15 00:00:00.000000000 Z
11
+ date: 2018-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout