Sha256: 629131a517eed4d3390103b70c1c21e15fc2f5bfc19c3c8c7287f66d88f4a27e

Contents?: true

Size: 1.65 KB

Versions: 4

Compression:

Stored size: 1.65 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 ["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

4 entries across 4 versions & 1 rubygems

Version Path
deploy-context-2.1.34 lib/deploy-context/deploy/git.rb
deploy-context-2.1.33.2.gfbb24ca lib/deploy-context/deploy/git.rb
deploy-context-2.1.33 lib/deploy-context/deploy/git.rb
deploy-context-2.1.32.15.g7b29619 lib/deploy-context/deploy/git.rb