gwu-libraries / scholarspace-hyrax

Hyrax-based repository for GW ETDs and other original content
https://scholarspace.library.gwu.edu/
MIT License
9 stars 4 forks source link

Compare customized files with defaults #387

Open alepbloyd opened 1 year ago

alepbloyd commented 1 year ago

This is a list of all files that exist in both the 'app' folder of ScholarSpace and in the 'app' folder of the hyrax-3.5.0 gem - meaning that the code in ScholarSpace is overriding the default Hyrax code. These need to be checked to ensure that we are not overriding UI or behavior changes in the upgrade.

alepbloyd commented 1 year ago

Haven't set up a repo for this, but sharing code I used to generate the above list:

gem_name = "hyrax-3.5.0"
repo_path = "/Users/alexander.boyd/Documents/repos/testinghyrax/scholarspace-hyrax"

class GemParser

  def initialize(gem_name, repo_path)
    @gem_name = gem_name
    @repo_path = repo_path
  end

  def gem_install_path
    Gem.default_dir
  end

  def installed_gems
    Dir.chdir("#{gem_install_path}/gems")
    Dir.glob('*').select {|file| File.directory? file}
  end

  def gem_present?
    installed_gems.include? @gem_name
  end

  def full_path
    if gem_present?
      "#{gem_install_path}/gems/#{@gem_name}"
    else
      "Gem not found"
    end
  end

  def gem_app_files
    files = Dir.glob("#{full_path}/app/**/*").reject { |f| File.directory?(f) }
    files = files.map {|file| file.split("/app/").last}
  end

  def repo_app_files
    files = Dir.glob("#{@repo_path}/app/**/*").reject { |f| File.directory?(f) }
    files = files.map {|file| file.split("/app/").last}
  end

  def present_in_both
    gem_app_files & repo_app_files
  end

end

@gp = GemParser.new(gem_name, repo_path)

puts @gp.present_in_both
kerchner commented 1 year ago

@maxturer look at .erb files @alepbloyd .rb files @alepbloyd also expand script scope to look in /public and /config/locales (.yml files)

kerchner commented 1 year ago

@alepbloyd Is this the most up-to-date version of this script? I'd like to place it either in the Wiki pages or in /scripts