mobvious-rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/.yardopts +1 -0
- data/Gemfile +16 -0
- data/Guardfile +24 -0
- data/Rakefile +10 -0
- data/app/assets/javascripts/mobvious-rails.js.coffee +11 -0
- data/lib/mobvious/rails.rb +14 -0
- data/lib/mobvious/rails/controller.rb +41 -0
- data/lib/mobvious/rails/engine.rb +8 -0
- data/lib/mobvious/rails/helper.rb +67 -0
- data/lib/mobvious/rails/version.rb +5 -0
- data/mobvious-rails.gemspec +46 -0
- data/spec/javascripts/mobvious-rails_spec.js.coffee +34 -0
- data/spec/javascripts/support/jasmine.yml +74 -0
- data/spec/javascripts/support/jasmine_config.rb +23 -0
- data/spec/javascripts/support/jasmine_runner.rb +32 -0
- data/spec/mobvious/rails/controller_spec.rb +63 -0
- data/spec/mobvious/rails/helper_spec.rb +69 -0
- data/spec/spec_helper.rb +6 -0
- metadata +214 -0
data/.gitignore
ADDED
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
-m markdown
|
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
# == SPECIAL DEVELOPMENT DEPS HANDLING ==
|
8
|
+
|
9
|
+
# temporarily switched for this fork, because the current version of guard-minitest has broken notifications
|
10
|
+
gem 'guard-minitest', git: 'git://github.com/aspiers/guard-minitest', ref: '4b660261d35'
|
11
|
+
|
12
|
+
gem 'mobileesp', git: 'git://github.com/jistr/mobileesp'
|
13
|
+
gem 'mobvious', git: 'git://github.com/jistr/mobvious', branch: 'develop'
|
14
|
+
# gem 'mobvious', path: '../mobvious' # for development
|
15
|
+
gem 'mocha', require: false
|
16
|
+
gem 'turn', require: false
|
data/Guardfile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
guard 'minitest' do
|
2
|
+
watch(%r|^spec/(.*)_spec\.rb|)
|
3
|
+
watch(%r|^lib/(.*)\.rb|) { |m| "spec/#{m[1]}_spec.rb" }
|
4
|
+
watch(%r|^spec/spec_helper\.rb|) { "spec" }
|
5
|
+
end
|
6
|
+
|
7
|
+
guard 'coffeescript', output: 'tmp/javascripts-compiled', hide_success: true do
|
8
|
+
watch(/^app\/assets\/javascripts\/(.*).coffee/)
|
9
|
+
end
|
10
|
+
|
11
|
+
guard 'coffeescript', output: 'tmp/spec-javascripts-compiled', hide_success: true do
|
12
|
+
watch(/^spec\/javascripts\/(.*).coffee/)
|
13
|
+
|
14
|
+
# FIXME: tests run for each compiled file, should run only once
|
15
|
+
callback(:run_all_end) do
|
16
|
+
`rake jasmine:ci`
|
17
|
+
if $? == 0
|
18
|
+
::Guard::Notifier.notify('CoffeeScript tests passed.', { title: 'CoffeeScript tests' })
|
19
|
+
else
|
20
|
+
::Guard::Notifier.notify('CoffeeScript tests failed.', { title: 'CoffeeScript tests', image: :failed })
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
if window.Mobvious == undefined
|
2
|
+
window.Mobvious = {}
|
3
|
+
|
4
|
+
Mobvious.for_device_type = (args...) ->
|
5
|
+
callback_fn = args[args.length - 1]
|
6
|
+
wanted_device_types = args[0..(args.length - 2)]
|
7
|
+
|
8
|
+
for wanted_device_type in wanted_device_types
|
9
|
+
return callback_fn() if Mobvious.device_type == wanted_device_type
|
10
|
+
|
11
|
+
null
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "mobvious/rails/version"
|
2
|
+
|
3
|
+
require "mobvious/rails/controller"
|
4
|
+
require "mobvious/rails/engine"
|
5
|
+
require "mobvious/rails/helper"
|
6
|
+
|
7
|
+
module Mobvious
|
8
|
+
# Mobvious::Rails is a helper library to ease development in Rails when using
|
9
|
+
# the Mobvious library to detect client device types.
|
10
|
+
#
|
11
|
+
# It provides basic controller and view extensions and some CoffeeScript helpers.
|
12
|
+
module Rails
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Mobvious
|
2
|
+
module Rails
|
3
|
+
# A module holding Rails controller extensions.
|
4
|
+
#
|
5
|
+
# Just put `include Mobvious::Rails::Controller` into your `ApplicationController`.
|
6
|
+
module Controller
|
7
|
+
# Executes a block of code only when a request was made by a given client device type.
|
8
|
+
#
|
9
|
+
# Example:
|
10
|
+
#
|
11
|
+
# for_device_type :mobile do
|
12
|
+
# logger.info "This gets executed only for mobile phones."
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# @param wanted_device_type a symbol identifying a device type
|
16
|
+
# @yield a block to execute if the specified device type matches device type of the
|
17
|
+
# current request
|
18
|
+
# @return value that the yielded block returns, or nil if it didn't get executed
|
19
|
+
def for_device_type(*wanted_device_types)
|
20
|
+
unless block_given?
|
21
|
+
raise ArgumentError, "Device helper takes a block of code to execute for given device."
|
22
|
+
end
|
23
|
+
|
24
|
+
unless device_type
|
25
|
+
raise "Mobvious device type not set. Did you add the Mobvious rack middleware?"
|
26
|
+
end
|
27
|
+
|
28
|
+
if wanted_device_types.include? device_type
|
29
|
+
yield
|
30
|
+
else
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [Symbol] device type for current request
|
36
|
+
def device_type
|
37
|
+
request.env['mobvious.device_type']
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Mobvious
|
2
|
+
module Rails
|
3
|
+
# A module holding Rails view helper extensions.
|
4
|
+
#
|
5
|
+
# Just put `include Mobvious::Rails::Helper` into your `ApplicationHelper`.
|
6
|
+
module Helper
|
7
|
+
# Executes a block of code only when a request was made by a given client device type.
|
8
|
+
#
|
9
|
+
# Example:
|
10
|
+
#
|
11
|
+
# <% for_device_type :mobile do %>
|
12
|
+
# <p>This gets rendered only on mobile phones.</p>
|
13
|
+
# <% end %>
|
14
|
+
#
|
15
|
+
# @param wanted_device_type a symbol identifying a device type
|
16
|
+
# @yield a block to execute if the specified device type matches device type of the
|
17
|
+
# current request
|
18
|
+
# @return value that the yielded block returns, or nil if it didn't get executed
|
19
|
+
def for_device_type(*wanted_device_types)
|
20
|
+
unless block_given?
|
21
|
+
raise ArgumentError, "Device helper takes a block of content to render for given device."
|
22
|
+
end
|
23
|
+
|
24
|
+
unless device_type
|
25
|
+
raise "Mobvious device type not set. Did you add the Mobvious rack middleware?"
|
26
|
+
end
|
27
|
+
|
28
|
+
if wanted_device_types.include? device_type
|
29
|
+
yield
|
30
|
+
else
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [Symbol] device type for current request
|
36
|
+
def device_type
|
37
|
+
request.env['mobvious.device_type']
|
38
|
+
end
|
39
|
+
|
40
|
+
# Forms a `<script>` tag setting JavaScript variable `window.Mobvious.device_type`
|
41
|
+
# to a string holding current request's device type. You can then use
|
42
|
+
# `Mobvious.device_type` in all your JavaScripts to get this value.
|
43
|
+
#
|
44
|
+
# Example:
|
45
|
+
#
|
46
|
+
# <head>
|
47
|
+
# <%= mobvious_javascript %>
|
48
|
+
#
|
49
|
+
# <script type="text/javascript">
|
50
|
+
# alert(Mobvious.device_type); // this will print 'mobile' or 'desktop' or similar
|
51
|
+
# </script>
|
52
|
+
# </head>
|
53
|
+
#
|
54
|
+
# @return [String] script tag that sets Mobvious variables (returned string is html_safe)
|
55
|
+
def mobvious_javascript
|
56
|
+
<<-END.html_safe
|
57
|
+
<script type="text/javascript">
|
58
|
+
if (window.Mobvious === undefined) {
|
59
|
+
window.Mobvious = {};
|
60
|
+
}
|
61
|
+
window.Mobvious.device_type = '#{device_type.to_s}';
|
62
|
+
</script>
|
63
|
+
END
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "mobvious/rails/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "mobvious-rails"
|
7
|
+
s.version = Mobvious::Rails::VERSION
|
8
|
+
s.authors = ["Jiří Stránský"]
|
9
|
+
s.email = ["jistr@jistr.com"]
|
10
|
+
s.homepage = "http://github.com/jistr/mobvious-rails"
|
11
|
+
s.summary = %q{Rails enhancements for rendering different content for different device types}
|
12
|
+
s.description = %q{Rails enhancements for rendering different content for different device types}
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
|
19
|
+
s.add_runtime_dependency "mobvious"
|
20
|
+
s.add_runtime_dependency "activesupport"
|
21
|
+
|
22
|
+
|
23
|
+
# == DEVELOPMENT DEPENDENCIES ==
|
24
|
+
# Smart irb
|
25
|
+
s.add_development_dependency 'pry'
|
26
|
+
|
27
|
+
# Specs
|
28
|
+
s.add_development_dependency 'minitest'
|
29
|
+
s.add_development_dependency 'mocha'
|
30
|
+
|
31
|
+
# CoffeeScript compilation and testing
|
32
|
+
s.add_development_dependency 'therubyracer'
|
33
|
+
s.add_development_dependency 'jasmine'
|
34
|
+
|
35
|
+
# Running tests during development
|
36
|
+
s.add_development_dependency 'guard'
|
37
|
+
s.add_development_dependency 'guard-minitest'
|
38
|
+
s.add_development_dependency 'guard-coffeescript'
|
39
|
+
# Linux Guard watching
|
40
|
+
s.add_development_dependency 'rb-inotify'
|
41
|
+
# Linux Guard notifications
|
42
|
+
s.add_development_dependency 'libnotify'
|
43
|
+
|
44
|
+
# Pretty printed test output
|
45
|
+
s.add_development_dependency 'turn'
|
46
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
describe 'Mobvious', ->
|
2
|
+
beforeEach ->
|
3
|
+
window.Mobvious = {} if window.Mobvious == undefined
|
4
|
+
window.Mobvious.device_type = 'mobile'
|
5
|
+
|
6
|
+
describe 'for_device_type', ->
|
7
|
+
it 'should run only for the right device types', ->
|
8
|
+
mobile_block_executed = false
|
9
|
+
desktop_block_executed = false
|
10
|
+
multiple_block_executed = false
|
11
|
+
|
12
|
+
mobile_retval = Mobvious.for_device_type 'mobile', ->
|
13
|
+
mobile_block_executed = true
|
14
|
+
'mobile_retval'
|
15
|
+
expect(mobile_block_executed).toEqual true
|
16
|
+
expect(mobile_retval).toEqual 'mobile_retval'
|
17
|
+
|
18
|
+
desktop_retval = Mobvious.for_device_type 'desktop', ->
|
19
|
+
desktop_block_executed = true
|
20
|
+
'desktop_retval'
|
21
|
+
expect(desktop_block_executed).toEqual false
|
22
|
+
expect(desktop_retval).toEqual null
|
23
|
+
|
24
|
+
multiple_retval = Mobvious.for_device_type 'desktop', 'tablet', ->
|
25
|
+
multiple_block_executed = true
|
26
|
+
'multiple_retval'
|
27
|
+
expect(multiple_block_executed).toEqual false
|
28
|
+
expect(multiple_retval).toEqual null
|
29
|
+
|
30
|
+
multiple_retval = Mobvious.for_device_type 'desktop', 'mobile', ->
|
31
|
+
multiple_block_executed = true
|
32
|
+
'multiple_retval'
|
33
|
+
expect(multiple_block_executed).toEqual true
|
34
|
+
expect(multiple_retval).toEqual 'multiple_retval'
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# src_files
|
2
|
+
#
|
3
|
+
# Return an array of filepaths relative to src_dir to include before jasmine specs.
|
4
|
+
# Default: []
|
5
|
+
#
|
6
|
+
# EXAMPLE:
|
7
|
+
#
|
8
|
+
# src_files:
|
9
|
+
# - lib/source1.js
|
10
|
+
# - lib/source2.js
|
11
|
+
# - dist/**/*.js
|
12
|
+
#
|
13
|
+
src_files:
|
14
|
+
- '**/*.js'
|
15
|
+
|
16
|
+
# stylesheets
|
17
|
+
#
|
18
|
+
# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
|
19
|
+
# Default: []
|
20
|
+
#
|
21
|
+
# EXAMPLE:
|
22
|
+
#
|
23
|
+
# stylesheets:
|
24
|
+
# - css/style.css
|
25
|
+
# - stylesheets/*.css
|
26
|
+
#
|
27
|
+
stylesheets:
|
28
|
+
|
29
|
+
# helpers
|
30
|
+
#
|
31
|
+
# Return an array of filepaths relative to spec_dir to include before jasmine specs.
|
32
|
+
# Default: ["helpers/**/*.js"]
|
33
|
+
#
|
34
|
+
# EXAMPLE:
|
35
|
+
#
|
36
|
+
# helpers:
|
37
|
+
# - helpers/**/*.js
|
38
|
+
#
|
39
|
+
helpers:
|
40
|
+
|
41
|
+
# spec_files
|
42
|
+
#
|
43
|
+
# Return an array of filepaths relative to spec_dir to include.
|
44
|
+
# Default: ["**/*[sS]pec.js"]
|
45
|
+
#
|
46
|
+
# EXAMPLE:
|
47
|
+
#
|
48
|
+
# spec_files:
|
49
|
+
# - **/*[sS]pec.js
|
50
|
+
#
|
51
|
+
spec_files:
|
52
|
+
- '**/*_spec.js'
|
53
|
+
|
54
|
+
# src_dir
|
55
|
+
#
|
56
|
+
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
|
57
|
+
# Default: project root
|
58
|
+
#
|
59
|
+
# EXAMPLE:
|
60
|
+
#
|
61
|
+
# src_dir: public
|
62
|
+
#
|
63
|
+
src_dir: tmp/javascripts-compiled
|
64
|
+
|
65
|
+
# spec_dir
|
66
|
+
#
|
67
|
+
# Spec directory path. Your spec_files must be returned relative to this path.
|
68
|
+
# Default: spec/javascripts
|
69
|
+
#
|
70
|
+
# EXAMPLE:
|
71
|
+
#
|
72
|
+
# spec_dir: spec/javascripts
|
73
|
+
#
|
74
|
+
spec_dir: tmp/spec-javascripts-compiled
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Jasmine
|
2
|
+
class Config
|
3
|
+
|
4
|
+
# Add your overrides or custom config code here
|
5
|
+
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
|
10
|
+
# Note - this is necessary for rspec2, which has removed the backtrace
|
11
|
+
module Jasmine
|
12
|
+
class SpecBuilder
|
13
|
+
def declare_spec(parent, spec)
|
14
|
+
me = self
|
15
|
+
example_name = spec["name"]
|
16
|
+
@spec_ids << spec["id"]
|
17
|
+
backtrace = @example_locations[parent.description + " " + example_name]
|
18
|
+
parent.it example_name, {} do
|
19
|
+
me.report_spec(spec["id"])
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
$:.unshift(ENV['JASMINE_GEM_PATH']) if ENV['JASMINE_GEM_PATH'] # for gem testing purposes
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'jasmine'
|
5
|
+
jasmine_config_overrides = File.expand_path(File.join(File.dirname(__FILE__), 'jasmine_config.rb'))
|
6
|
+
require jasmine_config_overrides if File.exist?(jasmine_config_overrides)
|
7
|
+
if Jasmine::Dependencies.rspec2?
|
8
|
+
require 'rspec'
|
9
|
+
else
|
10
|
+
require 'spec'
|
11
|
+
end
|
12
|
+
|
13
|
+
jasmine_config = Jasmine::Config.new
|
14
|
+
spec_builder = Jasmine::SpecBuilder.new(jasmine_config)
|
15
|
+
|
16
|
+
should_stop = false
|
17
|
+
|
18
|
+
if Jasmine::Dependencies.rspec2?
|
19
|
+
RSpec.configuration.after(:suite) do
|
20
|
+
spec_builder.stop if should_stop
|
21
|
+
end
|
22
|
+
else
|
23
|
+
Spec::Runner.configure do |config|
|
24
|
+
config.after(:suite) do
|
25
|
+
spec_builder.stop if should_stop
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
spec_builder.start
|
31
|
+
should_stop = true
|
32
|
+
spec_builder.declare_suites
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'mobvious/rails/controller'
|
3
|
+
|
4
|
+
module Mobvious
|
5
|
+
module Rails
|
6
|
+
class ControllerSpec < MiniTest::Spec
|
7
|
+
describe Controller do
|
8
|
+
before do
|
9
|
+
@env = mock 'env'
|
10
|
+
@env.stubs('[]').with('mobvious.device_type').returns(:mobile)
|
11
|
+
|
12
|
+
@request = mock 'request'
|
13
|
+
@request.stubs(:env).returns(@env)
|
14
|
+
mock_request = @request
|
15
|
+
|
16
|
+
@controller = Object.new
|
17
|
+
@controller.extend Controller
|
18
|
+
@controller.define_singleton_method(:request) do
|
19
|
+
mock_request
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it "runs the provided block only for corresponding device type" do
|
24
|
+
mobile_block_executed = false
|
25
|
+
desktop_block_executed = false
|
26
|
+
multiple_block_executed = false
|
27
|
+
|
28
|
+
mobile_retval = @controller.for_device_type :mobile do
|
29
|
+
mobile_block_executed = true
|
30
|
+
:mobile_retval
|
31
|
+
end
|
32
|
+
mobile_block_executed.must_equal true
|
33
|
+
mobile_retval.must_equal :mobile_retval
|
34
|
+
|
35
|
+
desktop_retval = @controller.for_device_type :desktop do
|
36
|
+
desktop_block_executed = true
|
37
|
+
:desktop_retval
|
38
|
+
end
|
39
|
+
desktop_block_executed.must_equal false
|
40
|
+
desktop_retval.must_equal nil
|
41
|
+
|
42
|
+
multiple_retval = @controller.for_device_type :desktop, :tablet do
|
43
|
+
multiple_block_executed = true
|
44
|
+
:multiple_retval
|
45
|
+
end
|
46
|
+
multiple_block_executed.must_equal false
|
47
|
+
multiple_retval.must_equal nil
|
48
|
+
|
49
|
+
multiple_retval = @controller.for_device_type :desktop, :mobile do
|
50
|
+
multiple_block_executed = true
|
51
|
+
:multiple_retval
|
52
|
+
end
|
53
|
+
multiple_block_executed.must_equal true
|
54
|
+
multiple_retval.must_equal :multiple_retval
|
55
|
+
end
|
56
|
+
|
57
|
+
it "returns current device type" do
|
58
|
+
@controller.device_type.must_equal :mobile
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'mobvious/rails/helper'
|
3
|
+
|
4
|
+
module Mobvious
|
5
|
+
module Rails
|
6
|
+
class HelperSpec < MiniTest::Spec
|
7
|
+
describe Helper do
|
8
|
+
before do
|
9
|
+
@env = mock 'env'
|
10
|
+
@env.stubs('[]').with('mobvious.device_type').returns(:mobile)
|
11
|
+
|
12
|
+
@request = mock 'request'
|
13
|
+
@request.stubs(:env).returns(@env)
|
14
|
+
mock_request = @request
|
15
|
+
|
16
|
+
@helper = Object.new
|
17
|
+
@helper.extend Helper
|
18
|
+
@helper.define_singleton_method(:request) do
|
19
|
+
mock_request
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it "runs the provided block only for corresponding device type" do
|
24
|
+
mobile_block_executed = false
|
25
|
+
desktop_block_executed = false
|
26
|
+
multiple_block_executed = false
|
27
|
+
|
28
|
+
mobile_retval = @helper.for_device_type :mobile do
|
29
|
+
mobile_block_executed = true
|
30
|
+
:mobile_retval
|
31
|
+
end
|
32
|
+
mobile_block_executed.must_equal true
|
33
|
+
mobile_retval.must_equal :mobile_retval
|
34
|
+
|
35
|
+
desktop_retval = @helper.for_device_type :desktop do
|
36
|
+
desktop_block_executed = true
|
37
|
+
:desktop_retval
|
38
|
+
end
|
39
|
+
desktop_block_executed.must_equal false
|
40
|
+
desktop_retval.must_equal nil
|
41
|
+
|
42
|
+
multiple_retval = @helper.for_device_type :desktop, :tablet do
|
43
|
+
multiple_block_executed = true
|
44
|
+
:multiple_retval
|
45
|
+
end
|
46
|
+
multiple_block_executed.must_equal false
|
47
|
+
multiple_retval.must_equal nil
|
48
|
+
|
49
|
+
multiple_retval = @helper.for_device_type :desktop, :mobile do
|
50
|
+
multiple_block_executed = true
|
51
|
+
:multiple_retval
|
52
|
+
end
|
53
|
+
multiple_block_executed.must_equal true
|
54
|
+
multiple_retval.must_equal :multiple_retval
|
55
|
+
end
|
56
|
+
|
57
|
+
it "returns current device type" do
|
58
|
+
@helper.device_type.must_equal :mobile
|
59
|
+
end
|
60
|
+
|
61
|
+
it "generates javascript tag with device type" do
|
62
|
+
device_type_assignment = /window.Mobvious.device_type = 'mobile';/
|
63
|
+
@helper.mobvious_javascript.must_match device_type_assignment
|
64
|
+
@helper.mobvious_javascript.must_be :'html_safe?'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,214 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mobvious-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jiří Stránský
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-02-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: mobvious
|
16
|
+
requirement: &7091660 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *7091660
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: activesupport
|
27
|
+
requirement: &7088280 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *7088280
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: pry
|
38
|
+
requirement: &7115160 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *7115160
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: minitest
|
49
|
+
requirement: &7114700 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *7114700
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: mocha
|
60
|
+
requirement: &7114180 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *7114180
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: therubyracer
|
71
|
+
requirement: &7113560 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *7113560
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: jasmine
|
82
|
+
requirement: &7112840 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *7112840
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: guard
|
93
|
+
requirement: &7111080 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *7111080
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: guard-minitest
|
104
|
+
requirement: &7109940 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *7109940
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: guard-coffeescript
|
115
|
+
requirement: &7109200 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *7109200
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: rb-inotify
|
126
|
+
requirement: &7124820 !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: *7124820
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: libnotify
|
137
|
+
requirement: &7123860 !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
type: :development
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: *7123860
|
146
|
+
- !ruby/object:Gem::Dependency
|
147
|
+
name: turn
|
148
|
+
requirement: &7123000 !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
|
+
requirements:
|
151
|
+
- - ! '>='
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
type: :development
|
155
|
+
prerelease: false
|
156
|
+
version_requirements: *7123000
|
157
|
+
description: Rails enhancements for rendering different content for different device
|
158
|
+
types
|
159
|
+
email:
|
160
|
+
- jistr@jistr.com
|
161
|
+
executables: []
|
162
|
+
extensions: []
|
163
|
+
extra_rdoc_files: []
|
164
|
+
files:
|
165
|
+
- .gitignore
|
166
|
+
- .yardopts
|
167
|
+
- Gemfile
|
168
|
+
- Guardfile
|
169
|
+
- Rakefile
|
170
|
+
- app/assets/javascripts/mobvious-rails.js.coffee
|
171
|
+
- lib/mobvious/rails.rb
|
172
|
+
- lib/mobvious/rails/controller.rb
|
173
|
+
- lib/mobvious/rails/engine.rb
|
174
|
+
- lib/mobvious/rails/helper.rb
|
175
|
+
- lib/mobvious/rails/version.rb
|
176
|
+
- mobvious-rails.gemspec
|
177
|
+
- spec/javascripts/mobvious-rails_spec.js.coffee
|
178
|
+
- spec/javascripts/support/jasmine.yml
|
179
|
+
- spec/javascripts/support/jasmine_config.rb
|
180
|
+
- spec/javascripts/support/jasmine_runner.rb
|
181
|
+
- spec/mobvious/rails/controller_spec.rb
|
182
|
+
- spec/mobvious/rails/helper_spec.rb
|
183
|
+
- spec/spec_helper.rb
|
184
|
+
homepage: http://github.com/jistr/mobvious-rails
|
185
|
+
licenses: []
|
186
|
+
post_install_message:
|
187
|
+
rdoc_options: []
|
188
|
+
require_paths:
|
189
|
+
- lib
|
190
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
191
|
+
none: false
|
192
|
+
requirements:
|
193
|
+
- - ! '>='
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: '0'
|
196
|
+
segments:
|
197
|
+
- 0
|
198
|
+
hash: 2203145114535676296
|
199
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
200
|
+
none: false
|
201
|
+
requirements:
|
202
|
+
- - ! '>='
|
203
|
+
- !ruby/object:Gem::Version
|
204
|
+
version: '0'
|
205
|
+
segments:
|
206
|
+
- 0
|
207
|
+
hash: 2203145114535676296
|
208
|
+
requirements: []
|
209
|
+
rubyforge_project:
|
210
|
+
rubygems_version: 1.8.11
|
211
|
+
signing_key:
|
212
|
+
specification_version: 3
|
213
|
+
summary: Rails enhancements for rendering different content for different device types
|
214
|
+
test_files: []
|