Class: Resource::Version
Instance Method Summary collapse
-
#initialize(location, &block) ⇒ Version
constructor
A new instance of Version.
- #run ⇒ Object
Methods inherited from Base
inherited, #not_if, #set_base_defaults, #should_skip?, #unix_mode
Methods included from ClassAttr
Methods included from BlockAttr
Constructor Details
#initialize(location, &block) ⇒ Version
Returns a new instance of Version.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/resource/version.rb', line 9 def initialize location, &block set_base_defaults @location = location @current_version = 'n/a' @deployed_by = 'n/a' @server_info = 'n/a' @environment = 'n/a' @branch = 'n/a' @ip = 'n/a' @copy_to = '/tmp/' @version = ::Deploy::Version.new self.instance_eval(&block) end |
Instance Method Details
#run ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/resource/version.rb', line 23 def run Execution.block 'Deployment version file', @location, 'root' do |b| b.always_run true @version.deployed_by = @deployed_by @version.current_version = @current_version @version.add :server_info, @server_info @version.add :environment, @environment @version.add :branch, @branch @version.add :reset, @reset @version.add :ip, @ip @version.store_to_file @location Output.info 'Copying version file to', @copy_to b.run "cp #{@location} #{@copy_to}" b.run "chown #{@owner}:#{@owner} #{@copy_to}/#{::File.basename(@location)}" end end |