h2ocube_rails_helper 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98d190df931ced4c044766e99eeebcf8b919fad0
4
- data.tar.gz: 5256b8f7852b970ab90cf17c7925eb53978f77d6
3
+ metadata.gz: 55dab7f856af3ade14b8678dd3fa0a88173307cf
4
+ data.tar.gz: e5dcff28c9c48499d67c1db233193eab1c7fd29e
5
5
  SHA512:
6
- metadata.gz: a00ca62e798dcc89f301516cd545bb9395350dfac5505a6601fd00c0cf682d091474f5b3e2470d0090ce43064ef96115acaf01b909f4c041776a75752f9f004e
7
- data.tar.gz: 0bf887356575bf47460e9456146fffc2ecc2cf2b54229764710fd05c54ff4a750f46b094614f23211d39ce8dba6f172b2d7fe26dd4868ba0af2b08e4e236127d
6
+ metadata.gz: 0326543897681548b45a4ed6bb67ccbb27cb213a734bd139fe6f5a2bf9d520832b79b8fa5868d6fdc0bff0c4c4046ba892bb8abd901b8d68abd619343a54c5dc
7
+ data.tar.gz: 15f88fb00dafb719a41c1bab8d65de0b532594071fd7425e6adfd099f7b95fcb3198ee82e375d983535fef5f39fd7a5636ab4e2d7d714420ac0ea9ec2d8d7baf
@@ -4,18 +4,18 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = 'h2ocube_rails_helper'
7
- gem.version = '0.1.0'
7
+ gem.version = '0.1.1'
8
8
  gem.authors = ['Ben']
9
9
  gem.email = ['ben@h2ocube.com']
10
- gem.description = %q{Just an helper collection}
11
- gem.summary = %q{Just an helper collection}
10
+ gem.description = 'Just an helper collection'
11
+ gem.summary = 'Just an helper collection'
12
12
  gem.homepage = 'https://github.com/h2ocube/h2ocube_rails_helper'
13
13
  gem.license = 'MIT'
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
16
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
+ gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
- gem.require_paths = ["lib"]
18
+ gem.require_paths = ['lib']
19
19
 
20
20
  gem.add_dependency 'settingslogic'
21
21
  gem.add_dependency 'browser'
@@ -25,6 +25,6 @@ Gem::Specification.new do |gem|
25
25
  gem.add_development_dependency 'rspec-rails'
26
26
  gem.add_development_dependency 'rr'
27
27
  gem.add_development_dependency 'capybara'
28
- gem.add_development_dependency 'rails', '< 4.0.0'
28
+ gem.add_development_dependency 'rails'
29
29
  gem.add_development_dependency 'sqlite3'
30
30
  end
@@ -1,114 +1,180 @@
1
1
  require 'settingslogic'
2
2
  require 'browser'
3
3
 
4
+ module Browser
5
+ class Base
6
+ def wechat?
7
+ !(ua =~ /MicroMessenger/i).nil?
8
+ end
9
+
10
+ def mobile?
11
+ !ua.blank? && (device.mobile? || device.tablet?)
12
+ end
13
+
14
+ def desktop?
15
+ !ua.blank? && !device.mobile?
16
+ end
17
+ end
18
+
19
+ class Generic < Base
20
+ alias _full_version full_version
21
+
22
+ def full_version
23
+ ua.blank? ? '0.0' : _full_version
24
+ end
25
+ end
26
+
27
+ class Device
28
+ alias _detect_mobile detect_mobile?
29
+
30
+ def detect_mobile?
31
+ !ua.blank? && _detect_mobile
32
+ end
33
+ end
34
+
35
+ module Meta
36
+ class Wechat < Base
37
+ def meta
38
+ 'wechat' if browser.wechat?
39
+ end
40
+ end
41
+
42
+ class Desktop < Base
43
+ def meta
44
+ 'desktop' if browser.desktop?
45
+ end
46
+ end
47
+
48
+ class Tablet < Base
49
+ def meta
50
+ 'tablet mobile' if browser.device.tablet?
51
+ end
52
+ end
53
+ end
54
+ end
55
+
4
56
  module H2ocubeRailsHelper
