lib/quality/rake/config.rb in quality-9.0.0 vs lib/quality/rake/config.rb in quality-10.0.0
- old
+ new
@@ -38,10 +38,14 @@
# Pick any extra files that are source files, but may not have
# extensions--defaults to %w(Rakefile Dockerfile)
attr_accessor :extra_files
+ # Pick any extra files that are Ruby source files, but may not have
+ # extensions--defaults to %w(Rakefile)
+ attr_accessor :extra_ruby_files
+
# Extensions for Ruby language files--defaults to 'rb,rake'
attr_accessor :ruby_file_extensions
# Extensions for all source files--defaults to
# 'rb,rake,swift,cpp,c,java,py,clj,cljs,scala,js,yml,sh,json'
@@ -66,35 +70,42 @@
def source_dirs
@source_dirs ||= ruby_dirs.clone
end
def extra_files
- @extra_files ||= %w(Rakefile Dockerfile)
+ @extra_files ||= extra_ruby_files.clone.concat(%w(Dockerfile))
end
+ def extra_ruby_files
+ @extra_ruby_files ||= %w(Rakefile)
+ end
+
def source_file_extensions
@source_file_extensions ||=
"#{ruby_file_extensions},swift,cpp,c,java,py,clj,cljs,scala,js," \
'yml,sh,json'
end
- def source_files_glob(dirs = source_dirs,
+ def source_files_glob(extra_source_files = extra_files,
+ dirs = source_dirs,
extensions = source_file_extensions)
- "{#{extra_files.join(',')}," +
+ "{#{extra_source_files.join(',')}," +
File.join("{#{dirs.join(',')}}",
'**',
"*.{#{extensions}}") +
'}'
end
+ # XXX: Should add .gemspec
def ruby_file_extensions
@ruby_file_extensions ||= 'rb,rake'
end
def ruby_files_glob
- source_files_glob(ruby_dirs, ruby_file_extensions)
+ source_files_glob(extra_ruby_files, ruby_dirs, ruby_file_extensions)
end
+ # XXX: Rakefile is hard-coded here--should use config instead
def ruby_files
@globber.glob("{*.{#{ruby_file_extensions}},Rakefile}")
.concat(@globber.glob(ruby_files_glob)).join(' ')
end