train 1.5.11 → 1.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/lib/train/transports/winrm.rb +16 -4
  3. data/lib/train/version.rb +1 -1
  4. metadata +3 -165
  5. data/.rubocop.yml +0 -77
  6. data/CHANGELOG.md +0 -900
  7. data/Gemfile +0 -41
  8. data/README.md +0 -212
  9. data/Rakefile +0 -73
  10. data/test/fixtures/plugins/train-test-fixture/LICENSE +0 -201
  11. data/test/fixtures/plugins/train-test-fixture/README.md +0 -5
  12. data/test/fixtures/plugins/train-test-fixture/lib/train-test-fixture/connection.rb +0 -35
  13. data/test/fixtures/plugins/train-test-fixture/lib/train-test-fixture/platform.rb +0 -18
  14. data/test/fixtures/plugins/train-test-fixture/lib/train-test-fixture/transport.rb +0 -14
  15. data/test/fixtures/plugins/train-test-fixture/lib/train-test-fixture/version.rb +0 -5
  16. data/test/fixtures/plugins/train-test-fixture/lib/train-test-fixture.rb +0 -4
  17. data/test/fixtures/plugins/train-test-fixture/pkg/train-test-fixture-0.1.0.gem +0 -0
  18. data/test/fixtures/plugins/train-test-fixture/train-test-fixture.gemspec +0 -35
  19. data/test/integration/.kitchen.yml +0 -43
  20. data/test/integration/Berksfile +0 -3
  21. data/test/integration/bootstrap.sh +0 -22
  22. data/test/integration/chefignore +0 -1
  23. data/test/integration/cookbooks/test/metadata.rb +0 -1
  24. data/test/integration/cookbooks/test/recipes/default.rb +0 -100
  25. data/test/integration/cookbooks/test/recipes/prep_files.rb +0 -56
  26. data/test/integration/docker_run.rb +0 -153
  27. data/test/integration/docker_test.rb +0 -24
  28. data/test/integration/docker_test_container.rb +0 -24
  29. data/test/integration/helper.rb +0 -61
  30. data/test/integration/sudo/customcommand.rb +0 -15
  31. data/test/integration/sudo/nopasswd.rb +0 -16
  32. data/test/integration/sudo/passwd.rb +0 -21
  33. data/test/integration/sudo/reqtty.rb +0 -17
  34. data/test/integration/sudo/run_as.rb +0 -12
  35. data/test/integration/test-travis-centos.yml +0 -6
  36. data/test/integration/test-travis-debian.yml +0 -6
  37. data/test/integration/test-travis-fedora.yml +0 -8
  38. data/test/integration/test-travis-oel.yml +0 -6
  39. data/test/integration/test-travis-ubuntu.yml +0 -8
  40. data/test/integration/test_local.rb +0 -19
  41. data/test/integration/test_ssh.rb +0 -39
  42. data/test/integration/tests/path_block_device_test.rb +0 -74
  43. data/test/integration/tests/path_character_device_test.rb +0 -74
  44. data/test/integration/tests/path_file_test.rb +0 -99
  45. data/test/integration/tests/path_folder_test.rb +0 -90
  46. data/test/integration/tests/path_missing_test.rb +0 -76
  47. data/test/integration/tests/path_pipe_test.rb +0 -62
  48. data/test/integration/tests/path_symlink_test.rb +0 -95
  49. data/test/integration/tests/run_command_test.rb +0 -35
  50. data/test/unit/extras/command_wrapper_test.rb +0 -110
  51. data/test/unit/extras/stat_test.rb +0 -210
  52. data/test/unit/file/local/unix_test.rb +0 -224
  53. data/test/unit/file/local/windows_test.rb +0 -101
  54. data/test/unit/file/local_test.rb +0 -121
  55. data/test/unit/file/remote/aix_test.rb +0 -81
  56. data/test/unit/file/remote/linux_test.rb +0 -221
  57. data/test/unit/file/remote/qnx_test.rb +0 -80
  58. data/test/unit/file/remote/unix_test.rb +0 -119
  59. data/test/unit/file/remote/windows_test.rb +0 -72
  60. data/test/unit/file/remote_test.rb +0 -62
  61. data/test/unit/file_test.rb +0 -129
  62. data/test/unit/helper.rb +0 -7
  63. data/test/unit/platforms/detect/os_common_test.rb +0 -85
  64. data/test/unit/platforms/detect/os_linux_test.rb +0 -132
  65. data/test/unit/platforms/detect/os_windows_test.rb +0 -107
  66. data/test/unit/platforms/detect/scanner_test.rb +0 -61
  67. data/test/unit/platforms/detect/uuid_test.rb +0 -133
  68. data/test/unit/platforms/family_test.rb +0 -32
  69. data/test/unit/platforms/os_detect_test.rb +0 -249
  70. data/test/unit/platforms/platform_test.rb +0 -405
  71. data/test/unit/platforms/platforms_test.rb +0 -52
  72. data/test/unit/plugins/connection_test.rb +0 -219
  73. data/test/unit/plugins/transport_test.rb +0 -111
  74. data/test/unit/plugins_test.rb +0 -22
  75. data/test/unit/train_test.rb +0 -247
  76. data/test/unit/transports/aws_test.rb +0 -120
  77. data/test/unit/transports/azure_test.rb +0 -145
  78. data/test/unit/transports/cisco_ios_connection.rb +0 -92
  79. data/test/unit/transports/gcp_test.rb +0 -266
  80. data/test/unit/transports/helpers/azure/file_credentials_test.rb +0 -129
  81. data/test/unit/transports/local_test.rb +0 -183
  82. data/test/unit/transports/mock_test.rb +0 -150
  83. data/test/unit/transports/ssh_test.rb +0 -330
  84. data/test/unit/transports/vmware_test.rb +0 -159
  85. data/test/unit/version_test.rb +0 -8
  86. data/test/windows/local_test.rb +0 -243
  87. data/test/windows/winrm_test.rb +0 -187
  88. data/train.gemspec +0 -45
