Class: Reap::Perm
Overview
File Permissions Task
Constant Summary
Constants inherited from Task
Instance Method Summary collapse
-
#chmod(file_list, file_mode = 644, dir_mode = 755) ⇒ Object
support functions.
- #run ⇒ Object
- #run_chown ⇒ Object
Methods inherited from Task
#ask, #execute, inherited, #initialize, #initiate, master, #master, #provide_setup_rb, #section, section_required, section_required?, #section_required?, #sh, #task, task_attr, #task_desc, task_desc, #task_help, task_help, task_list, #task_name, task_name, #tell, #use_subsection, verify?
Constructor Details
This class inherits a constructor from Reap::Task
Instance Method Details
#chmod(file_list, file_mode = 644, dir_mode = 755) ⇒ Object
support functions
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/reap/task/fileperm.rb', line 71 def chmod( file_list, file_mode=644, dir_mode=755 ) dirs, files = file_list.partition{ |l| File.directory?(l) } unless files.empty? fstr = '"' + files.join('" "') + '"' sh %{chmod #{file_mode} #{fstr}} end unless dirs.empty? fstr = '"' + dirs.join('" "') + '"' sh %{chmod #{dir_mode} #{fstr}} end end |
#run ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/reap/task/fileperm.rb', line 36 def run perm.group ||= perm.user perm.filemod ||= 644 perm.dirmod ||= 755 puts "Reap is shelling out work to chmod..." # misc misc = FileList.new misc.include('[A-Z]*') misc.exclude('InstalledFiles') chmod( misc ) unless misc.empty? # lib libs = FileList.new libs.include('lib/**/*') libs.exclude('lib/CVS/**/*') libs.include('packages/*/lib/**/*') libs.exclude('packages/*/lib/CVS/**/*') libs.exclude('packages/CVS/**/*') chmod( libs ) unless libs.empty? # bin bins = FileList.new bins.include('bin/**/*') bins.exclude('bin/CVS/**/*') bins.include('packages/*/bin/**/*') bins.exclude('packages/*/bin/CVS/**/*') bins.exclude('packages/CVS/**/*') chmod( bins, 755 ) unless bins.empty? end |
#run_chown ⇒ Object
83 84 85 |
# File 'lib/reap/task/fileperm.rb', line 83 def run_chown puts "NOT YET IMPLEMENTED" end |