5
- module ActionViewExtension
6
- def render_html_class
7
- cls = []
8
- if params[:controller].include?('/')
9
- cls.push params[:controller].gsub('/', '_')
10
- params[:controller].split('/').each { |c| cls.push c }
11
- else
12
- cls.push params[:controller]
13
- end
14
-
15
- cls.push params[:action]
16
- cls.push cls[0] + '_' + params[:action]
17
-
18
- if params.has_key?(:html_class)
19
- if params[:html_class].class != Array
20
- cls.push params[:html_class].to_s
57
+ module ActionView
58
+ module Helpers
59
+ def render_html_class
60
+ cls = []
61
+ if params[:controller].include?('/')
62
+ cls.push params[:controller].gsub('/', '_')
63
+ params[:controller].split('/').each { |c| cls.push c }
64
+ else
65
+ cls.push params[:controller]
66
+ end
67
+
68
+ cls.push params[:action]
69
+ cls.push cls[0] + '_' + params[:action]
70
+
71
+ if params.key?(:html_class)
72
+ if params[:html_class].class != Array
73
+ cls.push params[:html_class].to_s
74
+ else
75
+ params[:html_class].each { |c| cls.push c }
76
+ end
77
+ end
78
+
79
+ cls.push Browser.new(request.env['HTTP_USER_AGENT']).to_s
80
+
81
+ cls.compact.uniq.join ' '
82
+ end
83
+
84
+ def _title(opts = {})
85
+ return [@_title] if defined?(@_title)
86
+ if defined?(@title) && !@title.blank?
87
+ title = @title.is_a?(Array) ? @title : [ @title.to_s ]
21
88
  else
22
- params[:html_class].each { |c| cls.push c }
89
+ begin
90
+ title = [resource.title, resource.class.model_name.human] if defined?(resource) && resource.respond_to?(:title) && resource.class.respond_to?(:model_name)
91
+ rescue
92
+ end
93
+
94
+ title ||= []
23
95
  end
96
+
97
+ if opts.key? :title
98
+ title.push opts[:title]
99
+ else
100
+ title.push HelperSettings.title
101
+ end
102
+ title.compact.map { |t| t = t.strip; t == '' ? nil : t }.compact
24
103
  end
25
104
 
26
- cls.push Browser.new(accept_language: request.headers['Accept-Language'], ua: request.headers['User-Agent']).to_s
105
+ def _render_title(opts = {})
106
+ strip_tags _title(opts).join(' - ')
107
+ end
27
108
 
28
- cls.compact.uniq.join ' '
29
- end
109
+ def render_title(opts = {})
110
+ "<title>#{_render_title opts}</title>".html_safe
111
+ end
30
112
 
31
- def _title opts = {}
32
- return [@_title] if defined?(@_title)
33
- if defined?(@title) && !@title.blank?
34
- title = @title.is_a?(Array) ? @title : [ @title.to_s ]
35
- else
36
- begin
37
- title = [resource.title, resource.class.model_name.human] if defined?(resource) && resource.respond_to?(:title) && resource.class.respond_to?(:model_name)
38
- rescue
113
+ def _keywords(opts = {})
114
+ if defined? @keywords
115
+ keywords = @keywords
116
+ elsif defined?(@item) && @item.respond_to?(:keywords) && !@item.keywords.blank?
117
+ keywords = @item.keywords.strip.split(/(,|,)/)
118
+ else
119
+ keywords = opts.key?(:keywords) ? opts[:keywords] : HelperSettings.keywords
39
120
  end
40
-
41
- title ||= []
121
+ [keywords].flatten.compact.map{ |k| k.to_s.strip.split(/(,|,)/) }.flatten.map { |k| k.gsub(/(,|,)/, '').blank? ? nil : k }.compact.uniq
42
122
  end
43
123
 
44
- if opts.has_key? :title
45
- title.push opts[:title]
46
- else
47
- title.push HelperSettings.title
124
+ def _render_keywords(opts = {})
125
+ strip_tags _keywords(opts).join(',')
48
126
  end
49
- title.compact.map{ |t| t = t.strip; t == '' ? nil : t }.compact
50
- end
51
127
 
52
- def render_title opts = {}
53
- "<title>#{_title(opts).join(' - ')}</title>".html_safe
54
- end
128
+ def render_keywords(opts = {})
129
+ return '' if _keywords.blank?
130
+ "<meta name=\"keywords\" content=\"#{_render_keywords opts}\" />".html_safe
131
+ end
55
132
 
