Class: Iev::Cli::Command
- Inherits:
-
Thor
- Object
- Thor
- Iev::Cli::Command
show all
- Includes:
- CommandHelper
- Defined in:
- lib/iev/cli/command.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Ui
debug, info, progress, set_ui_tag, warn
Class Method Details
.exit_on_failure? ⇒ Boolean
150
151
152
|
# File 'lib/iev/cli/command.rb', line 150
def self.exit_on_failure?
true
end
|
Instance Method Details
#db2yaml(dbfile) ⇒ Object
102
103
104
105
106
107
108
109
110
111
112
113
|
# File 'lib/iev/cli/command.rb', line 102
def db2yaml(dbfile)
handle_generic_options(options)
Iev::Exporter.new(
dbfile,
output_dir: options[:output],
only_concepts: options[:only_concepts],
only_languages: options[:only_languages],
).export
summary
end
|
#export(file) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/iev/cli/command.rb', line 39
def export(file)
handle_generic_options(options)
Iev::Exporter.new(
file,
output_dir: options[:output],
only_concepts: options[:only_concepts],
only_languages: options[:only_languages],
fetch_relaton_links: options[:relaton],
).export
info "Done!"
end
|
#fetch(code) ⇒ Object
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
# File 'lib/iev/cli/command.rb', line 134
def fetch(code)
raw = if options[:scrape]
Scraper.new.fetch_concept(code)
else
DataSource.fetch_concept(code)
end
unless raw
warn "IEV: concept #{code} not found."
exit 1
end
concept = build_concept_from_raw(code, raw)
print_concept_grouped_yaml(concept)
end
|
#xlsx2db(file) ⇒ Object
123
124
125
126
127
128
129
|
# File 'lib/iev/cli/command.rb', line 123
def xlsx2db(file)
handle_generic_options(options)
db = Sequel.sqlite
DbWriter.new(db).import_spreadsheet(file)
save_db_to_file(db, options[:output])
summary
end
|
#xlsx2yaml(file) ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/iev/cli/command.rb', line 71
def xlsx2yaml(file)
handle_generic_options(options)
Iev::Exporter.new(
file,
output_dir: options[:output],
only_concepts: options[:only_concepts],
only_languages: options[:only_languages],
).export
summary
end
|