data/Gemfile DELETED
@@ -1,41 +0,0 @@
1
- # encoding: utf-8
2
- source 'https://rubygems.org'
3
- gemspec name: 'train'
4
-
5
- # pin dependency for Ruby 1.9.3 since bundler is not
6
- # detecting that net-ssh 3 does not work with 1.9.3
7
- if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new('1.9.3')
8
- gem 'net-ssh', '~> 2.9'
9
- end
10
-
11
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.2.2')
12
- gem 'json', '< 2.0'
13
- end
14
-
15
- group :test do
16
- gem 'bundler', '~> 1.11'
17
- gem 'minitest', '~> 5.8'
18
- gem 'rake', '~> 10'
19
- gem 'rubocop', '~> 0.36.0'
20
- gem 'simplecov', '~> 0.10'
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-test-fixture', path: 'test/fixtures/plugins/train-test-fixture'
29
- end
30
-
31
- group :integration do
32
- gem 'berkshelf', '~> 5.2'
33
- gem 'test-kitchen', '~> 1.11'
34
- gem 'kitchen-vagrant'
35
- end
36
-
37
- group :tools do
38
- gem 'pry', '~> 0.10'
39
- gem 'rb-readline'
40
- gem 'license_finder'
41
- end
data/README.md DELETED
@@ -1,212 +0,0 @@
1
- # Train - Transport Interface
2
-
3
- [![Build Status](https://travis-ci.org/inspec/train.svg?branch=master)](https://travis-ci.org/inspec/train)
4
- [![Build Status Master](https://ci.appveyor.com/api/projects/status/github/inspec/train?branch=master&svg=true&passingText=master%20-%20Ok&pendingText=master%20-%20Pending&failingText=master%20-%20Failing)](https://ci.appveyor.com/project/Chef/train/branch/master)
5
- [![Gem Version](https://badge.fury.io/rb/train.svg)](https://badge.fury.io/rb/train)
6
-
7
- Train lets you talk to your local or remote operating systems and APIs with a unified interface.
8
-
9
- It allows you to:
10
-
11
- * execute commands via `run_command`
12
- * interact with files via `file`
13
- * identify the target operating system via `os`
14
- * authenticate to API-based services and treat them like a platform
15
-
16
- Train supports:
17
-
18
- * Local execution
19
- * SSH
20
- * WinRM
21
- * Docker
22
- * Mock (for testing and debugging)
23
- * AWS as an API
24
- * Azure as an API
25
- * VMware via PowerCLI
26
-
27
- # Examples
28
-
29
- ## Setup
30
-
31
- **Local**
32
-
33
- ```ruby
34
- require 'train'
35
- train = Train.create('local')
36
- ```
37
-
38
- **SSH**
39
-
40
- ```ruby
41
- require 'train'
42
- train = Train.create('ssh',
43
- host: '1.2.3.4', port: 22, user: 'root', key_files: '/vagrant')
44
- ```
45
-
46
- If you don't specify the `key_files` and `password` options, SSH agent authentication will be attempted. For example:
47
-
48
- ```ruby
49
- require 'train'
50
- train = Train.create('ssh', host: '1.2.3.4', port: 22, user: 'root')
51
- ```
52
-
53
- **WinRM**
54
-
55
- ```ruby
56
- require 'train'
57
- train = Train.create('winrm',
58
- host: '1.2.3.4', user: 'Administrator', password: '...', ssl: true, self_signed: true)
59
- ```
60
-
61
- **Docker**
62
-
63
- ```ruby
64
- require 'train'
65
- train = Train.create('docker', host: 'container_id...')
66
- ```
67
-
68
- **AWS**
69
-
70
- To use AWS API authentication, setup an AWS client profile to store the Access Key ID and Secret Access Key.
71
-
72
- ```ruby
73
- require 'train'
74
- train = Train.create('aws', region: 'us-east-2', profile: 'my-profile')
75
- ```
76
-
77
- You may also use the standard AWS CLI environment variables, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_REGION`.
78
- ```ruby
79
- require 'train'
80
- train = Train.create('aws')
81
- ```
82
-
83
- **VMware**
84
-
85
- ```ruby
86
- require 'train'
87
- Train.create('vmware', viserver: '10.0.0.10', user: 'demouser', password: 'securepassword')
88
- ```
89
-
90
- You may also use environment variables by setting `VISERVER`, `VISERVER__USERNAME`, and `VISERVER_PASSWORD`
91
-
92
- ```ruby
93
- require 'train'
94
- Train.create('vmware')
95
- ```
96
-
97
- ## Configuration
98
-
99
- To get a list of available options for a plugin:
100
-
101
- ```ruby
102
- puts Train.options('ssh')
103
- ```
104
- This will provide all configuration options:
105
-
106
- ```ruby
107
- {
108
- :host => { :required => true},
109
- :port => { :default => 22, :required => true},
110
- :user => { :default => "root", :required => true},
111
- :keys => { :default => nil},
112
- :password => { :default => nil},
113
- ...
114
- ```
115
-
116
- ## Usage
117
-
118
- ```ruby
119
- # start or reuse a connection
120
- conn = train.connection
121
-
122
- # run a command on Linux/Unix/Mac
123
- puts conn.run_command('whoami').stdout
124
-
125
- # get OS info
126
- puts conn.os[:family]
127
- puts conn.os[:release]
128
-
129
- # access files
130
- puts conn.file('/proc/version').content
131
-
132
- # access specific API client functionality
133
- ec2_client = train.connection.aws_client(Aws::EC2::Client)
134
- puts ec2_client.describe_instances
135
-
136
- # close the connection
137
- conn.close
138
- ```
139
-
140
- # Testing
141
-
142
- We perform `unit`, `integration` and `windows` tests.
143
-
144
- * `unit` tests ensure the intended behaviour of the implementation
145
- * `integration` tests run against VMs and docker containers
146
- * `windows` tests that run on appveyor for windows integration tests
147
-
148
- ## Mac/Linux
149
-
150
- ```
151
- bundle exec ruby -W -Ilib:test/unit test/unit/extras/stat_test.rb
152
- ```
153
-
154
- ## Windows
155
-
156
- ```
157
- # run windows tests
158
- bundle exec rake test:windows
159
-
160
- # run single tests
161
- bundle exec ruby -I .\test\windows\ .\test\windows\local_test.rb
162
- ```
163
-
164
-
165
- # Kudos and Contributors
166
-
167
- Train is heavily based on the work of:
168
-
169
- * [test-kitchen](https://github.com/test-kitchen/test-kitchen)
170
-
171
- by [Fletcher Nichol](fnichol@nichol.ca)
172
- and [a great community of contributors](https://github.com/test-kitchen/test-kitchen/graphs/contributors)
173
-
174
- * [ohai](https://github.com/chef/ohai)
175
-
176
- by Adam Jacob, Chef Software Inc.
177
- and [a great community of contributors](https://github.com/chef/ohai/graphs/contributors)
178
-
179
-
180
- We also want to thank [halo](https://github.com/halo) who did a great contribution by handing over the `train` gem name.
181
-
182
- ## Contributing
183
-
184
- 1. Fork it
185
- 1. Create your feature branch (git checkout -b my-new-feature)
186
- 1. Commit your changes (git commit -am 'Add some feature')
187
- 1. Push to the branch (git push origin my-new-feature)
188
- 1. Create new Pull Request
189
-
190
- ## License
191
-
192
- | **Author:** | Dominik Richter (<drichter@chef.io>)
193
-
194
- | **Author:** | Christoph Hartmann (<chartmann@chef.io>)
195
-
196
- | **Copyright:** | Copyright (c) 2015-2018 Chef Software Inc.
197
-
198
- | **Copyright:** | Copyright (c) 2015 Vulcano Security GmbH.
199
-
200
- | **License:** | Apache License, Version 2.0
201
-
202
- Licensed under the Apache License, Version 2.0 (the "License");
203
- you may not use this file except in compliance with the License.
204
- You may obtain a copy of the License at
205
-
206
- http://www.apache.org/licenses/LICENSE-2.0
207
-
208
- Unless required by applicable law or agreed to in writing, software
209
- distributed under the License is distributed on an "AS IS" BASIS,
210
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
211
- See the License for the specific language governing permissions and
212
- limitations under the License.
data/Rakefile DELETED
@@ -1,73 +0,0 @@
1
- #!/usr/bin/env rake
2
- # encoding: utf-8
3
-
4
- require 'bundler'
5
- require 'bundler/gem_helper'
6
- require 'rake/testtask'
7
- require 'rubocop/rake_task'
8
-
9
- Bundler::GemHelper.install_tasks name: 'train'
10
-
11
- # Rubocop
12
- desc 'Run Rubocop lint checks'
13
- task :rubocop do
14
- RuboCop::RakeTask.new
15
- end
16
-
17
- # lint the project
18
- desc 'Run robocop linter'
19
- task lint: [:rubocop]
20
-
21
- # run tests
22
- task default: [:test, :lint]
23
-
24
- Rake::TestTask.new do |t|
25
- t.libs << 'test/unit'
26
- t.pattern = 'test/unit/**/*_test.rb'
27
- t.warning = true
28
- t.verbose = true
29
- t.ruby_opts = ['--dev'] if defined?(JRUBY_VERSION)
30
- end
31
-
32
- namespace :test do
33
- task :docker do
34
- path = File.join(File.dirname(__FILE__), 'test', 'integration')
35
- sh('sh', '-c', "cd #{path} && ruby -I ../../lib docker_test.rb tests/*")
36
- end
37
-
38
- task :windows do
39
- Dir.glob('test/windows/*_test.rb').all? do |file|
40
- sh(Gem.ruby, '-w', '-I .\test\windows', file)
41
- end or fail 'Failures'
42
- end
43
-
44
- task :vm do
45
- concurrency = ENV['CONCURRENCY'] || 4
46
- path = File.join(File.dirname(__FILE__), 'test', 'integration')
47
- sh('sh', '-c', "cd #{path} && kitchen test -c #{concurrency}")
48
- end
49
-
50
- # Target required:
51
- # rake "test:ssh[user@server]"
52
- # sh -c cd /home/foobarbam/src/gems/train/test/integration \
53
- # && target=user@server ruby -I ../../lib test_ssh.rb tests/*
54
- # ...
55
- # Turn debug logging back on:
56
- # debug=1 rake "test:ssh[user@server]"
57
- # Use a different ssh key:
58
- # key_files=/home/foobarbam/.ssh/id_rsa2 rake "test:ssh[user@server]"
59
- # Run with a specific test:
60
- # test=path_block_device_test.rb rake "test:ssh[user@server]"
61
- task :ssh, [:target] do |t, args|
62
- path = File.join(File.dirname(__FILE__), 'test', 'integration')
63
- key_files = ENV['key_files'] || File.join(ENV['HOME'], '.ssh', 'id_rsa')
64
-
65
- sh_cmd = "cd #{path} && target=#{args[:target]} key_files=#{key_files}"
66
-
67
- sh_cmd += " debug=#{ENV['debug']}" if ENV['debug']
68
- sh_cmd += ' ruby -I ../../lib test_ssh.rb tests/'
69
- sh_cmd += ENV['test'] || '*'
70
-
71
- sh('sh', '-c', sh_cmd)
72
- end
73
- end
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
@@ -1,5 +0,0 @@
1
- This is a very simple train transport plugin. It provided fixed responses to file.content and command.stdout/stderr/exit_status.
2
-
3
- It is not a good example to use for learning, nor a good base for starting your own plugin - it's intended for for use during the testing of Train.
4
-
5
- For good examples of plugin development, see train/examples/plugin.
@@ -1,35 +0,0 @@
1
- require 'train-test-fixture/platform'
2
- require 'train/transports/local'
3
-
4
- module TrainPlugins
5
- module TestFixture
6
- class Connection < Train::Plugins::Transport::BaseConnection
7
- include TrainPlugins::TestFixture::Platform
8
-
9
- def initialize(options)
10
- super(options)
11
- end
12
-
13
- private
14
-
15
- def run_command_via_connection(cmd)
16
- Train::Transports::Local::CommandResult.new(
17
- 'Mock Command Result stdout',
18
- 'Mock Command Result stderr',
19
- 17
20
- )
21
- end
22
-
23
- def file_via_connection(path, *args)
24
- MockFile.new(self, path)
25
- end
26
-
27
- class MockFile < Train::File
28
- def content
29
- # Remarkably, the content is always the same.
30
- 'Lorem Ipsum'
31
- end
32
- end
33
- end
34
- end
35
- end
@@ -1,18 +0,0 @@
1
- require 'train-test-fixture/version'
2
-
3
- module TrainPlugins
4
- module TestFixture
5
- module Platform
6
- def platform
7
- # Build this platform's family declarations.
8
- # You'll need at least unix and windows to make the file() resource work.
9
- Train::Platforms.name('test-fixture').in_family('unix')
10
- Train::Platforms.name('test-fixture').in_family('windows')
11
- force_platform!('test-fixture',
12
- release: TrainPlugins::TestFixture::VERSION,
13
- arch: 'mock',
14
- )
15
- end
16
- end
17
- end
18
- end
@@ -1,14 +0,0 @@
1
- require 'train-test-fixture/connection'
2
-
3
- module TrainPlugins
4
- module TestFixture
5
- class Transport < Train.plugin(1)
6
- name 'test-fixture'
7
-
8
- def connection(_ = nil)
9
- @connection ||= TrainPlugins::TestFixture::Connection.new(@options)
10
- end
11
-
12
- end
13
- end
14
- end
@@ -1,5 +0,0 @@
1
- module TrainPlugins
2
- module TestFixture
3
- VERSION = '0.1.0'
4
- end
5
- end
@@ -1,4 +0,0 @@
1
- lib = File.expand_path("../../lib", __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
-
4
- require 'train-test-fixture/transport'
@@ -1,35 +0,0 @@
1
-
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "train-test-fixture"
7
- spec.version = '0.1.0'
8
- spec.authors = ["Inspec core engineering team"]
9
- spec.email = ["hello@chef.io"]
10
- spec.license = 'Apache-2.0'
11
-
12
- spec.summary = %q{Test train plugin. Not intended for use as an example.}
13
- spec.description = <<-EOD
14
- Train plugin used in testing Train's plugin loader and InSpec's plugin manager.
15
- This plugin does things that a normal plugin should not. Do not use it as an
16
- example or as a starting point for plugin of your own. For that, please see
17
- https://github.com/inspec/train/tree/master/examples/plugins
18
- EOD
19
- spec.homepage = "https://github.com/inspec/train"
20
-
21
- spec.files = %w{
22
- README.md
23
- LICENSE
24
- lib/train-test-fixture.rb
25
- lib/train-test-fixture/version.rb
26
- lib/train-test-fixture/transport.rb
27
- lib/train-test-fixture/connection.rb
28
- lib/train-test-fixture/platform.rb
29
- train-test-fixture.gemspec
30
- }
31
- spec.executables = []
32
- spec.require_paths = ["lib"]
33
-
34
- # No deps
35
- end