56
- def _keywords opts = {}
57
- if defined? @keywords
58
- keywords = @keywords
59
- elsif defined?(@item) && @item.respond_to?(:keywords) && !@item.keywords.blank?
60
- keywords = @item.keywords.strip.split(/(,|,)/)
61
- else
62
- keywords = opts.has_key?(:keywords) ? opts[:keywords] : HelperSettings.keywords
133
+ def _description(opts = {})
134
+ if defined? @description
135
+ description = @description
136
+ elsif defined?(@item) && @item.respond_to?(:description) && !@item.description.blank?
137
+ description = @item.description
138
+ else
139
+ description = opts.key?(:description) ? opts[:description] : HelperSettings.description
140
+ end
141
+ strip_tags description.to_s.strip
63
142
  end
64
- [keywords].flatten.compact.map{ |k| k.to_s.strip.split(/(,|,)/) }.flatten.map{ |k| k.gsub(/(,|,)/, '').blank? ? nil : k }.compact.uniq
65
- end
66
143
 
67
- def render_keywords opts = {}
68
- return '' if _keywords.length == 0
69
- "<meta name=\"keywords\" content=\"#{_keywords(opts).join(',')}\" />".html_safe
70
- end
144
+ def render_description(opts = {})
145
+ return '' if _description == ''
146
+ "<meta name=\"description\" content=\"#{_description(opts)}\" />".html_safe
147
+ end
71
148
 
72
- def _description opts = {}
73
- if defined? @description
74
- description = @description
75
- elsif defined?(@item) && @item.respond_to?(:description) && !@item.description.blank?
76
- description = @item.description
77
- else
78
- description = opts.has_key?(:description) ? opts[:description] : HelperSettings.description
149
+ def render_canonical(opts = {})
150
+ !@canonical.blank? ? "<link rel=\"canonical\" href=\"#{@canonical}\" />".html_safe : ''
79
151
  end
80
- description.to_s.strip
81
- end
82
152
 
83
- def render_description opts = {}
84
- return '' if _description == ''
85
- "<meta name=\"description\" content=\"#{_description(opts)}\" />".html_safe
86
- end
153
+ def render_seo(opts = {})
154
+ render_title(opts) << render_canonical(opts) << render_keywords(opts) << render_description(opts) << render_ga(opts) << csrf_meta_tags
155
+ end
87
156
 
88
- def render_canonical opts = {}
89
- defined?(@canonical) && !@canonical.blank? ? "<link rel=\"canonical\" href=\"#{@canonical}\" />".html_safe : ''
90
- end
157
+ def render_ga(opts = {})
158
+ return '' if Rails.env.development?
159
+ ga = opts.key?(:ga) ? opts[:ga] : HelperSettings.ga
160
+ domain = opts.key?(:domain) ? opts[:domain] : HelperSettings.domain
161
+ return '' if ga.nil?
162
+ "<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', '#{ga}', '#{domain}');ga('send', 'pageview');</script>".html_safe
163
+ end
91
164
 
92
- def render_seo opts = {}
93
- render_title(opts) << render_canonical(opts) << render_keywords(opts) << render_description(opts) << render_ga(opts) << csrf_meta_tags
94
- end
165
+ private
95
166
 
96
- def render_ga opts = {}
97
- return '' if Rails.env.development?
98
- ga = opts.has_key?(:ga) ? opts[:ga] : HelperSettings.ga
99
- domain = opts.has_key?(:domain) ? opts[:domain] : HelperSettings.domain
100
- return '' if ga.nil?
101
- return "<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', '#{ga}', '#{domain}');ga('send', 'pageview');</script>".html_safe
167
+ def strip_tags(text)
168
+ Rails::Html::FullSanitizer.new.sanitize text
169
+ end
102
170
  end
103
171
  end
104
172
 
105
173
  class Railtie < ::Rails::Railtie
106
174
  initializer 'h2ocube_rails_helper' do
107
- ActiveSupport.on_load(:action_view) do
108
- ::ActionView::Base.send :include, H2ocubeRailsHelper::ActionViewExtension
175
+ ActiveSupport.on_load :action_view do
176
+ include H2ocubeRailsHelper::ActionView::Helpers
109
177
  end
110
178
  end
111
179
  end
112
180
  end
113
-
114
-
@@ -2,15 +2,15 @@ require 'spec_helper'
2
2
 
3
3
  describe 'render_canonical' do
4
4
  it 'simple' do
5
- render_canonical.should == ''
5
+ expect(render_canonical).to eq('')
6
6
  end
7
-
7
+
8
8
  it '@canonical' do
9
9
  @canonical = '@canonical'
10
- render_canonical.should == '<link rel="canonical" href="@canonical" />'
10
+ expect(render_canonical).to eq('<link rel="canonical" href="@canonical" />')
11
11
  [' ', '', nil].each do |desc|
12
12
  @canonical = desc
13
- render_canonical.should == ''
13
+ expect(render_canonical).to eq('')
14
14
  end
15
15
  end
16
16
  end
@@ -14,24 +14,24 @@ end
14
14
 
15
15
  describe 'render_description' do
16
16
  it 'simple' do
17
- render_description.should == '<meta name="description" content="description" />'
17
+ expect(render_description).to eq('<meta name="description" content="description" />')
18
18
  end
19
-
19
+
20
20
  it '@description' do
21
21
  @description = '@description'
22
- render_description.should == '<meta name="description" content="@description" />'
22
+ expect(render_description).to eq('<meta name="description" content="@description" />')
23
23
  [' ', '', nil].each do |desc|
24
24
  @description = desc
25
- render_description.should == ''
25
+ expect(render_description).to eq('')
26
26
  end
27
27
  end
28
-
28
+
29
29
  it '@item' do
30
30
  @item = Item.new
31
- render_description.should == '<meta name="description" content="item_description" />'
31
+ expect(render_description).to eq('<meta name="description" content="item_description" />')
32
32
  end
33
33
 
34
34
  it 'opts' do
35
- render_description(description: 'opts').should == '<meta name="description" content="opts" />'
35
+ expect(render_description(description: 'opts')).to eq('<meta name="description" content="opts" />')
36
36
  end
37
37
  end
@@ -24,15 +24,14 @@ end
24
24
 
25
25
  describe 'render_ga' do
26
26
  it 'default' do
27
- render_ga.include?('ga_code').should be_true
27
+ expect(render_ga).to include('ga_code')
28
28
  end
29
29
 
30
30
  it 'with option' do
31
- render_ga(ga: '123').include?('123').should be_true
31
+ expect(render_ga(ga: '123')).to include('123')
32
32
  end
33
33
 
34
34
  it 'with nil' do
35
- render_ga(ga: nil).should == ''
35
+ expect(render_ga(ga: nil)).to eq('')
36
36
  end
37
37
  end
38
-
@@ -1,76 +1,77 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'render_html_class' do
4
- def params
5
- @params || {}
6
- end
4
+ def params
5
+ @params || {}
6
+ end
7
7
 
8
- def params= data
9
- @params = data
10
- end
8
+ def params=(data)
9
+ @params = data
10
+ end
11
11
 
12
- class Request
13
- def env
14
- @env || {}
15
- end
12
+ class Request
13
+ def env
14
+ @env ||= {}
15
+ @env
16
+ end
16
17
 
17
- def env= data
18
- @env = data
19
- end
20
- end
18
+ def env=(data)
19
+ @env = data
20
+ end
21
+ end
21
22
 
22
- def request
23
- @request ||= Request.new
24
- end
23
+ def request
24
+ @request ||= Request.new
25
+ end
25
26
 
26
- it 'simple params' do
27
- self.params = {
28
- controller: 'controller',
29
- action: 'action'
30
- }
31
- cls = render_html_class.split ' '
32
- cls.should include('controller')
33
- cls.should include('action')
34
- cls.should include('controller_action')
35
- end
27
+ it 'simple params' do
28
+ self.params = {
29
+ controller: 'controller',
30
+ action: 'action'
31
+ }
32
+ cls = render_html_class.split ' '
33
+ expect(cls).to include('controller')
34
+ expect(cls).to include('action')
35
+ expect(cls).to include('controller_action')
36
+ end
36
37
 
