Skip to content

Commit

Permalink
Updating copyright per guidance from Alliance For Sustatianable Energy
Browse files Browse the repository at this point in the history
  • Loading branch information
macumber committed Oct 23, 2020
1 parent 1aa3f94 commit 19581b6
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved.
OpenStudio(R), Copyright (c) 2008-2020, OpenStudio Coalition and other contributors. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
Expand Down
142 changes: 142 additions & 0 deletions developer/ApplyCopyright.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Inserts copyright at beginning of each
#
# Inputs:
# ARGV[0] - path to top level cmake source directory (one level above 'src' directory)

require 'pathname'
require 'rubygems'
require 'fileutils'

include FileUtils

# check that called from command line directly
if not ($0 == __FILE__)
puts "#{__FILE__} called from external script"
exit
end

basepath = ARGV[0].gsub("\\", "/")

copyright = "/***********************************************************************************************************************\n"
ruby_copyright = "########################################################################################################################\n"
File.open(basepath + "/LICENSE.md") do |file|
while (line = file.gets)
if line.strip.empty?
copyright += "*" + line
ruby_copyright += "#" + line

else
copyright += "* " + line
ruby_copyright += "# " + line
end
end
end
copyright += "***********************************************************************************************************************/\n\n"
ruby_copyright += "########################################################################################################################\n\n"

# first do c++

# exceptions are files that are not part of OpenStudio
exceptions = [basepath + "/src/qtwinmigrate/",
"mainpage.hpp"]

# glob for hpp and cpp
files = Dir.glob(basepath + "/src/**/*.[ch]pp")
files.concat Dir.glob(basepath + "/ruby/**/*.[ch]pp")
files.concat Dir.glob(basepath + "/src/**/*.cxx.in")
files.concat Dir.glob(basepath + "/src/**/*.tmp")

# reject exceptions
files.reject! do |p|
result = false
exceptions.each do |e|
if p.include?(e)
result = true
puts p
break
end
end
result
end

# loop over all files
files.each do |p|

# start with copyright
text = copyright

# read file
File.open(p, "r") do |file|
# read until end of current copyright
while (line = file.gets)
if not /^\s?[\/\*]/.match(line)
if not line.chomp.empty?
text += line
end
break
end
end

# now keep rest of file
while (line = file.gets)
text += line
end
end

# write file
File.open(p, "w") do |file|
file << text
end

end

# now do ruby

# exceptions are files that are not part of OpenStudio
exceptions = []

# glob for rb
files = Dir.glob(basepath + "/ruby/**/*.rb")

# reject exceptions
files.reject! do |p|
result = false
exceptions.each do |e|
if p.include?(e)
result = true
break
end
end
result
end

# loop over all files
files.each do |p|

# start with copyright
text = ruby_copyright

# read file
File.open(p, "r") do |file|
# read until end of current copyright
while (line = file.gets)
if not /^#/.match(line)
if not line.chomp.empty?
text += line
end
break
end
end

# now keep rest of file
while (line = file.gets)
text += line
end
end

# write file
File.open(p, "w") do |file|
file << text
end

end
5 changes: 1 addition & 4 deletions plugin/openstudio/lib/dialogs/html/About.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@
OpenStudio Version:<br><input id="OPENSTUDIO_VERSION" name="OPENSTUDIO_VERSION" type="text" size="50" class="static_text" style="text-align:center; border:0; border-style:solid;" readonly><br>
<a href="https://openstudio.net" target="_blank">https://openstudio.net/</a><br><br>

Developed by the National Renewable Energy Laboratory<br>
For the United States Department of Energy<br><br>

Copyright &copy; 2008-2020, Alliance for Sustainable Energy, LLC, and other contributors<br><br>
Copyright &copy; 2020-2020, OpenStudio Coalition and other contributors<br><br>

<input id="ok" onclick="onOK()" type="button" class="button" value=" OK ">

Expand Down

0 comments on commit 19581b6

Please sign in to comment.