Class: Bolognese::CLI

Inherits:
Thor
  • Object
show all
Includes:
DoiUtils, Utils
Defined in:
lib/bolognese/cli.rb

Constant Summary

Constants included from Utils

Utils::BIB_TO_CR_TRANSLATIONS, Utils::BIB_TO_DC_TRANSLATIONS, Utils::CP_TO_DC_TRANSLATIONS, Utils::CR_TO_BIB_TRANSLATIONS, Utils::CR_TO_CP_TRANSLATIONS, Utils::CR_TO_DC_TRANSLATIONS, Utils::CR_TO_JATS_TRANSLATIONS, Utils::CR_TO_RIS_TRANSLATIONS, Utils::CR_TO_SO_TRANSLATIONS, Utils::DC_TO_CP_TRANSLATIONS, Utils::DC_TO_RIS_TRANSLATIONS, Utils::DC_TO_SO_TRANSLATIONS, Utils::NORMALIZED_LICENSES, Utils::RESOURCE_PATHS, Utils::RIS_TO_DC_TRANSLATIONS, Utils::SO_TO_BIB_TRANSLATIONS, Utils::SO_TO_CP_TRANSLATIONS, Utils::SO_TO_DC_TRANSLATIONS, Utils::SO_TO_JATS_TRANSLATIONS, Utils::SO_TO_RIS_TRANSLATIONS, Utils::UNKNOWN_INFORMATION

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils

#dfg_ids_to_fos, #find_from_format, #find_from_format_by_ext, #find_from_format_by_filename, #find_from_format_by_id, #find_from_format_by_string, #from_citeproc, #from_datacite_json, #from_schema_org, #from_schema_org_contributors, #from_schema_org_creators, #get_contributor, #get_date, #get_date_from_date_parts, #get_date_from_parts, #get_date_parts, #get_date_parts_from_parts, #get_datetime_from_iso8601, #get_datetime_from_time, #get_identifier, #get_identifier_type, #get_iso8601_date, #get_series_information, #get_year_month, #get_year_month_day, #github_as_codemeta_url, #github_as_owner_url, #github_as_release_url, #github_as_repo_url, #github_from_url, #github_owner_from_url, #github_release_from_url, #github_repo_from_url, #hsh_to_fos, #hsh_to_spdx, #jsonlint, #map_hash_keys, #name_to_fos, #name_to_spdx, #normalize_cc_url, #normalize_id, #normalize_ids, #normalize_issn, #normalize_licenses, #normalize_orcid, #normalize_ror, #normalize_url, #orcid_as_url, #orcid_from_url, #parse_attributes, #resource_file, #resource_json, #resources_dir_path, #sanitize, #to_citeproc, #to_datacite_json, #to_identifier, #to_ris, #to_schema_org, #to_schema_org_container, #to_schema_org_contributors, #to_schema_org_creators, #to_schema_org_funder, #to_schema_org_identifiers, #to_schema_org_relation, #to_schema_org_spatial_coverage, #validate_orcid, #validate_orcid_scheme, #validate_ror, #validate_url

Methods included from DoiUtils

#doi_api_url, #doi_as_url, #doi_from_url, #doi_resolver, #get_doi_ra, #normalize_doi, #validate_doi, #validate_funder_doi, #validate_prefix

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/bolognese/cli.rb', line 14

def self.exit_on_failure?
  true
end

Instance Method Details

#__print_versionObject



22
23
24
# File 'lib/bolognese/cli.rb', line 22

def __print_version
  puts Bolognese::VERSION
end

#convert(input) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/bolognese/cli.rb', line 33

def convert(input)
   = Metadata.new(input: input,
                          from: options[:from],
                          regenerate: options[:regenerate],
                          style: options[:style],
                          locale: options[:locale],
                          show_errors: options[:show_errors])
  to = options[:to] || "schema_org"

  if options[:show_errors] && !.valid?
    $stderr.puts .errors
  else
    puts .send(to)
  end
end