module TrainPlugins::AliCloud::Platform

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

Public Instance Methods

platform() click to toggle source

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.

# File lib/train-alicloud/platform.rb, line 16
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 defines a new platform.
  Train::Platforms.name("alicloud").in_family("cloud")

  # When you know you will only ever run on your dedicated 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.
  alicloud_version = Gem.loaded_specs["aliyunsdkcore"].version
  alicloud_version = "aliyunsdkcore: v#{alicloud_version}"
  plugin_version = "train-alicloud: v#{TrainPlugins::AliCloud::VERSION}"

  force_platform!("alicloud", release: "#{plugin_version}, #{alicloud_version}")
end