jekyll-linkpreview 0.4.1 → 0.6.0.rc1

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
2
  SHA256:
3
- metadata.gz: adf9461d95ca27356364fab24299596d9dbfe50148c84055920275c87c98b975
4
- data.tar.gz: b5e364944e5f919276035478795d21ddd1172f070739a8d513ea2e6c056edd77
3
+ metadata.gz: 8c51945d7da1fdd7145948dffd3f991f1675a1c8dc0f64f3a44d19afc700fd3f
4
+ data.tar.gz: e18b2a9aa699e6d6208343790cf7e548fee7942f51cb197f87e8db36077b4394
5
5
  SHA512:
6
- metadata.gz: 03a80ba47f3b838a9f6ea6c383d3822d091caf210c9e3038405e2b1558d385643d2b8de2c4abe3c8353ef1688322ad808716cea53fe663c348255bd75952aa68
7
- data.tar.gz: 6576980e12bf8816b8b16f336f5d1fd106ee0005f151f4cf621613ee743b17e487cf7d84ce5d683ce6375e4a9261315453a78192b8a7aed7b294bcd0b6d5e281
6
+ metadata.gz: b73fa9cdc4ef0ef09906df15b56563f7c048af2c5ade7e78a87d1938f4654022f3073d243a32b4d5d11a62ba50622d9914b26a0cabe14a98156e08285452e8ea
7
+ data.tar.gz: 654a1d448bc7c74785beba8c6cfb1e2d6303e7e4db63b341955ee029ec10309334cbc03297b93666b55d804d4a8e9540968041437c8825f656e1f60040f0814e
@@ -0,0 +1,53 @@
1
+ name: Release
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
+ jobs:
7
+ check-release:
8
+ container:
9
+ image: ruby:3.1
10
+ outputs:
11
+ release: ${{ steps.check-release.outputs.release }}
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v3
16
+ with:
17
+ fetch-depth: 2
18
+ - id: check-release
19
+ name: Decide whether to release
20
+ run: |
21
+ set +e
22
+ git diff --exit-code --quiet HEAD~1 -- lib/jekyll-linkpreview/version.rb
23
+ if [ $? = 1 ]; then
24
+ echo release=true >> ${GITHUB_OUTPUT}
25
+ else
26
+ echo release=false >> ${GITHUB_OUTPUT}
27
+ fi
28
+ release:
29
+ container:
30
+ image: ruby:3.1
31
+ if: needs.check-release.outputs.release == 'true'
32
+ needs: check-release
33
+ runs-on: ubuntu-latest
34
+ steps:
35
+ - name: Checkout
36
+ uses: actions/checkout@v3
37
+ - env:
38
+ RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
39
+ name: Set credentials for RubyGems
40
+ run: |
41
+ mkdir ~/.gem
42
+ echo :rubygems_api_key: ${RUBYGEMS_API_KEY} > ~/.gem/credentials
43
+ chmod 0600 ~/.gem/credentials
44
+ - name: Configure git
45
+ run: |
46
+ git config --global user.email "yusuke.nishioka.0713@gmail..com"
47
+ git config --global user.name "Yusuke Nishioka"
48
+ - name: Install dependencies
49
+ run: bundle install
50
+ - env:
51
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52
+ name: Make a new release
53
+ run: bundle exec rake release
@@ -0,0 +1,39 @@
1
+ name: Test
2
+ on: [push]
3
+ jobs:
4
+ test:
5
+ container:
6
+ image: ruby:${{ matrix.ruby }}
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby: ["2.7", "3.1"]
11
+ appraisal:
12
+ - jekyll-35
13
+ - jekyll-36
14
+ - jekyll-37
15
+ - jekyll-38
16
+ - jekyll-39
17
+ - jekyll-40
18
+ - jekyll-41
19
+ - jekyll-42
20
+ - jekyll-43
21
+ exclude:
22
+ # To prevent 'cannot load such file -- rexml/parsers/baseparser'
23
+ - ruby: "3.1"
24
+ appraisal: jekyll-35
25
+ - ruby: "3.1"
26
+ appraisal: jekyll-36
27
+ - ruby: "3.1"
28
+ appraisal: jekyll-37
29
+ - ruby: "3.1"
30
+ appraisal: jekyll-38
31
+ steps:
32
+ - name: Checkout
33
+ uses: actions/checkout@v3
34
+ - name: Install dependencies
35
+ run: bundle install
36
+ - name: Install dependencies for each appraisal
37
+ run: bundle exec appraisal install
38
+ - name: Run tests
39
+ run: bundle exec appraisal ${{ matrix.appraisal }} rake test
data/Appraisals CHANGED
@@ -1,23 +1,35 @@
1
1
  appraise "jekyll-35" do
