Sha256: 424596d864a710606aba4aee3f954bdc393daace797d3c333e2ebe866461a4a1

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

module Middleman
  module Deploy
    module Strategies
      module Git
        class Submodule < Base
          def process
            Dir.chdir(build_dir) do
              checkout_branch
              pull_submodule
              commit_branch
            end

            commit_submodule
          end

          private

          def commit_submodule
            current_branch  = `git rev-parse --abbrev-ref HEAD`
            message         = add_signature_to_commit_message('Deployed')

            `git add #{build_dir}`
            `git commit --allow-empty -m "#{message}"`
            `git push origin #{current_branch}`
          end

          def pull_submodule
            `git fetch`
            `git stash`
            `git rebase #{remote}/#{branch}`
            `git stash pop`

            if $CHILD_STATUS.exitstatus == 1
              puts "Can't deploy! Please resolve conflicts. Then process to manual commit and push on #{branch} branch."
              exit
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
middleman-deploy-2.0.0.pre.alpha lib/middleman-deploy/strategies/git/submodule.rb