lib/pt-flow/ui.rb in pt-flow-0.0.3 vs lib/pt-flow/ui.rb in pt-flow-0.0.4

- old
+ new

@@ -4,19 +4,10 @@ `git-tracker install` message 'git-tracker ready to add story numbers to commits' congrats 'All done!' end - def load_local_config - config = super - unless config[:github_url] - config[:github_url] = ask "What is the url for the Github repo?" - save_config(config, LOCAL_CONFIG_PATH) - end - config - end - def list @params[0] ||= 'all' super end @@ -41,11 +32,11 @@ end def request `git push origin #{current_branch}` task = PivotalTracker::Story.find(current_branch, @project.id) - `open '#{github_url}/pull/new/#{current_branch}?title=#{task.name} [##{task.id}]'` + `open '#{github_page_url}/pull/new/#{current_branch}?title=#{task.name} [##{task.id}]'` end def merge branch = @params[0] || current_branch `git checkout master` @@ -57,11 +48,13 @@ deliver_task(task) end private - def github_url - @local_config[:github_url] + 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