Class: AppCommand::JiraCard

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

Instance Method Summary collapse

Instance Method Details

#executeObject



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

def execute

    @opts = command_options
    @args = arguments
    @jira = App::Jira.new

    opts_validate
    opts_routing

end

#get_card_infoObject



43
44
45
46
47
48
# File 'lib/routes/jira.rb', line 43

def get_card_info

    jira_number = @jira.get_jira_number_from_arg(@args[0])
    puts jira_number

end

#opts_routingObject



35
36
37
38
39
40
41
# File 'lib/routes/jira.rb', line 35

def opts_routing

    if @opts[:card]
        get_card_info
    end

end

#opts_validateObject



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

def opts_validate

    if @opts[:card] == false
        if @args.any?
            @opts[:card] = true
        else
            system('bp j -h')
        end
        exit
    end

    if @opts[:card]
        if @args[0].nil? || @args[0] == ''
            App::Terminal::error('Argument required', 'You must supply a valid Jira Number as an argument.', true)
        end
    end

end