Class: Dependabot::Gradle::FileFetcher::SettingsFileParser
- Inherits:
-
Object
- Object
- Dependabot::Gradle::FileFetcher::SettingsFileParser
- Defined in:
- lib/dependabot/gradle/file_fetcher/settings_file_parser.rb
Instance Method Summary collapse
-
#initialize(settings_file:) ⇒ SettingsFileParser
constructor
A new instance of SettingsFileParser.
- #subproject_paths ⇒ Object
Constructor Details
#initialize(settings_file:) ⇒ SettingsFileParser
Returns a new instance of SettingsFileParser.
9 10 11 |
# File 'lib/dependabot/gradle/file_fetcher/settings_file_parser.rb', line 9 def initialize(settings_file:) @settings_file = settings_file end |
Instance Method Details
#subproject_paths ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dependabot/gradle/file_fetcher/settings_file_parser.rb', line 13 def subproject_paths subprojects = [] comment_free_content.scan(function_regex("include")) do args = Regexp.last_match.named_captures.fetch("args") args = args.split(",") args = args.map { |p| p.gsub(/["']/, "").strip }.compact subprojects += args end subprojects = subprojects.uniq subproject_dirs = subprojects.map do |proj| if comment_free_content.match?(project_dir_regex(proj)) comment_free_content.match(project_dir_regex(proj)). named_captures.fetch("path").sub(%r{^/}, "") else proj.tr(":", "/").sub(%r{^/}, "") end end subproject_dirs.uniq end |