Class: Nuspec
Instance Attribute Summary collapse
-
#authors ⇒ Object
Returns the value of attribute authors.
-
#copyright ⇒ Object
Returns the value of attribute copyright.
-
#description ⇒ Object
Returns the value of attribute description.
-
#icon_url ⇒ Object
(also: #iconUrl)
Returns the value of attribute icon_url.
-
#id ⇒ Object
Returns the value of attribute id.
-
#language ⇒ Object
Returns the value of attribute language.
-
#license_url ⇒ Object
(also: #licenseUrl)
Returns the value of attribute license_url.
-
#output_file ⇒ Object
Returns the value of attribute output_file.
-
#owners ⇒ Object
Returns the value of attribute owners.
-
#pretty_formatting ⇒ Object
writeonly
Sets the attribute pretty_formatting.
-
#project_url ⇒ Object
(also: #projectUrl)
Returns the value of attribute project_url.
-
#release_notes ⇒ Object
Returns the value of attribute release_notes.
-
#require_license_acceptance ⇒ Object
(also: #requireLicenseAcceptance)
Returns the value of attribute require_license_acceptance.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#title ⇒ Object
Returns the value of attribute title.
-
#version ⇒ Object
Returns the value of attribute version.
-
#working_directory ⇒ Object
Returns the value of attribute working_directory.
Attributes included from Logging
Instance Method Summary collapse
- #build(document) ⇒ Object
- #check_required_field(field, fieldname) ⇒ Object
- #dependency(id, version) ⇒ Object
- #execute ⇒ Object
- #file(src, target = nil, exclude = nil) ⇒ Object
- #framework_assembly(name, target_framework) ⇒ Object
-
#initialize ⇒ Nuspec
constructor
A new instance of Nuspec.
- #pretty_formatting? ⇒ Boolean
- #reference ⇒ Object
Methods included from Albacore::Task
clean_dirname, create_rake_task, include_config, included
Methods included from UpdateAttributes
Methods included from YAMLConfig
#configure, #load_config_by_task_name
Methods included from Logging
#create_logger, #log_device=, #log_level, #log_level=
Methods included from Failure
Constructor Details
#initialize ⇒ Nuspec
Returns a new instance of Nuspec.
77 78 79 80 81 82 83 |
# File 'lib/albacore/nuspec.rb', line 77 def initialize() @dependencies = [] @files = [] @frameworkAssemblies = [] @references = [] super() end |
Instance Attribute Details
#authors ⇒ Object
Returns the value of attribute authors.
63 64 65 |
# File 'lib/albacore/nuspec.rb', line 63 def @authors end |
#copyright ⇒ Object
Returns the value of attribute copyright.
63 64 65 |
# File 'lib/albacore/nuspec.rb', line 63 def copyright @copyright end |
#description ⇒ Object
Returns the value of attribute description.
63 64 65 |
# File 'lib/albacore/nuspec.rb', line 63 def description @description end |
#icon_url ⇒ Object Also known as: iconUrl
Returns the value of attribute icon_url.
63 64 65 |
# File 'lib/albacore/nuspec.rb', line 63 def icon_url @icon_url end |
#id ⇒ Object
Returns the value of attribute id.
63 64 65 |
# File 'lib/albacore/nuspec.rb', line 63 def id @id end |
#language ⇒ Object
Returns the value of attribute language.
63 64 65 |
# File 'lib/albacore/nuspec.rb', line 63 def language @language end |
#license_url ⇒ Object Also known as: licenseUrl
Returns the value of attribute license_url.
63 64 65 |
# File 'lib/albacore/nuspec.rb', line 63 def license_url @license_url end |
#output_file ⇒ Object
Returns the value of attribute output_file.
63 64 65 |
# File 'lib/albacore/nuspec.rb', line 63 def output_file @output_file end |
#owners ⇒ Object
Returns the value of attribute owners.
63 64 65 |
# File 'lib/albacore/nuspec.rb', line 63 def owners @owners end |
#pretty_formatting=(value) ⇒ Object (writeonly)
Sets the attribute pretty_formatting
85 86 87 |
# File 'lib/albacore/nuspec.rb', line 85 def pretty_formatting=(value) @pretty_formatting = value end |
#project_url ⇒ Object Also known as: projectUrl
Returns the value of attribute project_url.
63 64 65 |
# File 'lib/albacore/nuspec.rb', line 63 def project_url @project_url end |
#release_notes ⇒ Object
Returns the value of attribute release_notes.
63 64 65 |
# File 'lib/albacore/nuspec.rb', line 63 def release_notes @release_notes end |
#require_license_acceptance ⇒ Object Also known as: requireLicenseAcceptance
Returns the value of attribute require_license_acceptance.
63 64 65 |
# File 'lib/albacore/nuspec.rb', line 63 def require_license_acceptance @require_license_acceptance end |
#summary ⇒ Object
Returns the value of attribute summary.
63 64 65 |
# File 'lib/albacore/nuspec.rb', line 63 def summary @summary end |
#tags ⇒ Object
Returns the value of attribute tags.
63 64 65 |
# File 'lib/albacore/nuspec.rb', line 63 def @tags end |
#title ⇒ Object
Returns the value of attribute title.
63 64 65 |
# File 'lib/albacore/nuspec.rb', line 63 def title @title end |
#version ⇒ Object
Returns the value of attribute version.
63 64 65 |
# File 'lib/albacore/nuspec.rb', line 63 def version @version end |
#working_directory ⇒ Object
Returns the value of attribute working_directory.
63 64 65 |
# File 'lib/albacore/nuspec.rb', line 63 def working_directory @working_directory end |
Instance Method Details
#build(document) ⇒ Object
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/albacore/nuspec.rb', line 129 def build(document) document << REXML::XMLDecl.new package = document.add_element('package') package.add_attribute("xmlns", "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd") = package.add_element('metadata') .add_element('id').add_text(@id) .add_element('version').add_text(@version) .add_element('title').add_text(@title) unless @title.nil? .add_element('authors').add_text(@authors) .add_element('description').add_text(@description) .add_element('releaseNotes').add_text(@release_notes) .add_element('copyright').add_text(@copyright) .add_element('language').add_text(@language) unless @language.nil? .add_element('licenseUrl').add_text(@license_url) unless @license_url.nil? .add_element('projectUrl').add_text(@project_url) unless @project_url.nil? .add_element('owners').add_text(@owners) unless @owners.nil? .add_element('summary').add_text(@summary) unless @summary.nil? .add_element('iconUrl').add_text(@icon_url) unless @icon_url.nil? .add_element('requireLicenseAcceptance').add_text(@require_license_acceptance) unless @require_license_acceptance.nil? .add_element('tags').add_text(@tags) unless @tags.nil? if @dependencies.length > 0 depend = .add_element('dependencies') @dependencies.each {|x| x.render(depend)} end if @files.length > 0 files = package.add_element('files') @files.each {|x| x.render(files)} end if @frameworkAssemblies.length > 0 depend = .add_element('frameworkAssemblies') @frameworkAssemblies.each {|x| x.render(depend)} end if @references.length > 0 depend = .add_element('references') @references.each {|x| x.render(depend)} end end |
#check_required_field(field, fieldname) ⇒ Object
174 175 176 177 |
# File 'lib/albacore/nuspec.rb', line 174 def check_required_field(field, fieldname) raise "Nuspec: required field '#{fieldname}' is not defined" if field.nil? true end |
#dependency(id, version) ⇒ Object
90 91 92 |
# File 'lib/albacore/nuspec.rb', line 90 def dependency(id, version) @dependencies.push NuspecDependency.new(id, version) end |
#execute ⇒ Object
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/albacore/nuspec.rb', line 106 def execute check_required_field @output_file, "output_file" check_required_field @id, "id" check_required_field @version, "version" check_required_field @authors, "authors" check_required_field @description, "description" if(@working_directory.nil?) @working_output_file = @output_file else @working_output_file = File.join(@working_directory, @output_file) end builder = REXML::Document.new build(builder) output = "" builder.write(output, self.pretty_formatting? ? 2 : -1) @logger.debug "Writing #{@working_output_file}" File.open(@working_output_file, 'w') {|f| f.write(output) } end |
#file(src, target = nil, exclude = nil) ⇒ Object
94 95 96 |
# File 'lib/albacore/nuspec.rb', line 94 def file(src, target = nil, exclude = nil) @files.push NuspecFile.new(src, target, exclude) end |
#framework_assembly(name, target_framework) ⇒ Object
98 99 100 |
# File 'lib/albacore/nuspec.rb', line 98 def framework_assembly(name, target_framework) @frameworkAssemblies.push NuspecFrameworkAssembly.new(name, target_framework) end |
#pretty_formatting? ⇒ Boolean
86 87 88 |
# File 'lib/albacore/nuspec.rb', line 86 def pretty_formatting? @pretty_formatting end |
#reference ⇒ Object
102 103 104 |
# File 'lib/albacore/nuspec.rb', line 102 def reference @references.push NuspecReference.new(file) end |