Commits

Alex Ulianytskyi committed 0a29774

Fix Rakefile

Comments (0)

Files changed (1)

-HGREV = `hg tip --template "{rev}"`
-DISTDIR = 'dist'
-
-desc "Copy final PDFs to #{DISTDIR}"
-directory DISTDIR
+desc "Copy final PDFs to dist directory"
 task :dist do
-    FileList["#{DISTDIR}/*"].each do |f|
+    HGREV = `hg tip --template "{rev}"`
+    DISTDIR = 'dist'
+    mkdir_p DISTDIR
+    FileList["#{DISTDIR}/*.pdf"].each do |f|
         File.delete(f)
     end
     FileList['*/*.pdf'].each do |f|
     puts "Lab # is required"
     exit 1
   end
-  src_dir = "source"
-  csv_dir = "source_csv"
+  SRC_DIR = "source"
+  CSV_DIR = "source_csv"
   regexp = /\d{3}\.\d{6}\s+[-0-9]{1,3}\.\d+/
-  mkdir_p "#{csv_dir}"
-  FileList["#{src_dir}/*"].each do |f|
-    dest_f = "#{csv_dir}/#{File.basename(f)}.csv"
+  mkdir_p "#{CSV_DIR}"
+  FileList["#{SRC_DIR}/*"].each do |f|
+    dest_f = "#{CSV_DIR}/#{File.basename(f)}.csv"
     sh "grep --color=no -P '#{regexp}' '#{f}' > '#{dest_f}'"
   end
 end
 
-task :default => :dist
+task :default => :dist