jekyll-flickr 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 73ce9c14613691b790731e566a736b8815195a19
4
- data.tar.gz: d43a4f4fb7111ae46713e6e2642be74bd5d1fe60
2
+ SHA256:
3
+ metadata.gz: 36695c3c9dde937ec527bf19b34865327ec83248d5acab73ba1e88b84f6f79a9
4
+ data.tar.gz: 7092b44fc42b05d27716c2805f5fb5aa73be2d0fe264ff34d036d49a6dc4d996
5
5
  SHA512:
6
- metadata.gz: 9d206f05f43e5e0bb88c6525abaf243589c3ef937612a38dada6ec3da6435cfd470524e93d99f1a7ae7d7deefd7d0325f31ae3d041b49f58f8eb185a872fe863
7
- data.tar.gz: 226f62d875fcd74bab8f19a11afa5d0e020162481881419be545ce4d37830b0742eabcd0d077616c3e874e0941551268d12689582f590c26529c76139115d28c
6
+ metadata.gz: 7423f1d84db3884f2e2c2b9dcb5c266db713a33e71788ae478993bb141136f4961b4e310cc110d272f14a7c744522f00331b9fb09c875ef5e68441ed6bcc58dc
7
+ data.tar.gz: 0a71a46c59c36f8f8708096360acc253cf9533adce08785f75371f8e5e3d57e768bcd8e43558658923217692cca91cec4acca70de3baa8544de92349846fbc09
@@ -1,5 +1,10 @@
1
1
  ## HEAD
2
2
 
3
+ ## 0.1.2 / 2019-03-06
4
+
5
+ * feature: reduce overhead due to class variables
6
+ * fix: disable expiry of the cache
7
+
3
8
  ## 0.1.1 / 2017-04-09
4
9
 
5
10
  * feature: add CSS class `flickr` to HTML
data/README.md CHANGED
@@ -51,7 +51,7 @@ Use the tag as follows in your Jekyll pages, posts and collections:
51
51
  Example:
52
52
 
53
53
  ```liquid
54
- {% flickr 38285149681 "My favourite photo of the month." style="float: right;"}
54
+ {% flickr 38285149681 "My favourite photo of the month." style="float: right;" %}
55
55
  ```
56
56
 
57
57
  This will create the following HTML output:
@@ -71,8 +71,24 @@ module Jekyll
71
71
  @text = text.strip
72
72
  end
73
73
 
74
+ def flickr
75
+ @@flickr ||= begin
76
+ FlickRaw.api_key = ENV['FLICKR_API_KEY'] || config['api_key']
77
+ FlickRaw.shared_secret = ENV['FLICKR_API_SECRET'] || config['api_secret']
78
+
79
+ @@flickr = FlickRaw::Flickr.new
80
+ end
81
+ end
82
+
83
+ def cache
84
+ @@cache ||= Jekyll::Cache::FileStore.new 'flickr'
85
+ end
86
+
87
+ def config
88
+ @@config ||= DEFAULT_CONFIG.merge(Jekyll.configuration({})['flickr'])
89
+ end
90
+
74
91
  def render(context)
75
- config = DEFAULT_CONFIG.merge(context.registers[:site].config['flickr'])
76
92
 
77
93
  match = /(?<photo_id>\d+)(\s(\"(?<caption>[^"]+)\"))?(?<attr>.*)/.match @text
78
94
 
@@ -80,10 +96,7 @@ module Jekyll
80
96
  photo_caption = match.named_captures['caption']
81
97
  photo_attr = match.named_captures['attr']
82
98
 
83
- cache = Jekyll::Cache::FileStore.new 'flickr'
84
- photo_data = cache.fetch photo_id do
85
- FlickRaw.api_key = ENV['FLICKR_API_KEY'] || config['api_key']
86
- FlickRaw.shared_secret = ENV['FLICKR_API_SECRET'] || config['api_secret']
99
+ photo_data = cache.fetch photo_id, expires_in: -1 do # disable expiry in production and development environment
87
100
  {
88
101
  info: flickr.photos.getInfo(photo_id: photo_id),
89
102
  sizes: flickr.photos.getSizes(photo_id: photo_id)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Onebox
5
- VERSION = "0.1.1".freeze
5
+ VERSION = "0.1.2".freeze
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-flickr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Riemann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-08 00:00:00.000000000 Z
11
+ date: 2019-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll-cache
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  version: '0'
132
132
  requirements: []
133
133
  rubyforge_project:
134
- rubygems_version: 2.6.14
134
+ rubygems_version: 2.7.9
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: Liquid tag for responsive Flickr images using HTML5 srcset.