Module: Spaceship::Slack2fa

Defined in:
lib/spaceship/slack2fa.rb,
lib/spaceship/slack2fa/version.rb,
lib/spaceship/slack2fa/monkey_patch.rb,
lib/spaceship/slack2fa/verification_code_not_found.rb

Overview

A module for applying a monkey patch to Spaceship::Client in the specific scope.

Examples:

Simple Fastfile

require "spaceship/slack2fa"

ENV["FASTLANE_USER"] = "user@example.com"
ENV["FASTLANE_PASSWORD"] = "password"
ENV["SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER"] = "+81 80-XXXX-XXXX"

lane :login do
  Spaceship::Slack2fa.enable(
    slack_api_token: "xoxb-0000000000-0000000000000-XXXXXXXXXXXXXXXXXXXXXXXX",
    channel_id: "CXXXXXXXX",
    user_id: "UXXXXXXXX",
    referrer: "My app"
  ) do
    Spaceship::TunesClient.
  end
end

Practical Fastfile

require "spaceship/slack2fa"

ENV["FASTLANE_USER"] = "user@example.com"
ENV["FASTLANE_PASSWORD"] = "password"
ENV["SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER"] = "+81 80-XXXX-XXXX"

lane :release do
  enable_slack2fa do
    deliver
  end
end

lane :beta do
  enable_slack2fa do
    pilot
  end
end

def enable_slack2fa(&block)
  Spaceship::Slack2fa.enable(
    slack_api_token: "xoxb-0000000000-0000000000000-XXXXXXXXXXXXXXXXXXXXXXXX",
    channel_id: "CXXXXXXXX",
    user_id: "UXXXXXXXX",
    referrer: "My app",
    &block
  )
end

Defined Under Namespace

Classes: MonkeyPatch, VerificationCodeNotFound

Constant Summary collapse

VERSION =
'0.4.1'

Class Method Summary collapse

Class Method Details

.enable(**options) { ... } ⇒ Object

Applies monkey patch to Spaceship::Client so that it retrieves 6-digit code from Slack.

The monkey patch is only enabled in the given block scope.

Parameters:

Yields:

  • A block where the monkey patch is enabled.



64
65
66
67
68
69
70
71
72
# File 'lib/spaceship/slack2fa.rb', line 64

def self.enable(**options)
  patch = MonkeyPatch.new(**options)
  patch.enable
  begin
    yield
  ensure
    patch.disable
  end
end