Merge branch 'develop' of https://github.com/vivo-project/VIVO into develop

This commit is contained in:
Holly Mistlebauer 2013-11-08 11:04:59 -05:00
commit ec5e81f75c
237 changed files with 8151 additions and 3172 deletions

View file

@ -10,6 +10,8 @@ class DirectoryWalker
if FileTest.directory?(path)
if File.basename(path).start_with?(".")
Find.prune # Don't look any further into this directory.
elsif @known_exceptions.skip?(path)
Find.prune
else
next
end
@ -33,13 +35,13 @@ class DirectoryWalker
def scan_line(path, line_number, line)
@obsolete_uris.uris.each do |uri|
next if @known_exceptions.skip?(path, line_number, uri)
# next if @known_exceptions.skip?(path, line_number, uri)
@report.add_event(Event.new(path, line_number, line, uri)) if line =~ Regexp.new("\\b#{Regexp.quote(uri)}\\b")
end
if @complete
@obsolete_uris.localnames.each do |localname|
term = ":#{localname}"
next if @known_exceptions.skip?(path, line_number, term)
# next if @known_exceptions.skip?(path, line_number, term)
@report.add_event(Event.new(path, line_number, line, term)) if line =~ Regexp.new("#{Regexp.quote(term)}\\b")
end
end

View file

@ -0,0 +1,7 @@
ruby obsoleteUriChecker.rb /Users/jeb228/git/VIVO \
../../../productMods/WEB-INF/ontologies/update/diff.tab.txt \
vivo_known_exceptions.txt complete > scan_VIVO_maint_branch
ruby obsoleteUriChecker.rb /Users/jeb228/git/Vitro \
../../../productMods/WEB-INF/ontologies/update/diff.tab.txt \
vivo_known_exceptions.txt complete > scan_Vitro_maint_branch

View file

@ -0,0 +1,2 @@
ruby obsoleteUriChecker.rb /Users/jeb228/Documents/Releases/VIVO\ 1.6/vivo-rel-1.6-rc1 ../../../productMods/WEB-INF/ontologies/update/diff.tab.txt vivo_known_exceptions.txt complete

View file

@ -5,9 +5,15 @@ class Event
attr_reader :string
attr_reader :is_localname
require 'pathname'
# ------------------------------------------------------------------------------------
private
# ------------------------------------------------------------------------------------
def relativize(root, path)
Pathname.new(path).relative_path_from(Pathname.new(root)).to_s
end
# ------------------------------------------------------------------------------------
public
@ -21,7 +27,11 @@ class Event
@is_localname = string[0] == ?:
end
def to_s()
"#{@path} \n #{@line_number} #{@line} \n #{@string} #{@is_localname ? "Localname" : "URI"}"
def to_s(directory_root = nil)
if directory_root
"#{relativize(directory_root, @path)} \n #{@line_number} #{@line} \n #{@string} #{@is_localname ? "Localname" : "URI"}"
else
"#{@path} \n #{@line_number} #{@line} \n #{@string} #{@is_localname ? "Localname" : "URI"}"
end
end
end

View file

@ -1,5 +1,22 @@
require 'pathname'
class KnownExceptionsError < StandardError; end
class GlobSkipper
def initialize(root_path, glob)
@root_path = root_path
@glob = glob
end
def relativize(path)
Pathname.new(path).relative_path_from(Pathname.new(@root_path)).to_s
end
def skip?(path, line, uri)
return File.fnmatch(@glob, relativize(path))
end
end
class ExtensionSkipper
def initialize(extension)
@extension = extension
@ -44,10 +61,11 @@ class KnownExceptions
line.strip!
next if line.length == 0 || line[0..0] == '#' || line[0] == ?!
if line =~ /^\.[^\/]*$/
skippers << ExtensionSkipper.new(line)
elsif line =~ /^(\S+)\s*$/
skippers << PathSkipper.new(@root_path, $1)
# if line =~ /^\.[^\/]*$/
# skippers << ExtensionSkipper.new(line)
if line =~ /^(\S+)\s*$/
# skippers << PathSkipper.new(@root_path, $1)
skippers << GlobSkipper.new(@root_path, $1)
elsif line =~ /^(\S+)\s*(\d+)\s*$/
skippers << LineSkipper.new(@root_path, $1, $2.to_i)
else
@ -71,7 +89,7 @@ class KnownExceptions
if line_number == -1
next if skipper.is_a?(LineSkipper)
else
next if skipper.is_a?(ExtensionSkipper) || skipper.is_a?(PathSkipper)
next if skipper.is_a?(ExtensionSkipper) || skipper.is_a?(PathSkipper) || skipper.is_a?(GlobSkipper)
end
if skipper.skip?(file, line_number, string)

