GitHub PullRequestReviewCommentEvent at 2014-03-27 17:37:01
Repository: dolly
Actor: javierg
Payload: {"comment":{"url":"https://api.github.com/repos/amco/dolly/pulls/comments/11034493","id":11034493,"diff_hunk":"@@ -0,0 +1,85 @@\n+require 'dolly/document'\n+require 'dolly/couch_view_doc'\n+\n+module Dolly\n+  class DesignTasksHelper\n+\n+    EXTENSIONS = {coffee: 'coffeescript', erl: 'erlang', js: 'javascript'}\n+    DESIGNS_PATH = File.join(Rails.root, 'db', 'designs')\n+\n+    def load!\n+      documents = {}\n+\n+      design_docs.each do |view_path|\n+        doc_id = view_path.split('/')[-2]\n+        file_type = file_type( view_path )\n+        view_name, view_functions = process_view( view_path )\n+        documents[ doc_id ] ||= CouchViewDoc.new(doc_id, file_type)\n+        documents[ doc_id ][:views][view_name] = view_functions\n+      end\n+\n+      documents.each{ |id, doc| post_process_design doc }\n+\n+      Dolly::Document.bulk_save\n+    end\n+\n+    def design_docs\n+      base_path = File.join(DESIGNS_PATH, '*/*')\n+      Dir[ base_path ]\n+    end\n+\n+    def file_type filename\n+      ext = File.extname filename\n+      ext_key = ext.gsub('.','').to_sym\n+      EXTENSIONS[ ext_key ]\n+    end\n+\n+    def post_process_design doc\n+      if remote_doc = retrieve_doc( doc.id )\n+        update_existing_design_document doc, *doc_to_hash( remote_doc )\n+      else\n+        create_design_document doc\n+      end","path":"lib/dolly/design_tasks_helper.rb","position":42,"original_position":42,"commit_id":"489c0ded2dc7edc707dd61cc581184268fdd8fa6","original_commit_id":"489c0ded2dc7edc707dd61cc581184268fdd8fa6","user":{"login":"javierg","id":149980,"avatar_url":"https://avatars.githubusercontent.com/u/149980?","gravatar_id":"7498f194fa0e46658e7071619fb66878","url":"https://api.github.com/users/javierg","html_url":"https://github.com/javierg","followers_url":"https://api.github.com/users/javierg/followers","following_url":"https://api.github.com/users/javierg/following{/other_user}","gists_url":"https://api.github.com/users/javierg/gists{/gist_id}","starred_url":"https://api.github.com/users/javierg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javierg/subscriptions","organizations_url":"https://api.github.com/users/javierg/orgs","repos_url":"https://api.github.com/users/javierg/repos","events_url":"https://api.github.com/users/javierg/events{/privacy}","received_events_url":"https://api.github.com/users/javierg/received_events","type":"User","site_admin":false},"body":":ok_hand: ","created_at":"2014-03-27T17:37:01Z","updated_at":"2014-03-27T17:37:01Z","html_url":"https://github.com/amco/dolly/pull/25#discussion_r11034493","pull_request_url":"https://api.github.com/repos/amco/dolly/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/amco/dolly/pulls/comments/11034493"},"html":{"href":"https://github.com/amco/dolly/pull/25#discussion_r11034493"},"pull_request":{"href":"https://api.github.com/repos/amco/dolly/pulls/25"}}}}