20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/mm/console/card_resource_command.rb', line 20
def execute(runtime)
case
when @command =~ /^transitions$/
runtime[:list] = MM::Console::SelectingList.new(@card_resource.transitions(runtime), MM::Console::CardTransition)
when @command =~ /^properties$/
(runtime[:api].property_definitions || []).inject({}) do |map, prop|
if value = CardResourceCommand.new(prop.column_name, @card_resource).execute(runtime)
map[prop.name.to_sym] = value
end
map
end.to_yaml
when @card_resource.respond_to?(@command)
@card_resource.send(@command)
when prop = find_property_definition(runtime, @command)
value = @card_resource.send(prop.column_name)
case prop.data_type
when 'user'
if member = runtime[:api].team_members.detect{|m| m.id == value}
value = member.name
end
when 'card'
if card = runtime[:api].find_card_by_number(value)
value = card.name
end
end
value
when runtime[@command.to_sym]
NoResourceCommand.new(@command).execute(runtime)
when @card_resource.transitions(runtime).any?{|t| t.to_s.downcase == @command.to_s.downcase}
Transition.new(:command => @command, :card_number => @card_resource.number).execute(runtime)
else
SystemCmd.execute_as_cmd(runtime, @command)
end
end
|