Last active
December 17, 2015 06:28
-
-
Save juliancheal/5565394 to your computer and use it in GitHub Desktop.
DM-Whisky-Mapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cd to dm-mapper's directory | |
# cd to lib | |
ruby_classes = [] | |
ObjectSpace.each_object do |o| | |
ruby_classes << o if o.is_a?(Class) | |
end | |
require 'rake' | |
ruby_files = Rake::FileList.new "**/*.rb" | |
gem_defined_classes = scan_filelist_for_defined_classes(ruby_files) | |
files_referring_to_foreign_classes = | |
ruby_files.each_with_object({}) { |file_path, file_to_foreign_classes| | |
class_names_from_file = all_class_names_referred_to_in(file_path) | |
foreign_classes = class_names_from_file - gem_defined_classes | |
unless foreign_classes.empty? | |
file_to_foreign_classes[file_path] = foreign_classes | |
end | |
} | |
# NOTE: we need scoped class names to be able to compare against ObjectSpace | |
def scan_filelist_for_defined_classes | |
end | |
# NOTE: we need scoped class names to be able to compare against ObjectSpace | |
def all_class_names_referred_to_in | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment