From 2e6ad2caa9aa46b3436c8f3f8f296a8748e3edd9 Mon Sep 17 00:00:00 2001 From: Allen Kramer Date: Mon, 13 Jun 2016 06:44:10 -0400 Subject: [PATCH 01/10] moved code into lib/ --- jekyll_get.rb | 40 --------------------------------- {_plugins => lib}/jekyll_get.rb | 0 2 files changed, 40 deletions(-) delete mode 100644 jekyll_get.rb rename {_plugins => lib}/jekyll_get.rb (100%) diff --git a/jekyll_get.rb b/jekyll_get.rb deleted file mode 100644 index f5fb7e3..0000000 --- a/jekyll_get.rb +++ /dev/null @@ -1,40 +0,0 @@ -require 'json' -require 'hash-joiner' -require 'open-uri' - -module Jekyll_Get - class Generator < Jekyll::Generator - safe true - priority :highest - - def generate(site) - config = site.config['jekyll_get'] - if !config - return - end - if !config.kind_of?(Array) - config = [config] - end - config.each do |d| - begin - target = site.data[d['data']] - source = JSON.load(open(d['json'])) - if target - HashJoiner.deep_merge target, source - else - site.data[d['data']] = source - end - if d['cache'] - data_source = (site.config['data_source'] || '_data') - path = "#{data_source}/#{d['data']}.json" - open(path, 'wb') do |file| - file << JSON.generate(site.data[d['data']]) - end - end - rescue - next - end - end - end - end -end diff --git a/_plugins/jekyll_get.rb b/lib/jekyll_get.rb similarity index 100% rename from _plugins/jekyll_get.rb rename to lib/jekyll_get.rb From 58478292f6668f4567f55f786449046aefdbb685 Mon Sep 17 00:00:00 2001 From: Allen Kramer Date: Mon, 13 Jun 2016 06:46:57 -0400 Subject: [PATCH 02/10] rename jekyll-get.rb, and module --- lib/{jekyll_get.rb => jekyll-get.rb} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename lib/{jekyll_get.rb => jekyll-get.rb} (98%) diff --git a/lib/jekyll_get.rb b/lib/jekyll-get.rb similarity index 98% rename from lib/jekyll_get.rb rename to lib/jekyll-get.rb index f5fb7e3..7407371 100644 --- a/lib/jekyll_get.rb +++ b/lib/jekyll-get.rb @@ -2,7 +2,7 @@ require 'hash-joiner' require 'open-uri' -module Jekyll_Get +module JekyllGet class Generator < Jekyll::Generator safe true priority :highest From f6b496220d7047477a7a5e9809fd55d3765ec71b Mon Sep 17 00:00:00 2001 From: Allen Kramer Date: Mon, 13 Jun 2016 06:47:54 -0400 Subject: [PATCH 03/10] add gemspec with runtime dependencies --- jekyll-get.gemspec | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 jekyll-get.gemspec diff --git a/jekyll-get.gemspec b/jekyll-get.gemspec new file mode 100644 index 0000000..adaf812 --- /dev/null +++ b/jekyll-get.gemspec @@ -0,0 +1,16 @@ +Gem::Specification.new do |s| + s.name = 'jekyll-get' + s.version = '1.0.0' + s.date = '2016-06-07' + s.summary = 'Ruby gem to download data from external JSON sources to use in Jekyll site' + s.description = 'Downloads data from external JSON source(s)' + s.authors = ['Allen Kramer & Michael Pell'] + s.email = 'kramer.alleng@gmail.com' + s.files = ['lib/jekyll-get.rb'] + s.homepage = + 'http://rubygems.org/gems/jekyll-get' + s.license = 'CC0-1.0' + + s.add_runtime_dependency 'hash-joiner', '~> 0.0.7' + s.add_runtime_dependency 'jekyll', '~> 3.1', '>= 3.1.6' +end From 080ee17d8d55a2a2924b6b38c67287693231ea16 Mon Sep 17 00:00:00 2001 From: Allen Kramer Date: Mon, 13 Jun 2016 06:49:47 -0400 Subject: [PATCH 04/10] create .gem file --- jekyll-get-1.0.0.gem | Bin 0 -> 4608 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 jekyll-get-1.0.0.gem diff --git a/jekyll-get-1.0.0.gem b/jekyll-get-1.0.0.gem new file mode 100644 index 0000000000000000000000000000000000000000..5e60168b333ef8720bfa065ad701a0bfe28c3dc8 GIT binary patch literal 4608 zcmc~zElEsCEJ@T$uVSDTFaQD*6B7my4Fu@4p`o!UgQ1bRk-4dXxtXy!gMp#3iK!Wb zf&r}@glukUaY8f@({lvJcp)zuyWov&=j;I!Z9nkW;1j z+3ezd#lDkNKAb2$nw8bfI<0ZP)7hV)-Am`34r0mVHFi>NXVnY$QZ;4!COUUHZ{6{e z{D;MuZ#1Q4PD@)8s&r=UWtm5kYP&8(Jh$|Iurw&+!B%B$KDoovk!DPyd)${Qow53J z$2r_nV&r5)!dhoZ6@Wr7i^MH<-E&o@6Z3sHRhi9k%zb1 zChhU`_mBzG6@0wT*fC4R@%4p;P7gh8#7{k*(NNQVXr9LZ#1-vQx67xfpTBf71#Qu zcE7YZ9u&UeSXPd!>}{KtY5vPEo|oF{zjpQVkB^TrE=%z|#ul5N9_h5WHgdDY z{MVx7i!y5z?(KAYUww7W^W@(NJU!PcPe%*R;@#Z4;goXwpLvSAqgnS~Kj8OH?%bUj ze{(i@D^~3fmwIj1@o~}NFW*;aCY}4H)o^!N#SFQ?r-oHt(>PXG< ztpzMQRcsx)6e3n!YyIUg_gBYTn$h)(1PStFByvD`w!zbHmlf4X*Zui@)`6@-q4r>tE^-7s^_OMddyPN2uw_V%lf!!C9_WPw5J+V@9q%xQOr(#;j!#O?wwy^ zam#d?`xEBGW#@WWAD%cbQK-yi+M(Uwb`&#kgiO`27C!x?=cVliqt1$7Cx7a&*zVZ7 zX@BYEcZW7B#4;=?n&gqEsl;EqF6t3iUHu`@3 z?^mL8)cRgFEI#SG+v&ROhOgSU4lv6f5Wjn(^s>9Y;~n?@6`HaickND8INX=o z#Ak8RneFmT39T#Xy|US7RZ=Hs?*1#JHhG&lx5U@gw;s)KT+)~`!)s3L+}0SrD|I&{ zuPP@R)Rccn^$)fUxezlwB1=(#Ews;yLs6)p&$pZbsQ zn8h7_;m89kvE2 Date: Mon, 13 Jun 2016 06:51:17 -0400 Subject: [PATCH 05/10] add .gitignore to ignore built .gem --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..323f2ea --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ ++/* Ignore built gems */ + +*.gem From 96cecb6f4fa3ceb0e59f4ad0c48306d91a6eeca7 Mon Sep 17 00:00:00 2001 From: Allen Kramer Date: Mon, 13 Jun 2016 06:52:27 -0400 Subject: [PATCH 06/10] added installation instructions to readme.md --- readme.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/readme.md b/readme.md index cfb734d..5f6ceb8 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,36 @@ +<<<<<<< HEAD +#Jekyll::Get + +Ruby gem to download data from external JSON sources to use in Jekyll site + +## Install + +In your `_config.yml` file, add a new array with the key ```gems:``` and the value of the gem name you'd like to use. + +```yml +gems: [jekyll-get] +``` + +Then install your gem using ```gem install jekyll-get``` + +or + +Add the this gem to a Bundler group in your Gemfile. + +```yml +group :jekyll_plugins do + gem 'jekyll-get' +end +``` + +Then install by running ```bundle install``` + +## Configure + +This plugin reads settings from the `_config.yml` file. Add settings as attributes or an array of attributes for multiple files. + +### Example +======= # Install Add this file to `_plugins` in the root of your Jekyll site. @@ -7,6 +40,7 @@ Add this file to `_plugins` in the root of your Jekyll site. This plugin reads settings from the `_config.yml` file. Add settings as attributes or an array of attributes for multiple files. ## Example +>>>>>>> 6285aa69e2c5eebcb247c5ca5fc2dc9e2a51e71c ```yml jekyll_get: @@ -49,6 +83,8 @@ jekyll_get: json: 'https://18f.gsa.gov/hub/api/pif_projects/' cache: true ``` +<<<<<<< HEAD +======= ## Public domain @@ -57,3 +93,4 @@ This project is in the worldwide [public domain](LICENSE.md). As stated in [CONT > This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the [CC0 1.0 Universal public domain dedication](https://creativecommons.org/publicdomain/zero/1.0/). > > All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest. +>>>>>>> 6285aa69e2c5eebcb247c5ca5fc2dc9e2a51e71c From 50e86e8988508bed6c86de448f3d0d972babdbae Mon Sep 17 00:00:00 2001 From: Allen Kramer Date: Mon, 13 Jun 2016 06:55:18 -0400 Subject: [PATCH 07/10] fixed copy/paste issues in readme instructions --- readme.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/readme.md b/readme.md index 5f6ceb8..521c631 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,3 @@ -<<<<<<< HEAD #Jekyll::Get Ruby gem to download data from external JSON sources to use in Jekyll site @@ -40,7 +39,6 @@ Add this file to `_plugins` in the root of your Jekyll site. This plugin reads settings from the `_config.yml` file. Add settings as attributes or an array of attributes for multiple files. ## Example ->>>>>>> 6285aa69e2c5eebcb247c5ca5fc2dc9e2a51e71c ```yml jekyll_get: From 0071ca380c95d8e419b8ffa02b6f29698d0a361c Mon Sep 17 00:00:00 2001 From: Allen Kramer Date: Mon, 13 Jun 2016 06:56:16 -0400 Subject: [PATCH 08/10] revised readme --- readme.md | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/readme.md b/readme.md index 521c631..f75845d 100644 --- a/readme.md +++ b/readme.md @@ -29,16 +29,6 @@ Then install by running ```bundle install``` This plugin reads settings from the `_config.yml` file. Add settings as attributes or an array of attributes for multiple files. ### Example -======= -# Install - -Add this file to `_plugins` in the root of your Jekyll site. - -# Configure - -This plugin reads settings from the `_config.yml` file. Add settings as attributes or an array of attributes for multiple files. - -## Example ```yml jekyll_get: @@ -81,8 +71,6 @@ jekyll_get: json: 'https://18f.gsa.gov/hub/api/pif_projects/' cache: true ``` -<<<<<<< HEAD -======= ## Public domain @@ -91,4 +79,3 @@ This project is in the worldwide [public domain](LICENSE.md). As stated in [CONT > This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the [CC0 1.0 Universal public domain dedication](https://creativecommons.org/publicdomain/zero/1.0/). > > All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest. ->>>>>>> 6285aa69e2c5eebcb247c5ca5fc2dc9e2a51e71c From a9a85cf7a86d30289f3344a36c5170dd3ce6f3c2 Mon Sep 17 00:00:00 2001 From: Allen Kramer Date: Mon, 13 Jun 2016 06:57:34 -0400 Subject: [PATCH 09/10] clean up .gitignore file --- .gitignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 323f2ea..9192750 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -+/* Ignore built gems */ - +*.gem +/* Ignore built gems */ + *.gem From 42b3597ed288be91757ada3050a8dad50c001b6e Mon Sep 17 00:00:00 2001 From: Allen Kramer Date: Mon, 13 Jun 2016 08:07:56 -0400 Subject: [PATCH 10/10] updated .gitignore to ignore built gem --- .gitignore | 2 +- jekyll-get-1.0.0.gem | Bin 4608 -> 0 bytes 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 jekyll-get-1.0.0.gem diff --git a/.gitignore b/.gitignore index 9192750..f0a191a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ /* Ignore built gems */ - *.gem +*.gem diff --git a/jekyll-get-1.0.0.gem b/jekyll-get-1.0.0.gem deleted file mode 100644 index 5e60168b333ef8720bfa065ad701a0bfe28c3dc8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4608 zcmc~zElEsCEJ@T$uVSDTFaQD*6B7my4Fu@4p`o!UgQ1bRk-4dXxtXy!gMp#3iK!Wb zf&r}@glukUaY8f@({lvJcp)zuyWov&=j;I!Z9nkW;1j z+3ezd#lDkNKAb2$nw8bfI<0ZP)7hV)-Am`34r0mVHFi>NXVnY$QZ;4!COUUHZ{6{e z{D;MuZ#1Q4PD@)8s&r=UWtm5kYP&8(Jh$|Iurw&+!B%B$KDoovk!DPyd)${Qow53J z$2r_nV&r5)!dhoZ6@Wr7i^MH<-E&o@6Z3sHRhi9k%zb1 zChhU`_mBzG6@0wT*fC4R@%4p;P7gh8#7{k*(NNQVXr9LZ#1-vQx67xfpTBf71#Qu zcE7YZ9u&UeSXPd!>}{KtY5vPEo|oF{zjpQVkB^TrE=%z|#ul5N9_h5WHgdDY z{MVx7i!y5z?(KAYUww7W^W@(NJU!PcPe%*R;@#Z4;goXwpLvSAqgnS~Kj8OH?%bUj ze{(i@D^~3fmwIj1@o~}NFW*;aCY}4H)o^!N#SFQ?r-oHt(>PXG< ztpzMQRcsx)6e3n!YyIUg_gBYTn$h)(1PStFByvD`w!zbHmlf4X*Zui@)`6@-q4r>tE^-7s^_OMddyPN2uw_V%lf!!C9_WPw5J+V@9q%xQOr(#;j!#O?wwy^ zam#d?`xEBGW#@WWAD%cbQK-yi+M(Uwb`&#kgiO`27C!x?=cVliqt1$7Cx7a&*zVZ7 zX@BYEcZW7B#4;=?n&gqEsl;EqF6t3iUHu`@3 z?^mL8)cRgFEI#SG+v&ROhOgSU4lv6f5Wjn(^s>9Y;~n?@6`HaickND8INX=o z#Ak8RneFmT39T#Xy|US7RZ=Hs?*1#JHhG&lx5U@gw;s)KT+)~`!)s3L+}0SrD|I&{ zuPP@R)Rccn^$)fUxezlwB1=(#Ews;yLs6)p&$pZbsQ zn8h7_;m89kvE2