Class: VFS::Command::Framework

Inherits:
VFS::Command
  • Object
show all
Defined in:
lib/yaml-vfs/command/yaml_vfs_writer.rb

Overview

vfs yaml file gen cmd

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Framework

Returns a new instance of Framework.



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/yaml-vfs/command/yaml_vfs_writer.rb', line 22

def initialize(argv)
  super
  framework_path = argv.option('framework-path')
  @framework_path = Pathname(framework_path) unless framework_path.nil?
  real_headers_dir = argv.option('real-headers-dir')
  @real_header_dir = Pathname(real_headers_dir) unless real_headers_dir.nil?
  real_modules_dir = argv.option('real-modules-dir')
  @real_modules_dir = Pathname(real_modules_dir) unless real_modules_dir.nil?
  output_path = argv.option('output-path')
  @output_path = output_path.nil? ? Pathname('.') : Pathname(output_path)
end

Class Method Details

.optionsObject

help



42
43
44
45
46
47
48
49
# File 'lib/yaml-vfs/command/yaml_vfs_writer.rb', line 42

def self.options
  [
    ['--framework-path=<path>', 'framework path'],
    ['--real-headers-dir=<path>', 'real header path'],
    ['--real-modules-dir=<path>', 'real modules path'],
    ['--output-path=<path>', 'vfs yaml file output path']
  ].concat(super)
end

Instance Method Details

#runObject



51
52
53
54
55
56
# File 'lib/yaml-vfs/command/yaml_vfs_writer.rb', line 51

def run
  require 'yaml_vfs'

  entrys = VFS::FileCollectorEntry.entrys_from_framework_dir(@framework_path, @real_header_dir, @real_modules_dir)
  VFS::FileCollector.new(entrys).write_mapping(@output_path)
end

#validate!Object



34
35
36
37
38
39
# File 'lib/yaml-vfs/command/yaml_vfs_writer.rb', line 34

def validate!
  super
  help! 'must set framework_path' if @framework_path.nil?
  help! 'must set real_headers_dir' if @real_header_dir.nil?
  help! 'must set real_modules_dir' if @real_modules_dir.nil?
end