Sha256: e37b0324c4139f6ac714d476a33f87a212c3276680df0521c99091982022fe7c
Contents?: true
Size: 1.58 KB
Versions: 4
Compression:
Stored size: 1.58 KB
Contents
require "#{$script_dir}/tasks/multiple-output-task.rb" require "#{$script_dir}/tasks/javascript-task.rb" class NibTask < MultipleOutputTask def self.task_name "jsnib" end def source_type "js" end def output_type "jsnib" end # NibTask handles files that end in .jsnib def handles_file?(file_name) "#{file_name}"[/\.jsnib$/] end def validate_file(file) return if (!File.exists?($lint_command)) tmp= Tempfile.new("jsl.conf") conf_files= [ "jsl.conf", "#{ENV['HOME']}/.jsl.conf", @options.jsl_conf ] jsl_conf= conf_files.find { |f| File.exists?(f) } tmp << File.read(jsl_conf) tmp << "\n" external_projects.each { |project| tmp << "+include #{project["include"]}\n" } file.dependencies.each { |f| tmp << "+process #{f}\n" } tmp << "+process #{file}\n" tmp.close() command= "#{$lint_command} -nologo -nofilelisting -conf #{tmp.path}" stdin, stdout, stderr= Open3.popen3(command) stdin.close output= stdout.read errors= stderr.read tmp.delete output= output.split("\n") summary= output.pop match= summary.match(/(\d+)\s+error\(s\), (\d+)\s+warning\(s\)/) if (match) @target.error_count+= match[1].to_i @target.warning_count+= match[2].to_i end output= output.join("\n") if (!output.empty?) puts output puts end end def validate_files @included_files.each { |f| validate_file(f) } end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
coherent-0.3.0 | lib/distilery/nib-task.rb |
coherent-0.2.1 | lib/distilery/nib-task.rb |
distil-0.8.2 | lib/tasks/nib-task.rb |
distil-0.8.1 | lib/tasks/nib-task.rb |