{"action":"closed","number":150,"pull_request":{"url":"https://api.github.com/repos/bernd/fpm-cookery/pulls/150","id":61844838,"html_url":"https://github.com/bernd/fpm-cookery/pull/150","diff_url":"https://github.com/bernd/fpm-cookery/pull/150.diff","patch_url":"https://github.com/bernd/fpm-cookery/pull/150.patch","issue_url":"https://api.github.com/repos/bernd/fpm-cookery/issues/150","number":150,"state":"closed","locked":false,"title":"Implement Hiera lookups of recipe data from templated YAML files","user":{"login":"BaxterStockman","id":1287639,"avatar_url":"https://avatars.githubusercontent.com/u/1287639?v=3","gravatar_id":"","url":"https://api.github.com/users/BaxterStockman","html_url":"https://github.com/BaxterStockman","followers_url":"https://api.github.com/users/BaxterStockman/followers","following_url":"https://api.github.com/users/BaxterStockman/following{/other_user}","gists_url":"https://api.github.com/users/BaxterStockman/gists{/gist_id}","starred_url":"https://api.github.com/users/BaxterStockman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BaxterStockman/subscriptions","organizations_url":"https://api.github.com/users/BaxterStockman/orgs","repos_url":"https://api.github.com/users/BaxterStockman/repos","events_url":"https://api.github.com/users/BaxterStockman/events{/privacy}","received_events_url":"https://api.github.com/users/BaxterStockman/received_events","type":"User","site_admin":false},"body":"Phew!  A mere one year and several weeks after #103, I'm back with a Hiera-based implementation of recipe data lookups.  This is a big PR; here's an overview of the changes:\r\n\r\n### `FPM::Cookery::Hiera`\r\n* Added an `Instance` class that subclasses `::Hiera`, wrapping a `Recipe`\r\n  class to do do lookups in `YAML` (and also `JSON`) backends.  Also, a\r\n  supporting `Defaults` class that provides sane defaults for the options to\r\n  the `Hiera` contstructor.\r\n* Added a `Scope` class that uses `Recipe` methods, `Facts`, and `::Facter` for\r\n  `%{scope(\"...\")}` interpolations in Hiera data files.\r\n\r\n### `FPM::Cookery::Log`\r\n* A `Hiera` class that passes through the `hiera` gem's messages to the\r\n  configured `FPM::Cookery` logger.  This class is aliased to\r\n  `::Hiera::Fpm_cookery_logger` for reasons explained in\r\n  `lib/hiera/fpm_cookery_logger.rb`.\r\n\r\n### `FPM::Cookery::Book`\r\n* Added the `inject_class_methods!` method for defining the `filename` and\r\n  `config` methods on recipe classes during `FPM::Cookery::Book.load_recipe`.\r\n  This is done so that the `hiera` and `lookup` methods are available for use\r\n  while defining `Recipe` subclasses.\r\n\r\n### `FPM::Cookery::CLI`\r\n* Added `--data-dir` for specifying the directory where Hiera data files are\r\n  located.\r\n* Added `--hiera-config` for specifying the path to an (optional) Hiera\r\n  configuration file.\r\n\r\n### `FPM::Cookery::Config`\r\n* Added `data_dir` and `hiera_config` attributes corresponding to the\r\n  `--data-dir` and `--hiera-config` CLI options.\r\n\r\n### `FPM::Cookery::InheritableAttr`\r\n* Factored out `FPM::Cookery::BaseRecipe.attr_rw` and\r\n  `FPM::Cookery::BaseRecipe.attr_rw_list` into a separate module, adding\r\n  `attr_rw_hash` and `attr_rw_path`.\r\n* Module provides class methods that return lists of defined attributes; these\r\n  methods are used with `FPM::Cookery::Recipe.apply` to do Hiera lookups on\r\n  all recipe attributes.\r\n\r\n### `FPM::Cookery::Environment`\r\n* Made `Environment` a subclass of `Hash` to facilitate easier cloning on\r\n  inheritance through `InheritableAttr`.\r\n\r\n### `FPM::Cookery::Recipe`\r\n* Added `.hiera` class method that represents a `Hiera::Instance` object\r\n* Added `.lookup` class method that delegates to the `hiera` object's `#lookup`\r\n  method.\r\n* Restructured `#initialize` to reflect the fact that `.filename` and `.config`\r\n  are now class methods.\r\n* Made a number of methods that were previously instance methods (such as all\r\n  of the filepath-related methods) into class methods so that they can be used\r\n  in Hiera `%{scope(\"...\")}` lookups at class definition time.\r\n\r\n### `FPM::Cookery::Source`\r\n* Added the `#fetchable?` method that returns `false` if `@url.empty?` and true\r\n  otherwise.\r\n\r\n### `FPM::Cookery::SourceHandler`\r\n* Added the `#fetchable?` method that delegates to the `@source` instance\r\n  variable.  This method is used in order to determine whether to enter the\r\n  source-downloading block in `FPM::Cookery::Packager#dispense`. This corrects\r\n  an issue I had introduced by making classes like\r\n  `FPM::Cookery::RubyGemRecipe` inherit from `Recipe` rather than `BaseRecipe`:\r\n  `Package#dispense` would raise an exception when trying to fetch a\r\n  `recipe.source` that returned `nil`.\r\n\r\n### Miscellaneous\r\n* Added `pry` as a development dependency for a nicer REPL when manually\r\n  testing code\r\n* Added `simplecov` as a development dependency, and increased some test\r\n  coverage for classes and modules that weren't otherwise affected by this PR.\r\n* Removed `exit` calls from library code and replaced with\r\n  `FPM::Cookery::Error` clases that are rescued by `FPM::Cookery::CLI`.  The\r\n  `exit`s were causing my REPL to mysteriously quit during manual testing.\r\n* Added lots of tests!\r\n\r\nI also have additions for the wiki that provide documentation of public methods of interest.  It appears there's no easy way to submit wiki PRs, though :(. While I figure something out, here's the [Hiera](https://github.com/BaxterStockman/fpm-cookery/wiki/Hiera) page, and the updated [Recipe Specification](https://github.com/BaxterStockman/fpm-cookery/wiki/Recipe-Specification) page.\r\n\r\nThanks in advance for considering this PR!","created_at":"2016-03-06T14:58:48Z","updated_at":"2016-06-14T17:17:22Z","closed_at":"2016-06-14T17:17:22Z","merged_at":"2016-06-14T17:17:22Z","merge_commit_sha":"8a710db8b3185c06b74d18af33a99cf93ce830b9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bernd/fpm-cookery/pulls/150/commits","review_comments_url":"https://api.github.com/repos/bernd/fpm-cookery/pulls/150/comments","review_comment_url":"https://api.github.com/repos/bernd/fpm-cookery/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bernd/fpm-cookery/issues/150/comments","statuses_url":"https://api.github.com/repos/bernd/fpm-cookery/statuses/456900986715825319f37cbfa2fc0cdb01390860","head":{"label":"BaxterStockman:hiera","ref":"hiera","sha":"456900986715825319f37cbfa2fc0cdb01390860","user":{"login":"BaxterStockman","id":1287639,"avatar_url":"https://avatars.githubusercontent.com/u/1287639?v=3","gravatar_id":"","url":"https://api.github.com/users/BaxterStockman","html_url":"https://github.com/BaxterStockman","followers_url":"https://api.github.com/users/BaxterStockman/followers","following_url":"https://api.github.com/users/BaxterStockman/following{/other_user}","gists_url":"https://api.github.com/users/BaxterStockman/gists{/gist_id}","starred_url":"https://api.github.com/users/BaxterStockman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BaxterStockman/subscriptions","organizations_url":"https://api.github.com/users/BaxterStockman/orgs","repos_url":"https://api.github.com/users/BaxterStockman/repos","events_url":"https://api.github.com/users/BaxterStockman/events{/privacy}","received_events_url":"https://api.github.com/users/BaxterStockman/received_events","type":"User","site_admin":false},"repo":{"id":30770743,"name":"fpm-cookery","full_name":"BaxterStockman/fpm-cookery","owner":{"login":"BaxterStockman","id":1287639,"avatar_url":"https://avatars.githubusercontent.com/u/1287639?v=3","gravatar_id":"","url":"https://api.github.com/users/BaxterStockman","html_url":"https://github.com/BaxterStockman","followers_url":"https://api.github.com/users/BaxterStockman/followers","following_url":"https://api.github.com/users/BaxterStockman/following{/other_user}","gists_url":"https://api.github.com/users/BaxterStockman/gists{/gist_id}","starred_url":"https://api.github.com/users/BaxterStockman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BaxterStockman/subscriptions","organizations_url":"https://api.github.com/users/BaxterStockman/orgs","repos_url":"https://api.github.com/users/BaxterStockman/repos","events_url":"https://api.github.com/users/BaxterStockman/events{/privacy}","received_events_url":"https://api.github.com/users/BaxterStockman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BaxterStockman/fpm-cookery","description":"A tool for building software packages with fpm.","fork":true,"url":"https://api.github.com/repos/BaxterStockman/fpm-cookery","forks_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/forks","keys_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/teams","hooks_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/hooks","issue_events_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/issues/events{/number}","events_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/events","assignees_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/assignees{/user}","branches_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/branches{/branch}","tags_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/tags","blobs_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/git/refs{/sha}","trees_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/statuses/{sha}","languages_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/languages","stargazers_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/stargazers","contributors_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/contributors","subscribers_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/subscribers","subscription_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/subscription","commits_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/commits{/sha}","git_commits_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/git/commits{/sha}","comments_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/comments{/number}","issue_comment_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/issues/comments{/number}","contents_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/contents/{+path}","compare_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/merges","archive_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/downloads","issues_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/issues{/number}","pulls_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/pulls{/number}","milestones_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/milestones{/number}","notifications_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/labels{/name}","releases_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/releases{/id}","deployments_url":"https://api.github.com/repos/BaxterStockman/fpm-cookery/deployments","created_at":"2015-02-13T18:53:55Z","updated_at":"2016-02-17T23:41:20Z","pushed_at":"2016-03-18T22:07:19Z","git_url":"git://github.com/BaxterStockman/fpm-cookery.git","ssh_url":"git@github.com:BaxterStockman/fpm-cookery.git","clone_url":"https://github.com/BaxterStockman/fpm-cookery.git","svn_url":"https://github.com/BaxterStockman/fpm-cookery","homepage":"","size":619,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"bernd:master","ref":"master","sha":"055a9ee635639a893e6250be5b14d2bea35e211c","user":{"login":"bernd","id":461,"avatar_url":"https://avatars.githubusercontent.com/u/461?v=3","gravatar_id":"","url":"https://api.github.com/users/bernd","html_url":"https://github.com/bernd","followers_url":"https://api.github.com/users/bernd/followers","following_url":"https://api.github.com/users/bernd/following{/other_user}","gists_url":"https://api.github.com/users/bernd/gists{/gist_id}","starred_url":"https://api.github.com/users/bernd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bernd/subscriptions","organizations_url":"https://api.github.com/users/bernd/orgs","repos_url":"https://api.github.com/users/bernd/repos","events_url":"https://api.github.com/users/bernd/events{/privacy}","received_events_url":"https://api.github.com/users/bernd/received_events","type":"User","site_admin":false},"repo":{"id":2452768,"name":"fpm-cookery","full_name":"bernd/fpm-cookery","owner":{"login":"bernd","id":461,"avatar_url":"https://avatars.githubusercontent.com/u/461?v=3","gravatar_id":"","url":"https://api.github.com/users/bernd","html_url":"https://github.com/bernd","followers_url":"https://api.github.com/users/bernd/followers","following_url":"https://api.github.com/users/bernd/following{/other_user}","gists_url":"https://api.github.com/users/bernd/gists{/gist_id}","starred_url":"https://api.github.com/users/bernd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bernd/subscriptions","organizations_url":"https://api.github.com/users/bernd/orgs","repos_url":"https://api.github.com/users/bernd/repos","events_url":"https://api.github.com/users/bernd/events{/privacy}","received_events_url":"https://api.github.com/users/bernd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bernd/fpm-cookery","description":"A tool for building software packages with fpm.","fork":false,"url":"https://api.github.com/repos/bernd/fpm-cookery","forks_url":"https://api.github.com/repos/bernd/fpm-cookery/forks","keys_url":"https://api.github.com/repos/bernd/fpm-cookery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bernd/fpm-cookery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bernd/fpm-cookery/teams","hooks_url":"https://api.github.com/repos/bernd/fpm-cookery/hooks","issue_events_url":"https://api.github.com/repos/bernd/fpm-cookery/issues/events{/number}","events_url":"https://api.github.com/repos/bernd/fpm-cookery/events","assignees_url":"https://api.github.com/repos/bernd/fpm-cookery/assignees{/user}","branches_url":"https://api.github.com/repos/bernd/fpm-cookery/branches{/branch}","tags_url":"https://api.github.com/repos/bernd/fpm-cookery/tags","blobs_url":"https://api.github.com/repos/bernd/fpm-cookery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bernd/fpm-cookery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bernd/fpm-cookery/git/refs{/sha}","trees_url":"https://api.github.com/repos/bernd/fpm-cookery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bernd/fpm-cookery/statuses/{sha}","languages_url":"https://api.github.com/repos/bernd/fpm-cookery/languages","stargazers_url":"https://api.github.com/repos/bernd/fpm-cookery/stargazers","contributors_url":"https://api.github.com/repos/bernd/fpm-cookery/contributors","subscribers_url":"https://api.github.com/repos/bernd/fpm-cookery/subscribers","subscription_url":"https://api.github.com/repos/bernd/fpm-cookery/subscription","commits_url":"https://api.github.com/repos/bernd/fpm-cookery/commits{/sha}","git_commits_url":"https://api.github.com/repos/bernd/fpm-cookery/git/commits{/sha}","comments_url":"https://api.github.com/repos/bernd/fpm-cookery/comments{/number}","issue_comment_url":"https://api.github.com/repos/bernd/fpm-cookery/issues/comments{/number}","contents_url":"https://api.github.com/repos/bernd/fpm-cookery/contents/{+path}","compare_url":"https://api.github.com/repos/bernd/fpm-cookery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bernd/fpm-cookery/merges","archive_url":"https://api.github.com/repos/bernd/fpm-cookery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bernd/fpm-cookery/downloads","issues_url":"https://api.github.com/repos/bernd/fpm-cookery/issues{/number}","pulls_url":"https://api.github.com/repos/bernd/fpm-cookery/pulls{/number}","milestones_url":"https://api.github.com/repos/bernd/fpm-cookery/milestones{/number}","notifications_url":"https://api.github.com/repos/bernd/fpm-cookery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bernd/fpm-cookery/labels{/name}","releases_url":"https://api.github.com/repos/bernd/fpm-cookery/releases{/id}","deployments_url":"https://api.github.com/repos/bernd/fpm-cookery/deployments","created_at":"2011-09-25T01:43:35Z","updated_at":"2016-06-04T22:04:10Z","pushed_at":"2016-06-14T17:17:22Z","git_url":"git://github.com/bernd/fpm-cookery.git","ssh_url":"git@github.com:bernd/fpm-cookery.git","clone_url":"https://github.com/bernd/fpm-cookery.git","svn_url":"https://github.com/bernd/fpm-cookery","homepage":"","size":763,"stargazers_count":378,"watchers_count":378,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":71,"mirror_url":null,"open_issues_count":21,"forks":71,"open_issues":21,"watchers":378,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bernd/fpm-cookery/pulls/150"},"html":{"href":"https://github.com/bernd/fpm-cookery/pull/150"},"issue":{"href":"https://api.github.com/repos/bernd/fpm-cookery/issues/150"},"comments":{"href":"https://api.github.com/repos/bernd/fpm-cookery/issues/150/comments"},"review_comments":{"href":"https://api.github.com/repos/bernd/fpm-cookery/pulls/150/comments"},"review_comment":{"href":"https://api.github.com/repos/bernd/fpm-cookery/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bernd/fpm-cookery/pulls/150/commits"},"statuses":{"href":"https://api.github.com/repos/bernd/fpm-cookery/statuses/456900986715825319f37cbfa2fc0cdb01390860"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"bernd","id":461,"avatar_url":"https://avatars.githubusercontent.com/u/461?v=3","gravatar_id":"","url":"https://api.github.com/users/bernd","html_url":"https://github.com/bernd","followers_url":"https://api.github.com/users/bernd/followers","following_url":"https://api.github.com/users/bernd/following{/other_user}","gists_url":"https://api.github.com/users/bernd/gists{/gist_id}","starred_url":"https://api.github.com/users/bernd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bernd/subscriptions","organizations_url":"https://api.github.com/users/bernd/orgs","repos_url":"https://api.github.com/users/bernd/repos","events_url":"https://api.github.com/users/bernd/events{/privacy}","received_events_url":"https://api.github.com/users/bernd/received_events","type":"User","site_admin":false},"comments":8,"review_comments":0,"commits":19,"additions":1345,"deletions":224,"changed_files":44}}
{"actor":{"display_login":"bernd"}}