Class: Archimate::Cli::Archi

Inherits:
Thor
  • Object
show all
Defined in:
lib/archimate/cli/archi.rb

Instance Method Summary collapse

Instance Method Details

#clean(archifile) ⇒ Object



103
104
105
106
107
108
109
110
111
112
113
# File 'lib/archimate/cli/archi.rb', line 103

def clean(archifile)
  Config.instance.interactive = !options.fetch("noninteractive", false)
  output_io = Cli.output_io(
    options.fetch("output", archifile),
    options.fetch("force", false)
  )
  Archimate::MaybeIO.new(options.fetch(:saveremoved, nil)) do |removed_element_io|
    Archimate::Cli::Cleanup.new(Archimate.read(archifile), output_io, removed_element_io).clean
  end
  output_io.close
end

#convert(archifile) ⇒ Object



185
186
187
188
189
190
191
192
193
194
195
# File 'lib/archimate/cli/archi.rb', line 185

def convert(archifile)
  output_dir = options.fetch("outputdir", Dir.pwd)
  output_io = Cli.output_io(
    options.fetch("output", $stdout),
    options.fetch("force", false)
  )
  Config.instance.interactive = !options.fetch("noninteractive", false)
  Archimate::Cli::Convert.new(
    Archimate.read(archifile)
  ).convert(options[:to], output_io, output_dir)
end

#dedupe(archifile) ⇒ Object



142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/archimate/cli/archi.rb', line 142

def dedupe(archifile)
  Config.instance.interactive = !options.fetch("noninteractive", false)
  output_io = Cli.output_io(
    options.fetch("output", archifile),
    options[:force]
  )
  Archimate::Cli::Duper.new(
    Archimate.read(archifile),
    output_io,
    options[:mergeall]
  ).merge
  output_io.close
end

#dupes(archifile) ⇒ Object



116
117
118
119
120
121
# File 'lib/archimate/cli/archi.rb', line 116

def dupes(archifile)
  Archimate::Cli::Duper.new(
    Archimate.read(archifile),
    $stdout
  ).list
end

#lint(archifile) ⇒ Object



201
202
203
204
205
206
207
208
209
210
# File 'lib/archimate/cli/archi.rb', line 201

def lint(archifile)
  output_io = Cli.output_io(
    options.fetch("output", $stdout),
    options.fetch("force", false)
  )
  Archimate::Cli::Lint.new(
    Archimate.read(archifile),
    output_io
  ).lint
end

#map(archifile) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/archimate/cli/archi.rb', line 43

def map(archifile)
  Config.instance.interactive = !options.fetch("noninteractive", false)
  Archimate::Cli::Mapper.new(
    Archimate.read(archifile),
    Cli.output_io(options.fetch("output", $stdout), false)
  ).map
end

#stats(archifile) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/archimate/cli/archi.rb', line 26

def stats(archifile)
  Config.instance.interactive = !options.fetch("noninteractive", false)
  Archimate::Cli::Stats.new(
    Archimate.read(archifile),
    $stdout
  ).statistics
end

#svg(archifile) ⇒ Object



75
76
77
78
79
80
81
82
83
84
# File 'lib/archimate/cli/archi.rb', line 75

def svg(archifile)
  Config.instance.interactive = !options.fetch("noninteractive", false)
  Archimate::Cli::Svger.export_svgs(
    archifile,
    options.fetch("output", Dir.pwd),
    svg_name: options["name"] ? :name : :id,
    legend: options["legend"],
    format_xml: options["format_xml"]
  )
end