Class: VFS::Command::Target
- Inherits:
-
VFS::Command
- Object
- CLAide::Command
- VFS::Command
- VFS::Command::Target
- Defined in:
- lib/yaml-vfs/command/yaml_vfs_writer.rb
Class Method Summary collapse
-
.options ⇒ Object
help.
Instance Method Summary collapse
-
#initialize(argv) ⇒ Target
constructor
A new instance of Target.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Target
Returns a new instance of Target.
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/yaml-vfs/command/yaml_vfs_writer.rb', line 74 def initialize(argv) super target_path = argv.option('target-path') @target_path = Pathname(target_path) unless target_path.nil? public_headers_dir = argv.option('public-headers-dir') @public_headers_dir = Pathname(public_headers_dir) unless public_headers_dir.nil? private_headers_dir = argv.option('private-headers-dir') @private_headers_dir = Pathname(private_headers_dir) unless private_headers_dir.nil? output_path = argv.option('output-path') @output_path = output_path.nil? ? Pathname('.') : Pathname(output_path) end |
Class Method Details
.options ⇒ Object
help
95 96 97 98 99 100 101 102 |
# File 'lib/yaml-vfs/command/yaml_vfs_writer.rb', line 95 def self. [ ['--target-pathh=<path>', 'target path'], ['--public-headers-dir=<path>', 'real public headers path'], ['--private-headers-dir=<path>', 'real private headers path'], ['--output-path=<path>', 'vfs yaml file output path'] ].concat(super) end |
Instance Method Details
#run ⇒ Object
104 105 106 107 108 109 |
# File 'lib/yaml-vfs/command/yaml_vfs_writer.rb', line 104 def run require 'yaml_vfs' entrys = VFS::FileCollectorEntry.entrys_from_target_dir(@target_path, @public_headers_dir, @private_headers_dir) VFS::FileCollector.new(entrys).write_mapping(@output_path) end |
#validate! ⇒ Object
87 88 89 90 91 92 |
# File 'lib/yaml-vfs/command/yaml_vfs_writer.rb', line 87 def validate! super help! 'must set --target-path' if @target_path.nil? help! 'must set --public-headers-dir' if @public_headers_dir.nil? help! 'must set --private-headers-dir' if @private_headers_dir.nil? end |