docs/learn/05-use.md in teuton-2.4.1 vs docs/learn/05-use.md in teuton-2.4.2

- old
+ new

@@ -1,81 +1,61 @@ [<< back](README.md) -# Example: 05-use +# use -Learn how to: -* Organize huge amount of groups/targets into several files. -* Checking Windows OS infrastructure (host1). +`use` keyword allow us organize huge amount of groups/targets into several files. -1. [Tree directory](#tree-directory) -2. [Execution section](#execution-section) -3. [Users file](#users-file) -4. [Network file](#network-file) +## Example -## Tree directory +> This example requires Windows OS on remote machine. -This example has more files: - ```bash -> tree example/04-use - -example/04-require +❯ tree examples/05-use +examples/05-use +├── lib +│   ├── network.rb +│   └── users.rb ├── config.yaml -├── network.rb -├── README.md -├── start.rb -└── users.rb +└── start.rb ``` -## Execution section +* `start.rb` file is now splited into: `start.rb`, `users.rb` and `network.rb`. -Previous `start.rb` file is now splited in: start.rb, users.rb and network.rb. - -Let's see current `start.rb` file: - ```ruby -use 'users' +# File: start.rb +use 'lib/users' use 'network' play do show export end ``` -* `use`, indicates external rb file that will be included/imported into main rb file. It's a good idea to organize project files, when the number of groups/targets is high. +* `use`, indicates that we require external file, that will be imported into our start.rb file. +* Notice that you can specify relative route `use 'lib/users'`, or only filename `use 'network'`. In the second case, teuton will search a file with that name into project folders. -## Users file +> It's a good idea to organize project files, when the number of groups/targets is high. -> Require Windows OS on remote machine. - -Let's see `users.rb` file - ```ruby -group "Use file: User configuration" do +# File: users.rb - target "Create user #{gett(:username)}" +group "Using file: users" do + target "Create user #{get(:username)}" run "net user", on: :host1 expect get(:username) - end ``` -## Network file - -> Require Windows OS on remote machine. - -Let's see `network.rb` file: - ```ruby -group "Use file: Network configuracion" do +# File: network.rb - target "Update computer name with #{gett(:host1_hostname)}" +group "Using file: network" do + target "Update computer name with #{get(:hostname)}" run "hostname", on: :host1 - expect_one get(:host1_hostname) + expect_one get(:hostname) target "Ensure DNS Server is working" - run "nslookup www.google.es", on: :host1 - expect "Nombre:" - + run "host www.google.es", on: :host1 + expect "www.google.es has address " end ```