Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Name some subroutines

  • Loading branch information...
commit 170a1213b07a35aab534f3117776bfd30599b752 1 parent 6d9bb8e
Daniela Wellisz & Kevin Fitzpatrick authored
Showing with 15 additions and 11 deletions.
  1. +15 −11 lib/license_finder/gem_spec_details.rb
26 lib/license_finder/gem_spec_details.rb
View
@@ -34,18 +34,11 @@ def determine_license
end
def license_files
- paths_for_license_names = Dir.glob(File.join(install_path, '**', LICENSE_FILE_NAMES))
- paths_for_license_names = paths_for_license_names.map do |path|
- if File.directory?(path)
- entries_in_directory = Dir::entries(path).reject {|p| p.match(/^(\.){1,2}$/) }
- entries_in_directory.map { |entry_name| File.join(path, entry_name) }
- else
- path
- end
+ paths_with_license_names = Dir.glob(File.join(install_path, '**', LICENSE_FILE_NAMES))
+ paths_for_license_files = paths_with_license_names.map do |path|
+ File.directory?(path) ? paths_for_files_in_license_directory(path) : path
end.flatten.uniq
- paths_for_license_names.map do |path|
- get_file_for_path(path)
- end
+ get_files_for_paths(paths_for_license_files)
end
def readme_files
@@ -92,5 +85,16 @@ def get_file_for_path(path)
file.include_license_text = include_license_text?
file
end
+
+ def paths_for_files_in_license_directory(path)
+ entries_in_directory = Dir::entries(path).reject { |p| p.match(/^(\.){1,2}$/) }
+ entries_in_directory.map { |entry_name| File.join(path, entry_name) }
+ end
+
+ def get_files_for_paths(paths_for_license_files)
+ paths_for_license_files.map do |path|
+ get_file_for_path(path)
+ end
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.