<commit_before># Train - Transport Interface

Train lets you talk to your local or remote operating systems with a unified interface.

It allows you to:

* execute commands via `run_command`
* interact with files via `file`
* identify the target operating system via `os`

Train supports:

* Local execution
* SSH
* WinRM
* Docker
* Mock (for testing and debugging)

# Examples

* Using [local execution](examples/loca.rb)
* Using [SSH](examples/ssh.rb)
* Using [WinRM](examples/winrm.rb)

# Kudos and Contribors

Train is heavily based on the work of:

* [test-kitchen](https://github.com/test-kitchen/test-kitchen)  

  by <NAME>
	and [all contributors](https://github.com/test-kitchen/test-kitchen/graphs/contributors)  

* [ohai](https://github.com/chef/ohai)

  by <NAME>, Chef Software Inc.
	and [all contributors](https://github.com/chef/ohai/graphs/contributors)

  
## Contributing

	1. Fork it
	1. Create your feature branch (git checkout -b my-new-feature)
	1. Commit your changes (git commit -am 'Add some feature')
	1. Push to the branch (git push origin my-new-feature)
	1. Create new Pull Request


Copyright 2015 Chef Software Inc. All rights reserved.
Copyright 2015 Vulcano Security GmbH. All rights reserved.
Copyright 2015 <NAME>. All rights reserved.

<commit_msg>add example section to readme<commit_after># Train - Transport Interface

Train lets you talk to your local or remote operating systems with a unified interface.

It allows you to:

* execute commands via `run_command`
* interact with files via `file`
* identify the target operating system via `os`

Train supports:

* Local execution
* SSH
* WinRM
* Docker
* Mock (for testing and debugging)

# Examples

## Setup

**Local**

```ruby
require 'train'
train = Train.create('local')
```

**SSH**

```ruby
require 'train'
train = Train.create('ssh',
  host: '1.2.3.4', port: 22, user: 'root', keys: '/vagrant')
```

**WinRM**

```ruby
require 'train'
train = Train.create('winrm',
  host: '1.2.3.4', user: 'Administrator', ssl: true, self_signed: true)
```

## Usage

```ruby
# start or reuse a connection
conn = train.connection

# run a command on Linux/Unix/Mac
puts conn.run_command('whoami').stdout

# get OS info
puts conn.os[:family]
puts conn.os[:release]

# access files
puts conn.file('/proc/version').content

# close the connection
conn.close
```

# Kudos and Contribors

Train is heavily based on the work of:

* [test-kitchen](https://github.com/test-kitchen/test-kitchen)  

  by <NAME>
	and [all contributors](https://github.com/test-kitchen/test-kitchen/graphs/contributors)  

* [ohai](https://github.com/chef/ohai)

  by <NAME>, Chef Software Inc.
	and [all contributors](https://github.com/chef/ohai/graphs/contributors)


## Contributing

	1. Fork it
	1. Create your feature branch (git checkout -b my-new-feature)
	1. Commit your changes (git commit -am 'Add some feature')
	1. Push to the branch (git push origin my-new-feature)
	1. Create new Pull Request


Copyright 2015 Chef Software Inc. All rights reserved.
Copyright 2015 Vulcano Security GmbH. All rights reserved.
Copyright 2015 <NAME>. All rights reserved.


{'fraction_non_alphanumeric': 0.1203585147247119, 'fraction_numerical': 0.014084507042253521, 'mean_word_length': 4.122950819672131, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1932716', 'n_tokens_mistral': 1080, 'n_tokens_neox': 984, 'n_words': 351}