Class: Hanami::CLI::Files Private
- Inherits:
-
Dry::Files
- Object
- Dry::Files
- Hanami::CLI::Files
- 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.
Instance Method Summary collapse
- #chdir(path, &blk) ⇒ Object private
- #create(path, *content) ⇒ Object private
-
#initialize(out: $stdout, **args) ⇒ Files
constructor
private
A new instance of Files.
- #mkdir(path) ⇒ Object private
- #touch(path) ⇒ Object private
- #write(path, *content) ⇒ Object private
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.
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.
51 52 53 54 |
# File 'lib/hanami/cli/files.rb', line 51 def chdir(path, &blk) within_folder(path) super end |
#create(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.
18 19 20 21 22 |
# File 'lib/hanami/cli/files.rb', line 18 def create(path, *content) raise FileAlreadyExistsError.new(path) if exist?(path) write(path, *content) 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.
42 43 44 45 46 47 |
# File 'lib/hanami/cli/files.rb', line 42 def mkdir(path) return if exist?(path) super created(dir_path(path)) end |
#touch(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.
56 57 58 59 60 61 |
# File 'lib/hanami/cli/files.rb', line 56 def touch(path) return if exist?(path) super created(path) 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.
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/hanami/cli/files.rb', line 26 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 |