37
- it 'module controller' do
38
- self.params = {
39
- controller: 'module/controller',
40
- action: 'action'
41
- }
42
- cls = render_html_class.split ' '
43
- cls.should include('module_controller')
44
- cls.should include('controller')
45
- cls.should include('action')
46
- cls.should include('module_controller_action')
47
- end
38
+ it 'module controller' do
39
+ self.params = {
40
+ controller: 'module/controller',
41
+ action: 'action'
42
+ }
43
+ cls = render_html_class.split ' '
44
+ expect(cls).to include('module_controller')
45
+ expect(cls).to include('controller')
46
+ expect(cls).to include('action')
47
+ expect(cls).to include('module_controller_action')
48
+ end
48
49
 
49
- it 'addition html class' do
50
- self.params = {
51
- controller: 'controller',
52
- action: 'action',
53
- html_class: 'addition'
54
- }
55
- cls = render_html_class.split ' '
56
- cls.should include('controller')
57
- cls.should include('action')
58
- cls.should include('controller_action')
59
- cls.should include('addition')
60
- end
50
+ it 'addition html class' do
51
+ self.params = {
52
+ controller: 'controller',
53
+ action: 'action',
54
+ html_class: 'addition'
55
+ }
56
+ cls = render_html_class.split ' '
57
+ expect(cls).to include('controller')
58
+ expect(cls).to include('action')
59
+ expect(cls).to include('controller_action')
60
+ expect(cls).to include('addition')
61
+ end
61
62
 
62
- it 'mobile' do
63
- self.params = {
64
- controller: 'controller',
65
- action: 'action'
66
- }
67
- self.request.user_agent = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/1A542a Safari/419.3'
68
- cls = render_html_class.split ' '
63
+ it 'mobile' do
64
+ self.params = {
65
+ controller: 'controller',
66
+ action: 'action'
67
+ }
68
+ request.env['HTTP_USER_AGENT'] = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5'
69
+ cls = render_html_class.split ' '
69
70
 
70
- cls.should include('controller')
71
- cls.should include('action')
72
- cls.should include('controller_action')
73
- cls.should include('mobile')
74
- cls.should include('iphone')
75
- end
71
+ expect(cls).to include('controller')
72
+ expect(cls).to include('action')
73
+ expect(cls).to include('controller_action')
74
+ expect(cls).to include('mobile')
75
+ expect(cls).to include('iphone')
76
+ end
76
77
  end
@@ -14,26 +14,26 @@ end
14
14
 
15
15
  describe 'render_keywords' do
16
16
  it 'simple' do
17
- render_keywords.should == '<meta name="keywords" content="keywords" />'
17
+ expect(render_keywords).to eq('<meta name="keywords" content="keywords" />')
18
18
  end
19
-
19
+
20
20
  it '@keywords' do
21
21
  @keywords = '@keywords'
22
- render_keywords.should == '<meta name="keywords" content="@keywords" />'
22
+ expect(render_keywords).to eq('<meta name="keywords" content="@keywords" />')
23
23
  @keywords = ['@keywords', ' ', '', nil]
24
- render_keywords.should == '<meta name="keywords" content="@keywords" />'
24
+ expect(render_keywords).to eq('<meta name="keywords" content="@keywords" />')
25
25
  [' ', '', nil].each do |key|
26
26
  @keywords = key
27
- render_keywords.should == ''
27
+ expect(render_keywords).to eq('')
28
28
  end
29
29
  end
30
-
30
+
31
31
  it '@item' do
32
32
  @item = Item.new
33
- render_keywords.should == '<meta name="keywords" content="item,item_keywords" />'
33
+ expect(render_keywords).to eq('<meta name="keywords" content="item,item_keywords" />')
34
34
  end
35
35
 
36
36
  it 'opts' do
37
- render_keywords(keywords: 'opts,a,b,c').should == '<meta name="keywords" content="opts,a,b,c" />'
37
+ expect(render_keywords(keywords: 'opts,a,b,c')).to eq('<meta name="keywords" content="opts,a,b,c" />')
38
38
  end
39
39
  end
@@ -1,7 +1,5 @@
1
1
  require 'spec_helper'
2
2
 
3
- include H2ocubeRailsHelper::ActionViewExtension
4
-
5
3
  class HelperSettings
