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



81
82
83
84
85
86
87
# File 'lib/archimate/cli/archi.rb', line 81

def clean(archifile)
  Config.instance.interactive = !options.fetch("noninteractive", false)
  outfile = options.key?(:output) ? options[:output] : archifile
  Archimate::MaybeIO.new(options.fetch(:saveremoved, nil)) do |removed_element_io|
    Archimate::Cli::Cleanup.new(Archimate.read(archifile), outfile, removed_element_io)
  end
end

#convert(archifile) ⇒ Object



154
155
156
157
158
159
160
161
162
163
164
# File 'lib/archimate/cli/archi.rb', line 154

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



116
117
118
119
120
121
122
123
124
125
126
# File 'lib/archimate/cli/archi.rb', line 116

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

#dupes(archifile) ⇒ Object



90
91
92
93
94
95
# File 'lib/archimate/cli/archi.rb', line 90

def dupes(archifile)
  Archimate::Cli::Duper.new(
    archimate.read(archifile),
    STDOUT
  ).list
end

#lint(archifile) ⇒ Object



170
171
172
173
174
175
176
177
178
179
# File 'lib/archimate/cli/archi.rb', line 170

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



61
62
63
64
65
66
67
# File 'lib/archimate/cli/archi.rb', line 61

def svg(archifile)
  Config.instance.interactive = !options.fetch("noninteractive", false)
  Archimate::Cli::Svger.export_svgs(
    archifile,
    options.fetch("output", Dir.pwd)
  )
end