Sha256: c6705a566bdcb5181e2a4534bb4cd61396b44a7dcdad4b662c898b4cba6873b8

Contents?: true

Size: 1.84 KB

Versions: 14

Compression:

Stored size: 1.84 KB

Contents

module Context
  module DeployHelpers
    module GitHelper
      def git(context, commands)
        context.chef_exec(context, %w(git) + commands)
      end

      def git_build(context)
        if context.present_localy?
          Dir.chdir(context.context_folder)
          context.git_pull(context)
        else
          context.error_log context.context_name, "Cloning from source in #{Dir.pwd}"
          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, %w(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

14 entries across 14 versions & 1 rubygems

Version Path
deploy-context-2.2.0.3.gec16643.4.g20d2d42.4.g17e8559.12.g831d0a8.4.gbb2ab14.12.g0bc028d libraries/deploy-context/deploy/git.rb
deploy-context-2.2.0.3.gec16643.4.g20d2d42.4.g17e8559.12.g831d0a8.4.gbb2ab14.4.gb48499b libraries/deploy-context/deploy/git.rb
deploy-context-2.2.0.3.gec16643.4.g20d2d42.4.g17e8559.12.g831d0a8.4.gbb2ab14 libraries/deploy-context/deploy/git.rb
deploy-context-2.2.0.3.gec16643.4.g20d2d42.4.g17e8559.12.g831d0a8 libraries/deploy-context/deploy/git.rb
deploy-context-2.2.0.3.gec16643.4.g20d2d42.4.g17e8559.8.g299e50a libraries/deploy-context/deploy/git.rb
deploy-context-2.2.0.3.gec16643.4.g20d2d42.4.g17e8559 libraries/deploy-context/deploy/git.rb
deploy-context-2.2.0.3.gec16643.4.g20d2d42 libraries/deploy-context/deploy/git.rb
deploy-context-2.2.0.3.gec16643 libraries/deploy-context/deploy/git.rb
deploy-context-2.1.37.6.gec1e116.4.g6190201 libraries/deploy-context/deploy/git.rb
deploy-context-2.1.37.6.gec1e116 libraries/deploy-context/deploy/git.rb
deploy-context-2.1.35.3.g2abab85.16.g399fb24.9.g1523b69.8.ga24e5ef libraries/deploy-context/deploy/git.rb
deploy-context-2.1.35.3.g2abab85.16.g399fb24.9.g1523b69.3.g0fb07cc libraries/deploy-context/deploy/git.rb
deploy-context-2.1.35.3.g2abab85.16.g399fb24.9.g1523b69 libraries/deploy-context/deploy/git.rb
deploy-context-2.1.35.3.g2abab85.16.g399fb24 lib/deploy-context/deploy/git.rb