Skip to content

Commit

Permalink
Merge branch 'snowblink/master' into integration
Browse files Browse the repository at this point in the history
  • Loading branch information
drnic committed Jan 30, 2011
2 parents 2ad3fff + df4893a commit c9354c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/commands/helpers.rb
Expand Up @@ -334,8 +334,9 @@
if cache_network_data(options)
begin
return cache_data(user)
rescue SocketError
rescue Exception => e
STDERR.puts "*** Warning: There was a problem accessing the network."
STDERR.puts e
rv = get_cache
STDERR.puts "Using cached data."
rv
Expand Down Expand Up @@ -373,12 +374,17 @@
File.join(dir, 'commits-cache')
end

helper :github_user do
`git config --get github.user`.chomp
end

helper :github_token do
`git config --get github.token`.chomp
end

helper :cache_data do |user|
raw_data = Kernel.open(network_meta_for(user)).read
File.open( network_cache_path, 'w' ) do |out|
out.write(raw_data)
end
data = JSON.parse(raw_data)
`curl -s -L -F 'login=#{github_user}' -F 'token=#{github_token}' #{network_meta_for(user)} -o #{network_cache_path}`
get_cache
end

helper :cache_expired? do
Expand Down
1 change: 1 addition & 0 deletions lib/github/ui.rb
@@ -1,3 +1,4 @@
require 'rubygems'
require "readline"
require "highline"
module GitHub
Expand Down

0 comments on commit c9354c7

Please sign in to comment.