Class: NugetHelper::NuSpec
- Inherits:
-
Object
- Object
- NugetHelper::NuSpec
- Defined in:
- lib/nuget_helper/nuspec.rb
Instance Attribute Summary collapse
-
#nuspec_filename ⇒ Object
readonly
Returns the value of attribute nuspec_filename.
-
#nuspec_path_base ⇒ Object
readonly
Returns the value of attribute nuspec_path_base.
-
#nuspec_xml_node ⇒ Object
readonly
Returns the value of attribute nuspec_xml_node.
Instance Method Summary collapse
-
#initialize(nuspec_path) ⇒ NuSpec
constructor
A new instance of NuSpec.
- #version ⇒ Object
Constructor Details
#initialize(nuspec_path) ⇒ NuSpec
Returns a new instance of NuSpec.
7 8 9 10 11 12 |
# File 'lib/nuget_helper/nuspec.rb', line 7 def initialize nuspec_path raise ArgumentError, 'nuspec path does not exist' unless File.exists? nuspec_path.to_s nuspec_path = nuspec_path.to_s unless nuspec_path.is_a? String @nuspec_xml_node = Nokogiri.XML(open(nuspec_path)) @nuspec_path_base, @nuspec_filename = File.split nuspec_path end |
Instance Attribute Details
#nuspec_filename ⇒ Object (readonly)
Returns the value of attribute nuspec_filename.
5 6 7 |
# File 'lib/nuget_helper/nuspec.rb', line 5 def nuspec_filename @nuspec_filename end |
#nuspec_path_base ⇒ Object (readonly)
Returns the value of attribute nuspec_path_base.
5 6 7 |
# File 'lib/nuget_helper/nuspec.rb', line 5 def nuspec_path_base @nuspec_path_base end |
#nuspec_xml_node ⇒ Object (readonly)
Returns the value of attribute nuspec_xml_node.
5 6 7 |
# File 'lib/nuget_helper/nuspec.rb', line 5 def nuspec_xml_node @nuspec_xml_node end |
Instance Method Details
#version ⇒ Object
13 14 15 16 |
# File 'lib/nuget_helper/nuspec.rb', line 13 def version el = @nuspec_xml_node.xpath("/package/metadata/version") SemVer.parse(el.text) end |