jemoji 0.6.2 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jemoji.rb +19 -5
  3. metadata +16 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 663ba1344d48de42b117da24d79b0e704fdf101b
4
- data.tar.gz: 1449d59da2f9d1118d5ba371f3f21f56335f1ca6
3
+ metadata.gz: 0f5813292ceb0435933a7292e5ed4c4e6d6c74bf
4
+ data.tar.gz: 6f889170c3c5714835aac5be4864629fe61be9eb
5
5
  SHA512:
6
- metadata.gz: f26f33f454aa288847d00f52117fafc08bd53707cd9af7bb182805b8af6a69fd9f8d556d7f0038606189d62cad8881c53d42f312a264de7c524e5aac6311e5ef
7
- data.tar.gz: 4f76cade7b1f987455ecfee964ec92223348b07472d2b90d29c6e6904d48e5f88803b534abf95f7ead21e0882a5639ed8927d43fd3a657b5f09b0292eb646f78
6
+ metadata.gz: 68ae4fe100adfb5e5b7b81e0e454dc5ea31292ec1cd3dc895c3412b5533f305984b86e7dc0c1921e8bdb5af9ef5a31a3be14d91e8aeaec08a41892caef1db92d
7
+ data.tar.gz: d07ca007174b814a835a681165d191bd0eb2bd60f14a85cf6293b76dbd85667bdcdb149bb57a173ac7ca09a08179d2ad2aae41af194560ff8d347f041126689c
@@ -4,7 +4,8 @@ require 'html/pipeline'
4
4
 
5
5
  module Jekyll
6
6
  class Emoji
7
- GITHUB_DOT_COM_ASSET_ROOT = "https://assets.github.com/images/icons/".freeze
7
+ GITHUB_DOT_COM_ASSET_HOST_URL = "https://assets-cdn.github.com".freeze
8
+ ASSET_PATH = "/images/icons/".freeze
8
9
  BODY_START_TAG = "<body".freeze
9
10
 
10
11
  class << self
@@ -23,7 +24,7 @@ module Jekyll
23
24
 
24
25
  # Public: Create or fetch the filter for the given {{src}} asset root.
25
26
  #
26
- # src - the asset root URL (e.g. https://assets.github.com/images/icons/)
27
+ # src - the asset root URL (e.g. https://assets-cdn.github.com/images/icons/)
27
28
  #
28
29
  # Returns an HTML::Pipeline instance for the given asset root.
29
30
  def filter_with_emoji(src)
@@ -45,13 +46,14 @@ module Jekyll
45
46
  #
46
47
  # config - the hash-like configuration of the document's site
47
48
  #
48
- # Returns a full URL to use as the asset root URL. Defaults to
49
- # the assets.github.com emoji root.
49
+ # Returns a full URL to use as the asset root URL. Defaults to the root
50
+ # URL for assets provided by an ASSET_HOST_URL environment variable,
51
+ # otherwise the root URL for emoji assets at assets-cdn.github.com.
50
52
  def emoji_src(config = {})
51
53
  if config.key?("emoji") && config["emoji"].key?("src")
52
54
  config["emoji"]["src"]
53
55
  else
54
- GITHUB_DOT_COM_ASSET_ROOT
56
+ default_asset_root
55
57
  end
56
58
  end
57
59
 
@@ -64,6 +66,18 @@ module Jekyll
64
66
  (doc.is_a?(Jekyll::Page) || doc.write?) &&
65
67
  doc.output_ext == ".html" || (doc.permalink && doc.permalink.end_with?("/"))
66
68
  end
69
+
70
+ private
71
+
72
+ def default_asset_root
73
+ if !ENV["ASSET_HOST_URL"].to_s.empty?
74
+ # Ensure that any trailing "/" is trimmed
75
+ asset_host_url = ENV["ASSET_HOST_URL"].chomp("/")
76
+ "#{asset_host_url}#{ASSET_PATH}"
77
+ else
78
+ "#{GITHUB_DOT_COM_ASSET_HOST_URL}#{ASSET_PATH}"
79
+ end
80
+ end
67
81
  end
68
82
  end
69
83
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jemoji
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-19 00:00:00.000000000 Z
11
+ date: 2016-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: activesupport
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '4.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '4.0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: gemoji
43
57
  requirement: !ruby/object:Gem::Requirement