{"action":"created","comment":{"url":"https://api.github.com/repos/rackerlabs/fastfood/pulls/comments/30746127","id":30746127,"diff_hunk":"@@ -141,85 +150,29 @@ def update_cookbook(cookbook, templatepack, stencilset_name, **options):\n     return written_files, cookbook\n \n \n-def create_new_cookbook(cookbook_name, templatepack,\n-                        cookbooks_home, force=False):\n+def create_new_cookbook(cookbook_name, cookbooks_home, force=False):\n     \"\"\"Create a new cookbook.\n \n     :param cookbook_name: Name of the new cookbook.\n-    :param templatepack: Path to templatepack.\n     :param cookbooks_home: Target dir for new cookbook.\n     \"\"\"\n     cookbooks_home = utils.normalize_path(cookbooks_home)\n \n-    tmppack = pack.TemplatePack(templatepack)\n-    tpmanifest = tmppack.manifest\n-\n-    files, directories = [], []\n-    for option, data in tpmanifest['base'].iteritems():\n-        if option == 'files':\n-            if not isinstance(data, list):\n-                raise TypeError(\"Base files should be a list of files.\")\n-            files = data\n-        elif option == 'directories':\n-            if not isinstance(data, list):\n-                raise TypeError(\"Base directories should be a list of \"\n-                                \"directory names.\")\n-            directories = data\n+    if not os.path.exists(cookbooks_home):\n+        raise ValueError(\"Target cookbook dir %s does not exist.\"\n+                         % os.path.relpath(cookbooks_home))\n+\n+    target_dir = os.path.join(cookbooks_home, cookbook_name)\n+    LOG.debug(\"Creating dir -> %s\", target_dir)\n+    try:\n+        os.makedirs(target_dir)\n+    except OSError as err:\n+        if err.errno != errno.EEXIST:\n+            raise\n         else:\n-            raise ValueError(\"Unknown 'base' option '%s'\" % option)\n+            LOG.info(\"Skipping existing directory %s\", target_dir)\n \n-    if files:\n-        if not os.path.exists(cookbooks_home):\n-            raise ValueError(\"Target cookbook dir %s does not exist.\"\n-                             % os.path.relpath(cookbooks_home))\n-\n-    template_map = {\n-        'cookbook': {\n-            'name': cookbook_name,\n-            'year': datetime.datetime.now().year,\n-            }\n-        }\n-\n-    template_files = [os.path.join(templatepack, 'base', f)\n-                      for f in files]\n-    path_map = dict(zip(template_files, files))\n-    filetable = templating.render_templates(*template_files, **template_map)\n-\n-    for path in directories:\n-        target_dir = os.path.join(cookbooks_home, cookbook_name, path)\n-        LOG.debug(\"Creating dir -> %s\", target_dir)\n-        try:\n-            os.makedirs(target_dir)\n-        except OSError as err:\n-            if err.errno != errno.EEXIST:\n-                raise\n-            else:\n-                LOG.info(\"Skipping existing directory %s\",\n-                         target_dir)\n-\n-    written_files = []\n-    for orig_path, content in filetable:\n-        target_path = os.path.join(\n-            cookbooks_home, cookbook_name, path_map[orig_path])\n-        needdir = os.path.dirname(target_path)\n-        assert needdir, \"Target should have valid parent dir\"\n-        try:\n-            os.makedirs(needdir)\n-        except OSError as err:\n-            if err.errno != errno.EEXIST:\n-                raise\n-\n-        if os.path.isfile(target_path):\n-            if force:\n-                LOG.warning(\"Forcing overwrite of existing file %s.\",\n-                            target_path)\n-            else:\n-                LOG.info(\"Skipping existing file %s\", target_path)\n-                continue\n-        with open(target_path, 'w') as newfile:\n-            LOG.info(\"Writing rendered file %s\", target_path)\n-            written_files.append(target_path)\n-            newfile.write(content)\n+    cookbook_path = os.path.join(cookbooks_home, cookbook_name)\n+    cookbook = book.CookBook(cookbook_path)\n \n-    return (written_files, book.CookBook(os.path.join(cookbooks_home,\n-                                                      cookbook_name)))\n+    return (cookbook, cookbook_path)","path":"fastfood/food.py","position":197,"original_position":197,"commit_id":"78f0ba29f9c02b4b56c98e0d0e361e7faa69453d","original_commit_id":"78f0ba29f9c02b4b56c98e0d0e361e7faa69453d","user":{"login":"martinb3","id":103033,"avatar_url":"https://avatars.githubusercontent.com/u/103033?v=3","gravatar_id":"","url":"https://api.github.com/users/martinb3","html_url":"https://github.com/martinb3","followers_url":"https://api.github.com/users/martinb3/followers","following_url":"https://api.github.com/users/martinb3/following{/other_user}","gists_url":"https://api.github.com/users/martinb3/gists{/gist_id}","starred_url":"https://api.github.com/users/martinb3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinb3/subscriptions","organizations_url":"https://api.github.com/users/martinb3/orgs","repos_url":"https://api.github.com/users/martinb3/repos","events_url":"https://api.github.com/users/martinb3/events{/privacy}","received_events_url":"https://api.github.com/users/martinb3/received_events","type":"User","site_admin":false},"body":"Good point. I've made the change.","created_at":"2015-05-20T20:35:12Z","updated_at":"2015-05-20T20:35:12Z","html_url":"https://github.com/rackerlabs/fastfood/pull/72#discussion_r30746127","pull_request_url":"https://api.github.com/repos/rackerlabs/fastfood/pulls/72","_links":{"self":{"href":"https://api.github.com/repos/rackerlabs/fastfood/pulls/comments/30746127"},"html":{"href":"https://github.com/rackerlabs/fastfood/pull/72#discussion_r30746127"},"pull_request":{"href":"https://api.github.com/repos/rackerlabs/fastfood/pulls/72"}}},"pull_request":{"url":"https://api.github.com/repos/rackerlabs/fastfood/pulls/72","id":35869122,"html_url":"https://github.com/rackerlabs/fastfood/pull/72","diff_url":"https://github.com/rackerlabs/fastfood/pull/72.diff","patch_url":"https://github.com/rackerlabs/fastfood/pull/72.patch","issue_url":"https://api.github.com/repos/rackerlabs/fastfood/issues/72","number":72,"state":"open","locked":false,"title":"Make base a regular stencil, simplify commands","user":{"login":"martinb3","id":103033,"avatar_url":"https://avatars.githubusercontent.com/u/103033?v=3","gravatar_id":"","url":"https://api.github.com/users/martinb3","html_url":"https://github.com/martinb3","followers_url":"https://api.github.com/users/martinb3/followers","following_url":"https://api.github.com/users/martinb3/following{/other_user}","gists_url":"https://api.github.com/users/martinb3/gists{/gist_id}","starred_url":"https://api.github.com/users/martinb3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinb3/subscriptions","organizations_url":"https://api.github.com/users/martinb3/orgs","repos_url":"https://api.github.com/users/martinb3/repos","events_url":"https://api.github.com/users/martinb3/events{/privacy}","received_events_url":"https://api.github.com/users/martinb3/received_events","type":"User","site_admin":false},"body":"- simplify commandline to just show, new, or build. build is now an all-in-one create-or-update, fixes #68.\r\n- base is now a regular stencil, just like the others. #69.\r\n- shell.py now adds `.decode('UTF-8')` to all the fancy interrobangs and pizza symbols, to prevent ascii decode, fixes #71.\r\n- add tests for metadata.rb template rendering, cookbook dir being created, etc","created_at":"2015-05-20T19:51:41Z","updated_at":"2015-05-20T20:35:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"495b30cedc1ab7d2b1455c00015b800e3fa4f35c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rackerlabs/fastfood/pulls/72/commits","review_comments_url":"https://api.github.com/repos/rackerlabs/fastfood/pulls/72/comments","review_comment_url":"https://api.github.com/repos/rackerlabs/fastfood/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rackerlabs/fastfood/issues/72/comments","statuses_url":"https://api.github.com/repos/rackerlabs/fastfood/statuses/78f0ba29f9c02b4b56c98e0d0e361e7faa69453d","head":{"label":"martinb3:template_work","ref":"template_work","sha":"78f0ba29f9c02b4b56c98e0d0e361e7faa69453d","user":{"login":"martinb3","id":103033,"avatar_url":"https://avatars.githubusercontent.com/u/103033?v=3","gravatar_id":"","url":"https://api.github.com/users/martinb3","html_url":"https://github.com/martinb3","followers_url":"https://api.github.com/users/martinb3/followers","following_url":"https://api.github.com/users/martinb3/following{/other_user}","gists_url":"https://api.github.com/users/martinb3/gists{/gist_id}","starred_url":"https://api.github.com/users/martinb3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinb3/subscriptions","organizations_url":"https://api.github.com/users/martinb3/orgs","repos_url":"https://api.github.com/users/martinb3/repos","events_url":"https://api.github.com/users/martinb3/events{/privacy}","received_events_url":"https://api.github.com/users/martinb3/received_events","type":"User","site_admin":false},"repo":{"id":35690354,"name":"fastfood","full_name":"martinb3/fastfood","owner":{"login":"martinb3","id":103033,"avatar_url":"https://avatars.githubusercontent.com/u/103033?v=3","gravatar_id":"","url":"https://api.github.com/users/martinb3","html_url":"https://github.com/martinb3","followers_url":"https://api.github.com/users/martinb3/followers","following_url":"https://api.github.com/users/martinb3/following{/other_user}","gists_url":"https://api.github.com/users/martinb3/gists{/gist_id}","starred_url":"https://api.github.com/users/martinb3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinb3/subscriptions","organizations_url":"https://api.github.com/users/martinb3/orgs","repos_url":"https://api.github.com/users/martinb3/repos","events_url":"https://api.github.com/users/martinb3/events{/privacy}","received_events_url":"https://api.github.com/users/martinb3/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/martinb3/fastfood","description":"","fork":true,"url":"https://api.github.com/repos/martinb3/fastfood","forks_url":"https://api.github.com/repos/martinb3/fastfood/forks","keys_url":"https://api.github.com/repos/martinb3/fastfood/keys{/key_id}","collaborators_url":"https://api.github.com/repos/martinb3/fastfood/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/martinb3/fastfood/teams","hooks_url":"https://api.github.com/repos/martinb3/fastfood/hooks","issue_events_url":"https://api.github.com/repos/martinb3/fastfood/issues/events{/number}","events_url":"https://api.github.com/repos/martinb3/fastfood/events","assignees_url":"https://api.github.com/repos/martinb3/fastfood/assignees{/user}","branches_url":"https://api.github.com/repos/martinb3/fastfood/branches{/branch}","tags_url":"https://api.github.com/repos/martinb3/fastfood/tags","blobs_url":"https://api.github.com/repos/martinb3/fastfood/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/martinb3/fastfood/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/martinb3/fastfood/git/refs{/sha}","trees_url":"https://api.github.com/repos/martinb3/fastfood/git/trees{/sha}","statuses_url":"https://api.github.com/repos/martinb3/fastfood/statuses/{sha}","languages_url":"https://api.github.com/repos/martinb3/fastfood/languages","stargazers_url":"https://api.github.com/repos/martinb3/fastfood/stargazers","contributors_url":"https://api.github.com/repos/martinb3/fastfood/contributors","subscribers_url":"https://api.github.com/repos/martinb3/fastfood/subscribers","subscription_url":"https://api.github.com/repos/martinb3/fastfood/subscription","commits_url":"https://api.github.com/repos/martinb3/fastfood/commits{/sha}","git_commits_url":"https://api.github.com/repos/martinb3/fastfood/git/commits{/sha}","comments_url":"https://api.github.com/repos/martinb3/fastfood/comments{/number}","issue_comment_url":"https://api.github.com/repos/martinb3/fastfood/issues/comments{/number}","contents_url":"https://api.github.com/repos/martinb3/fastfood/contents/{+path}","compare_url":"https://api.github.com/repos/martinb3/fastfood/compare/{base}...{head}","merges_url":"https://api.github.com/repos/martinb3/fastfood/merges","archive_url":"https://api.github.com/repos/martinb3/fastfood/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/martinb3/fastfood/downloads","issues_url":"https://api.github.com/repos/martinb3/fastfood/issues{/number}","pulls_url":"https://api.github.com/repos/martinb3/fastfood/pulls{/number}","milestones_url":"https://api.github.com/repos/martinb3/fastfood/milestones{/number}","notifications_url":"https://api.github.com/repos/martinb3/fastfood/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/martinb3/fastfood/labels{/name}","releases_url":"https://api.github.com/repos/martinb3/fastfood/releases{/id}","created_at":"2015-05-15T18:37:06Z","updated_at":"2015-05-15T18:37:06Z","pushed_at":"2015-05-20T20:23:25Z","git_url":"git://github.com/martinb3/fastfood.git","ssh_url":"git@github.com:martinb3/fastfood.git","clone_url":"https://github.com/martinb3/fastfood.git","svn_url":"https://github.com/martinb3/fastfood","homepage":null,"size":203,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rackerlabs:master","ref":"master","sha":"fb5b25f5d4890f4aff685849c500c62f196ccf43","user":{"login":"rackerlabs","id":84293,"avatar_url":"https://avatars.githubusercontent.com/u/84293?v=3","gravatar_id":"","url":"https://api.github.com/users/rackerlabs","html_url":"https://github.com/rackerlabs","followers_url":"https://api.github.com/users/rackerlabs/followers","following_url":"https://api.github.com/users/rackerlabs/following{/other_user}","gists_url":"https://api.github.com/users/rackerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rackerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackerlabs/subscriptions","organizations_url":"https://api.github.com/users/rackerlabs/orgs","repos_url":"https://api.github.com/users/rackerlabs/repos","events_url":"https://api.github.com/users/rackerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rackerlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":30567320,"name":"fastfood","full_name":"rackerlabs/fastfood","owner":{"login":"rackerlabs","id":84293,"avatar_url":"https://avatars.githubusercontent.com/u/84293?v=3","gravatar_id":"","url":"https://api.github.com/users/rackerlabs","html_url":"https://github.com/rackerlabs","followers_url":"https://api.github.com/users/rackerlabs/followers","following_url":"https://api.github.com/users/rackerlabs/following{/other_user}","gists_url":"https://api.github.com/users/rackerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rackerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackerlabs/subscriptions","organizations_url":"https://api.github.com/users/rackerlabs/orgs","repos_url":"https://api.github.com/users/rackerlabs/repos","events_url":"https://api.github.com/users/rackerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rackerlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rackerlabs/fastfood","description":"","fork":false,"url":"https://api.github.com/repos/rackerlabs/fastfood","forks_url":"https://api.github.com/repos/rackerlabs/fastfood/forks","keys_url":"https://api.github.com/repos/rackerlabs/fastfood/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rackerlabs/fastfood/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rackerlabs/fastfood/teams","hooks_url":"https://api.github.com/repos/rackerlabs/fastfood/hooks","issue_events_url":"https://api.github.com/repos/rackerlabs/fastfood/issues/events{/number}","events_url":"https://api.github.com/repos/rackerlabs/fastfood/events","assignees_url":"https://api.github.com/repos/rackerlabs/fastfood/assignees{/user}","branches_url":"https://api.github.com/repos/rackerlabs/fastfood/branches{/branch}","tags_url":"https://api.github.com/repos/rackerlabs/fastfood/tags","blobs_url":"https://api.github.com/repos/rackerlabs/fastfood/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rackerlabs/fastfood/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rackerlabs/fastfood/git/refs{/sha}","trees_url":"https://api.github.com/repos/rackerlabs/fastfood/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rackerlabs/fastfood/statuses/{sha}","languages_url":"https://api.github.com/repos/rackerlabs/fastfood/languages","stargazers_url":"https://api.github.com/repos/rackerlabs/fastfood/stargazers","contributors_url":"https://api.github.com/repos/rackerlabs/fastfood/contributors","subscribers_url":"https://api.github.com/repos/rackerlabs/fastfood/subscribers","subscription_url":"https://api.github.com/repos/rackerlabs/fastfood/subscription","commits_url":"https://api.github.com/repos/rackerlabs/fastfood/commits{/sha}","git_commits_url":"https://api.github.com/repos/rackerlabs/fastfood/git/commits{/sha}","comments_url":"https://api.github.com/repos/rackerlabs/fastfood/comments{/number}","issue_comment_url":"https://api.github.com/repos/rackerlabs/fastfood/issues/comments{/number}","contents_url":"https://api.github.com/repos/rackerlabs/fastfood/contents/{+path}","compare_url":"https://api.github.com/repos/rackerlabs/fastfood/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rackerlabs/fastfood/merges","archive_url":"https://api.github.com/repos/rackerlabs/fastfood/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rackerlabs/fastfood/downloads","issues_url":"https://api.github.com/repos/rackerlabs/fastfood/issues{/number}","pulls_url":"https://api.github.com/repos/rackerlabs/fastfood/pulls{/number}","milestones_url":"https://api.github.com/repos/rackerlabs/fastfood/milestones{/number}","notifications_url":"https://api.github.com/repos/rackerlabs/fastfood/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rackerlabs/fastfood/labels{/name}","releases_url":"https://api.github.com/repos/rackerlabs/fastfood/releases{/id}","created_at":"2015-02-10T00:52:33Z","updated_at":"2015-04-23T14:52:19Z","pushed_at":"2015-05-20T20:23:25Z","git_url":"git://github.com/rackerlabs/fastfood.git","ssh_url":"git@github.com:rackerlabs/fastfood.git","clone_url":"https://github.com/rackerlabs/fastfood.git","svn_url":"https://github.com/rackerlabs/fastfood","homepage":null,"size":1030,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":18,"forks":6,"open_issues":18,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rackerlabs/fastfood/pulls/72"},"html":{"href":"https://github.com/rackerlabs/fastfood/pull/72"},"issue":{"href":"https://api.github.com/repos/rackerlabs/fastfood/issues/72"},"comments":{"href":"https://api.github.com/repos/rackerlabs/fastfood/issues/72/comments"},"review_comments":{"href":"https://api.github.com/repos/rackerlabs/fastfood/pulls/72/comments"},"review_comment":{"href":"https://api.github.com/repos/rackerlabs/fastfood/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rackerlabs/fastfood/pulls/72/commits"},"statuses":{"href":"https://api.github.com/repos/rackerlabs/fastfood/statuses/78f0ba29f9c02b4b56c98e0d0e361e7faa69453d"}}}}