Class: Commonmeta::CLI
- Inherits:
-
Thor
- Object
- Thor
- Commonmeta::CLI
show all
- Includes:
- DoiUtils, Utils
- Defined in:
- lib/commonmeta/cli.rb
Constant Summary
Constants included
from Utils
Utils::BIB_TO_CM_TRANSLATIONS, Utils::CM_TO_BIB_TRANSLATIONS, Utils::CM_TO_CR_TRANSLATIONS, Utils::CM_TO_CSL_TRANSLATIONS, Utils::CM_TO_DC_TRANSLATIONS, Utils::CM_TO_JATS_TRANSLATIONS, Utils::CM_TO_RIS_TRANSLATIONS, Utils::CM_TO_SO_TRANSLATIONS, Utils::CR_TO_CM_TRANSLATIONS, Utils::CSL_TO_CM_TRANSLATIONS, Utils::DC_TO_CM_TRANSLATIONS, Utils::NORMALIZED_LICENSES, Utils::RIS_TO_CM_TRANSLATIONS, Utils::SO_TO_CM_TRANSLATIONS, Utils::UNKNOWN_INFORMATION
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Utils
#decode_container_id, #decode_doi, #encode_container_id, #encode_doi, #find_from_format, #find_from_format_by_ext, #find_from_format_by_filename, #find_from_format_by_id, #find_from_format_by_string, #from_csl, #from_datacite, #from_json_post, #from_schema_org, #get_contributor, #get_date, #get_date_from_date_parts, #get_date_from_parts, #get_date_parts, #get_date_parts_from_parts, #get_dates_from_date, #get_datetime_from_iso8601, #get_datetime_from_time, #get_identifier, #get_identifier_type, #get_iso8601_date, #get_link, #get_series_information, #get_year_month, #get_year_month_day, #github_as_cff_url, #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_issn, #normalize_licenses, #normalize_orcid, #normalize_url, #orcid_as_url, #orcid_from_url, #parse_attributes, #rogue_scholar_api_url, #sanitize, #spdx_to_hsh, #strip_milliseconds, #to_csl, #to_datacite, #to_identifier, #to_ris, #to_schema_org, #to_schema_org_citation, #to_schema_org_container, #to_schema_org_funder, #to_schema_org_identifiers, #to_schema_org_relation, #to_schema_org_spatial_coverage, #validate_orcid, #validate_orcid_scheme, #validate_url
Methods included from DoiUtils
#crossref_api_url, #datacite_api_url, #doi_as_url, #doi_from_url, #doi_resolver, #get_crossref_member, #get_doi_ra, #normalize_doi, #validate_doi, #validate_funder_doi, #validate_prefix
Class Method Details
.exit_on_failure? ⇒ Boolean
13
14
15
|
# File 'lib/commonmeta/cli.rb', line 13
def self.exit_on_failure?
true
end
|
Instance Method Details
#__print_version ⇒ Object
22
23
24
|
# File 'lib/commonmeta/cli.rb', line 22
def __print_version
puts Commonmeta::VERSION
end
|
#convert(input) ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/commonmeta/cli.rb', line 38
def convert(input)
metadata = Metadata.new(input: input,
from: options[:from],
regenerate: options[:regenerate],
style: options[:style],
locale: options[:locale],
show_errors: options[:show_errors],
doi: options[:doi],
depositor: options[:depositor],
email: options[:email],
registrant: options[:registrant])
to = options[:to] || 'schema_org'
if options[:show_errors] && !metadata.valid?
warn metadata.errors
else
puts metadata.send(to)
end
end
|
#decode(doi) ⇒ Object
72
73
74
|
# File 'lib/commonmeta/cli.rb', line 72
def decode(doi)
puts decode_doi(doi)
end
|
#decode_id(id) ⇒ Object
78
79
80
|
# File 'lib/commonmeta/cli.rb', line 78
def decode_id(id)
puts decode_container_id(id)
end
|
#encode(prefix) ⇒ Object
60
61
62
|
# File 'lib/commonmeta/cli.rb', line 60
def encode(prefix)
puts encode_doi(prefix)
end
|
#encode_id ⇒ Object
66
67
68
|
# File 'lib/commonmeta/cli.rb', line 66
def encode_id
puts encode_container_id
end
|