h2ocube_rails_helper 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/LICENSE.txt +2 -2
- data/README.md +5 -6
- data/h2ocube_rails_helper.gemspec +3 -2
- data/lib/h2ocube_rails_helper.rb +6 -7
- data/test/dummy/config/environments/test.rb +2 -3
- data/test/render_html_class_test.rb +2 -1
- metadata +6 -9
- data/test/dummy/log/production.log +0 -0
- data/test/dummy/log/test.log +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb9cdfd52a86668d433fa7d3e80189feba6e0c5c
|
4
|
+
data.tar.gz: c3b982ebf734bb70b06f42580ab3574f18cd6fd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 431bff8e9411ab8b5bd36e56f0bf735645c07927e6b371edd6023ff6b6cebe9da27f7b1c23b385bfa37fbdc30e94809c5ae92b84bf4a9259997cede7455ae086
|
7
|
+
data.tar.gz: 141064df285a3b08e3a133e3eda7a394aaf29172054f6a8d503926fad08a85b731d20a0c47b5ad461ef31341432fb3afccbf703df9bb731fddef91c09636d61b
|
data/.gitignore
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c)
|
1
|
+
Copyright (c) 2013 H2ocube.com
|
2
2
|
|
3
3
|
MIT License
|
4
4
|
|
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
Just an helper collection.
|
4
4
|
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/h2ocube_rails_production.png)](http://badge.fury.io/rb/h2ocube_rails_production)
|
5
6
|
[![Build Status](https://travis-ci.org/h2ocube/h2ocube_rails_helper.png)](https://travis-ci.org/h2ocube/h2ocube_rails_helper)
|
6
7
|
|
7
8
|
## Installation
|
@@ -18,23 +19,21 @@ And then execute:
|
|
18
19
|
|
19
20
|
## Usage
|
20
21
|
|
21
|
-
render_html_class #=> controller_name action_name controller_name_action_name
|
22
|
-
|
23
|
-
request.env['X_MOBILE_DEVICE'] #=> such as 'iPhone'
|
24
|
-
|
22
|
+
render_html_class #=> controller_name action_name controller_name_action_name devise_meta
|
23
|
+
|
25
24
|
render_title
|
26
25
|
render_canonical
|
27
26
|
render_keywords
|
28
27
|
render_description
|
29
28
|
|
30
29
|
render_ga #=> show Google Analytics code at production (if require Garelic, will show Garelic code)
|
31
|
-
|
30
|
+
|
32
31
|
render_seo #=> render_title << render_canonical << render_keywords << render_description << render_ga << csrf_meta_tags
|
33
32
|
|
34
33
|
## Include
|
35
34
|
|
36
35
|
* settingslogic https://github.com/binarylogic/settingslogic
|
37
|
-
*
|
36
|
+
* browser https://github.com/fnando/browser
|
38
37
|
|
39
38
|
## Contributing
|
40
39
|
|
@@ -4,12 +4,13 @@ $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.0.
|
7
|
+
gem.version = '0.0.15'
|
8
8
|
gem.authors = ['Ben']
|
9
9
|
gem.email = ['ben@h2ocube.com']
|
10
10
|
gem.description = %q{Just an helper collection}
|
11
11
|
gem.summary = %q{Just an helper collection}
|
12
12
|
gem.homepage = 'https://github.com/h2ocube/h2ocube_rails_helper'
|
13
|
+
gem.license = 'MIT'
|
13
14
|
|
14
15
|
gem.files = `git ls-files`.split($/)
|
15
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
@@ -17,5 +18,5 @@ Gem::Specification.new do |gem|
|
|
17
18
|
gem.require_paths = ["lib"]
|
18
19
|
|
19
20
|
gem.add_dependency 'settingslogic'
|
20
|
-
gem.add_dependency '
|
21
|
+
gem.add_dependency 'browser'
|
21
22
|
end
|
data/lib/h2ocube_rails_helper.rb
CHANGED
@@ -1,14 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
require 'settingslogic'
|
4
|
-
require '
|
4
|
+
require 'browser'
|
5
5
|
|
6
6
|
module H2ocubeRailsHelper
|
7
7
|
module Rails
|
8
8
|
class Rails::Engine < ::Rails::Engine
|
9
|
-
initializer 'Rack::MobileDetect' do |app|
|
10
|
-
app.middleware.use Rack::MobileDetect
|
11
|
-
end
|
12
9
|
end
|
13
10
|
end
|
14
11
|
end
|
@@ -21,8 +18,10 @@ def render_html_class
|
|
21
18
|
else
|
22
19
|
cls.push params[:controller]
|
23
20
|
end
|
21
|
+
|
24
22
|
cls.push params[:action]
|
25
23
|
cls.push cls[0] + '_' + params[:action]
|
24
|
+
|
26
25
|
if params.has_key?(:html_class)
|
27
26
|
if params[:html_class].class != Array
|
28
27
|
cls.push params[:html_class].to_s
|
@@ -30,9 +29,9 @@ def render_html_class
|
|
30
29
|
params[:html_class].each { |c| cls.push c }
|
31
30
|
end
|
32
31
|
end
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
|
33
|
+
cls.push Browser.new(accept_language: request.headers['Accept-Language'], ua: request.headers['User-Agent']).to_s
|
34
|
+
|
36
35
|
cls.compact.uniq.join ' '
|
37
36
|
end
|
38
37
|
|
@@ -7,9 +7,6 @@ Dummy::Application.configure do
|
|
7
7
|
# and recreated between test runs. Don't rely on the data there!
|
8
8
|
config.cache_classes = true
|
9
9
|
|
10
|
-
# Log error messages when you accidentally call methods on nil.
|
11
|
-
config.whiny_nils = true
|
12
|
-
|
13
10
|
# Show full error reports and disable caching
|
14
11
|
config.consider_all_requests_local = true
|
15
12
|
config.action_controller.perform_caching = false
|
@@ -22,4 +19,6 @@ Dummy::Application.configure do
|
|
22
19
|
|
23
20
|
# Print deprecation notices to the stderr
|
24
21
|
config.active_support.deprecation = :stderr
|
22
|
+
|
23
|
+
config.eager_load = false if config.respond_to?(:eager_load)
|
25
24
|
end
|
@@ -42,8 +42,9 @@ class RenderHtmlClass < ActionView::TestCase
|
|
42
42
|
controller: 'controller',
|
43
43
|
action: 'action'
|
44
44
|
}
|
45
|
-
self.request.
|
45
|
+
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'
|
46
46
|
cls = render_html_class.split ' '
|
47
|
+
|
47
48
|
assert cls.include?('controller')
|
48
49
|
assert cls.include?('action')
|
49
50
|
assert cls.include?('controller_action')
|
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.0.
|
4
|
+
version: 0.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: settingslogic
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: browser
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '>='
|
@@ -75,8 +75,6 @@ files:
|
|
75
75
|
- test/dummy/config/initializers/session_store.rb
|
76
76
|
- test/dummy/config/locales/en.yml
|
77
77
|
- test/dummy/config/routes.rb
|
78
|
-
- test/dummy/log/production.log
|
79
|
-
- test/dummy/log/test.log
|
80
78
|
- test/dummy/script/rails
|
81
79
|
- test/render_canonical_test.rb
|
82
80
|
- test/render_description_test.rb
|
@@ -86,7 +84,8 @@ files:
|
|
86
84
|
- test/render_title_test.rb
|
87
85
|
- test/test_helper.rb
|
88
86
|
homepage: https://github.com/h2ocube/h2ocube_rails_helper
|
89
|
-
licenses:
|
87
|
+
licenses:
|
88
|
+
- MIT
|
90
89
|
metadata: {}
|
91
90
|
post_install_message:
|
92
91
|
rdoc_options: []
|
@@ -104,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
103
|
version: '0'
|
105
104
|
requirements: []
|
106
105
|
rubyforge_project:
|
107
|
-
rubygems_version: 2.0.
|
106
|
+
rubygems_version: 2.0.5
|
108
107
|
signing_key:
|
109
108
|
specification_version: 4
|
110
109
|
summary: Just an helper collection
|
@@ -128,8 +127,6 @@ test_files:
|
|
128
127
|
- test/dummy/config/initializers/session_store.rb
|
129
128
|
- test/dummy/config/locales/en.yml
|
130
129
|
- test/dummy/config/routes.rb
|
131
|
-
- test/dummy/log/production.log
|
132
|
-
- test/dummy/log/test.log
|
133
130
|
- test/dummy/script/rails
|
134
131
|
- test/render_canonical_test.rb
|
135
132
|
- test/render_description_test.rb
|
File without changes
|
data/test/dummy/log/test.log
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Connecting to database specified by database.yml
|