class Objc2swiftAssistant::FileSet

Attributes

configuration[RW]
directory_nodes_by_path[RW]
root[RW]
root_dir_node[RW]

Public Class Methods

new( root, configuration ) click to toggle source
Calls superclass method
# File lib/objc2swift_assistant/file_sets.rb, line 22
def initialize( root, configuration )
  super()
  @configuration = configuration
  @root = Pathname.new( root )
  @directory_nodes_by_path = {}
end

Public Instance Methods

directory_node_for_path( path ) click to toggle source
# File lib/objc2swift_assistant/file_sets.rb, line 29
def directory_node_for_path( path )
  node = @directory_nodes_by_path[ path.to_s ]

  if node.nil?
    node = make_directory_node( path )
    @directory_nodes_by_path[ path.to_s ] = node
  end

  return node
end
dump( indent, tab, errors_only ) click to toggle source
# File lib/objc2swift_assistant/file_sets.rb, line 45
def dump( indent, tab, errors_only )
  if errors_only
    puts( "\nWARNING: You specified '--structure errors'")
    puts( "         This option (Logging only only the file structure that caused errors) is not yet supported. The full source file structure will be logged.\n\n" )
  end

  @configuration.log_verbose( indent + "File Set")
  @root_dir_node.dump( indent+tab, tab, errors_only )
end
make_directory_node( path ) click to toggle source
# File lib/objc2swift_assistant/file_sets.rb, line 40
def make_directory_node( path )
  node = DirectoryNode.new( path, self )
  node
end
scan() click to toggle source

Create nodes for all directories and files of interest Use find() to limit stack depth

# File lib/objc2swift_assistant/file_sets.rb, line 57
def scan()
  @root.find() do |path|
    if path.directory?
      process_directory( path )
    else
      process_file( path )
    end
  end

  @configuration.log_verbose( "Processed #{@directory_nodes_by_path.size} directories.")

  collect_active_file_nodes()
end