bunto-avatar 4.0.0 → 5.0.0

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
  SHA1:
3
- metadata.gz: bfdae717283bca66ded18ea4f622cd5a9fd395ee
4
- data.tar.gz: 267ebd1fbc1629a47ce07e831a4995e78ac37d8d
3
+ metadata.gz: 3751fdc961f70c8d0d14d945fece07b193bbb361
4
+ data.tar.gz: 9469cff32a3fcc4fc748d1478bcbf5ef6679b163
5
5
  SHA512:
6
- metadata.gz: 270ddd53b25be1262d8f5c6e7bf23920f268e477aea2463ab7cde06768a9bdd30d01f2182b0cc21d325b0555a263c1c395acb2c6ae501d1c558eb7fc3f49e14a
7
- data.tar.gz: 2126506ada23b445bbdc91ab1b201442bcce478a5de0541372d33217c74e691b26eb337c5ff08ab206019018ad14481cba967c94319e88834cbd9a8977c1acfd
6
+ metadata.gz: ec5496df54876bea974532b199858c718338c57bff62883124c39298ee464323ae983fdc735a02db712f6c98530edc7f178115f89061fc2aa567cf12ca6c30db
7
+ data.tar.gz: 724cda8d0fdb8839a1919638aa4666e48c9c97db92d9856b876a92b6d114a2c0290c2a8d6a5f79ca5b0432a418c5ad812679e61adbb2a85f187412c8c8263430
data/.gitignore CHANGED
@@ -1,10 +1,10 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.gem
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.gem
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --format documentation
2
- --color
1
+ --format documentation
2
+ --color
@@ -1,13 +1,5 @@
1
- Style/AlignHash:
2
- EnforcedHashRocketStyle: table
3
- EnforcedColonStyle: table
4
-
5
- Style/Documentation:
6
- Enabled: false
7
-
8
- Lint/EndAlignment:
9
- AlignWith: variable
10
- AutoCorrect: true
1
+ inherit_gem:
2
+ bunto: .rubocop.yml
11
3
 
12
4
  Style/FileName:
13
5
  Enabled: false
@@ -15,6 +7,3 @@ Style/FileName:
15
7
  Metrics/LineLength:
16
8
  Exclude:
17
9
  - spec/*/**
18
-
19
- Style/DeprecatedHashMethods:
20
- Enabled: false
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.3.1
@@ -1,10 +1,10 @@
1
- language: ruby
2
- rvm:
3
- - 2.3.0
4
- sudo: false
5
- cache: bundler
6
- before_script:
7
- - chmod a+x script/bootstrap
8
- - chmod a+x script/cibuild
9
- - gem install bundler -v 1.11.2
10
- script: script/cibuild
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.0
4
+ sudo: false
5
+ cache: bundler
6
+ before_script:
7
+ - chmod a+x script/bootstrap
8
+ - chmod a+x script/cibuild
9
+ - gem install bundler -v 1.11.2
10
+ script: script/cibuild
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  source 'https://rubygems.org'
2
3
 
3
4
  # Specify your gem's dependencies in bunto-avatar.gemspec
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016-present Ben Balter
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016-present Ben Balter
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,74 +1,74 @@
1
- # Bunto Avatar
2
-
3
- *A Bunto plugin for rendering GitHub avatars*
4
-
5
- [![Build Status](https://travis-ci.org/bunto/bunto-avatar.svg)](https://travis-ci.org/bunto/bunto-avatar)
6
-
7
- Bunto Avatar makes it easy to add GitHub avatars to your Bunto site by specifying a username. If performance is a concern, Bunto Avatar is deeply integrated with the GitHub avatar API, ensuring avatars are cached and load in parallel. It even automatically upgrades users to Retina images, when supported.
8
-
9
- ## Installation
10
-
11
- Add the following to your site's `Gemfile`:
12
-
13
- ```ruby
14
- gem 'bunto-avatar'
15
- ```
16
-
17
- And add the following to your site's `_config.yml` file:
18
-
19
- ```yaml
20
- gems:
21
- - bunto-avatar
22
- ```
23
-
24
- ## Usage
25
-
26
- Simply add the following, anywhere you'd like a user's avatar to appear:
27
-
28
- ```
29
- {% avatar [USERNAME] %}
30
- ```
31
-
32
- With `[USERNAME]` being the user's GitHub username:
33
-
34
- ```
35
- {% avatar hubot %}
36
- ```
37
-
38
- That will output:
39
-
40
- ```html
41
- <img class="avatar avatar-small" src="https://avatars3.githubusercontent.com/hubot?v=3&amp;s=40" alt="hubot" srcset="https://avatars3.githubusercontent.com/hubot?v=3&amp;s=40 1x, https://avatars3.githubusercontent.com/hubot?v=3&amp;s=80 2x, https://avatars3.githubusercontent.com/hubot?v=3&amp;s=120 3x, https://avatars3.githubusercontent.com/hubot?v=3&amp;s=160 4x" width="40" height="40" />
42
- ```
43
-
44
- ### Customizing
45
-
46
- You can customize the size of the resulting avatar by passing the size argument:
47
-
48
- ```
49
- {% avatar hubot size=50 %}
50
- ```
51
-
52
- That will output:
53
-
54
- ```html
55
- <img class="avatar" src="https://avatars3.githubusercontent.com/hubot?v=3&amp;s=50" alt="hubot" srcset="https://avatars3.githubusercontent.com/hubot?v=3&amp;s=50 1x, https://avatars3.githubusercontent.com/hubot?v=3&amp;s=100 2x, https://avatars3.githubusercontent.com/hubot?v=3&amp;s=150 3x, https://avatars3.githubusercontent.com/hubot?v=3&amp;s=200 4x" width="50" height="50" />
56
- ```
57
-
58
- ### Passing the username as variable
59
-
60
- You can also pass the username as a variable, like this:
61
-
62
- ```
63
- {% assign username="hubot" %}
64
- {% avatar {{ username }} %}
65
- ```
66
-
67
- Or, if the variable is someplace a bit more complex, like a loop:
68
-
69
- ```
70
- {% assign employees = "alice|bob" | split:"|" %}
71
- {% for employee in employees %}
72
- {% avatar user=employee %}
73
- {% endfor %}
74
- ```
1
+ # Bunto Avatar
2
+
3
+ *A Bunto plugin for rendering GitHub avatars*
4
+
5
+ [![Build Status](https://travis-ci.org/bunto/bunto-avatar.svg)](https://travis-ci.org/bunto/bunto-avatar)
6
+
7
+ Bunto Avatar makes it easy to add GitHub avatars to your Bunto site by specifying a username. If performance is a concern, Bunto Avatar is deeply integrated with the GitHub avatar API, ensuring avatars are cached and load in parallel. It even automatically upgrades users to Retina images, when supported.
8
+
9
+ ## Installation
10
+
11
+ Add the following to your site's `Gemfile`:
12
+
13
+ ```ruby
14
+ gem 'bunto-avatar'
15
+ ```
16
+
17
+ And add the following to your site's `_config.yml` file:
18
+
19
+ ```yaml
20
+ gems:
21
+ - bunto-avatar
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ Simply add the following, anywhere you'd like a user's avatar to appear:
27
+
28
+ ```
29
+ {% avatar [USERNAME] %}
30
+ ```
31
+
32
+ With `[USERNAME]` being the user's GitHub username:
33
+
34
+ ```
35
+ {% avatar hubot %}
36
+ ```
37
+
38
+ That will output:
39
+
40
+ ```html
41
+ <img class="avatar avatar-small" src="https://avatars3.githubusercontent.com/hubot?v=3&amp;s=40" alt="hubot" srcset="https://avatars3.githubusercontent.com/hubot?v=3&amp;s=40 1x, https://avatars3.githubusercontent.com/hubot?v=3&amp;s=80 2x, https://avatars3.githubusercontent.com/hubot?v=3&amp;s=120 3x, https://avatars3.githubusercontent.com/hubot?v=3&amp;s=160 4x" width="40" height="40" />
42
+ ```
43
+
44
+ ### Customizing
45
+
46
+ You can customize the size of the resulting avatar by passing the size argument:
47
+
48
+ ```
49
+ {% avatar hubot size=50 %}
50
+ ```
51
+
52
+ That will output:
53
+
54
+ ```html
55
+ <img class="avatar" src="https://avatars3.githubusercontent.com/hubot?v=3&amp;s=50" alt="hubot" srcset="https://avatars3.githubusercontent.com/hubot?v=3&amp;s=50 1x, https://avatars3.githubusercontent.com/hubot?v=3&amp;s=100 2x, https://avatars3.githubusercontent.com/hubot?v=3&amp;s=150 3x, https://avatars3.githubusercontent.com/hubot?v=3&amp;s=200 4x" width="50" height="50" />
56
+ ```
57
+
58
+ ### Passing the username as variable
59
+
60
+ You can also pass the username as a variable, like this:
61
+
62
+ ```
63
+ {% assign username="hubot" %}
64
+ {% avatar {{ username }} %}
65
+ ```
66
+
67
+ Or, if the variable is someplace a bit more complex, like a loop:
68
+
69
+ ```
70
+ {% assign employees = "alice|bob" | split:"|" %}
71
+ {% for employee in employees %}
72
+ {% avatar user=employee %}
73
+ {% endfor %}
74
+ ```
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'bundler/gem_tasks'
2
3
  require 'rspec/core/rake_task'
3
4
 
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'bunto-avatar/version'
@@ -19,7 +20,7 @@ Gem::Specification.new do |spec|
19
20
 
20
21
  spec.require_paths = ['lib']
21
22
 
22
- spec.add_dependency 'bunto', '~> 1.0'
23
+ spec.add_dependency 'bunto', '~> 3.2.1'
23
24
  spec.add_development_dependency 'bundler', '~> 1.11'
24
25
  spec.add_development_dependency 'rake', '~> 10.0'
25
26
  spec.add_development_dependency 'rspec', '~> 3.0'
@@ -1,7 +1,10 @@
1
- require 'zlib'
1
+ # frozen_string_literal: true
2
+ require "zlib"
2
3
 
3
4
  module Bunto
4
5
  class Avatar < Liquid::Tag
6
+ include Bunto::LiquidExtensions
7
+
5
8
  SERVERS = 4
6
9
  DEFAULT_SIZE = 40
7
10
  API_VERSION = 3
@@ -14,7 +17,7 @@ module Bunto
14
17
  def render(context)
15
18
  @context = context
16
19
  @text = Liquid::Template.parse(@text).render(@context)
17
- attrs = attributes.map { |k, v| "#{k}=\"#{v}\"" }.join(' ')
20
+ attrs = attributes.map { |k, v| "#{k}=\"#{v}\"" }.join(" ")
18
21
  "<img #{attrs} />"
19
22
  end
20
23
 
@@ -22,27 +25,27 @@ module Bunto
22
25
 
23
26
  def attributes
24
27
  {
25
- :class => classes,
26
- :src => url,
27
- :alt => username,
28
- :srcset => srcset,
29
- :width => size,
30
- :height => size,
31
- :'data-proofer-ignore' => true
28
+ :class => classes,
29
+ :src => url,
30
+ :alt => username,
31
+ :srcset => srcset,
32
+ :width => size,
33
+ :height => size,
34
+ "data-proofer-ignore" => true
32
35
  }
33
36
  end
34
37
 
35
38
  def username
36
- matches = @text.match(/\buser=(\w+)\b/)
37
- if matches && @context.has_key?(matches[1])
38
- @context[matches[1]]
39
+ matches = @text.match(%r!\buser=([\w\.]+)\b!)
40
+ if matches
41
+ lookup_variable(@context, matches[1])
39
42
  else
40
- @text.split(' ').first.sub('@', '')
43
+ @text.split(" ").first.sub("@", "")
41
44
  end
42
45
  end
43
46
 
44
47
  def size
45
- matches = @text.match(/\bsize=(\d+)\b/i)
48
+ matches = @text.match(%r!\bsize=(\d+)\b!i)
46
49
  matches ? matches[1].to_i : DEFAULT_SIZE
47
50
  end
48
51
 
@@ -63,14 +66,14 @@ module Bunto
63
66
  end
64
67
 
65
68
  def srcset
66
- (1..4).map { |scale| "#{url(scale)} #{scale}x" }.join(', ')
69
+ (1..4).map { |scale| "#{url(scale)} #{scale}x" }.join(", ")
67
70
  end
68
71
 
69
72
  # See http://primercss.io/avatars/#small-avatars
70
73
  def classes
71
- size < 48 ? 'avatar avatar-small' : 'avatar'
74
+ size < 48 ? "avatar avatar-small" : "avatar"
72
75
  end
73
76
  end
74
77
  end
75
78
 
76
- Liquid::Template.register_tag('avatar', Bunto::Avatar)
79
+ Liquid::Template.register_tag("avatar", Bunto::Avatar)
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
1
2
  module Liquid; class Tag; end; end
2
3
  module Bunto
3
4
  class Avatar < Liquid::Tag
4
- VERSION = '4.0.0'.freeze
5
+ VERSION = "5.0.0".freeze
5
6
  end
6
7
  end
@@ -1,5 +1,5 @@
1
- #!/bin/sh
2
-
3
- set -ex
4
-
5
- bundle install
1
+ #!/bin/sh
2
+
3
+ set -ex
4
+
5
+ bundle install
@@ -1,6 +1,6 @@
1
- #!/bin/sh
2
-
3
- set -ex
4
-
5
- bundle exec rake spec
6
- bundle exec rubocop
1
+ #!/bin/sh
2
+
3
+ set -ex
4
+
5
+ bundle exec rake spec
6
+ bundle exec rubocop
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bunto-avatar
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Suriyaa Kudo
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-03-25 00:00:00.000000000 Z
12
+ date: 2017-07-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bunto
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.0'
20
+ version: 3.2.1
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.0'
27
+ version: 3.2.1
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: bundler
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  requirements: []
124
124
  rubyforge_project:
125
- rubygems_version: 2.2.2
125
+ rubygems_version: 2.6.12
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: A Bunto plugin for rendering GitHub avatars