View file

@ -80,8 +80,8 @@ class ObsoleteUriChecker
# ------------------------------------------------------------------------------------
def initialize(args)
@report = Report.new(args)
@directory_root, @obsolete_uris, @known_exceptions, @complete = parse_arguments(args)
@report = Report.new(args, @directory_root)
rescue UsageError => e
puts "\n----------------\nUsage error\n----------------\n\n#{e}\n\n----------------\n\n"
exit

View file

@ -3,6 +3,10 @@ class Report
private
# ------------------------------------------------------------------------------------
def relativize(path)
Pathname.new(path).relative_path_from(Pathname.new(@directory_root)).to_s
end
def state_arguments()
puts
puts "-----------------------------------------------------------------"
@ -29,9 +33,8 @@ class Report
hash[event.path] = hash[event.path] << event
end
# puts "FLAT: #{hash.to_a.flatten}"
hash.sort.each do |path, events|
puts "#{path}"
puts "#{relativize(path)}"
events.sort{|a, b| a.line_number <=> b.line_number }.each do |e|
trimmed =
if e.line.size <= 100
@ -46,18 +49,13 @@ class Report
end
end
def list_events()
@events.each do |event|
puts "Event: #{event}"
end
end
# ------------------------------------------------------------------------------------
public
# ------------------------------------------------------------------------------------
def initialize(args)
def initialize(args, directory_root)
@args = args;
@directory_root = directory_root
@file_count = 0
@extensions_count = Hash.new(0)
@events = []
@ -75,7 +73,6 @@ class Report
def report()
state_arguments()
file_summary()
# list_events()
collate_and_list_events()
end
end

View file

@ -1,17 +1,23 @@
.GIF
.as
.class
.fla
.gif
.gz
.ico
.jar
.jpg
.psd
.png
.swf
.war
.zip
bin
utilities/ISF-transition/obsoleteUris
*.GIF
*.as
*.class
*.fla
*.gif
*.gz
*.ico
*.jar
*.jpg
*.psd
*.png
*.swf
*.war
*.zip
**/.*
#
# first_pass: no excluded files. everything was duplicated in the .bin directory, and
@ -39,3 +45,25 @@ productMods/WEB-INF/ontologies/update/oldVersion/vivo-bibo-1.5.owl
productMods/WEB-INF/ontologies/update/oldVersion/scires-1.5.owl
productMods/WEB-INF/ontologies/update/oldVersion/vivo-dcterms-1.5.owl
productMods/WEB-INF/ontologies/update/oldVersion/vivo-dcelements-1.5.owl
#
# Exclude old performance tests
#
utilities/LoadTesting/distros/release1.4/deploy.properties.template
#
# Exclude the migration code itself
#
productMods/WEB-INF/ontologies/update/**/*
#
# This is commented out.
#
src/edu/cornell/mannlib/vitro/webapp/visualization/utilities/UtilitiesRequestHandler.java
#
# The URI is obsolete, but it has been replaced by another URI with the same localname.
# http://purl.org/dc/terms/publisher http://vivoweb.org/ontology/core#publisher
# How to catch this?
#

View file