2
- gem "jekyll", "3.5.2"
2
+ gem "jekyll", "~> 3.5.2"
3
3
  end
4
4
 
5
5
  appraise "jekyll-36" do
6
- gem "jekyll", "3.6.3"
6
+ gem "jekyll", "~> 3.6.3"
7
7
  end
8
8
 
9
9
  appraise "jekyll-37" do
10
- gem "jekyll", "3.7.4"
10
+ gem "jekyll", "~> 3.7.4"
11
11
  end
12
12
 
13
13
  appraise "jekyll-38" do
14
- gem "jekyll", "3.8.7"
14
+ gem "jekyll", "~> 3.8.7"
15
+ end
16
+
17
+ appraise "jekyll-39" do
18
+ gem "jekyll", "~> 3.9.1"
15
19
  end
16
20
 
17
21
  appraise "jekyll-40" do
18
- gem "jekyll", "4.0.1"
22
+ gem "jekyll", "~> 4.0.1"
19
23
  end
20
24
 
21
25
  appraise "jekyll-41" do
22
- gem "jekyll", "4.1.0"
26
+ gem "jekyll", "~> 4.1.1"
27
+ end
28
+
29
+ appraise "jekyll-42" do
30
+ gem "jekyll", "~> 4.2.2"
31
+ end
32
+
33
+ appraise "jekyll-43" do
34
+ gem "jekyll", "~> 4.3.1"
23
35
  end
data/README.md CHANGED
@@ -34,6 +34,7 @@ See https://jekyllrb.com/docs/plugins/installation/ .
34
34
  ## Usage
35
35
 
36
36
  1. Create `_cache` directory.
37
+ * This directory _must_ exist under your project root even if you've modified the [site source](https://jekyllrb.com/docs/configuration/options/).
37
38
 
38
39
  1. Embed [linkpreview.css](assets/css/linkpreview.css) into your Website.
39
40
 
@@ -49,6 +50,8 @@ You can override the default templates used for generating previews, both in cas
49
50
  ### Template for pages where Open Graph protocol metadata exists
50
51
 
51
52
  1. Place `linkpreview.html` file inside `_includes/` folder of your Jekyll site (`_includes/linkpreview.html`)
