Class: Docman::Deployers::GitDeployer

Inherits:
Deployer show all
Defined in:
lib/docman/deployers/git_deployer.rb

Instance Attribute Summary

Attributes inherited from Command

#type

Instance Method Summary collapse

Methods inherited from Deployer

#build, #build_dir, #build_dir_chain, #build_recursive, #config, create, #deploy, #describe, #execute, #files_deployed?, #initialize, #read_file, #read_version_file_param, register_deployer, #write_config_file, #write_version_file

Methods inherited from Command

#add_action, #add_actions, #config, create, #describe, #execute, #initialize, #perform, #prefix, register_command, #replace_placeholder, #run_actions, #run_with_hooks

Methods included from Logging

#log, logger, #logger, #prefix, #properties_info, #with_logging

Constructor Details

This class inherits a constructor from Docman::Deployers::Deployer

Instance Method Details

#pushObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/docman/deployers/git_deployer.rb', line 7

def push
  root = @docroot_config.root
  root.state_name = self['state']
  tag = nil

  if self['environment'].has_key?('tagger')
    filepath = File.join(root['full_build_path'], 'VERSION')
    prev_version = File.file?(filepath) ? File.open(filepath) : nil
    params = self['environment']['tagger']
    params['prev_version'] = prev_version
    version = Docman::Taggers::Tagger.create(params, root, self).perform
    File.open(filepath, 'w') {|f| f.write(version) }

    filepath = File.join(root['full_build_path'], 'version.properties')
    File.open(filepath, 'w') {|f| f.write("tag=#{version}") }

    tag = version
  end

  GitUtil.commit(root['full_build_path'], root['full_build_path'], 'Updated version', tag)
  GitUtil.push(root['full_build_path'], root.version)
end