class Speedflow::Plugin::Git::Plugin

Plugin core

Attributes

client[W]

@return [Client] Plugin client.

prompt[W]

@return [Prompt] Plugin prompt.

Public Class Methods

new(config, _) click to toggle source

Public: Constructor

config - Speedflow::Plugin::Configuration object. prompt - Speedflow::Plugin::Prompt object.

Examples

Manager.new(
  <Speedflow::Plugin::Configuration.new({})>,
  <Speedflow::Plugin::Prompt.new>)
# => <Speedflow::Plugin::Abstract>

Returns nothing.

Calls superclass method
# File lib/speedflow/plugin/git/plugin.rb, line 25
def initialize(config, _)
  super(config, Prompt.new)
end

Public Instance Methods

action_create_branch() click to toggle source

Public: Create branch.

Returns Hash of branch.

# File lib/speedflow/plugin/git/plugin.rb, line 32
def action_create_branch
  branch = config.by_input('branch')
  branch = prompt.ask_branch if branch.empty?

  branch_from = config.by_input('branch_from')
  branch_from = action_search_branch['branch'] if branch_from.empty?

  client.create_branch(branch, branch_from)

  prompt.ok '[GIT] Branch successful created: ' \
            "'#{branch}' from '#{branch_from}'."

  { 'branch' => branch, 'branch_from' => branch_from }
end
action_search_branch() click to toggle source

Public: Search branch.

Returns Hash of branch.

# File lib/speedflow/plugin/git/plugin.rb, line 50
def action_search_branch
  branch = prompt.branch(client.branches(prompt.branch_type))
  action_search_branch if branch == :retry

  { 'branch' => branch }
end
client() click to toggle source

Public: Plugin client.

Returns Client instance.

# File lib/speedflow/plugin/git/plugin.rb, line 60
def client
  @client ||= Client.new(@config, @prompt)
end
prompt() click to toggle source

Public: Plugin prompt.

Returns Prompt instance.

# File lib/speedflow/plugin/git/plugin.rb, line 67
def prompt
  @prompt ||= Prompt.new
end