Class: Hexx::CLI::Base::File Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hexx/cli/base/file.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Copies a file from a source path to the target folder

  • Files, that have '.erb' extension, are pre-processed as erb templates.
  • The starting "_" symbol is removed from a file name.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.initialize(scaffolder, source, target, options = {}) ⇒ Hexx::Processors::File

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Constructs the processor for given scaffolder, source and target paths

Parameters:

  • scaffolder (Thor::Actions)

    the decorated scaffolder

  • source (Pathname)

    the source folder path to take file from

  • target (Pathname)

    the target folder path to copy file to

  • options (Hash) (defaults to: {})

    the list of options to copy file

Returns:

  • (Hexx::Processors::File)


33
34
35
36
37
38
# File 'lib/hexx/cli/base/file.rb', line 33

def initialize(scaffolder, source, target, options = {})
  @__scaffolder__ = scaffolder
  @source  = source
  @target  = target
  @options = options
end

Instance Method Details

#copy(source_file) ⇒ self

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Makes a copy of given source file

Parameters:

  • source_file (Pathname)

Returns:

  • (self)

    itself



45
46
47
48
49
50
# File 'lib/hexx/cli/base/file.rb', line 45

def copy(source_file)
  @source_file = source_file
  __scaffolder__.send(copy_method, source_path, target_path, options)

  self
end

#new(scaffolder, source, target, options = {}) ⇒ Hexx::Processors::File

Constructs the processor for given scaffolder, source and target paths

Parameters:

  • scaffolder (Thor::Actions)

    the decorated scaffolder

  • source (Pathname)

    the source folder path to take file from

  • target (Pathname)

    the target folder path to copy file to

  • options (Hash) (defaults to: {})

    the list of options to copy file

Returns:

  • (Hexx::Processors::File)


33
34
35
36
37
38
# File 'lib/hexx/cli/base/file.rb', line 33

def initialize(scaffolder, source, target, options = {})
  @__scaffolder__ = scaffolder
  @source  = source
  @target  = target
  @options = options
end