Sha256: a8ee87d2ed25d0533129659435c346becce1c820579545857b97840595c1ec53

Contents?: true

Size: 1.32 KB

Versions: 9

Compression:

Stored size: 1.32 KB

Contents

module Context
  module GitDeployerHelper
    def git_build(context)
      if context.present_localy?
        Dir.chdir(context.context_folder)
        git_pull(context)
      else
        local_dir = File.join(Dir.pwd, context.context_name)
        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)
      git_build(context) unless context.actual_working_directory?
      git ['pull']
    end

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

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

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

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

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
deploy-context-2.1.32 lib/deploy-context/deploy/git.rb
deploy-context-2.1.31.1.g6ccfd57 lib/deploy-context/deploy/git.rb
deploy-context-2.1.31 lib/deploy-context/deploy/git.rb
deploy-context-2.1.30.1.gdf915e9 lib/deploy-context/deploy/git.rb
deploy-context-2.1.30 lib/deploy-context/deploy/git.rb
deploy-context-2.1.29.1.gb63f262 lib/deploy-context/deploy/git.rb
deploy-context-2.1.29 lib/deploy-context/deploy/git.rb
deploy-context-2.1.28 lib/deploy-context/deploy/git.rb
deploy-context-2.1.27.1.gd07a6e7 lib/deploy-context/deploy/git.rb