Class: Vanagon::Component::DSL
- Inherits:
-
Object
- Object
- Vanagon::Component::DSL
- Defined in:
- lib/vanagon/component/dsl.rb
Instance Method Summary collapse
-
#_component ⇒ Vanagon::Component
Accessor for the component.
-
#add_debian_activate_triggers(activate_name) ⇒ Object
Adds activate trigger name to be watched.
-
#add_debian_interest_triggers(pkg_state, scripts, interest_name) ⇒ Object
Adds interest trigger based on the specified packaging state and interest name.
-
#add_postinstall_action(pkg_state, scripts) ⇒ Object
Adds action to run during the postinstall phase of packaging.
-
#add_postinstall_required_action(pkg_state, scripts) ⇒ Object
Add post installation action that must exit successfully before restarting the service.
-
#add_postremove_action(pkg_state, scripts) ⇒ Object
Adds action to run during the postremoval phase of packaging.
-
#add_preinstall_action(pkg_state, scripts) ⇒ Object
Adds action to run during the preinstall phase of packaging.
-
#add_preremove_action(pkg_state, scripts) ⇒ Object
Adds action to run during the preremoval phase of packaging.
-
#add_rpm_ghost_file(path) ⇒ Object
Add a %ghost entry to the rpm %files section.
-
#add_rpm_install_triggers(pkg_state, scripts, pkg) ⇒ Object
Adds trigger for scripts to be run on specified pkg_state.
-
#add_source(uri, options = {}) ⇒ Object
This will add a source to the project and put it in the workdir alongside the other sources.
-
#apply_patch(patch, options = {}) ⇒ Object
Add a patch to the list of patches to apply to the component’s source after unpacking.
-
#build(&block) ⇒ Object
Set or add to the build call for the component.
-
#build_dir(path) ⇒ Object
Set a build dir relative to the source directory.
-
#build_requires(build_requirement) ⇒ Object
build_requires adds a requirements to the list of build time dependencies that will need to be fetched from an external source before this component can be built.
-
#check(&block) ⇒ Object
Set or add to the check call for the component.
-
#check_pkg_state_array(pkg_state) ⇒ Object
Checks that the array of pkg_state is valid (install AND/OR upgrade).
-
#clone_option(option, value) ⇒ Object
Sets clone option for git repository.
-
#component(name, &block) {|_self, @component.settings, @component.platform| ... } ⇒ Object
Primary way of interacting with the DSL.
-
#configfile(file, mode: nil, owner: nil, group: nil) ⇒ Object
Marks a file as a configfile to ensure that it is not overwritten on upgrade if it has been modified.
-
#configure(&block) ⇒ Object
Set or add to the configure call for the component.
-
#conflicts(pkgname, version = nil) ⇒ Object
Indicates that this component conflicts with another package, so both cannot be installed at the same time.
-
#directory(dir, mode: nil, owner: nil, group: nil) ⇒ Object
Adds a directory to the list of directories provided by the project, to be included in any packages of the project.
-
#dirname(path) ⇒ Object
Set a source dir.
-
#environment(*env) ⇒ Object
Adds a set of environment overrides to the environment for a component.
-
#get_version_forced ⇒ Object
Force version determination for components.
-
#homepage(homepage) ⇒ Object
Set the homepage for the component.
-
#initialize(name, settings, platform) ⇒ Vanagon::Component::DSL
constructor
Constructor for the DSL object.
-
#install(&block) ⇒ Object
Set or add to the install call for the component.
-
#install_configfile(source, target, mode: '0644', owner: nil, group: nil) ⇒ Object
Shorthand to install a file and mark it as a configfile.
-
#install_file(source, target, mode: nil, owner: nil, group: nil) ⇒ Object
Copies a file from source to target during the install phase of the component.
- #install_only(install_only) ⇒ Object
-
#install_service(service_file, default_file = nil, service_name = @component.name, **options) ⇒ Object
install_service adds the commands to install the various files on disk during the package build and registers the service with the project.
- #license(license) ⇒ Object
-
#link(source, target) ⇒ Object
link will add a command to the install to create a symlink from source to target.
-
#load_from_json(file) ⇒ Object
Loads and parses json from a file.
-
#method_missing(method_name, *args) ⇒ Object
All purpose getter.
-
#mirror(url) ⇒ Object
Sets a mirror url for the source of this component.
-
#provides(provide, version = nil) ⇒ Object
Indicates that this component provides a system level package.
-
#ref(the_ref) ⇒ Object
Sets the ref of the source for use in a git source.
-
#replaces(replacement, version = nil) ⇒ Object
Indicates that this component replaces a system level package.
-
#requires(requirement, version = nil) ⇒ Object
requires adds a requirement to the list of runtime requirements for the component.
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
- #sum(value) ⇒ Object (also: #md5sum, #sha1sum, #sha256sum, #sha512sum)
-
#url(uri) ⇒ Object
Sets the canonical URL or URI for the upstream source of this component.
-
#version(ver) ⇒ Object
Sets the version for the component.
Constructor Details
#initialize(name, settings, platform) ⇒ Vanagon::Component::DSL
Constructor for the DSL object
16 17 18 19 |
# File 'lib/vanagon/component/dsl.rb', line 16 def initialize(name, settings, platform) @name = name @component = Vanagon::Component.new(@name, settings, platform) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
All purpose getter. This object, which is passed to the component block, won’t have easy access to the attributes of the @component, so we make a getter for each attribute.
We only magically handle get_ methods, any other methods just get the standard method_missing treatment.
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/vanagon/component/dsl.rb', line 43 def method_missing(method_name, *args) attribute_match = method_name.to_s.match(/get_(.*)/) if attribute_match attribute = attribute_match.captures.first else super end @component.send(attribute) end |
Instance Method Details
#_component ⇒ Vanagon::Component
Accessor for the component.
32 33 34 |
# File 'lib/vanagon/component/dsl.rb', line 32 def _component @component end |
#add_debian_activate_triggers(activate_name) ⇒ Object
Adds activate trigger name to be watched
502 503 504 |
# File 'lib/vanagon/component/dsl.rb', line 502 def add_debian_activate_triggers(activate_name) @component.activate_triggers << OpenStruct.new(:activate_name => activate_name) end |
#add_debian_interest_triggers(pkg_state, scripts, interest_name) ⇒ Object
Adds interest trigger based on the specified packaging state and interest name.
492 493 494 495 496 497 |
# File 'lib/vanagon/component/dsl.rb', line 492 def add_debian_interest_triggers(pkg_state, scripts, interest_name) pkg_state = Array(pkg_state) scripts = Array(scripts) check_pkg_state_array(pkg_state) @component.interest_triggers << OpenStruct.new(:pkg_state => pkg_state, :scripts => scripts, :interest_name => interest_name) end |
#add_postinstall_action(pkg_state, scripts) ⇒ Object
Adds action to run during the postinstall phase of packaging
521 522 523 524 525 526 |
# File 'lib/vanagon/component/dsl.rb', line 521 def add_postinstall_action(pkg_state, scripts) pkg_state = Array(pkg_state) scripts = Array(scripts) check_pkg_state_array(pkg_state) @component.postinstall_actions << OpenStruct.new(:pkg_state => pkg_state, :scripts => scripts) end |
#add_postinstall_required_action(pkg_state, scripts) ⇒ Object
Add post installation action that must exit successfully before restarting the service
511 512 513 514 |
# File 'lib/vanagon/component/dsl.rb', line 511 def add_postinstall_required_action(pkg_state, scripts) check_pkg_state_array(pkg_state) @component.postinstall_required_actions << OpenStruct.new(:pkg_state => Array(pkg_state), :scripts => Array(scripts)) end |
#add_postremove_action(pkg_state, scripts) ⇒ Object
Adds action to run during the postremoval phase of packaging
559 560 561 562 563 564 565 566 567 |
# File 'lib/vanagon/component/dsl.rb', line 559 def add_postremove_action(pkg_state, scripts) pkg_state = Array(pkg_state) scripts = Array(scripts) if pkg_state.empty? || !(pkg_state - ["upgrade", "removal"]).empty? raise Vanagon::Error, "#{pkg_state} should be an array containing one or more of ['removal', 'upgrade']" end @component.postremove_actions << OpenStruct.new(:pkg_state => pkg_state, :scripts => scripts) end |
#add_preinstall_action(pkg_state, scripts) ⇒ Object
Adds action to run during the preinstall phase of packaging
466 467 468 469 470 471 |
# File 'lib/vanagon/component/dsl.rb', line 466 def add_preinstall_action(pkg_state, scripts) pkg_state = Array(pkg_state) scripts = Array(scripts) check_pkg_state_array(pkg_state) @component.preinstall_actions << OpenStruct.new(:pkg_state => pkg_state, :scripts => scripts) end |
#add_preremove_action(pkg_state, scripts) ⇒ Object
Adds action to run during the preremoval phase of packaging
533 534 535 536 537 538 539 540 541 |
# File 'lib/vanagon/component/dsl.rb', line 533 def add_preremove_action(pkg_state, scripts) pkg_state = Array(pkg_state) scripts = Array(scripts) if pkg_state.empty? || !(pkg_state - ["upgrade", "removal"]).empty? raise Vanagon::Error, "#{pkg_state} should be an array containing one or more of ['removal', 'upgrade']" end @component.preremove_actions << OpenStruct.new(:pkg_state => pkg_state, :scripts => scripts) end |
#add_rpm_ghost_file(path) ⇒ Object
Add a %ghost entry to the rpm %files section. This indicates a file that is tracked in the rpm database (the package manages it), but not installed. Used, for example, when setting up alternative packages for use with update-alternatives.
299 300 301 |
# File 'lib/vanagon/component/dsl.rb', line 299 def add_rpm_ghost_file(path) @component.add_rpm_ghost_file(Vanagon::Common::Pathname.file(path)) end |
#add_rpm_install_triggers(pkg_state, scripts, pkg) ⇒ Object
Adds trigger for scripts to be run on specified pkg_state.
479 480 481 482 483 484 |
# File 'lib/vanagon/component/dsl.rb', line 479 def add_rpm_install_triggers(pkg_state, scripts, pkg) pkg_state = Array(pkg_state) scripts = Array(scripts) check_pkg_state_array(pkg_state) @component.install_triggers << OpenStruct.new(:pkg_state => pkg_state, :scripts => scripts, :pkg => pkg) end |
#add_source(uri, options = {}) ⇒ Object
This will add a source to the project and put it in the workdir alongside the other sources
403 404 405 |
# File 'lib/vanagon/component/dsl.rb', line 403 def add_source(uri, = {}) @component.sources << OpenStruct.new(.merge({ url: uri })) end |
#apply_patch(patch, options = {}) ⇒ Object
Add a patch to the list of patches to apply to the component’s source after unpacking
95 96 97 |
# File 'lib/vanagon/component/dsl.rb', line 95 def apply_patch(patch, = {}) @component.patches << Vanagon::Patch.new(patch, @component, ) end |
#build(&block) ⇒ Object
Set or add to the build call for the component. The commands required to build the component before testing/installing it.
68 69 70 |
# File 'lib/vanagon/component/dsl.rb', line 68 def build(&block) @component.build << yield end |
#build_dir(path) ⇒ Object
Set a build dir relative to the source directory.
The build dir will be created before the configure block runs and configure/build/install commands will be run in the build dir.
365 366 367 368 369 370 371 |
# File 'lib/vanagon/component/dsl.rb', line 365 def build_dir(path) if Pathname.new(path).relative? @component.build_dir = path else raise Vanagon::Error, "build_dir should be a relative path, but '#{path}' looks to be absolute." end end |
#build_requires(build_requirement) ⇒ Object
build_requires adds a requirements to the list of build time dependencies that will need to be fetched from an external source before this component can be built. build_requires can also be satisfied by other components in the same project.
127 128 129 |
# File 'lib/vanagon/component/dsl.rb', line 127 def build_requires(build_requirement) @component.build_requires << build_requirement end |
#check(&block) ⇒ Object
Set or add to the check call for the component. The commands required to test the component before installing it.
75 76 77 |
# File 'lib/vanagon/component/dsl.rb', line 75 def check(&block) @component.check << yield end |
#check_pkg_state_array(pkg_state) ⇒ Object
Checks that the array of pkg_state is valid (install AND/OR upgrade). Returns vanagon error if invalid
455 456 457 458 459 |
# File 'lib/vanagon/component/dsl.rb', line 455 def check_pkg_state_array(pkg_state) if pkg_state.empty? || (pkg_state - ["install", "upgrade"]).any? raise Vanagon::Error, "#{pkg_state} should be an array containing one or more of ['install', 'upgrade']" end end |
#clone_option(option, value) ⇒ Object
Sets clone option for git repository
346 347 348 349 350 |
# File 'lib/vanagon/component/dsl.rb', line 346 def clone_option(option, value) option_sym = option.to_sym @component.[:clone_options] ||= {} @component.[:clone_options][option_sym] = value end |
#component(name, &block) {|_self, @component.settings, @component.platform| ... } ⇒ Object
Primary way of interacting with the DSL
25 26 27 |
# File 'lib/vanagon/component/dsl.rb', line 25 def component(name, &block) yield(self, @component.settings, @component.platform) end |
#configfile(file, mode: nil, owner: nil, group: nil) ⇒ Object
Marks a file as a configfile to ensure that it is not overwritten on upgrade if it has been modified
260 261 262 263 264 265 266 267 268 269 |
# File 'lib/vanagon/component/dsl.rb', line 260 def configfile(file, mode: nil, owner: nil, group: nil) # I AM SO SORRY @component.delete_file file if @component.platform.name =~ /solaris-10|osx/ @component.install << "mv '#{file}' '#{file}.pristine'" @component.add_file Vanagon::Common::Pathname.configfile("#{file}.pristine", mode: mode, owner: owner, group: group) else @component.add_file Vanagon::Common::Pathname.configfile(file, mode: mode, owner: owner, group: group) end end |
#configure(&block) ⇒ Object
Set or add to the configure call for the component. The commands required to configure the component before building it.
61 62 63 |
# File 'lib/vanagon/component/dsl.rb', line 61 def configure(&block) @component.configure << yield end |
#conflicts(pkgname, version = nil) ⇒ Object
Indicates that this component conflicts with another package, so both cannot be installed at the same time. Conflicts can be collected and used by the project and package.
161 162 163 |
# File 'lib/vanagon/component/dsl.rb', line 161 def conflicts(pkgname, version = nil) @component.conflicts << OpenStruct.new(:pkgname => pkgname, :version => version) end |
#directory(dir, mode: nil, owner: nil, group: nil) ⇒ Object
Adds a directory to the list of directories provided by the project, to be included in any packages of the project
413 414 415 416 417 418 419 420 421 422 423 424 |
# File 'lib/vanagon/component/dsl.rb', line 413 def directory(dir, mode: nil, owner: nil, group: nil) # rubocop:disable Metrics/AbcSize install_flags = ['-d'] if @component.platform.is_windows? unless mode.nil? && owner.nil? && group.nil? VanagonLogger.info "You're trying to set the mode, owner, or group for windows. I don't know how to do that, ignoring!" end else install_flags << "-m '#{mode}'" unless mode.nil? end @component.install << "#{@component.platform.install} #{install_flags.join(' ')} '#{dir}'" @component.directories << Vanagon::Common::Pathname.new(dir, mode: mode, owner: owner, group: group) end |
#dirname(path) ⇒ Object
Set a source dir
The build dir will be created when the source archive is unpacked. This should be used when the unpacked directory name does not match the source archive name.
387 388 389 390 391 392 393 |
# File 'lib/vanagon/component/dsl.rb', line 387 def dirname(path) if Pathname.new(path).relative? @component.dirname = path else raise Vanagon::Error, "dirname should be a relative path, but '#{path}' looks to be absolute." end end |
#environment(*env) ⇒ Object
Adds a set of environment overrides to the environment for a component. This environment is included in the configure, build and install steps.
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
# File 'lib/vanagon/component/dsl.rb', line 430 def environment(*env) if env.size == 1 && env.first.is_a?(Hash) VanagonLogger.info <<-WARNING.undent the component DSL method signature #environment({Key => Value}) is deprecated and will be removed by Vanagon 1.0.0. Please update your project configurations to use the form: #environment(key, value) WARNING return @component.environment.merge!(env.first) elsif env.size == 2 return @component.environment[env.first] = env.last end raise ArgumentError, <<-WARNING.undent component DSL method #environment only accepts a single Hash (deprecated) or a key-value pair (preferred): environment({"KEY" => "value"}) environment("KEY", "value") WARNING end |
#get_version_forced ⇒ Object
Force version determination for components
If the component doesn’t already have a version set (which normally happens for git sources), the source will be fetched into a temporary directory to attempt to figure out the version if the source type supports :version. This directory will be cleaned once the get_sources method returns
550 551 552 |
# File 'lib/vanagon/component/dsl.rb', line 550 def get_version_forced @component.force_version end |
#homepage(homepage) ⇒ Object
Set the homepage for the component
580 581 582 |
# File 'lib/vanagon/component/dsl.rb', line 580 def homepage(homepage) @component.homepage = homepage end |
#install(&block) ⇒ Object
Set or add to the install call for the component. The commands required to install the component.
82 83 84 |
# File 'lib/vanagon/component/dsl.rb', line 82 def install(&block) @component.install << yield end |
#install_configfile(source, target, mode: '0644', owner: nil, group: nil) ⇒ Object
Shorthand to install a file and mark it as a configfile
275 276 277 278 |
# File 'lib/vanagon/component/dsl.rb', line 275 def install_configfile(source, target, mode: '0644', owner: nil, group: nil) install_file(source, target, mode: mode, owner: owner, group: group) configfile(target, mode: mode, owner: owner, group: group) end |
#install_file(source, target, mode: nil, owner: nil, group: nil) ⇒ Object
Copies a file from source to target during the install phase of the component
241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
# File 'lib/vanagon/component/dsl.rb', line 241 def install_file(source, target, mode: nil, owner: nil, group: nil) # rubocop:disable Metrics/AbcSize @component.install << "#{@component.platform.install} -d '#{File.dirname(target)}'" @component.install << "#{@component.platform.copy} -p '#{source}' '#{target}'" if @component.platform.is_windows? unless mode.nil? && owner.nil? && group.nil? VanagonLogger.info "You're trying to set the mode, owner, or group for windows. I don't know how to do that, ignoring!" end else mode ||= '0644' @component.install << "chmod #{mode} '#{target}'" end @component.add_file Vanagon::Common::Pathname.file(target, mode: mode, owner: owner, group: group) end |
#install_only(install_only) ⇒ Object
573 574 575 |
# File 'lib/vanagon/component/dsl.rb', line 573 def install_only(install_only) @component.install_only = install_only end |
#install_service(service_file, default_file = nil, service_name = @component.name, **options) ⇒ Object
install_service adds the commands to install the various files on disk during the package build and registers the service with the project
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/vanagon/component/dsl.rb', line 175 def install_service(service_file, default_file = nil, service_name = @component.name, **) # rubocop:disable Metrics/AbcSize init_system = [:init_system] || @component.platform.servicetype servicedir = @component.platform.get_service_dir(init_system) case init_system when "sysv" target_service_file = File.join(servicedir, service_name) target_default_file = File.join(@component.platform.defaultdir, service_name) target_mode = '0755' default_mode = '0644' when "systemd" target_service_file = File.join(servicedir, "#{service_name}.service") target_default_file = File.join(@component.platform.defaultdir, service_name) target_mode = '0644' default_mode = '0644' when "launchd" target_service_file = File.join(servicedir, "#{service_name}.plist") target_mode = '0644' default_mode = '0644' when "smf" # modify version in smf manifest so service gets restarted after package upgrade @component.install << %{#{@component.platform.sed} -ri 's/(<service.*version=)(".*")/\\1"#{Time.now.to_i}"/' #{service_file}} target_service_file = File.join(servicedir, [:service_type].to_s, "#{service_name}.xml") target_default_file = File.join(@component.platform.defaultdir, service_name) target_mode = '0644' default_mode = '0755' when "aix" @component.service << OpenStruct.new(:name => service_name, :service_command => File.read(service_file).chomp) # Return here because there is no file to install, just a string read in return when "windows" @component.service << OpenStruct.new( \ :bindir_id => "#{service_name.gsub(/[^A-Za-z0-9]/, '').upcase}BINDIR", \ :service_file => service_file, \ :component_group_id => "#{service_name.gsub(/[^A-Za-z0-9]/, '')}Component" \ ) # return here as we are just collecting the name of the service file to put into the harvest filter list. return else fail "Don't know how to install the #{init_system}. Please teach #install_service how to do this." end # Install the service and default files if [:link_target] install_file(service_file, [:link_target], mode: target_mode) link [:link_target], target_service_file else install_file(service_file, target_service_file, mode: target_mode) end if default_file install_file(default_file, target_default_file, mode: default_mode) configfile target_default_file end # Register the service for use in packaging @component.service << OpenStruct.new(:name => service_name, :service_file => target_service_file, :type => [:service_type], :init_system => init_system) end |
#license(license) ⇒ Object
569 570 571 |
# File 'lib/vanagon/component/dsl.rb', line 569 def license(license) @component.license = license end |
#link(source, target) ⇒ Object
link will add a command to the install to create a symlink from source to target
284 285 286 287 288 289 290 291 |
# File 'lib/vanagon/component/dsl.rb', line 284 def link(source, target) @component.install << "#{@component.platform.install} -d '#{File.dirname(target)}'" # Use a bash conditional to only create the link if it doesn't already point to the correct source. # This allows rerunning the install step to be idempotent, rather than failing because the link # already exists. @component.install << "([[ '#{target}' -ef '#{source}' ]] || ln -s '#{source}' '#{target}')" @component.add_file Vanagon::Common::Pathname.file(target) end |
#load_from_json(file) ⇒ Object
Loads and parses json from a file. Will treat the keys in the json as methods to invoke on the component in question
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/vanagon/component/dsl.rb', line 105 def load_from_json(file) if File.exist?(file) data = JSON.parse(File.read(file)) raise "Hash required. Got '#{data.class}' when parsing '#{file}'" unless data.is_a?(Hash) data.each do |key, value| if self.respond_to?(key) self.send(key, value) else fail "Component does not have a '#{key}' method to invoke. Maybe your bespoke json has a typo?" end end else fail "Cannot load component data from '#{file}'. It does not exist." end end |
#mirror(url) ⇒ Object
Sets a mirror url for the source of this component
322 323 324 |
# File 'lib/vanagon/component/dsl.rb', line 322 def mirror(url) @component.mirrors << url end |
#provides(provide, version = nil) ⇒ Object
Indicates that this component provides a system level package. Provides can be collected and used by the project and package.
151 152 153 |
# File 'lib/vanagon/component/dsl.rb', line 151 def provides(provide, version = nil) @component.provides << OpenStruct.new(:provide => provide, :version => version) end |
#ref(the_ref) ⇒ Object
Sets the ref of the source for use in a git source
339 340 341 |
# File 'lib/vanagon/component/dsl.rb', line 339 def ref(the_ref) @component.[:ref] = the_ref end |
#replaces(replacement, version = nil) ⇒ Object
Indicates that this component replaces a system level package. Replaces can be collected and used by the project and package.
143 144 145 |
# File 'lib/vanagon/component/dsl.rb', line 143 def replaces(replacement, version = nil) @component.replaces << OpenStruct.new(:replacement => replacement, :version => version) end |
#requires(requirement, version = nil) ⇒ Object
requires adds a requirement to the list of runtime requirements for the component
135 136 137 |
# File 'lib/vanagon/component/dsl.rb', line 135 def requires(requirement, version = nil) @component.requires << OpenStruct.new(:requirement => requirement, :version => version) end |
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
54 55 56 |
# File 'lib/vanagon/component/dsl.rb', line 54 def respond_to_missing?(method_name, include_private = false) method_name.to_s.start_with?('get_') || super end |
#sum(value) ⇒ Object Also known as: md5sum, sha1sum, sha256sum, sha512sum
326 327 328 329 330 |
# File 'lib/vanagon/component/dsl.rb', line 326 def sum(value) type = __callee__.to_s.gsub(/sum$/, '') @component.[:sum] = value @component.[:sum_type] = type end |
#url(uri) ⇒ Object
Sets the canonical URL or URI for the upstream source of this component
314 315 316 |
# File 'lib/vanagon/component/dsl.rb', line 314 def url(uri) @component.url = uri.to_s end |
#version(ver) ⇒ Object
Sets the version for the component
306 307 308 |
# File 'lib/vanagon/component/dsl.rb', line 306 def version(ver) @component.version = ver end |