File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -24,15 +24,26 @@ 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 ) } for #{ 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/exception_detector.rb' ,
32+ 'lib/fluent/plugin/out_detect_exceptions.rb'
33+ ] . flat_map do |file |
34+ file . include? ( '*' ) ? Dir . glob ( file ) : [ file ]
35+ end
36+
37+ files . each do |file |
38+ mode = File . stat ( file ) . mode & 0o777
39+ next unless mode & 0o444 != 0o444
40+ puts "Changing mode of #{ file } from #{ mode . to_s ( 8 ) } to " \
41+ "#{ ( mode | 0444 ) . to_s ( 8 ) } "
42+ chmod mode | 0o444 , file
43+ end
3344end
3445
3546desc 'Run unit tests and RuboCop to check for style violations'
36- task all : [ :test , :rubocop , :check_perms ]
47+ task all : [ :test , :rubocop , :fix_perms ]
3748
3849task default : :all
You can’t perform that action at this time.
0 commit comments