Class: Hanami::CLI::Files Private

Inherits:
Dry::Files
  • Object
show all
Defined in:
lib/hanami/cli/files.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.

Since:

  • 2.0.0

Instance Method Summary collapse

Constructor Details

#initialize(out: $stdout, **args) ⇒ Files

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.

Returns a new instance of Files.

Since:

  • 2.0.0



12
13
14
15
# File 'lib/hanami/cli/files.rb', line 12

def initialize(out: $stdout, **args)
  super(**args)
  @out = out
end

Instance Method Details

#chdir(path, &blk) ⇒ Object

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.

Since:

  • 2.0.0



44
45
46
47
# File 'lib/hanami/cli/files.rb', line 44

def chdir(path, &blk)
  within_folder(path)
  super
end

#mkdir(path) ⇒ Object

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.

Since:

  • 2.0.0



35
36
37
38
39
40
# File 'lib/hanami/cli/files.rb', line 35

def mkdir(path)
  unless exist?(path)
    super
    created(_path(path))
  end
end

#write(path, *content) ⇒ Object

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.

Since:

  • 2.0.0



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/hanami/cli/files.rb', line 19

def write(path, *content)
  already_exists = exist?(path)

  super

  delete_keepfiles(path) unless already_exists

  if already_exists
    updated(path)
  else
    created(path)
  end
end