6
4
  def self.title
7
5
  'title'
@@ -26,31 +24,31 @@ end
26
24
 
27
25
  describe 'render_title' do
28
26
  it 'simple' do
29
- render_title.should == '<title>title</title>'
27
+ expect(render_title).to eq('<title>title</title>')
30
28
  end
31
-
29
+
32
30
  it '@title' do
33
31
  @title = '@title'
34
- render_title.should == '<title>@title - title</title>'
32
+ expect(render_title).to eq('<title>@title - title</title>')
35
33
  @title = ['@title', ' ', '', nil]
36
- render_title.should == '<title>@title - title</title>'
34
+ expect(render_title).to eq('<title>@title - title</title>')
37
35
  end
38
-
36
+
39
37
  it 'resource' do
40
38
  self.class_eval do
41
39
  def resource
42
40
  Resource.new
43
41
  end
44
42
  end
45
- render_title.should == '<title>Resource Name - Class Name - title</title>'
43
+ expect(render_title).to eq('<title>Resource Name - Class Name - title</title>')
46
44
  end
47
45
 
48
46
  it '@_title' do
49
47
  @_title = '@_title'
50
- render_title.should == '<title>@_title</title>'
48
+ expect(render_title).to eq('<title>@_title</title>')
51
49
  end
52
50
 
53
51
  it 'opts' do
54
- render_title(title: 'opts').should == '<title>opts</title>'
52
+ expect(render_title(title: 'opts')).to eq('<title>opts</title>')
55
53
  end
56
54
  end
@@ -1,13 +1,9 @@
1
- ENV['RAILS_ENV'] = "test"
1
+ ENV['RAILS_ENV'] = 'test'
2
2
 
3
3
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
4
  $LOAD_PATH.unshift(File.dirname(__FILE__))
5
5
 
6
- begin
7
- require 'rails'
8
- rescue LoadError
9
- end
10
-
6
+ require 'rails'
11
7
  require 'bundler/setup'
12
8
  Bundler.require
13
9
 
@@ -15,10 +11,11 @@ require 'capybara/rspec'
15
11
  require 'fake_app/rails_app'
16
12
  require 'rspec/rails'
17
13
 
18
-
19
14
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
20
15
 
21
16
  RSpec.configure do |config|
22
17
  config.mock_with :rr
23
- config.filter_run_excluding :generator_spec => true if !ENV['GENERATOR_SPEC']
18
+ config.filter_run_excluding generator_spec: true unless ENV['GENERATOR_SPEC']
19
+ config.raise_errors_for_deprecations!
20
+ config.include H2ocubeRailsHelper::ActionView::Helpers
24
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: h2ocube_rails_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-10 00:00:00.000000000 Z
11
+ date: 2016-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: settingslogic
@@ -112,16 +112,16 @@ dependencies:
112
112
  name: rails
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "<"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 4.0.0
117
+ version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "<"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 4.0.0
124
+ version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: sqlite3
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -150,7 +150,6 @@ files:
150
150
  - README.md
151
151
  - Rakefile
152
152
  - h2ocube_rails_helper.gemspec
153
- - h2ocube_rails_helper.sublime-project
154
153
  - lib/generators/h2ocube_rails_helper_generator.rb
155
154
  - lib/generators/source/helper.yml.erb
156
155
  - lib/generators/source/helper_settings.rb.erb
@@ -184,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
183
  version: '0'
185
184
  requirements: []
186
185
  rubyforge_project:
187
- rubygems_version: 2.2.2
186
+ rubygems_version: 2.5.1
188
187
  signing_key:
189
188
  specification_version: 4
190
189
  summary: Just an helper collection
@@ -1,15 +0,0 @@
1
- {
2
- "folders":
3
- [
4
- {
5
- "path": "./",
6
- "folder_exclude_patterns": ["tmp", "log", "dump"],
7
- "file_exclude_patterns": ["*.sassc", "*.log", "*.scssc"]
8
- }
9
- ],
10
- "tab_size": 2,
11
- "translate_tabs_to_spaces": true,
12
- "ensure_newline_at_eof_on_save": true,
13
- "trim_trailing_white_space_on_save": true,
14
- "scroll_past_end": true
15
- }