File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -24,15 +24,25 @@ Rake::TestTask.new(:test) do |test|
2424end 
2525
2626# Building the gem will use the local file mode, so ensure it's world-readable. 
27- desc  'Check plugin file permissions' 
28- task  :check_perms  do 
29-   plugin  =  'lib/fluent/plugin/out_detect_exceptions.rb' 
30-   mode  =  File . stat ( plugin ) . mode  & 0o777 
31-   raise  "Unexpected mode #{ mode . to_s ( 8 ) } #{ plugin }   unless 
32-     mode  & 0o444  == 0o444 
27+ # https://github.com/GoogleCloudPlatform/fluent-plugin-detect-exceptions/issues/32 
28+ desc  'Fix file permissions' 
29+ task  :fix_perms  do 
30+   files  =  [ 
31+     'lib/fluent/plugin/*.rb' 
32+   ] . flat_map  do  |file |
33+     file . include? ( '*' )  ? Dir . glob ( file )  : [ file ] 
34+   end 
35+ 
36+   files . each  do  |file |
37+     mode  =  File . stat ( file ) . mode  & 0o777 
38+     next  unless  mode  & 0o444  != 0o444 
39+     puts  "Changing mode of #{ file } #{ mode . to_s ( 8 ) }  \
40+          "#{ ( mode  | 0o444 ) . to_s ( 8 ) }  
41+     chmod  mode  | 0o444 ,  file 
42+   end 
3343end 
3444
3545desc  'Run unit tests and RuboCop to check for style violations' 
36- task  all : [ :test ,  :rubocop ,  :check_perms  ] 
46+ task  all : [ :test ,  :rubocop ,  :fix_perms  ] 
3747
3848task  default : :all 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments