Module: TrainPlugins::Pwsh::Platform

Included in:
Connection
Defined in:
lib/train-pwsh/platform.rb

Overview

Since we’re mixing in the platform detection facility into Connection, this has to come in as a Module.

Instance Method Summary collapse

Instance Method Details

#platformObject

The method ‘platform` is called when platform detection is about to be performed. Train core defines a sophisticated system for platform detection, but for most plugins, you’ll only ever run on the special platform for which you are targeting.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/train-pwsh/platform.rb', line 14

def platform
  # If you are declaring a new platform, you will need to tell
  # Train a bit about it.
  # If you were defining a cloud API, you should say you are a member
  # of the cloud family.

  # This plugin makes up a new platform.  Train (or rather InSpec) only
  # know how to read files on Windows and Un*x (MacOS is a kind of Un*x),
  # so we'll say we're part of those families.
  Train::Platforms.name("pwsh").in_family("unix")
  Train::Platforms.name("pwsh").in_family("windows")

  # When you know you will only ever run on your dedicated platform
  # (for example, a plugin named train-aws would only run on the AWS
  # API, which we report as the 'aws' platform).
  # force_platform! lets you bypass platform detection.
  # The options to this are not currently documented completely.

  # Use release to report a version number.  You might use the version
  # of the plugin, or a version of an important underlying SDK, or a
  # version of a remote API.
  force_platform!("pwsh", release: Train::Pwsh::VERSION)
end