<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/lisp.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -19,6 +19,7 @@ require 'active_record'
 
 #custom requires
 require 'kml'
+require 'lib/lisp'
 
 def get_db_conn(env)
   env = env.to_sym</diff>
      <filename>initialize.rb</filename>
    </modified>
    <modified>
      <diff>@@ -126,7 +126,7 @@ class Co2ColorCodeBar &lt; Processing::App
       end
     end
 
-    save &quot;#{GTRON_ROOT}/output/co2_color_bar.png&quot;
+    save $co2_color_bar_file
     
     # close window and quit the method
     # There might be a cleaner way</diff>
      <filename>lib/co2_color_code.rb</filename>
    </modified>
    <modified>
      <diff>@@ -15,8 +15,8 @@ class DataPoint &lt; ActiveRecord::Base
       dp
     end
 
-    co2 = File.read(Dir.glob(&quot;#{dir_name}/lear*.txt&quot;).first).split(/\r?\n/)
-    co2 = co2[1...co2.size].map{|x| x.split(/,\s+/)[2].to_f }
+    co2 = cdr(File.read(Dir.glob(&quot;#{dir_name}/lear*.txt&quot;).first).split(/\r?\n/))
+    co2 = co2.map{|x| x.split(/,\s+/)[2].to_f }
     data_points = data_point_coords.map do |dp|
       if dp.altitude &gt; 0
         dp.co2_ppm = co2.shift
@@ -24,7 +24,8 @@ class DataPoint &lt; ActiveRecord::Base
       dp
     end
     data_points.each{|dp| dp.save }
-    puts &quot;DROPPING #{co2.size} PIECES OF VERY IMPORTANT DATA&quot; if co2.size
+    ActiveRecord::Base.logger.warn( 
+      &quot;DROPPING #{co2.size} PIECES OF VERY IMPORTANT DATA&quot;) if co2.size
     data_points
   end
 </diff>
      <filename>models/data_point.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,6 @@
 desc &quot;Tests out my shape drawing code by drawing simple shapes&quot;
 task :draw_simple_shapes do
+  output_path = ENV[&quot;OUTPUT_PATH&quot;] || &quot;#{GTRON_ROOT}/output&quot;
   kml = KMLFile.new
   doc = KML::Document.new(:name =&gt; &quot;Simple Shapes&quot;)
   circle_p = KML::Placemark.new(:name =&gt; &quot;Circle&quot;)
@@ -24,5 +25,5 @@ task :draw_simple_shapes do
   doc.features &lt;&lt; circle_p &lt;&lt; cylinder_p &lt;&lt; square_p &lt;&lt; square1_p
   kml.objects &lt;&lt; doc
   puts kml
-  File.open(&quot;output/simple_shapes.kml&quot;, &quot;w&quot;) {|f| f.write kml.render }
+  File.open(&quot;#{output_path}/simple_shapes.kml&quot;, &quot;w&quot;) {|f| f.write kml.render }
 end</diff>
      <filename>tasks/draw_simple_shapes.rake</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,9 @@
 desc &quot;Import data into the database&quot;
 task :import do
   get_db_conn(ENV[&quot;GTRON_ENV&quot;] || GTRON_ENV)
+  input_path = ENV[&quot;INPUT_PATH&quot;] || &quot;#{GTRON_ROOT}/input&quot;
+
   Flight.delete_all
   DataPoint.delete_all
-  Flight.load(Dir.glob(&quot;#{GTRON_ROOT}/input/*&quot;))
+  Flight.load(Dir.glob(&quot;#{input_path}/*&quot;))
 end</diff>
      <filename>tasks/import.rake</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,9 @@
 desc &quot;Creates Color Bar for Google Earth&quot;
 task :make_color_bar do
+  output_path = ENV[&quot;OUTPUT_PATH&quot;] || &quot;#{GTRON_ROOT}/output&quot;
+  $co2_color_bar_file = File.expand_path(&quot;#{output_path}/co2_color_bar.png&quot;)
   Co2ColorCode.make_color_bar
-  image_path = File.expand_path(&quot;#{GTRON_ROOT}/output/co2_color_bar.png&quot;)
+  image_path = $co2_color_bar_file
   kml = KMLFile.new
   doc = KML::Document.new(:name =&gt; &quot;ASCENDS CO2 Color Bar&quot;)
   overlay = KML::ScreenOverlay.new(:name =&gt; 'CO2 Color Bar',
@@ -11,5 +13,5 @@ task :make_color_bar do
                                       :href =&gt; &quot;file:/#{image_path}&quot;))
   doc.features &lt;&lt; overlay
   kml.objects &lt;&lt; doc
-  File.open(&quot;output/co2_color_bar.kml&quot;, &quot;w&quot;) {|f| f.write kml.render }
+  File.open(&quot;#{output_path}/co2_color_bar.kml&quot;, &quot;w&quot;) {|f| f.write kml.render }
 end</diff>
      <filename>tasks/make_color_bar.rake</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,6 @@
 desc &quot;Plots the flightpath in Google Earth&quot;
 task :plot_datapoint_paths do
+  output_path = ENV[&quot;OUTPUT_PATH&quot;] || &quot;#{GTRON_ROOT}/output&quot;
   get_db_conn(GTRON_ENV)
   kml = KMLFile.new
   doc = KML::Document.new(:name =&gt; &quot;ASCENDS Flight Paths&quot;)
@@ -16,5 +17,5 @@ task :plot_datapoint_paths do
   doc.features &lt;&lt; style &lt;&lt; placemark
 
   kml.objects &lt;&lt; doc
-  File.open(&quot;output/datapoint_paths.kml&quot;,&quot;w&quot;) {|f| f.write kml.render }
+  File.open(&quot;#{output_path}/datapoint_paths.kml&quot;,&quot;w&quot;) {|f| f.write kml.render }
 end</diff>
      <filename>tasks/plot_datapoint_paths.rake</filename>
    </modified>
    <modified>
      <diff>@@ -1,14 +1,19 @@
-desc &quot;Plot columns&quot;
+require 'benchmark'
+
+desc &quot;Plot columns of CO2&quot;
 task :plot_flightpath_with_co2_columns do
+  output_path = ENV[&quot;OUTPUT_PATH&quot;] || &quot;#{GTRON_ROOT}/output&quot;
   get_db_conn(GTRON_ENV)
 
   kml = KMLFile.new
   doc = KML::Document.new(:name =&gt; &quot;CO2 Columns&quot;)
   
+
   dps = DataPoint.find(:all)
   
   heading = 0
   column_coords = []
+  #assemble datapoint tuples as [Column Pair coordinates, CO2 measure]
   dps.each_with_index do |dp, i|
     if dp.co2_ppm
       if i &lt; (dps.size-1)
@@ -20,6 +25,7 @@ task :plot_flightpath_with_co2_columns do
     end
   end
 
+  #create polygons from computed coordinates.
   column_coords.each_with_index do |c, i|
     if i &lt; column_coords.size-1
       sty = KML::Style.new(:poly_style =&gt; KML::PolyStyle.new(
@@ -34,7 +40,7 @@ task :plot_flightpath_with_co2_columns do
       placemark.features &lt;&lt; sty &lt;&lt; col
       doc.features &lt;&lt; placemark
     end
-  end.compact
+  end
   kml.objects &lt;&lt; doc
-  File.open(&quot;output/co2_columns.kml&quot;, &quot;w&quot;) {|f| f.write kml.render}
+  File.open(&quot;#{output_path}/co2_columns.kml&quot;, &quot;w&quot;) {|f| f.write kml.render}
 end</diff>
      <filename>tasks/plot_flightpath_with_co2_columns.rake</filename>
    </modified>
    <modified>
      <diff>@@ -2,21 +2,25 @@ require File.dirname(__FILE__) + '/../test_helper.rb'
 
 class TestDrawSimpleShapes &lt; Test::Unit::TestCase
   def setup
+    ENV[&quot;OUTPUT_PATH&quot;] = TEST_TMP
+    bare_setup
+
     get_db_conn(GTRON_ENV)
     @rake = Rake::Application.new
     Rake.application = @rake
     load File.dirname(__FILE__) + '/../../tasks/draw_simple_shapes.rake'
   end
 
-  should &quot;be true&quot; do
-    # Testing rake is a bit different
-    # http://blog.nicksieger.com/articles/2007/06/11/test-your-rake-tasks
-    # Example:
-    #   @rake[&quot;task_name&quot;].invoke
-    assert true
+  context &quot;Drawing Shapes&quot; do
+    setup { @rake[&quot;draw_simple_shapes&quot;].invoke }
+
+    should &quot;make kml file&quot; do
+      assert File.exists?(&quot;#{TEST_TMP}/simple_shapes.kml&quot;)
+    end
   end
 
   def teardown
     Rake.application = nil
+    bare_teardown
   end
 end</diff>
      <filename>test/tasks/test_draw_simple_shapes.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,16 +5,25 @@ class TestImport &lt; Test::Unit::TestCase
     get_db_conn(GTRON_ENV)
     @rake = Rake::Application.new
     Rake.application = @rake
+    ENV[&quot;INPUT_PATH&quot;] = &quot;test/sample_data&quot;
     load File.dirname(__FILE__) + '/../../tasks/import.rake'
   end
 
-  should &quot;import data&quot; do
-    # Testing rake is a bit different
-    # http://blog.nicksieger.com/articles/2007/06/11/test-your-rake-tasks
-    # Example:
-    #   @rake[&quot;task_name&quot;].invoke
-    #@rake[&quot;import&quot;].invoke
-    assert true
+  context &quot;Import data&quot; do
+    setup { @rake[&quot;import&quot;].invoke }
+
+    should &quot;create flights&quot; do
+      assert_equal 1, Flight.find(:all).size
+    end
+
+    should &quot;create datapoints&quot; do
+      assert_equal 10, DataPoint.find(:all).size
+    end
+
+    should &quot;associate datapoints with flight&quot; do
+      assert_equal DataPoint.find(:all).size,
+        Flight.find(:first).data_points.size
+    end
   end
 
   def teardown</diff>
      <filename>test/tasks/test_import.rb</filename>
    </modified>
    <modified>
      <diff>@@ -21,4 +21,12 @@ module Test
   end
 end
 
+TEST_TMP = &quot;#{GTRON_ROOT}/test/tmp&quot;
 
+def bare_setup
+  FileUtils.mkdir TEST_TMP
+end
+
+def bare_teardown
+  FileUtils.rm_rf TEST_TMP
+end</diff>
      <filename>test/test_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ad624db758a3c559a6d325e666fd209ffa42d2d4</id>
    </parent>
  </parents>
  <author>
    <name>Ben Hughes</name>
    <email>ben@pixelmachine.org</email>
  </author>
  <url>http://github.com/schleyfox/ascends_viz/commit/4b45b2acd21d65cca98708605fc3883530d9ac6f</url>
  <id>4b45b2acd21d65cca98708605fc3883530d9ac6f</id>
  <committed-date>2008-06-30T13:57:05-07:00</committed-date>
  <authored-date>2008-06-30T13:57:05-07:00</authored-date>
  <message> I did something, I don't really care about what

 * something involving lisp</message>
  <tree>00df524a9c3721bfda6b6ae58ea491ae49243efe</tree>
  <committer>
    <name>Ben Hughes</name>
    <email>ben@pixelmachine.org</email>
  </committer>
</commit>
