Skip to content

Commit

Permalink
remove rubyzip gem
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-dleung committed Nov 13, 2018
1 parent 4a61c2f commit f6bfd75
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 45 deletions.
2 changes: 1 addition & 1 deletion ABOUT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"product": "Source Code Analysis Lab",
"version": "2.1.4.2"
"version": "2.1.4.3"
}
10 changes: 5 additions & 5 deletions COPYRIGHT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SCALe 2.1.4.2
SCALe 2.1.4.3
Copyright 2018 Carnegie Mellon University. All Rights Reserved.
MIT (SEI)

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scale.app/ABOUT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"product": "Source Code Analysis Lab",
"version": "2.1.4.2"
"version": "2.1.4.3"
}
10 changes: 5 additions & 5 deletions scale.app/COPYRIGHT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SCALe 2.1.4.2
SCALe 2.1.4.3
Copyright 2018 Carnegie Mellon University. All Rights Reserved.
MIT (SEI)

Expand All @@ -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
Expand Down
72 changes: 39 additions & 33 deletions scale.app/app/controllers/diagnostics_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f6bfd75

Please sign in to comment.