Skip to content

Commit

Permalink
Merge pull request #526 from jimryan/master
Browse files Browse the repository at this point in the history
Pass ActiveSupport::JSON.decode a string and not an IO when interfacing with GitHub API
  • Loading branch information
yuki24 committed Apr 9, 2014
2 parents 5c2ff8d + f228dbf commit b18825c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/generators/kaminari/views_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ def templates_for(template_engine) #:nodoc:
module GitHubApiHelper
def get_files_in_master
master_tree_sha = open('https://api.github.com/repos/amatsuda/kaminari_themes/git/refs/heads/master') do |json|
ActiveSupport::JSON.decode(json)['object']['sha']
ActiveSupport::JSON.decode(json.read)['object']['sha']
end
open('https://api.github.com/repos/amatsuda/kaminari_themes/git/trees/' + master_tree_sha + '?recursive=1') do |json|
blobs = ActiveSupport::JSON.decode(json)['tree'].find_all {|i| i['type'] == 'blob' }
blobs = ActiveSupport::JSON.decode(json.read)['tree'].find_all {|i| i['type'] == 'blob' }
blobs.map do |blob|
[blob['path'], blob['sha']]
end
Expand All @@ -109,7 +109,7 @@ def get_files_in_master

def get_content_for(path)
open('https://api.github.com/repos/amatsuda/kaminari_themes/contents/' + path) do |json|
Base64.decode64(ActiveSupport::JSON.decode(json)['content'])
Base64.decode64(ActiveSupport::JSON.decode(json.read)['content'])
end
end
module_function :get_content_for
Expand Down

0 comments on commit b18825c

Please sign in to comment.