/
dump_package_definition_parsed.rb
65 lines (48 loc) · 1.39 KB
/
dump_package_definition_parsed.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
54
55
56
57
58
59
60
61
62
63
64
65
# coding: utf-8
require 'fig/command/action'
require 'fig/command/action/role/has_no_sub_action'
require 'fig/package_definition_text_assembler'
module Fig; end
class Fig::Command; end
module Fig::Command::Action; end
class Fig::Command::Action::DumpPackageDefinitionParsed
include Fig::Command::Action
include Fig::Command::Action::Role::HasNoSubAction
def options()
return %w<--dump-package-definition-parsed>
end
def descriptor_requirement()
return nil
end
def modifies_repository?()
return false
end
def load_base_package?()
return true
end
def register_base_package?()
return nil # don't care
end
def apply_config?()
return nil # don't care
end
def execute()
if @execution_context.synthetic_package_for_command_line
# Purposely syntactically incorrect so that nothing attempts to round
# trip this.
puts "---- synthetic package for command-line ----\n"
dump_package @execution_context.synthetic_package_for_command_line
puts "\n---- base package ----\n"
end
dump_package @execution_context.base_package
return EXIT_SUCCESS
end
private
def dump_package(package)
text_assembler = Fig::PackageDefinitionTextAssembler.new :emit_as_input
text_assembler.add_output package.statements
unparsed, * = text_assembler.assemble_package_definition
print unparsed
return
end
end