Sha256: d224b145fac7a73adb75fb8283edd3f0aa9455b7ca5b82a0a07b9c17d91cdc78

Contents?: true

Size: 1.58 KB

Versions: 2

Compression:

Stored size: 1.58 KB

Contents

module Autowow
  module Commands
    module Vcs
      def cmd
        ['git']
      end

      def terminal_options
        ['--no-pager']
      end

      def changes_not_on_remote(branch)
        cmd + terminal_options + ['log', branch, '--not', '--remotes']
      end

      def branch_list
        cmd + ['for-each-ref', "--format=%(refname)", 'refs/heads/']
      end

      def push(branch = nil, remote = nil)
        cmd + ['push'] + [branch, remote].compact
      end

      def rebase(branch)
        cmd + ['rebase', branch]
      end

      def git_status
        cmd + ['status']
      end

      def stash
        cmd + ['stash']
      end

      def stash_pop
        cmd + ['stash', 'pop']
      end

      def current_branch
        cmd + ['symbolic-ref', '--short', 'HEAD']
      end

      def checkout(existing_branch)
        cmd + ['checkout', existing_branch]
      end

      def pull
        cmd + ['pull']
      end

      def branch_force_delete(branch)
        cmd + ['branch', '-D', branch]
      end

      def create(branch)
        cmd + ['checkout', '-b', branch]
      end

      def set_upstream(remote, branch)
        cmd + ['push', '--set-upstream', remote, branch]
      end

      def remotes
        cmd + ['remote', '-v']
      end

      def fetch(remote)
        cmd + ['fetch', remote]
      end

      def merge(compare)
        cmd + ['merge', compare]
      end

      def branch
        cmd + ['branch']
      end

      def add_remote(name, url)
        cmd + ['remote', 'add', name, url]
      end

      include ReflectionUtils::CreateModuleFunctions
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
autowow-0.8.0 lib/autowow/commands/vcs.rb
autowow-0.7.0 lib/autowow/commands/vcs.rb