Sha256: 174f740b25f6cfc8244cddba8c23b1a8d5a79405000c0b2ba7eb05ce61359edf
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
class PT::Flow::UI < PT::UI def start tasks = @client.get_work(@project) table = PT::TasksTable.new(tasks) if @params[0] task = table[@params[0].to_i] else title("Available tasks in #{project_to_s}") task = select("Please select a task to start working on", table) end result = @client.assign_task(@project, task, owner) if result.errors.any? error(result.errors.errors) else start_task(task) congrats("Task assigned to #{owner}, checking out new branch!") `git checkout -B #{task.id}` end end def finish `git push origin #{current_branch}` task = PivotalTracker::Story.find(current_branch, @project.id) finish_task(task) pull_request_url = "#{github_page_url}/pull/new/#{current_branch}?title=#{task.name} [##{task.id}]&body=#{task.url}" `open '#{pull_request_url}'` end def deliver branch = @params[0] || current_branch `git checkout master` `git merge #{branch}` `git push origin master` `git push origin :#{branch}` `git branch -d #{branch}` task = PivotalTracker::Story.find(branch, @project.id) deliver_task(task) end private def github_page_url repo_url = `git config --get remote.origin.url`.strip stub = repo_url.match(/:(\S+\/\S+)\.git/)[1] "https://github.com/#{stub}" end def current_branch @current_branch ||= `git rev-parse --abbrev-ref HEAD`.strip end def owner @local_config[:user_name] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pt-flow-0.1.0 | lib/pt-flow/ui.rb |