Sha256: dffcd5843ee989d099a0cb54c3ba46e74a2544ffe624bbb0498590e037fca5f1

Contents?: true

Size: 1.41 KB

Versions: 6

Compression:

Stored size: 1.41 KB

Contents

module Docman
  module Deployers
    class GitDeployer < Deployer

      register_deployer :git_deployer

      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_tag_var = "DOCMAN_TAG"
          if ENV.has_key? docman_tag_var and ENV[docman_tag_var].length > 0
            puts "Variable #{docman_tag_var} => #{ENV[docman_tag_var]}"
            version = ENV[docman_tag_var]
          else
            puts "Variable #{docman_tag_var} not found."
            version = Docman::Taggers::Tagger.create(params, root, self).perform
          end
          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')
        GitUtil.squash_commits(Docman::Application.instance.commit_count, nil, tag)
        GitUtil.push(root['full_build_path'], root.version(type: 'root'))
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
docman-0.0.105 lib/docman/deployers/git_deployer.rb
docman-0.0.104 lib/docman/deployers/git_deployer.rb
docman-0.0.103 lib/docman/deployers/git_deployer.rb
docman-0.0.102 lib/docman/deployers/git_deployer.rb
docman-0.0.101 lib/docman/deployers/git_deployer.rb
docman-0.0.100 lib/docman/deployers/git_deployer.rb