53
+ * The folder is the same one you would store files for use with `{% include fragment.html %}` tag.
54
+ Therefore, it *must* be under the [site's source](https://jekyllrb.com/docs/configuration/options/).
52
55
 
53
56
  2. Use built-in variables to extract data which you would like to render. Available variables are:
54
57
  * **link_url** i.e. `{{ link_url }}`
@@ -60,6 +63,8 @@ You can override the default templates used for generating previews, both in cas
60
63
  ### Template for pages where Open Graph protocol metadata does not exist
61
64
 
62
65
  1. Place `linkpreview_nog.html` file inside `_includes/` folder of your Jekyll site (`_includes/linkpreview_nog.html`)
66
+ * The folder is the same one you would store files for use with `{% include fragment.html %}` tag.
67
+ Therefore, it *must* be under the [site's source](https://jekyllrb.com/docs/configuration/options/).
63
68
 
64
69
  2. Use built-in variables to extract data which you would like to render. Available variables are:
65
70
  * **link_url** i.e. `{{ link_url }}`
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "bundler", "~> 2.0"
24
24
  spec.add_development_dependency "rake", "~> 12.3.3"
25
25
  spec.add_development_dependency "rspec", "~> 3.0"
26
+ spec.add_development_dependency "rspec-parameterized", "~> 0.5.2"
26
27
  spec.add_development_dependency "appraisal", "~> 2.2.0"
27
28
  spec.add_development_dependency "wwtd", "~> 1.4.1"
28
29
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Linkpreview
3
- VERSION = "0.4.1"
3
+ VERSION = "0.6.0.rc1"
4
4
  end
5
5
  end
@@ -147,7 +147,7 @@ module Jekyll
147
147
  def render(context)
148
148
  url = get_url_from(context)
149
149
  properties = get_properties(url)
150
- render_linkpreview properties
150
+ render_linkpreview context, properties
151
151
  end
152
152
 
153
153
  def get_properties(url)
@@ -208,8 +208,8 @@ module Jekyll
208
208
  end
209
209
 
210
210
  private
211
- def render_linkpreview(properties)
212
- template_path = get_custom_template_path properties
211
+ def render_linkpreview(context, properties)
212
+ template_path = get_custom_template_path context, properties
213
213
  if File.exist?(template_path)
214
214
  hash = properties.to_hash_for_custom_template
215
215
  gen_custom_template template_path, hash
@@ -219,8 +219,14 @@ module Jekyll
219
219
  end
220
220
 
221
221
  private
222
- def get_custom_template_path(properties)
223
- File.join Dir.pwd, @@template_dir, properties.template_file
222
+ def get_custom_template_path(context, properties)
223
+ source_dir = get_source_dir_from context
224
+ File.join source_dir, @@template_dir, properties.template_file
225
+ end
226
+
227
+ private
228
+ def get_source_dir_from(context)
229
+ File.absolute_path context.registers[:site].config['source'], Dir.pwd
224
230
  end
225
231
 
226
232
  private
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-linkpreview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.6.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusuke Nishioka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-18 00:00:00.000000000 Z
11
+ date: 2022-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -86,6 +86,20 @@ dependencies:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: '3.0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: rspec-parameterized
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: 0.5.2
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: 0.5.2
89
103
  - !ruby/object:Gem::Dependency
90
104
  name: appraisal
91
105
  requirement: !ruby/object:Gem::Requirement
@@ -121,9 +135,10 @@ executables: []
121
135
  extensions: []
122
136
  extra_rdoc_files: []
123
137
  files:
138
+ - ".github/workflows/release.yaml"
139
+ - ".github/workflows/test.yaml"
124
140
  - ".gitignore"
125
141
  - ".rspec"
126
- - ".travis.yml"
127
142
  - Appraisals
128
143
  - Dockerfile
129
144
  - Gemfile
@@ -133,13 +148,6 @@ files:
133
148
  - assets/css/linkpreview.css
134
149
  - bin/console
135
150
  - bin/setup
136
- - gemfiles/.bundle/config
137
- - gemfiles/jekyll_35.gemfile
138
- - gemfiles/jekyll_36.gemfile
139
- - gemfiles/jekyll_37.gemfile
140
- - gemfiles/jekyll_38.gemfile
141
- - gemfiles/jekyll_40.gemfile
142
- - gemfiles/jekyll_41.gemfile
143
151
  - jekyll-linkpreview.gemspec
144
152
  - lib/jekyll-linkpreview.rb
145
153
  - lib/jekyll-linkpreview/version.rb
@@ -158,11 +166,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
158
166
  version: '0'
159
167
  required_rubygems_version: !ruby/object:Gem::Requirement
160
168
  requirements:
161
- - - ">="
169
+ - - ">"
162
170
  - !ruby/object:Gem::Version
163
- version: '0'
171
+ version: 1.3.1
164
172
  requirements: []
165
- rubygems_version: 3.0.3
173
+ rubygems_version: 3.3.26
166
174
  signing_key:
167
175
  specification_version: 4
168
176
  summary: Jekyll tag plugin to generate link preview
data/.travis.yml DELETED
@@ -1,22 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.4.2
7
- - 2.7.0
8
- before_install: gem install bundler -v 2.0.1
9
- gemfile:
10
- - gemfiles/jekyll_35.gemfile
11
- - gemfiles/jekyll_36.gemfile
12
- - gemfiles/jekyll_37.gemfile
13
- - gemfiles/jekyll_38.gemfile
14
- - gemfiles/jekyll_40.gemfile
15
- - gemfiles/jekyll_41.gemfile
16
- script: "bundle exec rake test"
17
- matrix:
18
- exclude:
19
- - rvm: 2.4.2
20
- gemfile: gemfiles/jekyll_40.gemfile
21
- - rvm: 2.4.2
22
- gemfile: gemfiles/jekyll_41.gemfile
@@ -1,2 +0,0 @@
1
- ---
2
- BUNDLE_RETRY: "1"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "jekyll", "3.5.2"
6
-
7
- gemspec path: "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "jekyll", "3.6.3"
6
-
7
- gemspec path: "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "jekyll", "3.7.4"
6
-
7
- gemspec path: "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "jekyll", "3.8.7"
6
-
7
- gemspec path: "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "jekyll", "4.0.1"
6
-
7
- gemspec path: "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "jekyll", "4.1.0"
6
-
7
- gemspec path: "../"