showcase 0.2.0.beta.4 → 0.2.0.beta.5

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: a552e964feb8dee0c01780000c3b5fcff2dd69e4
4
- data.tar.gz: 33e71c49318a0edb2874caa823a6d2bbd04b9373
3
+ metadata.gz: 9f9f2fdb7c485fa431bdc844dfa1e90c19df2327
4
+ data.tar.gz: f82059c06749b78396057a4902ba5ce305d51804
5
5
  SHA512:
6
- metadata.gz: 911610134d24f4f00bd3315a634e5bec6b4a304e0a56035d7f1adf5e4cc0cc1075b24c9f3cd3cf75377975e619e1f53f2625aeb483839b2a15487b9d9009b662
7
- data.tar.gz: 508533360df64c06a1de58e999abe82de44ada2c45207f27b015a37fae37507ecb45a33e52899a7c79549e72086697bce0953b4f92f21ae19563cc728ce7b665
6
+ metadata.gz: a870589ee0807ebf648ba0f77032ec9dda5ef459314099c9fc7ec1b61e1f1f1c74ee839ec519fb757875be0fede89f65d2f5ac95f24cb69041aa1ffc9ae81c89
7
+ data.tar.gz: dfd4c857afb37106f3d6f61562a2a3efe3304a5f29881e6e759cbfc679633299c67f7d470afbc5cae0858d03ca729a51ede348fbac355002da41861a772ef31c
data/README.md CHANGED
@@ -33,12 +33,12 @@ $ gem install showcase
33
33
 
34
34
  ## Usage
35
35
 
36
- With Rails, you're already set, move on! With Padrino, include `Showcase::Helpers`
36
+ With Rails, you're already set, move on! With Padrino, include `Showcase::Helpers::Present`
37
37
  in your app `helpers` block.
38
38
 
39
39
  ```ruby
40
40
  helpers do
41
- include Showcase::Helpers
41
+ include Showcase::Helpers::Present
42
42
  end
43
43
  ```
44
44
 
@@ -12,19 +12,33 @@ module Showcase
12
12
  title += options[:title_suffix] if options[:title_suffix]
13
13
 
14
14
  context.content_tag(:title, title) <<
15
- seo_meta_tags(:og_title, :twitter_title, values)
15
+ seo_meta_tags('og:title', 'twitter:title', values)
16
16
  end
17
17
 
18
18
  def description(values, options = {})
19
- seo_meta_tags(:description, :og_description, :twitter_description, values)
19
+ seo_meta_tags('description', 'og:description', 'twitter:description', values)
20
20
  end
21
21
 
22
22
  def image_url(image_url, options = {})
23
- seo_meta_tags(:og_image, :twitter_image, image_url)
23
+ seo_meta_tags('og:image', 'twitter:image', image_url)
24
+ end
25
+
26
+ def iframe_video_url(video_url, options = {})
27
+ seo_meta_tags('og:video:url', 'twitter:player', video_url) <<
28
+ seo_meta_tags('og:video:type', 'text/html')
29
+ end
30
+
31
+ def stream_video_url(video_url, options = {})
32
+ seo_meta_tags('og:video:url', 'twitter:player:stream', video_url) <<
33
+ seo_meta_tags('og:video:type', 'video/mp4')
34
+ end
35
+
36
+ def site_name(name, options = {})
37
+ seo_meta_tags('og:site_name', name)
24
38
  end
25
39
 
26
40
  def canonical_url(url, options = {})
27
- seo_meta_tags(:og_url, url) <<
41
+ seo_meta_tags('og:url', url) <<
28
42
  context.tag(:link, rel: "canonical", "href" => url)
29
43
  end
30
44
 
@@ -40,7 +54,7 @@ module Showcase
40
54
  return nil unless value.present?
41
55
 
42
56
  args.map do |name|
43
- chunks = name.to_s.split("_")
57
+ chunks = name.to_s.split(":")
44
58
  attr_name = if chunks.first == 'og'
45
59
  'property'
46
60
  else
@@ -22,7 +22,11 @@ module Showcase
22
22
  meta.merge!(options.symbolize_keys) if options
23
23
 
24
24
  builder = Helpers::SeoMetaBuilder.new(view_context)
25
- parts = %w(title description canonical_url image_url canonical_url).map(&:to_sym)
25
+ parts = %w(
26
+ title description site_name
27
+ canonical_url
28
+ image_url iframe_video_url stream_video_url
29
+ ).map(&:to_sym)
26
30
 
27
31
  parts.map do |tag|
28
32
  builder.send(tag, meta[tag], meta.except(*parts)) if meta[tag]
@@ -45,7 +45,7 @@ module Showcase
45
45
  html_options = meta.html_options || {}
46
46
  params = Hash[
47
47
  settings[:params].map do |param, meta_key|
48
- values = [:"#{social}_#{meta_key}", meta_key].map { |key| meta[key] }
48
+ values = [:"#{social}_#{meta_key}", meta_key].map { |key| meta.send(key) }
49
49
  [ param, values.find(&:presence) ]
50
50
  end
51
51
  ]
@@ -1,4 +1,4 @@
1
1
  module Showcase
2
- VERSION = "0.2.0.beta.4"
2
+ VERSION = "0.2.0.beta.5"
3
3
  end
4
4
 
@@ -90,6 +90,39 @@ module Showcase::Helpers
90
90
  end
91
91
  end
92
92
 
93
+ describe '#iframe_video_url' do
94
+ it 'produces a og:video:url meta tag' do
95
+ expect(subject.iframe_video_url('foo')).to have_tag(:meta, with: { property: 'og:video:url', content: 'foo' })
96
+ end
97
+
98
+ it 'produces a twitter:player meta tag' do
99
+ expect(subject.iframe_video_url('foo')).to have_tag(:meta, with: { name: 'twitter:player', content: 'foo' })
100
+ end
101
+
102
+ it 'produces a og:video:type meta tag' do
103
+ expect(subject.iframe_video_url('foo')).to have_tag(:meta, with: { property: 'og:video:type', content: 'text/html' })
104
+ end
105
+ end
106
+
107
+ describe '#stream_video_url' do
108
+ it 'produces a og:video:url meta tag' do
109
+ expect(subject.stream_video_url('foo')).to have_tag(:meta, with: { property: 'og:video:url', content: 'foo' })
110
+ end
111
+
112
+ it 'produces a twitter:player:stream meta tag' do
113
+ expect(subject.stream_video_url('foo')).to have_tag(:meta, with: { name: 'twitter:player:stream', content: 'foo' })
114
+ end
115
+
116
+ it 'produces a og:video:type meta tag' do
117
+ expect(subject.stream_video_url('foo')).to have_tag(:meta, with: { property: 'og:video:type', content: 'video/mp4' })
118
+ end
119
+ end
120
+
121
+ describe '#site_name' do
122
+ it 'produces a og:site_name meta tag' do
123
+ expect(subject.site_name('foo')).to have_tag(:meta, with: { property: 'og:site_name', content: 'foo' })
124
+ end
125
+ end
93
126
  end
94
127
  end
95
128
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: showcase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.beta.4
4
+ version: 0.2.0.beta.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Verna
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-08 00:00:00.000000000 Z
11
+ date: 2013-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport