mobile-rails 0.1.pre.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +93 -0
- data/README.md +19 -0
- data/lib/mobile/rails/aware.rb +22 -0
- data/lib/mobile/rails/version.rb +5 -0
- data/lib/mobile-rails.rb +12 -0
- data/mobile-rails.gemspec +27 -0
- data/spec/aware_spec.rb +2 -0
- data/spec/spec_helper.rb +0 -0
- metadata +105 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mobile-rails (0.1.pre.1)
|
5
|
+
railties (~> 3.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionmailer (3.2.3)
|
11
|
+
actionpack (= 3.2.3)
|
12
|
+
mail (~> 2.4.4)
|
13
|
+
actionpack (3.2.3)
|
14
|
+
activemodel (= 3.2.3)
|
15
|
+
activesupport (= 3.2.3)
|
16
|
+
builder (~> 3.0.0)
|
17
|
+
erubis (~> 2.7.0)
|
18
|
+
journey (~> 1.0.1)
|
19
|
+
rack (~> 1.4.0)
|
20
|
+
rack-cache (~> 1.2)
|
21
|
+
rack-test (~> 0.6.1)
|
22
|
+
sprockets (~> 2.1.2)
|
23
|
+
activemodel (3.2.3)
|
24
|
+
activesupport (= 3.2.3)
|
25
|
+
builder (~> 3.0.0)
|
26
|
+
activerecord (3.2.3)
|
27
|
+
activemodel (= 3.2.3)
|
28
|
+
activesupport (= 3.2.3)
|
29
|
+
arel (~> 3.0.2)
|
30
|
+
tzinfo (~> 0.3.29)
|
31
|
+
activeresource (3.2.3)
|
32
|
+
activemodel (= 3.2.3)
|
33
|
+
activesupport (= 3.2.3)
|
34
|
+
activesupport (3.2.3)
|
35
|
+
i18n (~> 0.6)
|
36
|
+
multi_json (~> 1.0)
|
37
|
+
arel (3.0.2)
|
38
|
+
builder (3.0.0)
|
39
|
+
erubis (2.7.0)
|
40
|
+
hike (1.2.1)
|
41
|
+
i18n (0.6.0)
|
42
|
+
journey (1.0.3)
|
43
|
+
json (1.6.6)
|
44
|
+
mail (2.4.4)
|
45
|
+
i18n (>= 0.4.0)
|
46
|
+
mime-types (~> 1.16)
|
47
|
+
treetop (~> 1.4.8)
|
48
|
+
mime-types (1.18)
|
49
|
+
multi_json (1.2.0)
|
50
|
+
polyglot (0.3.3)
|
51
|
+
rack (1.4.1)
|
52
|
+
rack-cache (1.2)
|
53
|
+
rack (>= 0.4)
|
54
|
+
rack-ssl (1.3.2)
|
55
|
+
rack
|
56
|
+
rack-test (0.6.1)
|
57
|
+
rack (>= 1.0)
|
58
|
+
rails (3.2.3)
|
59
|
+
actionmailer (= 3.2.3)
|
60
|
+
actionpack (= 3.2.3)
|
61
|
+
activerecord (= 3.2.3)
|
62
|
+
activeresource (= 3.2.3)
|
63
|
+
activesupport (= 3.2.3)
|
64
|
+
bundler (~> 1.0)
|
65
|
+
railties (= 3.2.3)
|
66
|
+
railties (3.2.3)
|
67
|
+
actionpack (= 3.2.3)
|
68
|
+
activesupport (= 3.2.3)
|
69
|
+
rack-ssl (~> 1.3.2)
|
70
|
+
rake (>= 0.8.7)
|
71
|
+
rdoc (~> 3.4)
|
72
|
+
thor (~> 0.14.6)
|
73
|
+
rake (0.9.2.2)
|
74
|
+
rdoc (3.12)
|
75
|
+
json (~> 1.4)
|
76
|
+
sprockets (2.1.2)
|
77
|
+
hike (~> 1.2)
|
78
|
+
rack (~> 1.0)
|
79
|
+
tilt (~> 1.1, != 1.3.0)
|
80
|
+
thor (0.14.6)
|
81
|
+
tilt (1.3.3)
|
82
|
+
treetop (1.4.10)
|
83
|
+
polyglot
|
84
|
+
polyglot (>= 0.3.1)
|
85
|
+
tzinfo (0.3.33)
|
86
|
+
|
87
|
+
PLATFORMS
|
88
|
+
x86-mingw32
|
89
|
+
|
90
|
+
DEPENDENCIES
|
91
|
+
bundler (~> 1.0)
|
92
|
+
mobile-rails!
|
93
|
+
rails (~> 3.0)
|
data/README.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# mobile-rails
|
2
|
+
|
3
|
+
## Install
|
4
|
+
|
5
|
+
gem 'mobile-rails', '~> 0.1.pre'
|
6
|
+
|
7
|
+
## Getting Started
|
8
|
+
|
9
|
+
* Add `is_mobile_aware` to each controller you want to be mobile aware or add it to `application_controller.rb`
|
10
|
+
in `app/controllers`. This will enable it in every controller.
|
11
|
+
|
12
|
+
* Create a new folder `mobile` inside `app/views`
|
13
|
+
|
14
|
+
## Example
|
15
|
+
|
16
|
+
class ApplicationController < ActionController::Base
|
17
|
+
protect_from_forgery
|
18
|
+
is_mobile_aware
|
19
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Mobile
|
2
|
+
module Rails
|
3
|
+
|
4
|
+
module Aware
|
5
|
+
def is_mobile_aware(options = {})
|
6
|
+
include Mobile::Rails::InstanceMethods
|
7
|
+
before_filter :render_for_mobile
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module InstanceMethods
|
12
|
+
def render_for_mobile
|
13
|
+
prepend_view_path 'app/views/mobile' if is_mobile?
|
14
|
+
end
|
15
|
+
|
16
|
+
def is_mobile?
|
17
|
+
logger.debug "User-Agent: #{request.user_agent}"
|
18
|
+
request.user_agent.downcase =~ /mobile/
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/mobile-rails.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.expand_path('../lib/mobile/rails/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'mobile-rails'
|
5
|
+
s.version = Mobile::Rails::VERSION
|
6
|
+
s.platform = Gem::Platform::RUBY
|
7
|
+
s.authors = ['Michael Schumacher']
|
8
|
+
s.email = ['schumacher.m@me.com']
|
9
|
+
s.homepage = 'https://github.com/schumacher-m/mobile-rails'
|
10
|
+
|
11
|
+
s.summary = 'Handle mobile requests without the hassle.'
|
12
|
+
s.description = <<-DESCRIPTION
|
13
|
+
mobile-rails provides an easy way to make
|
14
|
+
a controller mobile aware. If a mobile user is accessing
|
15
|
+
your website, a different view may be used if it exists.
|
16
|
+
DESCRIPTION
|
17
|
+
|
18
|
+
s.add_dependency 'railties', '~> 3.0'
|
19
|
+
|
20
|
+
s.add_development_dependency 'rails', '~> 3.0'
|
21
|
+
s.add_development_dependency 'bundler', '~> 1.0'
|
22
|
+
|
23
|
+
s.files = `git ls-files`.split("\n")
|
24
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
25
|
+
s.require_path = ['lib']
|
26
|
+
|
27
|
+
end
|
data/spec/aware_spec.rb
ADDED
data/spec/spec_helper.rb
ADDED
File without changes
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mobile-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.pre.2
|
5
|
+
prerelease: 4
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Michael Schumacher
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-04-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: railties
|
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'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rails
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '3.0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '3.0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: bundler
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
description: ! " mobile-rails provides an easy way to make\n a controller mobile
|
63
|
+
aware. If a mobile user is accessing\n your website, a different view may be
|
64
|
+
used if it exists.\n"
|
65
|
+
email:
|
66
|
+
- schumacher.m@me.com
|
67
|
+
executables: []
|
68
|
+
extensions: []
|
69
|
+
extra_rdoc_files: []
|
70
|
+
files:
|
71
|
+
- .gitignore
|
72
|
+
- Gemfile
|
73
|
+
- Gemfile.lock
|
74
|
+
- README.md
|
75
|
+
- lib/mobile-rails.rb
|
76
|
+
- lib/mobile/rails/aware.rb
|
77
|
+
- lib/mobile/rails/version.rb
|
78
|
+
- mobile-rails.gemspec
|
79
|
+
- spec/aware_spec.rb
|
80
|
+
- spec/spec_helper.rb
|
81
|
+
homepage: https://github.com/schumacher-m/mobile-rails
|
82
|
+
licenses: []
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- - lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>'
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 1.3.1
|
99
|
+
requirements: []
|
100
|
+
rubyforge_project:
|
101
|
+
rubygems_version: 1.8.21
|
102
|
+
signing_key:
|
103
|
+
specification_version: 3
|
104
|
+
summary: Handle mobile requests without the hassle.
|
105
|
+
test_files: []
|