mobile-rails 0.1.pre.2 → 0.1.pre.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -4
- data/Gemfile.lock +110 -93
- data/README.md +18 -2
- data/lib/mobile/rails/aware.rb +2 -2
- data/lib/mobile/rails/version.rb +1 -1
- data/mobile-rails.gemspec +6 -2
- data/spec/spec_helper.rb +37 -0
- metadata +53 -6
- data/spec/aware_spec.rb +0 -2
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,93 +1,110 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
mobile-rails (0.1.pre.
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
rack
|
21
|
-
rack-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
rack-
|
55
|
-
rack
|
56
|
-
rack-
|
57
|
-
rack
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mobile-rails (0.1.pre.3)
|
5
|
+
rails (~> 3.0)
|
6
|
+
railties (~> 3.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionmailer (3.2.3)
|
12
|
+
actionpack (= 3.2.3)
|
13
|
+
mail (~> 2.4.4)
|
14
|
+
actionpack (3.2.3)
|
15
|
+
activemodel (= 3.2.3)
|
16
|
+
activesupport (= 3.2.3)
|
17
|
+
builder (~> 3.0.0)
|
18
|
+
erubis (~> 2.7.0)
|
19
|
+
journey (~> 1.0.1)
|
20
|
+
rack (~> 1.4.0)
|
21
|
+
rack-cache (~> 1.2)
|
22
|
+
rack-test (~> 0.6.1)
|
23
|
+
sprockets (~> 2.1.2)
|
24
|
+
activemodel (3.2.3)
|
25
|
+
activesupport (= 3.2.3)
|
26
|
+
builder (~> 3.0.0)
|
27
|
+
activerecord (3.2.3)
|
28
|
+
activemodel (= 3.2.3)
|
29
|
+
activesupport (= 3.2.3)
|
30
|
+
arel (~> 3.0.2)
|
31
|
+
tzinfo (~> 0.3.29)
|
32
|
+
activeresource (3.2.3)
|
33
|
+
activemodel (= 3.2.3)
|
34
|
+
activesupport (= 3.2.3)
|
35
|
+
activesupport (3.2.3)
|
36
|
+
i18n (~> 0.6)
|
37
|
+
multi_json (~> 1.0)
|
38
|
+
arel (3.0.2)
|
39
|
+
builder (3.0.0)
|
40
|
+
diff-lcs (1.1.3)
|
41
|
+
erubis (2.7.0)
|
42
|
+
hike (1.2.1)
|
43
|
+
i18n (0.6.0)
|
44
|
+
journey (1.0.3)
|
45
|
+
json (1.6.6)
|
46
|
+
mail (2.4.4)
|
47
|
+
i18n (>= 0.4.0)
|
48
|
+
mime-types (~> 1.16)
|
49
|
+
treetop (~> 1.4.8)
|
50
|
+
mime-types (1.18)
|
51
|
+
multi_json (1.2.0)
|
52
|
+
polyglot (0.3.3)
|
53
|
+
rack (1.4.1)
|
54
|
+
rack-cache (1.2)
|
55
|
+
rack (>= 0.4)
|
56
|
+
rack-ssl (1.3.2)
|
57
|
+
rack
|
58
|
+
rack-test (0.6.1)
|
59
|
+
rack (>= 1.0)
|
60
|
+
rails (3.2.3)
|
61
|
+
actionmailer (= 3.2.3)
|
62
|
+
actionpack (= 3.2.3)
|
63
|
+
activerecord (= 3.2.3)
|
64
|
+
activeresource (= 3.2.3)
|
65
|
+
activesupport (= 3.2.3)
|
66
|
+
bundler (~> 1.0)
|
67
|
+
railties (= 3.2.3)
|
68
|
+
railties (3.2.3)
|
69
|
+
actionpack (= 3.2.3)
|
70
|
+
activesupport (= 3.2.3)
|
71
|
+
rack-ssl (~> 1.3.2)
|
72
|
+
rake (>= 0.8.7)
|
73
|
+
rdoc (~> 3.4)
|
74
|
+
thor (~> 0.14.6)
|
75
|
+
rake (0.9.2.2)
|
76
|
+
rdoc (3.12)
|
77
|
+
json (~> 1.4)
|
78
|
+
rspec (2.9.0)
|
79
|
+
rspec-core (~> 2.9.0)
|
80
|
+
rspec-expectations (~> 2.9.0)
|
81
|
+
rspec-mocks (~> 2.9.0)
|
82
|
+
rspec-core (2.9.0)
|
83
|
+
rspec-expectations (2.9.1)
|
84
|
+
diff-lcs (~> 1.1.3)
|
85
|
+
rspec-mocks (2.9.0)
|
86
|
+
rspec-rails (2.9.0)
|
87
|
+
actionpack (>= 3.0)
|
88
|
+
activesupport (>= 3.0)
|
89
|
+
railties (>= 3.0)
|
90
|
+
rspec (~> 2.9.0)
|
91
|
+
sprockets (2.1.2)
|
92
|
+
hike (~> 1.2)
|
93
|
+
rack (~> 1.0)
|
94
|
+
tilt (~> 1.1, != 1.3.0)
|
95
|
+
thor (0.14.6)
|
96
|
+
tilt (1.3.3)
|
97
|
+
treetop (1.4.10)
|
98
|
+
polyglot
|
99
|
+
polyglot (>= 0.3.1)
|
100
|
+
tzinfo (0.3.33)
|
101
|
+
|
102
|
+
PLATFORMS
|
103
|
+
x86-mingw32
|
104
|
+
|
105
|
+
DEPENDENCIES
|
106
|
+
actionpack (~> 3.0)
|
107
|
+
bundler
|
108
|
+
mobile-rails!
|
109
|
+
rails (~> 3.0)
|
110
|
+
rspec-rails
|
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# mobile-rails
|
2
2
|
|
3
|
+
Check the User-Agent for a mobile user and respond with a mobile friendly view if it exists.
|
4
|
+
|
3
5
|
## Install
|
4
6
|
|
5
|
-
gem 'mobile-rails', '~> 0.1.pre'
|
7
|
+
gem 'mobile-rails', '~> 0.1.pre.2'
|
6
8
|
|
7
9
|
## Getting Started
|
8
10
|
|
@@ -11,9 +13,23 @@ in `app/controllers`. This will enable it in every controller.
|
|
11
13
|
|
12
14
|
* Create a new folder `mobile` inside `app/views`
|
13
15
|
|
16
|
+
* Place your mobile view eg. `controller/action` inside the `mobile` folder
|
17
|
+
|
18
|
+
* ???
|
19
|
+
|
20
|
+
* Profit
|
21
|
+
|
14
22
|
## Example
|
15
23
|
|
16
24
|
class ApplicationController < ActionController::Base
|
17
25
|
protect_from_forgery
|
18
26
|
is_mobile_aware
|
19
|
-
end
|
27
|
+
end
|
28
|
+
|
29
|
+
## Todo
|
30
|
+
|
31
|
+
* spec it ;)
|
32
|
+
* More elaborate checking against the user agent
|
33
|
+
* Options to exclude certain User-Agents (Tablets?)
|
34
|
+
* More Options
|
35
|
+
* Use session to disable the mobile view on request
|
data/lib/mobile/rails/aware.rb
CHANGED
@@ -4,12 +4,12 @@ module Mobile
|
|
4
4
|
module Aware
|
5
5
|
def is_mobile_aware(options = {})
|
6
6
|
include Mobile::Rails::InstanceMethods
|
7
|
-
before_filter :
|
7
|
+
before_filter :prepend_mobile_view_path
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
module InstanceMethods
|
12
|
-
def
|
12
|
+
def prepend_mobile_view_path
|
13
13
|
prepend_view_path 'app/views/mobile' if is_mobile?
|
14
14
|
end
|
15
15
|
|
data/lib/mobile/rails/version.rb
CHANGED
data/mobile-rails.gemspec
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path('../lib/mobile/rails/version', __FILE__)
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'mobile-rails'
|
5
5
|
s.version = Mobile::Rails::VERSION
|
6
|
-
s.platform
|
6
|
+
s.platform = Gem::Platform::RUBY
|
7
7
|
s.authors = ['Michael Schumacher']
|
8
8
|
s.email = ['schumacher.m@me.com']
|
9
9
|
s.homepage = 'https://github.com/schumacher-m/mobile-rails'
|
@@ -15,13 +15,17 @@ Gem::Specification.new do |s|
|
|
15
15
|
your website, a different view may be used if it exists.
|
16
16
|
DESCRIPTION
|
17
17
|
|
18
|
+
s.add_dependency 'rails', '~> 3.0'
|
18
19
|
s.add_dependency 'railties', '~> 3.0'
|
19
20
|
|
20
21
|
s.add_development_dependency 'rails', '~> 3.0'
|
21
|
-
s.add_development_dependency '
|
22
|
+
s.add_development_dependency 'actionpack', '~> 3.0'
|
23
|
+
s.add_development_dependency 'bundler'
|
24
|
+
s.add_development_dependency 'rspec-rails'
|
22
25
|
|
23
26
|
s.files = `git ls-files`.split("\n")
|
24
27
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
28
|
+
|
25
29
|
s.require_path = ['lib']
|
26
30
|
|
27
31
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
|
4
|
+
ENV["RAILS_ENV"] ||= 'test'
|
5
|
+
|
6
|
+
require 'rubygems'
|
7
|
+
gem 'actionpack', '>= 3.0.0'
|
8
|
+
gem 'activesupport', '>= 3.0.0'
|
9
|
+
gem 'activemodel', '>= 3.0.0'
|
10
|
+
gem 'railties', '>= 3.0.0'
|
11
|
+
|
12
|
+
require 'action_controller'
|
13
|
+
require 'action_pack'
|
14
|
+
require 'action_controller/railtie'
|
15
|
+
require_relative '../lib/mobile-rails'
|
16
|
+
|
17
|
+
root = File.expand_path(File.dirname(__FILE__))
|
18
|
+
puts "ROOT: #{root}"
|
19
|
+
|
20
|
+
module MobileAware
|
21
|
+
class Application < ::Rails::Application
|
22
|
+
config.active_support.deprecation = :stderr
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
MobileAware::Application.initialize!
|
27
|
+
|
28
|
+
MobileAware::Application.routes.draw do
|
29
|
+
resources :mobile_aware
|
30
|
+
end
|
31
|
+
|
32
|
+
require 'rspec/rails'
|
33
|
+
|
34
|
+
RSpec.configure do |config|
|
35
|
+
end
|
36
|
+
|
37
|
+
require 'mobile-rails'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mobile-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.pre.
|
4
|
+
version: 0.1.pre.3
|
5
5
|
prerelease: 4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.0'
|
14
30
|
- !ruby/object:Gem::Dependency
|
15
31
|
name: railties
|
16
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,13 +60,13 @@ dependencies:
|
|
44
60
|
- !ruby/object:Gem::Version
|
45
61
|
version: '3.0'
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
63
|
+
name: actionpack
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|
49
65
|
none: false
|
50
66
|
requirements:
|
51
67
|
- - ~>
|
52
68
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
69
|
+
version: '3.0'
|
54
70
|
type: :development
|
55
71
|
prerelease: false
|
56
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +74,39 @@ dependencies:
|
|
58
74
|
requirements:
|
59
75
|
- - ~>
|
60
76
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
77
|
+
version: '3.0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: bundler
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rspec-rails
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
62
110
|
description: ! " mobile-rails provides an easy way to make\n a controller mobile
|
63
111
|
aware. If a mobile user is accessing\n your website, a different view may be
|
64
112
|
used if it exists.\n"
|
@@ -76,7 +124,6 @@ files:
|
|
76
124
|
- lib/mobile/rails/aware.rb
|
77
125
|
- lib/mobile/rails/version.rb
|
78
126
|
- mobile-rails.gemspec
|
79
|
-
- spec/aware_spec.rb
|
80
127
|
- spec/spec_helper.rb
|
81
128
|
homepage: https://github.com/schumacher-m/mobile-rails
|
82
129
|
licenses: []
|
data/spec/aware_spec.rb
DELETED