{"action":"created","comment":{"url":"https://api.github.com/repos/ericroberts/tint/pulls/comments/71450011","id":71450011,"diff_hunk":"@@ -18,194 +18,288 @@\n   Dotenv.load\n end\n \n-class Tint < Sinatra::Base\n-  helpers Sinatra::Streaming\n+module Tint\n+  PROJECT_PATH = ENV[\"PROJECT_PATH\"]\n \n-  configure :development do\n-    register Sinatra::Reloader\n-  end\n+  class App < Sinatra::Base\n+    helpers Sinatra::Streaming\n \n-  set :environment, Sprockets::Environment.new\n+    configure :development do\n+      register Sinatra::Reloader\n+    end\n \n-  environment.append_path \"assets/stylesheets\"\n-  environment.css_compressor = :scss\n+    set :environment, Sprockets::Environment.new\n \n-  project_path = ENV['PROJECT_PATH']\n+    environment.append_path \"assets/stylesheets\"\n+    environment.css_compressor = :scss\n \n-  get \"/\" do\n-    erb :index\n-  end\n+    def project_path\n+      PROJECT_PATH\n+    end\n \n-  get \"/assets/*\" do\n-    env[\"PATH_INFO\"].sub!(\"/assets\", \"\")\n-    settings.environment.call(env)\n-  end\n+    get \"/\" do\n+      erb :index\n+    end\n \n-  get \"/files\" do\n-    files = Dir.glob(\"#{project_path}/*\")\n-    erb :\"files/index\", locals: { files: files, root: project_path }\n-  end\n+    get \"/assets/*\" do\n+      env[\"PATH_INFO\"].sub!(\"/assets\", \"\")\n+      settings.environment.call(env)\n+    end\n \n-  get \"/files/*\" do\n-    path = \"#{project_path}/#{params['splat'].join('/')}\"\n-    if File.directory?(path)\n-      files = Dir.glob(\"#{path}/*\")\n-      erb :\"files/index\", locals: { files: files, root: project_path }\n-    else\n-      is_text = FileMagic.open(:mime) do |magic|\n-        magic.file(path).split('/').first == 'text'\n-      end\n+    get \"/files\" do\n+      render_directory project_path\n+    end\n \n-      if is_text\n-        has_content, has_frontmatter = detect_content_or_frontmatter(path)\n-        if path.split(/\\./).last.downcase == 'yml' || !has_content\n-          data = YAML.safe_load(open(path))\n-          erb :\"files/yml\", locals: { data: data, path: \"/files\" + path.gsub(project_path, \"\") }\n+    get \"/files/*\" do\n+      path = \"#{project_path}/#{params['splat'].join('/')}\"\n+      file = Tint::File.new(path)\n+\n+      if file.directory?\n+        render_directory path\n+      elsif file.text?\n+        if path.split(/\\./).last.downcase == 'yml' || !file.content?","path":"app.rb","position":77,"original_position":77,"commit_id":"c8c3cb5e9685b2d4114ff30b49e69f58507c3353","original_commit_id":"c8c3cb5e9685b2d4114ff30b49e69f58507c3353","user":{"login":"singpolyma","id":12770,"avatar_url":"https://avatars.githubusercontent.com/u/12770?v=3","gravatar_id":"","url":"https://api.github.com/users/singpolyma","html_url":"https://github.com/singpolyma","followers_url":"https://api.github.com/users/singpolyma/followers","following_url":"https://api.github.com/users/singpolyma/following{/other_user}","gists_url":"https://api.github.com/users/singpolyma/gists{/gist_id}","starred_url":"https://api.github.com/users/singpolyma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/singpolyma/subscriptions","organizations_url":"https://api.github.com/users/singpolyma/orgs","repos_url":"https://api.github.com/users/singpolyma/repos","events_url":"https://api.github.com/users/singpolyma/events{/privacy}","received_events_url":"https://api.github.com/users/singpolyma/received_events","type":"User","site_admin":false},"body":"If we're making our own file class, perhaps a `#ext` is in order?","created_at":"2016-07-20T00:51:00Z","updated_at":"2016-07-20T00:51:00Z","html_url":"https://github.com/ericroberts/tint/pull/56#discussion_r71450011","pull_request_url":"https://api.github.com/repos/ericroberts/tint/pulls/56","_links":{"self":{"href":"https://api.github.com/repos/ericroberts/tint/pulls/comments/71450011"},"html":{"href":"https://github.com/ericroberts/tint/pull/56#discussion_r71450011"},"pull_request":{"href":"https://api.github.com/repos/ericroberts/tint/pulls/56"}}},"pull_request":{"url":"https://api.github.com/repos/ericroberts/tint/pulls/56","id":78072451,"html_url":"https://github.com/ericroberts/tint/pull/56","diff_url":"https://github.com/ericroberts/tint/pull/56.diff","patch_url":"https://github.com/ericroberts/tint/pull/56.patch","issue_url":"https://api.github.com/repos/ericroberts/tint/issues/56","number":56,"state":"open","locked":false,"title":"Breadcrumbs and parent folder link","user":{"login":"ericroberts","id":695547,"avatar_url":"https://avatars.githubusercontent.com/u/695547?v=3","gravatar_id":"","url":"https://api.github.com/users/ericroberts","html_url":"https://github.com/ericroberts","followers_url":"https://api.github.com/users/ericroberts/followers","following_url":"https://api.github.com/users/ericroberts/following{/other_user}","gists_url":"https://api.github.com/users/ericroberts/gists{/gist_id}","starred_url":"https://api.github.com/users/ericroberts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericroberts/subscriptions","organizations_url":"https://api.github.com/users/ericroberts/orgs","repos_url":"https://api.github.com/users/ericroberts/repos","events_url":"https://api.github.com/users/ericroberts/events{/privacy}","received_events_url":"https://api.github.com/users/ericroberts/received_events","type":"User","site_admin":false},"body":"Closes #8","created_at":"2016-07-20T00:43:18Z","updated_at":"2016-07-20T00:51:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1c504eee9e77ffc7eeabdc48f7d366525c7e9343","assignee":{"login":"singpolyma","id":12770,"avatar_url":"https://avatars.githubusercontent.com/u/12770?v=3","gravatar_id":"","url":"https://api.github.com/users/singpolyma","html_url":"https://github.com/singpolyma","followers_url":"https://api.github.com/users/singpolyma/followers","following_url":"https://api.github.com/users/singpolyma/following{/other_user}","gists_url":"https://api.github.com/users/singpolyma/gists{/gist_id}","starred_url":"https://api.github.com/users/singpolyma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/singpolyma/subscriptions","organizations_url":"https://api.github.com/users/singpolyma/orgs","repos_url":"https://api.github.com/users/singpolyma/repos","events_url":"https://api.github.com/users/singpolyma/events{/privacy}","received_events_url":"https://api.github.com/users/singpolyma/received_events","type":"User","site_admin":false},"assignees":[{"login":"singpolyma","id":12770,"avatar_url":"https://avatars.githubusercontent.com/u/12770?v=3","gravatar_id":"","url":"https://api.github.com/users/singpolyma","html_url":"https://github.com/singpolyma","followers_url":"https://api.github.com/users/singpolyma/followers","following_url":"https://api.github.com/users/singpolyma/following{/other_user}","gists_url":"https://api.github.com/users/singpolyma/gists{/gist_id}","starred_url":"https://api.github.com/users/singpolyma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/singpolyma/subscriptions","organizations_url":"https://api.github.com/users/singpolyma/orgs","repos_url":"https://api.github.com/users/singpolyma/repos","events_url":"https://api.github.com/users/singpolyma/events{/privacy}","received_events_url":"https://api.github.com/users/singpolyma/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ericroberts/tint/pulls/56/commits","review_comments_url":"https://api.github.com/repos/ericroberts/tint/pulls/56/comments","review_comment_url":"https://api.github.com/repos/ericroberts/tint/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ericroberts/tint/issues/56/comments","statuses_url":"https://api.github.com/repos/ericroberts/tint/statuses/c8c3cb5e9685b2d4114ff30b49e69f58507c3353","head":{"label":"ericroberts:folder-navigation","ref":"folder-navigation","sha":"c8c3cb5e9685b2d4114ff30b49e69f58507c3353","user":{"login":"ericroberts","id":695547,"avatar_url":"https://avatars.githubusercontent.com/u/695547?v=3","gravatar_id":"","url":"https://api.github.com/users/ericroberts","html_url":"https://github.com/ericroberts","followers_url":"https://api.github.com/users/ericroberts/followers","following_url":"https://api.github.com/users/ericroberts/following{/other_user}","gists_url":"https://api.github.com/users/ericroberts/gists{/gist_id}","starred_url":"https://api.github.com/users/ericroberts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericroberts/subscriptions","organizations_url":"https://api.github.com/users/ericroberts/orgs","repos_url":"https://api.github.com/users/ericroberts/repos","events_url":"https://api.github.com/users/ericroberts/events{/privacy}","received_events_url":"https://api.github.com/users/ericroberts/received_events","type":"User","site_admin":false},"repo":{"id":63621954,"name":"tint","full_name":"ericroberts/tint","owner":{"login":"ericroberts","id":695547,"avatar_url":"https://avatars.githubusercontent.com/u/695547?v=3","gravatar_id":"","url":"https://api.github.com/users/ericroberts","html_url":"https://github.com/ericroberts","followers_url":"https://api.github.com/users/ericroberts/followers","following_url":"https://api.github.com/users/ericroberts/following{/other_user}","gists_url":"https://api.github.com/users/ericroberts/gists{/gist_id}","starred_url":"https://api.github.com/users/ericroberts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericroberts/subscriptions","organizations_url":"https://api.github.com/users/ericroberts/orgs","repos_url":"https://api.github.com/users/ericroberts/repos","events_url":"https://api.github.com/users/ericroberts/events{/privacy}","received_events_url":"https://api.github.com/users/ericroberts/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ericroberts/tint","description":null,"fork":false,"url":"https://api.github.com/repos/ericroberts/tint","forks_url":"https://api.github.com/repos/ericroberts/tint/forks","keys_url":"https://api.github.com/repos/ericroberts/tint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ericroberts/tint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ericroberts/tint/teams","hooks_url":"https://api.github.com/repos/ericroberts/tint/hooks","issue_events_url":"https://api.github.com/repos/ericroberts/tint/issues/events{/number}","events_url":"https://api.github.com/repos/ericroberts/tint/events","assignees_url":"https://api.github.com/repos/ericroberts/tint/assignees{/user}","branches_url":"https://api.github.com/repos/ericroberts/tint/branches{/branch}","tags_url":"https://api.github.com/repos/ericroberts/tint/tags","blobs_url":"https://api.github.com/repos/ericroberts/tint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ericroberts/tint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ericroberts/tint/git/refs{/sha}","trees_url":"https://api.github.com/repos/ericroberts/tint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ericroberts/tint/statuses/{sha}","languages_url":"https://api.github.com/repos/ericroberts/tint/languages","stargazers_url":"https://api.github.com/repos/ericroberts/tint/stargazers","contributors_url":"https://api.github.com/repos/ericroberts/tint/contributors","subscribers_url":"https://api.github.com/repos/ericroberts/tint/subscribers","subscription_url":"https://api.github.com/repos/ericroberts/tint/subscription","commits_url":"https://api.github.com/repos/ericroberts/tint/commits{/sha}","git_commits_url":"https://api.github.com/repos/ericroberts/tint/git/commits{/sha}","comments_url":"https://api.github.com/repos/ericroberts/tint/comments{/number}","issue_comment_url":"https://api.github.com/repos/ericroberts/tint/issues/comments{/number}","contents_url":"https://api.github.com/repos/ericroberts/tint/contents/{+path}","compare_url":"https://api.github.com/repos/ericroberts/tint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ericroberts/tint/merges","archive_url":"https://api.github.com/repos/ericroberts/tint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ericroberts/tint/downloads","issues_url":"https://api.github.com/repos/ericroberts/tint/issues{/number}","pulls_url":"https://api.github.com/repos/ericroberts/tint/pulls{/number}","milestones_url":"https://api.github.com/repos/ericroberts/tint/milestones{/number}","notifications_url":"https://api.github.com/repos/ericroberts/tint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ericroberts/tint/labels{/name}","releases_url":"https://api.github.com/repos/ericroberts/tint/releases{/id}","deployments_url":"https://api.github.com/repos/ericroberts/tint/deployments","created_at":"2016-07-18T17:09:29Z","updated_at":"2016-07-19T21:06:11Z","pushed_at":"2016-07-20T00:43:18Z","git_url":"git://github.com/ericroberts/tint.git","ssh_url":"git@github.com:ericroberts/tint.git","clone_url":"https://github.com/ericroberts/tint.git","svn_url":"https://github.com/ericroberts/tint","homepage":null,"size":500,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":45,"forks":1,"open_issues":45,"watchers":0,"default_branch":"master"}},"base":{"label":"ericroberts:master","ref":"master","sha":"43eb7892759de3a778af22f01f65fd1c53f4313a","user":{"login":"ericroberts","id":695547,"avatar_url":"https://avatars.githubusercontent.com/u/695547?v=3","gravatar_id":"","url":"https://api.github.com/users/ericroberts","html_url":"https://github.com/ericroberts","followers_url":"https://api.github.com/users/ericroberts/followers","following_url":"https://api.github.com/users/ericroberts/following{/other_user}","gists_url":"https://api.github.com/users/ericroberts/gists{/gist_id}","starred_url":"https://api.github.com/users/ericroberts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericroberts/subscriptions","organizations_url":"https://api.github.com/users/ericroberts/orgs","repos_url":"https://api.github.com/users/ericroberts/repos","events_url":"https://api.github.com/users/ericroberts/events{/privacy}","received_events_url":"https://api.github.com/users/ericroberts/received_events","type":"User","site_admin":false},"repo":{"id":63621954,"name":"tint","full_name":"ericroberts/tint","owner":{"login":"ericroberts","id":695547,"avatar_url":"https://avatars.githubusercontent.com/u/695547?v=3","gravatar_id":"","url":"https://api.github.com/users/ericroberts","html_url":"https://github.com/ericroberts","followers_url":"https://api.github.com/users/ericroberts/followers","following_url":"https://api.github.com/users/ericroberts/following{/other_user}","gists_url":"https://api.github.com/users/ericroberts/gists{/gist_id}","starred_url":"https://api.github.com/users/ericroberts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericroberts/subscriptions","organizations_url":"https://api.github.com/users/ericroberts/orgs","repos_url":"https://api.github.com/users/ericroberts/repos","events_url":"https://api.github.com/users/ericroberts/events{/privacy}","received_events_url":"https://api.github.com/users/ericroberts/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ericroberts/tint","description":null,"fork":false,"url":"https://api.github.com/repos/ericroberts/tint","forks_url":"https://api.github.com/repos/ericroberts/tint/forks","keys_url":"https://api.github.com/repos/ericroberts/tint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ericroberts/tint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ericroberts/tint/teams","hooks_url":"https://api.github.com/repos/ericroberts/tint/hooks","issue_events_url":"https://api.github.com/repos/ericroberts/tint/issues/events{/number}","events_url":"https://api.github.com/repos/ericroberts/tint/events","assignees_url":"https://api.github.com/repos/ericroberts/tint/assignees{/user}","branches_url":"https://api.github.com/repos/ericroberts/tint/branches{/branch}","tags_url":"https://api.github.com/repos/ericroberts/tint/tags","blobs_url":"https://api.github.com/repos/ericroberts/tint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ericroberts/tint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ericroberts/tint/git/refs{/sha}","trees_url":"https://api.github.com/repos/ericroberts/tint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ericroberts/tint/statuses/{sha}","languages_url":"https://api.github.com/repos/ericroberts/tint/languages","stargazers_url":"https://api.github.com/repos/ericroberts/tint/stargazers","contributors_url":"https://api.github.com/repos/ericroberts/tint/contributors","subscribers_url":"https://api.github.com/repos/ericroberts/tint/subscribers","subscription_url":"https://api.github.com/repos/ericroberts/tint/subscription","commits_url":"https://api.github.com/repos/ericroberts/tint/commits{/sha}","git_commits_url":"https://api.github.com/repos/ericroberts/tint/git/commits{/sha}","comments_url":"https://api.github.com/repos/ericroberts/tint/comments{/number}","issue_comment_url":"https://api.github.com/repos/ericroberts/tint/issues/comments{/number}","contents_url":"https://api.github.com/repos/ericroberts/tint/contents/{+path}","compare_url":"https://api.github.com/repos/ericroberts/tint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ericroberts/tint/merges","archive_url":"https://api.github.com/repos/ericroberts/tint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ericroberts/tint/downloads","issues_url":"https://api.github.com/repos/ericroberts/tint/issues{/number}","pulls_url":"https://api.github.com/repos/ericroberts/tint/pulls{/number}","milestones_url":"https://api.github.com/repos/ericroberts/tint/milestones{/number}","notifications_url":"https://api.github.com/repos/ericroberts/tint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ericroberts/tint/labels{/name}","releases_url":"https://api.github.com/repos/ericroberts/tint/releases{/id}","deployments_url":"https://api.github.com/repos/ericroberts/tint/deployments","created_at":"2016-07-18T17:09:29Z","updated_at":"2016-07-19T21:06:11Z","pushed_at":"2016-07-20T00:43:18Z","git_url":"git://github.com/ericroberts/tint.git","ssh_url":"git@github.com:ericroberts/tint.git","clone_url":"https://github.com/ericroberts/tint.git","svn_url":"https://github.com/ericroberts/tint","homepage":null,"size":500,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":45,"forks":1,"open_issues":45,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ericroberts/tint/pulls/56"},"html":{"href":"https://github.com/ericroberts/tint/pull/56"},"issue":{"href":"https://api.github.com/repos/ericroberts/tint/issues/56"},"comments":{"href":"https://api.github.com/repos/ericroberts/tint/issues/56/comments"},"review_comments":{"href":"https://api.github.com/repos/ericroberts/tint/pulls/56/comments"},"review_comment":{"href":"https://api.github.com/repos/ericroberts/tint/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ericroberts/tint/pulls/56/commits"},"statuses":{"href":"https://api.github.com/repos/ericroberts/tint/statuses/c8c3cb5e9685b2d4114ff30b49e69f58507c3353"}}}}
{"actor":{"display_login":"singpolyma"}}