Method: Thor::Actions#chmod
- Defined in:
- lib/thor/actions/file_manipulation.rb
permalink #chmod(path, mode, config = {}) ⇒ Object
Changes the mode of the given file or directory.
Parameters
- mode<Integer>
-
the file mode
- path<String>
-
the name of the file to change mode
- config<Hash>
-
give :verbose => false to not log the status.
Example
chmod "script/server", 0755
145 146 147 148 149 150 151 152 153 |
# File 'lib/thor/actions/file_manipulation.rb', line 145 def chmod(path, mode, config = {}) return unless behavior == :invoke path = File.(path, destination_root) say_status :chmod, relative_to_original_destination_root(path), config.fetch(:verbose, true) unless [:pretend] require "fileutils" FileUtils.chmod_R(mode, path) end end |