Class: AppCommand::Review

Inherits:
Convoy::ActionCommand::Base
  • Object
show all
Defined in:
lib/routes/review.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



5
6
7
8
9
10
11
12
13
# File 'lib/routes/review.rb', line 5

def execute

    @opts = command_options
    @args = arguments
    @git = App::Git.new
    opts_validate
    opts_routing

end

#opts_routingObject



25
26
27
28
29
# File 'lib/routes/review.rb', line 25

def opts_routing

    review

end

#opts_validateObject



15
16
17
18
19
20
21
22
23
# File 'lib/routes/review.rb', line 15

def opts_validate

    unless @args.any?
        
        App::Terminal::error('Must specify a valid branch name', nil, true)
        
    end

end

#reviewObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/routes/review.rb', line 31

def review

    current_branch = @git.current_branch_for_repo(App::Config.param(App::Config::WORKSTATION_PATH_TO_BP_CODE))

    if @args[0] =~ /\A\d{4,5}\z/i
        branch_to_review = @git.resolve_branch_for_jira(@args[0])
    else
        branch_to_review = @args[0]
    end

    @git.check_branch_exists_somewhere(branch_to_review)

    system("BR=#{branch_to_review} && bp g co -u ${BR} && bp g d -l ${BR} && bp g co #{current_branch}")

end