Module: Shell
- Defined in:
- lib/capistrano/modules/shell.rb
Instance Method Summary collapse
- #file_exists?(file) ⇒ Boolean
- #file_exists_and_overwrite?(file) ⇒ Boolean
- #file_new_or_overwrite?(file) ⇒ Boolean
- #overwrite_file?(file) ⇒ Boolean
Instance Method Details
#file_exists?(file) ⇒ Boolean
3 4 5 |
# File 'lib/capistrano/modules/shell.rb', line 3 def file_exists?(file) test("[ -f #{file} ]") end |
#file_exists_and_overwrite?(file) ⇒ Boolean
12 13 14 |
# File 'lib/capistrano/modules/shell.rb', line 12 def file_exists_and_overwrite?(file) file_exists?(file) && overwrite_file?(file) end |
#file_new_or_overwrite?(file) ⇒ Boolean
16 17 18 |
# File 'lib/capistrano/modules/shell.rb', line 16 def file_new_or_overwrite?(file) !file_exists?(file) || overwrite_file?(file) end |
#overwrite_file?(file) ⇒ Boolean
7 8 9 10 |
# File 'lib/capistrano/modules/shell.rb', line 7 def overwrite_file?(file) ask(:answer, "File #{file} already exists. Overwrite it? (y/N)") fetch(:answer).downcase == "y" end |