Sha256: c7f8cb7704066de5e73278b80f5db89d624a54bfaeaeaab3936c059b9f4a1773

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

class Gitcycle
  module Ready

    def ready(*issues)
      require_git && require_config

      branch = pull

      if branch && !branch['collab']
        # Recreate pull request if force == true
        force   = branch['labels'] && branch['labels'].include?('Pass')
        force ||= branch['state']  && branch['state'] == 'closed'

        branch  = create_pull_request(branch, force)
      end

      if branch == false
        puts "Branch not found.\n".red
      elsif branch['collab']
        remote, branch = branch['home'], branch['source']
        puts "\nPushing branch '#{remote}/#{branch}'.\n".green
        run("git push #{remote} #{branch} -q")
      elsif branch['issue_url']
        puts "\nLabeling issue as 'Pending Review'.\n".green
        get('label',
          'branch[name]' => branch['name'],
          'labels' => [ 'Pending Review' ]
        )

        puts "Opening issue: #{branch['issue_url']}\n".green
        Launchy.open(branch['issue_url'])
      else
        puts "You have not pushed any commits to '#{branch['name']}'.\n".red
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gitcycle-0.3.5 lib/gitcycle/ready.rb
gitcycle-0.3.4 lib/gitcycle/ready.rb