Sha256: f61364d347258ffa6fed6267ba7e65a5cded771cfff8eb889fd3cdf1d7885767

Contents?: true

Size: 1.66 KB

Versions: 2

Compression:

Stored size: 1.66 KB

Contents

module Context
  module DeployHelpers
    module GitHelper
      def git_build(context)
        if context.present_localy?
          Dir.chdir(context.context_folder)
          context.git_pull(context)
        else
          local_dir = File.join(Dir.pwd, context.context_name)
          context.git context, ["clone git@github.com:JimboDragonGit/#{context.context_name}.git"] unless ::Dir.exist?(local_dir)
          context.move_folder(local_dir)
        end
      end

      def git_pull(context)
        context.git_build(context) unless context.actual_working_directory?
        context.git context, ['pull']
      end

      def git_commit(context)
        context.git_build(context)
        context.git context, ['add .']
        context.git context, ["commit -m 'Create #{context.context_name} automatic commit'"]
      end

      def git_release(context)
        context.git_build(context)
        context.git context, ['push', '--follow-tags']
      end

      def git_bump(context, level)
        context.git_build(context)
        context.git context, ['version-bump', level]
        context.git_commit(context)
      end

      def patch_reset(context)
        context.git_build(context)
        context.git_bump(context, 'minor')
      end

      def git_update_available?(context)
        context.git_build(context)
        # context.git ['log', "v#{context.version}"]
        context.git context, ['ls-remote origin', "v#{context.version}"]
      end

      def git_dirty_state?(context)
        context.git_build(context)
        # context.git ['log', "v#{context.version}"]
        context.get_data(["git status --porcelain"]).split('\n').count > 0
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
deploy-context-2.1.35 lib/deploy-context/deploy/git.rb
deploy-context-2.1.34.1.g531fe3b lib/deploy-context/deploy/git.rb