diff --git a/ABOUT b/ABOUT index 6fe1d7b..8697d50 100755 --- a/ABOUT +++ b/ABOUT @@ -1,4 +1,4 @@ { "product": "Source Code Analysis Lab", - "version": "2.1.4.2" + "version": "2.1.4.3" } diff --git a/COPYRIGHT b/COPYRIGHT index af140b8..5305948 100755 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,4 +1,4 @@ -SCALe 2.1.4.2 +SCALe 2.1.4.3 Copyright 2018 Carnegie Mellon University. All Rights Reserved. MIT (SEI) @@ -13,21 +13,21 @@ the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -SCALe 2.1.4.2 includes and/or can make use of certain third party +SCALe 2.1.4.3 includes and/or can make use of certain third party software ("Third Party Software"). The Third Party Software that is -used by SCALe 2.1.4.2 is dependent upon your system configuration, but +used by SCALe 2.1.4.3 is dependent upon your system configuration, but typically includes the software identified in the system requirements ([SCALE_HOME]/scale.app/public/doc/SCALe2/System-Requirements_215846591.html) and/or installation instructions ([SCALE_HOME]/scale.app/public/doc/SCALe2/Installing-SCALe_215846594.html). By -using SCALe 2.1.4.2, You agree to comply with any and all relevant Third +using SCALe 2.1.4.3, You agree to comply with any and all relevant Third Party Software terms and conditions contained in any such Third Party Software or separate license file distributed with such Third Party Software. The parties who own the Third Party Software ("Third Party Licensors") are intended third party beneficiaries to this License with respect to the terms applicable to their Third Party Software. Third Party Software licenses only apply to the Third Party -Software and not any other portion of SCALe 2.1.4.2 or SCALe 2.1.4.2 as a +Software and not any other portion of SCALe 2.1.4.3 or SCALe 2.1.4.3 as a whole. This material is based upon work funded and supported by the diff --git a/scale.app/ABOUT b/scale.app/ABOUT index 6fe1d7b..8697d50 100755 --- a/scale.app/ABOUT +++ b/scale.app/ABOUT @@ -1,4 +1,4 @@ { "product": "Source Code Analysis Lab", - "version": "2.1.4.2" + "version": "2.1.4.3" } diff --git a/scale.app/COPYRIGHT b/scale.app/COPYRIGHT index af140b8..5305948 100755 --- a/scale.app/COPYRIGHT +++ b/scale.app/COPYRIGHT @@ -1,4 +1,4 @@ -SCALe 2.1.4.2 +SCALe 2.1.4.3 Copyright 2018 Carnegie Mellon University. All Rights Reserved. MIT (SEI) @@ -13,21 +13,21 @@ the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -SCALe 2.1.4.2 includes and/or can make use of certain third party +SCALe 2.1.4.3 includes and/or can make use of certain third party software ("Third Party Software"). The Third Party Software that is -used by SCALe 2.1.4.2 is dependent upon your system configuration, but +used by SCALe 2.1.4.3 is dependent upon your system configuration, but typically includes the software identified in the system requirements ([SCALE_HOME]/scale.app/public/doc/SCALe2/System-Requirements_215846591.html) and/or installation instructions ([SCALE_HOME]/scale.app/public/doc/SCALe2/Installing-SCALe_215846594.html). By -using SCALe 2.1.4.2, You agree to comply with any and all relevant Third +using SCALe 2.1.4.3, You agree to comply with any and all relevant Third Party Software terms and conditions contained in any such Third Party Software or separate license file distributed with such Third Party Software. The parties who own the Third Party Software ("Third Party Licensors") are intended third party beneficiaries to this License with respect to the terms applicable to their Third Party Software. Third Party Software licenses only apply to the Third Party -Software and not any other portion of SCALe 2.1.4.2 or SCALe 2.1.4.2 as a +Software and not any other portion of SCALe 2.1.4.3 or SCALe 2.1.4.3 as a whole. This material is based upon work funded and supported by the diff --git a/scale.app/app/controllers/diagnostics_controller.rb b/scale.app/app/controllers/diagnostics_controller.rb index 5b44a9e..f910ee2 100644 --- a/scale.app/app/controllers/diagnostics_controller.rb +++ b/scale.app/app/controllers/diagnostics_controller.rb @@ -328,45 +328,51 @@ def export zipname = "#{@project.name}-#{timestamp}.zip" zipfilename = Rails.root.join("db/backup/#{zipname}") - Zip::ZipFile.open(zipfilename, Zip::ZipFile::CREATE) do |zipfile| + Dir.chdir("tmp") do + Zip::ZipFile.open(zipfilename, Zip::ZipFile::CREATE) do |zipfile| + zipfile.get_output_stream("display.csv") do |output_entry_stream| #Filename + output_entry_stream.write(display_csv) #generated content + end + zipfile.get_output_stream("display.csv") do |output_entry_stream| #Filename output_entry_stream.write(display_csv) #generated content end - ActiveRecord::Base.remove_connection - ActiveRecord::Base.establish_connection :external - con = ActiveRecord::Base.connection() - - ["Lizard", "Ccsm", "Understand"].each do |metric| # TODO read table names from scripts/tools.org - table = con.quote_string("#{metric}Metrics") - query = "SELECT name FROM sqlite_master WHERE "+ - "type='table' AND name='#{table}'"; - if con.execute(ActionController::Base.helpers.sanitize(query)).count > 0 - query = "SELECT * FROM '#{table}'" - res = con.execute(ActionController::Base.helpers.sanitize(query)) - if res.length > 0 - columns = res[0].keys - columns = columns[0..columns.index(0) - 1] # to remove numeric keys - metric_csv = CSV.generate do |csv| - csv << columns - res.each do |r| - row = columns.map do |c| - r[c] - end - csv << row - end # res.each - end # CSV.generate - zipfile.get_output_stream("#{table}.csv") do |output_entry_stream| - output_entry_stream.write(metric_csv) - end + ActiveRecord::Base.remove_connection + ActiveRecord::Base.establish_connection :external + con = ActiveRecord::Base.connection() + + ["Lizard", "Ccsm", "Understand"].each do |metric| # TODO read table names from scripts/tools.org + table = con.quote_string("#{metric}Metrics") + query = "SELECT name FROM sqlite_master WHERE "+ + "type='table' AND name='#{table}'"; + if con.execute(ActionController::Base.helpers.sanitize(query)).count > 0 + query = "SELECT * FROM '#{table}'" + res = con.execute(ActionController::Base.helpers.sanitize(query)) + if res.length > 0 + columns = res[0].keys + columns = columns[0..columns.index(0) - 1] # to remove numeric keys + metric_csv = CSV.generate do |csv| + csv << columns + res.each do |r| + row = columns.map do |c| + r[c] + end + csv << row + end # res.each + end # CSV.generate + zipfile.get_output_stream("#{table}.csv") do |output_entry_stream| + output_entry_stream.write(metric_csv) + end + end # if end # if - end # if - end # each + end # each - ActiveRecord::Base.remove_connection - ActiveRecord::Base.establish_connection :development - con = ActiveRecord::Base.connection() - end # open + ActiveRecord::Base.remove_connection + ActiveRecord::Base.establish_connection :development + con = ActiveRecord::Base.connection() + end # open + end # Dir.chdir send_data( zipfilename.read, type: 'application/zip', filename: zipname) if File.exists?(zipfilename)