{"action":"created","comment":{"url":"https://api.github.com/repos/ashfurrow/playgroundbook/pulls/comments/76521192","id":76521192,"diff_hunk":"@@ -0,0 +1,112 @@\n+require File.expand_path('../../spec_helper', __FILE__)\n+\n+module Playgroundbook\n+  describe Renderer do\n+    include FakeFS::SpecHelpers\n+    let(:renderer) { Renderer.new(yaml_file_name, contents_manifest_generator, chapter_collator, test_ui) }\n+    let(:yaml_file_name) { 'book.yml' }\n+    let(:contents_manifest_generator) { double(ContentsManifestGenerator) }\n+    let(:chapter_collator) { double(ChapterCollator) }\n+    let(:test_ui) { Cork::Board.new(silent: true) }\n+\n+    before do\n+      File.open(yaml_file_name, 'w') do |file|\n+        file.write(test_book_metadata.to_yaml)\n+      end\n+\n+      allow(contents_manifest_generator).to receive(:generate!)\n+      allow(chapter_collator).to receive(:collate!)\n+    end\n+\n+    it 'initializes correctly' do\n+      expect(renderer.yaml_file_name) == yaml_file_name\n+    end\n+\n+    it 'explodes when there is no playground' do\n+      expect{renderer.render!}.to raise_error\n+    end\n+\n+    context 'with a playground' do\n+      before do\n+        Dir.mkdir('assets')\n+        FileUtils.touch('assets/file.png')\n+        Dir.mkdir('test_chapter.playground/')\n+        File.open('test_chapter.playground/Contents.swift', 'w') do |file|\n+          file.write('')\n+        end\n+      end\n+\n+      it 'creates a directory with book name' do\n+        renderer.render!\n+\n+        expect(Dir.exist?('Testing Book.playgroundbook')).to be_truthy\n+      end\n+\n+      it 'creates a resources folder' do\n+        renderer.render!\n+\n+        expect(Dir.exist?('Testing Book.playgroundbook/Contents/Resources')).to be_truthy\n+      end\n+\n+      it 'copies a resources folder contents' do\n+        renderer.render!\n+        \n+        expect(File.exist?('Testing Book.playgroundbook/Contents/Resources/file.png')).to be_truthy\n+      end\n+\n+      context 'within an existing playgroundbook directory' do\n+        before do\n+          Dir.mkdir('Testing Book.playgroundbook')\n+        end\n+\n+        it 'does not explode when the directory already exists' do\n+          expect { renderer.render! }.to_not raise_error\n+        end\n+\n+        it 'creates a Contents directory within the main bundle dir' do\n+          renderer.render!\n+\n+          expect(Dir.exist?('Testing Book.playgroundbook/Contents')).to be_truthy\n+        end\n+\n+        context 'within the Contents directory' do\n+          before do\n+            Dir.mkdir('Testing Book.playgroundbook/Contents')\n+          end\n+\n+          it 'does not explode when the Contents directory already exists' do\n+            expect { renderer.render! }.to_not raise_error\n+          end\n+\n+          it 'renders main manifest' do\n+            expect(contents_manifest_generator).to receive(:generate!)\n+\n+            renderer.render!\n+          end\n+\n+          it 'creates a Chapters directory within the Contents dir' do\n+            renderer.render!\n+\n+            expect(Dir.exist?('Testing Book.playgroundbook/Contents/Chapters')).to be_truthy\n+          end\n+\n+          context 'within the Chapters directory' do\n+            before do\n+              Dir.mkdir('Testing Book.playgroundbook/Contents/Chapters')\n+            end\n+\n+            it 'does not explode when the Chapters directory already exists' do\n+              expect { renderer.render! }.to_not raise_error\n+            end\n+\n+            it 'generates each chapter' do\n+              expect(chapter_collator).to receive(:collate!)\n+\n+              renderer.render!\n+            end\n+          end\n+        end\n+      end\n+    end\n+  end\n+end","path":"spec/playgroundbook_renderer_spec/playgroundbook_renderer_spec.rb","position":112,"original_position":112,"commit_id":"0fe75ecbdfff7fdbba4abc123be2aed737d9ac06","original_commit_id":"0fe75ecbdfff7fdbba4abc123be2aed737d9ac06","user":{"login":"orta","id":49038,"avatar_url":"https://avatars.githubusercontent.com/u/49038?v=3","gravatar_id":"","url":"https://api.github.com/users/orta","html_url":"https://github.com/orta","followers_url":"https://api.github.com/users/orta/followers","following_url":"https://api.github.com/users/orta/following{/other_user}","gists_url":"https://api.github.com/users/orta/gists{/gist_id}","starred_url":"https://api.github.com/users/orta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orta/subscriptions","organizations_url":"https://api.github.com/users/orta/orgs","repos_url":"https://api.github.com/users/orta/repos","events_url":"https://api.github.com/users/orta/events{/privacy}","received_events_url":"https://api.github.com/users/orta/received_events","type":"User","site_admin":false},"body":"this is well tested 👍 ","created_at":"2016-08-27T19:25:55Z","updated_at":"2016-08-27T19:25:55Z","html_url":"https://github.com/ashfurrow/playgroundbook/pull/15#discussion_r76521192","pull_request_url":"https://api.github.com/repos/ashfurrow/playgroundbook/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/ashfurrow/playgroundbook/pulls/comments/76521192"},"html":{"href":"https://github.com/ashfurrow/playgroundbook/pull/15#discussion_r76521192"},"pull_request":{"href":"https://api.github.com/repos/ashfurrow/playgroundbook/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/ashfurrow/playgroundbook/pulls/15","id":82637498,"html_url":"https://github.com/ashfurrow/playgroundbook/pull/15","diff_url":"https://github.com/ashfurrow/playgroundbook/pull/15.diff","patch_url":"https://github.com/ashfurrow/playgroundbook/pull/15.patch","issue_url":"https://api.github.com/repos/ashfurrow/playgroundbook/issues/15","number":15,"state":"closed","locked":false,"title":"Initial work on Rendering","user":{"login":"ashfurrow","id":498212,"avatar_url":"https://avatars.githubusercontent.com/u/498212?v=3","gravatar_id":"","url":"https://api.github.com/users/ashfurrow","html_url":"https://github.com/ashfurrow","followers_url":"https://api.github.com/users/ashfurrow/followers","following_url":"https://api.github.com/users/ashfurrow/following{/other_user}","gists_url":"https://api.github.com/users/ashfurrow/gists{/gist_id}","starred_url":"https://api.github.com/users/ashfurrow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashfurrow/subscriptions","organizations_url":"https://api.github.com/users/ashfurrow/orgs","repos_url":"https://api.github.com/users/ashfurrow/repos","events_url":"https://api.github.com/users/ashfurrow/events{/privacy}","received_events_url":"https://api.github.com/users/ashfurrow/received_events","type":"User","site_admin":false},"body":"Fixes #14.\r\n\r\nBasically I'm splitting the project into two independent code paths: one for linting and one for rendering. Feedback welcome as always. \r\n\r\nLeft to complete:\r\n\r\n- [x] Generate playground chapter and page directories for each chapter.\r\n- [x] Generate a manifest for each chapter.\r\n- [x] Generate a manifest for each page.\r\n- [x] Copy each playground page to the approach playground chapter's page directory.\r\n- [x] Update documentation in readme.\r\n- [x] More UI output. ","created_at":"2016-08-24T23:58:20Z","updated_at":"2016-08-27T19:25:55Z","closed_at":"2016-08-27T16:49:05Z","merged_at":"2016-08-27T16:49:05Z","merge_commit_sha":"f1c165644813cee6d34ae2f65451d37a89225371","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ashfurrow/playgroundbook/pulls/15/commits","review_comments_url":"https://api.github.com/repos/ashfurrow/playgroundbook/pulls/15/comments","review_comment_url":"https://api.github.com/repos/ashfurrow/playgroundbook/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ashfurrow/playgroundbook/issues/15/comments","statuses_url":"https://api.github.com/repos/ashfurrow/playgroundbook/statuses/0fe75ecbdfff7fdbba4abc123be2aed737d9ac06","head":{"label":"ashfurrow:render","ref":"render","sha":"0fe75ecbdfff7fdbba4abc123be2aed737d9ac06","user":{"login":"ashfurrow","id":498212,"avatar_url":"https://avatars.githubusercontent.com/u/498212?v=3","gravatar_id":"","url":"https://api.github.com/users/ashfurrow","html_url":"https://github.com/ashfurrow","followers_url":"https://api.github.com/users/ashfurrow/followers","following_url":"https://api.github.com/users/ashfurrow/following{/other_user}","gists_url":"https://api.github.com/users/ashfurrow/gists{/gist_id}","starred_url":"https://api.github.com/users/ashfurrow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashfurrow/subscriptions","organizations_url":"https://api.github.com/users/ashfurrow/orgs","repos_url":"https://api.github.com/users/ashfurrow/repos","events_url":"https://api.github.com/users/ashfurrow/events{/privacy}","received_events_url":"https://api.github.com/users/ashfurrow/received_events","type":"User","site_admin":false},"repo":{"id":63914039,"name":"playgroundbook","full_name":"ashfurrow/playgroundbook","owner":{"login":"ashfurrow","id":498212,"avatar_url":"https://avatars.githubusercontent.com/u/498212?v=3","gravatar_id":"","url":"https://api.github.com/users/ashfurrow","html_url":"https://github.com/ashfurrow","followers_url":"https://api.github.com/users/ashfurrow/followers","following_url":"https://api.github.com/users/ashfurrow/following{/other_user}","gists_url":"https://api.github.com/users/ashfurrow/gists{/gist_id}","starred_url":"https://api.github.com/users/ashfurrow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashfurrow/subscriptions","organizations_url":"https://api.github.com/users/ashfurrow/orgs","repos_url":"https://api.github.com/users/ashfurrow/repos","events_url":"https://api.github.com/users/ashfurrow/events{/privacy}","received_events_url":"https://api.github.com/users/ashfurrow/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ashfurrow/playgroundbook","description":"Linter for Swift Playground books","fork":false,"url":"https://api.github.com/repos/ashfurrow/playgroundbook","forks_url":"https://api.github.com/repos/ashfurrow/playgroundbook/forks","keys_url":"https://api.github.com/repos/ashfurrow/playgroundbook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ashfurrow/playgroundbook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ashfurrow/playgroundbook/teams","hooks_url":"https://api.github.com/repos/ashfurrow/playgroundbook/hooks","issue_events_url":"https://api.github.com/repos/ashfurrow/playgroundbook/issues/events{/number}","events_url":"https://api.github.com/repos/ashfurrow/playgroundbook/events","assignees_url":"https://api.github.com/repos/ashfurrow/playgroundbook/assignees{/user}","branches_url":"https://api.github.com/repos/ashfurrow/playgroundbook/branches{/branch}","tags_url":"https://api.github.com/repos/ashfurrow/playgroundbook/tags","blobs_url":"https://api.github.com/repos/ashfurrow/playgroundbook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ashfurrow/playgroundbook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ashfurrow/playgroundbook/git/refs{/sha}","trees_url":"https://api.github.com/repos/ashfurrow/playgroundbook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ashfurrow/playgroundbook/statuses/{sha}","languages_url":"https://api.github.com/repos/ashfurrow/playgroundbook/languages","stargazers_url":"https://api.github.com/repos/ashfurrow/playgroundbook/stargazers","contributors_url":"https://api.github.com/repos/ashfurrow/playgroundbook/contributors","subscribers_url":"https://api.github.com/repos/ashfurrow/playgroundbook/subscribers","subscription_url":"https://api.github.com/repos/ashfurrow/playgroundbook/subscription","commits_url":"https://api.github.com/repos/ashfurrow/playgroundbook/commits{/sha}","git_commits_url":"https://api.github.com/repos/ashfurrow/playgroundbook/git/commits{/sha}","comments_url":"https://api.github.com/repos/ashfurrow/playgroundbook/comments{/number}","issue_comment_url":"https://api.github.com/repos/ashfurrow/playgroundbook/issues/comments{/number}","contents_url":"https://api.github.com/repos/ashfurrow/playgroundbook/contents/{+path}","compare_url":"https://api.github.com/repos/ashfurrow/playgroundbook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ashfurrow/playgroundbook/merges","archive_url":"https://api.github.com/repos/ashfurrow/playgroundbook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ashfurrow/playgroundbook/downloads","issues_url":"https://api.github.com/repos/ashfurrow/playgroundbook/issues{/number}","pulls_url":"https://api.github.com/repos/ashfurrow/playgroundbook/pulls{/number}","milestones_url":"https://api.github.com/repos/ashfurrow/playgroundbook/milestones{/number}","notifications_url":"https://api.github.com/repos/ashfurrow/playgroundbook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ashfurrow/playgroundbook/labels{/name}","releases_url":"https://api.github.com/repos/ashfurrow/playgroundbook/releases{/id}","deployments_url":"https://api.github.com/repos/ashfurrow/playgroundbook/deployments","created_at":"2016-07-22T01:34:09Z","updated_at":"2016-08-27T19:10:56Z","pushed_at":"2016-08-27T16:54:26Z","git_url":"git://github.com/ashfurrow/playgroundbook.git","ssh_url":"git@github.com:ashfurrow/playgroundbook.git","clone_url":"https://github.com/ashfurrow/playgroundbook.git","svn_url":"https://github.com/ashfurrow/playgroundbook","homepage":null,"size":251,"stargazers_count":14,"watchers_count":14,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":14,"default_branch":"master"}},"base":{"label":"ashfurrow:master","ref":"master","sha":"81db43afff0425dc6c5b420d1d3a5842cef30a0f","user":{"login":"ashfurrow","id":498212,"avatar_url":"https://avatars.githubusercontent.com/u/498212?v=3","gravatar_id":"","url":"https://api.github.com/users/ashfurrow","html_url":"https://github.com/ashfurrow","followers_url":"https://api.github.com/users/ashfurrow/followers","following_url":"https://api.github.com/users/ashfurrow/following{/other_user}","gists_url":"https://api.github.com/users/ashfurrow/gists{/gist_id}","starred_url":"https://api.github.com/users/ashfurrow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashfurrow/subscriptions","organizations_url":"https://api.github.com/users/ashfurrow/orgs","repos_url":"https://api.github.com/users/ashfurrow/repos","events_url":"https://api.github.com/users/ashfurrow/events{/privacy}","received_events_url":"https://api.github.com/users/ashfurrow/received_events","type":"User","site_admin":false},"repo":{"id":63914039,"name":"playgroundbook","full_name":"ashfurrow/playgroundbook","owner":{"login":"ashfurrow","id":498212,"avatar_url":"https://avatars.githubusercontent.com/u/498212?v=3","gravatar_id":"","url":"https://api.github.com/users/ashfurrow","html_url":"https://github.com/ashfurrow","followers_url":"https://api.github.com/users/ashfurrow/followers","following_url":"https://api.github.com/users/ashfurrow/following{/other_user}","gists_url":"https://api.github.com/users/ashfurrow/gists{/gist_id}","starred_url":"https://api.github.com/users/ashfurrow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashfurrow/subscriptions","organizations_url":"https://api.github.com/users/ashfurrow/orgs","repos_url":"https://api.github.com/users/ashfurrow/repos","events_url":"https://api.github.com/users/ashfurrow/events{/privacy}","received_events_url":"https://api.github.com/users/ashfurrow/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ashfurrow/playgroundbook","description":"Linter for Swift Playground books","fork":false,"url":"https://api.github.com/repos/ashfurrow/playgroundbook","forks_url":"https://api.github.com/repos/ashfurrow/playgroundbook/forks","keys_url":"https://api.github.com/repos/ashfurrow/playgroundbook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ashfurrow/playgroundbook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ashfurrow/playgroundbook/teams","hooks_url":"https://api.github.com/repos/ashfurrow/playgroundbook/hooks","issue_events_url":"https://api.github.com/repos/ashfurrow/playgroundbook/issues/events{/number}","events_url":"https://api.github.com/repos/ashfurrow/playgroundbook/events","assignees_url":"https://api.github.com/repos/ashfurrow/playgroundbook/assignees{/user}","branches_url":"https://api.github.com/repos/ashfurrow/playgroundbook/branches{/branch}","tags_url":"https://api.github.com/repos/ashfurrow/playgroundbook/tags","blobs_url":"https://api.github.com/repos/ashfurrow/playgroundbook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ashfurrow/playgroundbook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ashfurrow/playgroundbook/git/refs{/sha}","trees_url":"https://api.github.com/repos/ashfurrow/playgroundbook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ashfurrow/playgroundbook/statuses/{sha}","languages_url":"https://api.github.com/repos/ashfurrow/playgroundbook/languages","stargazers_url":"https://api.github.com/repos/ashfurrow/playgroundbook/stargazers","contributors_url":"https://api.github.com/repos/ashfurrow/playgroundbook/contributors","subscribers_url":"https://api.github.com/repos/ashfurrow/playgroundbook/subscribers","subscription_url":"https://api.github.com/repos/ashfurrow/playgroundbook/subscription","commits_url":"https://api.github.com/repos/ashfurrow/playgroundbook/commits{/sha}","git_commits_url":"https://api.github.com/repos/ashfurrow/playgroundbook/git/commits{/sha}","comments_url":"https://api.github.com/repos/ashfurrow/playgroundbook/comments{/number}","issue_comment_url":"https://api.github.com/repos/ashfurrow/playgroundbook/issues/comments{/number}","contents_url":"https://api.github.com/repos/ashfurrow/playgroundbook/contents/{+path}","compare_url":"https://api.github.com/repos/ashfurrow/playgroundbook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ashfurrow/playgroundbook/merges","archive_url":"https://api.github.com/repos/ashfurrow/playgroundbook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ashfurrow/playgroundbook/downloads","issues_url":"https://api.github.com/repos/ashfurrow/playgroundbook/issues{/number}","pulls_url":"https://api.github.com/repos/ashfurrow/playgroundbook/pulls{/number}","milestones_url":"https://api.github.com/repos/ashfurrow/playgroundbook/milestones{/number}","notifications_url":"https://api.github.com/repos/ashfurrow/playgroundbook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ashfurrow/playgroundbook/labels{/name}","releases_url":"https://api.github.com/repos/ashfurrow/playgroundbook/releases{/id}","deployments_url":"https://api.github.com/repos/ashfurrow/playgroundbook/deployments","created_at":"2016-07-22T01:34:09Z","updated_at":"2016-08-27T19:10:56Z","pushed_at":"2016-08-27T16:54:26Z","git_url":"git://github.com/ashfurrow/playgroundbook.git","ssh_url":"git@github.com:ashfurrow/playgroundbook.git","clone_url":"https://github.com/ashfurrow/playgroundbook.git","svn_url":"https://github.com/ashfurrow/playgroundbook","homepage":null,"size":251,"stargazers_count":14,"watchers_count":14,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ashfurrow/playgroundbook/pulls/15"},"html":{"href":"https://github.com/ashfurrow/playgroundbook/pull/15"},"issue":{"href":"https://api.github.com/repos/ashfurrow/playgroundbook/issues/15"},"comments":{"href":"https://api.github.com/repos/ashfurrow/playgroundbook/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/ashfurrow/playgroundbook/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/ashfurrow/playgroundbook/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ashfurrow/playgroundbook/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/ashfurrow/playgroundbook/statuses/0fe75ecbdfff7fdbba4abc123be2aed737d9ac06"}}}}
{"actor":{"display_login":"orta"}}