Class: YARD::CLI::I18n
- Inherits:
-
Yardoc
- Object
- Command
- YardoptsCommand
- Yardoc
- YARD::CLI::I18n
- Defined in:
- lib/yard/cli/i18n.rb
Overview
Support msgminit and msgmerge features?
CLI command to support internationalization (a.k.a. i18n). I18n feature is based on gettext technology. This command generates .pot file from docstring and extra documentation.
Constant Summary
Instance Attribute Summary collapse
-
#apis ⇒ Array<String>
inherited
from Yardoc
Keep track of which APIs are to be shown.
-
#assets ⇒ Array<String>
inherited
from Yardoc
A list of assets to copy after generation.
-
#excluded ⇒ Array<String>
inherited
from Yardoc
List of excluded paths (regexp matches).
-
#files ⇒ Array<String>
inherited
from Yardoc
List of Ruby source files to process.
-
#generate ⇒ Boolean
inherited
from Yardoc
Whether to generate output.
-
#has_markup ⇒ Boolean
inherited
from Yardoc
Whether markup option was specified.
-
#hidden_apis ⇒ Array<String>
inherited
from Yardoc
Keep track of which APIs are to be hidden.
-
#hidden_tags ⇒ Array<Symbol>
inherited
from Yardoc
A list of tags to hide from templates.
-
#list ⇒ Boolean
inherited
from Yardoc
Whether to print a list of objects.
-
#options ⇒ Hash
inherited
from Yardoc
readonly
The hash of options passed to the template.
-
#options_file ⇒ String
inherited
from YardoptsCommand
The options file name (defaults to YardoptsCommand::DEFAULT_YARDOPTS_FILE).
-
#save_yardoc ⇒ Boolean
inherited
from Yardoc
Whether objects should be serialized to .yardoc db.
-
#statistics ⇒ Boolean
inherited
from Yardoc
Whether to print statistics after parsing.
-
#use_cache ⇒ Boolean
inherited
from Yardoc
Whether to use the existing yardoc db if the .yardoc already exists.
-
#use_document_file ⇒ Boolean
inherited
from YardoptsCommand
Whether to parse options from .document.
-
#use_yardopts_file ⇒ Boolean
inherited
from YardoptsCommand
Whether to parse options from .yardopts.
-
#visibilities ⇒ Array<Symbol>
inherited
from Yardoc
Keep track of which visibilities are to be shown.
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize ⇒ I18n
constructor
A new instance of I18n.
- #run(*args) ⇒ Object
Constructor Details
#initialize ⇒ I18n
Returns a new instance of I18n
13 14 15 16 |
# File 'lib/yard/cli/i18n.rb', line 13 def initialize super @options.serializer.basepath = "po/yard.pot" end |
Instance Attribute Details
#assets ⇒ Array<String> Originally defined in class Yardoc
Returns a list of assets to copy after generation
#excluded ⇒ Array<String> Originally defined in class Yardoc
Returns list of excluded paths (regexp matches)
#files ⇒ Array<String> Originally defined in class Yardoc
Returns list of Ruby source files to process
#generate ⇒ Boolean Originally defined in class Yardoc
Returns whether to generate output
#has_markup ⇒ Boolean Originally defined in class Yardoc
Returns whether markup option was specified
#hidden_apis ⇒ Array<String> Originally defined in class Yardoc
Keep track of which APIs are to be hidden
#hidden_tags ⇒ Array<Symbol> Originally defined in class Yardoc
Returns a list of tags to hide from templates
#list ⇒ Boolean Originally defined in class Yardoc
Returns whether to print a list of objects
#options ⇒ Hash (readonly) Originally defined in class Yardoc
Returns the hash of options passed to the template.
#options_file ⇒ String Originally defined in class YardoptsCommand
The options file name (defaults to DEFAULT_YARDOPTS_FILE)
#save_yardoc ⇒ Boolean Originally defined in class Yardoc
Returns whether objects should be serialized to .yardoc db
#statistics ⇒ Boolean Originally defined in class Yardoc
Returns whether to print statistics after parsing
#use_cache ⇒ Boolean Originally defined in class Yardoc
Returns whether to use the existing yardoc db if the .yardoc already exists. Also makes use of file checksums to parse only changed files.
#use_document_file ⇒ Boolean Originally defined in class YardoptsCommand
Returns whether to parse options from .document
#use_yardopts_file ⇒ Boolean Originally defined in class YardoptsCommand
Returns whether to parse options from .yardopts
Instance Method Details
#description ⇒ Object
18 19 20 |
# File 'lib/yard/cli/i18n.rb', line 18 def description 'Generates .pot file from source code and extra documentation' end |
#run(*args) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/yard/cli/i18n.rb', line 22 def run(*args) if args.size == 0 || !args.first.nil? # fail early if arguments are not valid return unless parse_arguments(*args) end YARD.parse(files, excluded) serializer = .serializer pot_file_path = Pathname.new(serializer.basepath). pot_file_dir_path, pot_file_basename = pot_file_path.split relative_base_path = Pathname.pwd.relative_path_from(pot_file_dir_path) serializer.basepath = pot_file_dir_path.to_s serializer.serialize(pot_file_basename.to_s, generate_pot(relative_base_path.to_s)) true end |