Sha256: 8d6fedcfdfb4da8b1229ae1b2c29489a724f5de603fe54781b83f1ddf34dc9dd

Contents?: true

Size: 1.11 KB

Versions: 16

Compression:

Stored size: 1.11 KB

Contents

require 'shipitron'
require 'shellwords'

module Shipitron
  module Server
    module Git
      class CloneLocalCopy
        include Metaractor

        required :application
        required :repository_url
        optional :repository_branch

        before do
          context.repository_branch ||= 'master'
        end

        def call
          Logger.info "Using this branch: #{repository_branch}"
          FileUtils.cd('/home/shipitron') do
            `git clone git-cache #{Shellwords.escape application} --recursive --branch #{Shellwords.escape repository_branch}`
          end

          Logger.info 'Using this git commit:'
          FileUtils.cd("/home/shipitron/#{application}") do
            context.git_sha = `git rev-parse --short=12 HEAD`.chomp
            Logger.info `git --no-pager log --format='%aN (%h): %s' -n 1`.chomp
          end
        end

        private
        def application
          context.application
        end

        def repository_url
          context.repository_url
        end

        def repository_branch
          context.repository_branch
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
shipitron-1.3.0 lib/shipitron/server/git/clone_local_copy.rb
shipitron-1.2.1 lib/shipitron/server/git/clone_local_copy.rb
shipitron-1.2.0 lib/shipitron/server/git/clone_local_copy.rb
shipitron-1.1.0 lib/shipitron/server/git/clone_local_copy.rb
shipitron-1.0.1 lib/shipitron/server/git/clone_local_copy.rb
shipitron-1.0.0 lib/shipitron/server/git/clone_local_copy.rb
shipitron-0.4.1 lib/shipitron/server/git/clone_local_copy.rb
shipitron-0.4.0 lib/shipitron/server/git/clone_local_copy.rb
shipitron-0.3.5 lib/shipitron/server/git/clone_local_copy.rb
shipitron-0.3.4 lib/shipitron/server/git/clone_local_copy.rb
shipitron-0.3.3 lib/shipitron/server/git/clone_local_copy.rb
shipitron-0.3.1 lib/shipitron/server/git/clone_local_copy.rb
shipitron-0.3.0 lib/shipitron/server/git/clone_local_copy.rb
shipitron-0.2.2 lib/shipitron/server/git/clone_local_copy.rb
shipitron-0.2.1 lib/shipitron/server/git/clone_local_copy.rb
shipitron-0.2.0 lib/shipitron/server/git/clone_local_copy.rb