Class: Fastlane::Actions::SlackTrainAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::SlackTrainAction
- Defined in:
- lib/fastlane/plugin/slack_train/actions/slack_train_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
31 32 33 |
# File 'lib/fastlane/plugin/slack_train/actions/slack_train_action.rb', line 31 def self. ["@KrauseFx"] end |
.available_options ⇒ Object
39 40 41 |
# File 'lib/fastlane/plugin/slack_train/actions/slack_train_action.rb', line 39 def self. [] end |
.description ⇒ Object
27 28 29 |
# File 'lib/fastlane/plugin/slack_train/actions/slack_train_action.rb', line 27 def self.description "Show a train of the fastlane progress" end |
.is_supported?(platform) ⇒ Boolean
43 44 45 |
# File 'lib/fastlane/plugin/slack_train/actions/slack_train_action.rb', line 43 def self.is_supported?(platform) true end |
.return_value ⇒ Object
35 36 37 |
# File 'lib/fastlane/plugin/slack_train/actions/slack_train_action.rb', line 35 def self.return_value "A string that is being sent to slack" end |
.run(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fastlane/plugin/slack_train/actions/slack_train_action.rb', line 4 def self.run(params) train_emoji = lane_context[SharedValues::SLACK_TRAIN_EMOJI] rail_emoji = lane_context[SharedValues::SLACK_TRAIN_RAIL] total_distance = lane_context[SharedValues::SLACK_TRAIN_DISTANCE] current_position = lane_context[SharedValues::SLACK_TRAIN_CURRENT_TRAIN_POSITION] speed = lane_context[SharedValues::SLACK_TRAIN_DIRECTION] return if total_distance.nil? # train hasn't started yet UI.user_error!("train drove too far") if current_position < 0 UI.user_error!("train drove too far") if total_distance == current_position before = rail_emoji * current_position after = rail_emoji * (total_distance - current_position - 1) lane_name = lane_context[SharedValues::LANE_NAME] = ["`#{lane_name}` ", before, train_emoji, after].join("") other_action.slack(message: , default_payloads: []) UI.() lane_context[SharedValues::SLACK_TRAIN_CURRENT_TRAIN_POSITION] += speed end |