Class: HustleAndFlow::Commands::Start

Inherits:
Object
  • Object
show all
Defined in:
lib/hustle_and_flow/commands/start.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io:, **args) ⇒ Start

Returns a new instance of Start.



11
12
13
14
# File 'lib/hustle_and_flow/commands/start.rb', line 11

def initialize(io:, **args)
  self.io         = io
  self.options    = args
end

Instance Attribute Details

#ioObject

Returns the value of attribute io.



8
9
10
# File 'lib/hustle_and_flow/commands/start.rb', line 8

def io
  @io
end

#optionsObject

Returns the value of attribute options.



8
9
10
# File 'lib/hustle_and_flow/commands/start.rb', line 8

def options
  @options
end

Instance Method Details

#callObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/hustle_and_flow/commands/start.rb', line 16

def call
  repo    = VersionControl.new(path: Dir.pwd)
  issue   = IssueTrackers::Commands::Start.call \
              io:              io,
              repo:            repo,
              me:              repo.user,
              options:         options
  _branch = VersionControls::Commands::Start.call \
              io:              io,
              repo:            repo,
              number:          issue.number,
              title:           issue.title,
              branch_template: issue.to_branch_name(version: '*****')
rescue Git::GitExecuteError => e
  io.say 'There was a problem running a git command.'
  io.say e.message
end