@ -0,0 +1,41 @@
.GIF
.as
.class
.fla
.gif
.gz
.ico
.jar
.jpg
.psd
.png
.swf
.war
.zip
#
# first_pass: no excluded files. everything was duplicated in the .bin directory, and
# probably in the .build directory also. Ran against the repository, so VIVO
# only.
#
# 7498 89730 2277668 first_pass.output
#
test/edu/cornell/mannlib/vitro/webapp/search/solr/NIHVIVO3853_DataSet1.rdf
productMods/WEB-INF/ontologies/update/oldVersion/vivo-event-1.5.owl
productMods/WEB-INF/ontologies/update/oldAnnotations/vivo-core-1.5-annotations.rdf
productMods/WEB-INF/ontologies/update/diff.tab.txt
#
# second_pass: excluded these nasty files. Ran against a clean distro, with VIVO and
# Vitro, but no .bin or .build
#
# 1798 5159 170092 second_pass.output
#
productMods/WEB-INF/ontologies/update/oldVersion/vivo-foaf-1.5.owl
productMods/WEB-INF/ontologies/update/oldVersion/vivo-core-1.5.owl
productMods/WEB-INF/ontologies/update/oldVersion/vivo-bibo-1.5.owl
productMods/WEB-INF/ontologies/update/oldVersion/scires-1.5.owl
productMods/WEB-INF/ontologies/update/oldVersion/vivo-dcterms-1.5.owl
productMods/WEB-INF/ontologies/update/oldVersion/vivo-dcelements-1.5.owl

View file

@ -12,11 +12,22 @@ directory, for possible inspection later.
require File.expand_path('subscripts/common', File.dirname(__FILE__))
require 'date'
require "#{File.dirname(__FILE__)}/subscripts/loadParms"
def figure_time_stamp()
return DateTime.now.strftime("%Y-%m-%d_%H-%M-%S")
end
def add_read_me()
puts "Add a comment for the README.txt file"
comment = STDIN.gets.strip
return if comment.empty?
File.open('README.txt', "w") do |file|
file.puts comment
end
end
@tomcat_logs_dir = version_file('tomcatLogs')
if (! File.directory?(@tomcat_logs_dir))
Dir.mkdir(@tomcat_logs_dir)
@ -29,5 +40,5 @@ end
Dir.chdir(@this_logs_dir) do |path|
system("cp #{@home}/tomcat/logs/* .")
add_read_me()
end

View file

@ -52,9 +52,10 @@ mydomain:facultyDepartmentDG
display:query """
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX vivo: <http://vivoweb.org/ontology/core#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
SELECT ?deptName
WHERE {
?individualUri vivo:hasMemberRole ?membership .
?individualUri obo:RO_0000053 ?membership .
?membership vivo:roleContributesTo ?deptUri .
?deptUri
a vivo:AcademicDepartment ;
@ -98,11 +99,11 @@ mydomain:departmentLocationDG
display:saveToVar "locations" ;
display:query """
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX vivo: <http://vivoweb.org/ontology/core#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
SELECT ?label
WHERE
{
?location vivo:geographicLocationOf ?individualUri ;
?location obo:RO_0001015 ?individualUri ;
rdfs:label ?label .
}
LIMIT 20
@ -113,12 +114,13 @@ mydomain:departmentHeadDG
display:saveToVar "deptHead" ;
display:query """
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX vivo: <http://vivoweb.org/ontology/core#>
SELECT ?label
WHERE
{
?individualUri vivo:contributingRole ?role .
?role vivo:leaderRoleOf ?head .
?role obo:RO_0000052 ?head .
?head rdfs:label ?label .
}
LIMIT 1

View file

@ -0,0 +1,2 @@
ruby i18nChecker.rb '/Library/Tomcat/webapps/vivo/i18n/*.properties' complete
ruby i18nChecker.rb '/Library/Tomcat/webapps/vivo/themes/wilma/i18n/*.properties' complete