Class: Dependabot::FileUpdaters::Dotnet::Nuget::PackagesConfigDeclarationFinder
- Inherits:
-
Object
- Object
- Dependabot::FileUpdaters::Dotnet::Nuget::PackagesConfigDeclarationFinder
- Defined in:
- lib/dependabot/file_updaters/dotnet/nuget/packages_config_declaration_finder.rb
Constant Summary collapse
- DECLARATION_REGEX =
%r{<package [^>]*?/>| <package [^>]*?[^/]>.*?</package>}mx.freeze
Instance Attribute Summary collapse
-
#declaring_requirement ⇒ Object
readonly
Returns the value of attribute declaring_requirement.
-
#dependency_name ⇒ Object
readonly
Returns the value of attribute dependency_name.
-
#packages_config ⇒ Object
readonly
Returns the value of attribute packages_config.
Instance Method Summary collapse
- #declaration_nodes ⇒ Object
- #declaration_strings ⇒ Object
-
#initialize(dependency_name:, packages_config:, declaring_requirement:) ⇒ PackagesConfigDeclarationFinder
constructor
A new instance of PackagesConfigDeclarationFinder.
Constructor Details
#initialize(dependency_name:, packages_config:, declaring_requirement:) ⇒ PackagesConfigDeclarationFinder
Returns a new instance of PackagesConfigDeclarationFinder.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/dependabot/file_updaters/dotnet/nuget/packages_config_declaration_finder.rb', line 18 def initialize(dependency_name:, packages_config:, declaring_requirement:) @dependency_name = dependency_name @packages_config = packages_config @declaring_requirement = declaring_requirement if declaring_requirement[:file].split("/").last. casecmp("packages.config").zero? return end raise "Requirement not from packages.config!" end |
Instance Attribute Details
#declaring_requirement ⇒ Object (readonly)
Returns the value of attribute declaring_requirement.
15 16 17 |
# File 'lib/dependabot/file_updaters/dotnet/nuget/packages_config_declaration_finder.rb', line 15 def declaring_requirement @declaring_requirement end |
#dependency_name ⇒ Object (readonly)
Returns the value of attribute dependency_name.
15 16 17 |
# File 'lib/dependabot/file_updaters/dotnet/nuget/packages_config_declaration_finder.rb', line 15 def dependency_name @dependency_name end |
#packages_config ⇒ Object (readonly)
Returns the value of attribute packages_config.
15 16 17 |
# File 'lib/dependabot/file_updaters/dotnet/nuget/packages_config_declaration_finder.rb', line 15 def packages_config @packages_config end |
Instance Method Details
#declaration_nodes ⇒ Object
36 37 38 39 40 |
# File 'lib/dependabot/file_updaters/dotnet/nuget/packages_config_declaration_finder.rb', line 36 def declaration_nodes declaration_strings.map do |declaration_string| Nokogiri::XML(declaration_string) end end |
#declaration_strings ⇒ Object
32 33 34 |
# File 'lib/dependabot/file_updaters/dotnet/nuget/packages_config_declaration_finder.rb', line 32 def declaration_strings @declaration_strings ||= fetch_declaration_strings end |