mobile-enhancements 0.0.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.
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ **.DS_Store
19
+ spec/internal/log
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mobile-enhancements.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,6 @@
1
+ guard "rspec" do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
+ watch("spec/spec_helper.rb") { "spec" }
5
+ end
6
+
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Ryan Townsend
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
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.
data/README.md ADDED
@@ -0,0 +1,92 @@
1
+ This gem provides a few features to a Rails app which aid the production of a mobile-targeted UI.
2
+
3
+ Firstly, it provides the `mobile_only` and `mobile_optional` blocks to your routes, these let you define particular routes which can only be accessed via your mobile prefix (default: `/mobile`) or ones which will work for both desktop and mobile. For details on customising the prefix, and exact usage of the routes helpers, see the "Usage" section below.
4
+
5
+ [![Build Status][2]][1] [![Code Climate][3]][4]
6
+
7
+ [1]: http://travis-ci.org/ryantownsend/mobile-enhancements
8
+ [2]: https://secure.travis-ci.org/ryantownsend/mobile-enhancements.png?branch=master
9
+ [3]: https://codeclimate.com/badge.png
10
+ [4]: https://codeclimate.com/github/ryantownsend/mobile-enhancements
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem "mobile-enhancements"
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install mobile-enhancements
27
+
28
+ ## Usage
29
+
30
+ In your config/routes.rb file:
31
+
32
+ ```ruby
33
+ YourApp::Application.routes.draw do
34
+ # this can be accessed via mobile or desktop versions
35
+ mobile_optional do
36
+ resource :items
37
+ end
38
+
39
+ # this cannot be access via desktop
40
+ mobile_only do
41
+ get :barcode_scanner, to: "scans#new"
42
+ end
43
+
44
+ # normal routes are desktop-only
45
+ resource :guides
46
+ end
47
+ ```
48
+
49
+ By default the path prefix for mobile routes will be `mobile/`. The app will also use `layouts/application.mobile.erb` as the root mobile UI template unless specified otherwise.
50
+
51
+ You can customise these options by creating an initializer, here's an example `config/initializers/mobile_enhancements.rb` file (the defaults):
52
+
53
+ ```ruby
54
+ require "mobile_enhancements"
55
+
56
+ MobileEnhancements.configure do
57
+ mobile do
58
+ # defines the path prefix used
59
+ prefix "mobile"
60
+ # defines the global view file
61
+ layout "mobile"
62
+ # defines the 'format' in view.format.renderer view filenames,
63
+ # to use the same HTML as standard actions, simply set to "html"
64
+ format "mobile"
65
+ end
66
+
67
+ desktop do
68
+ layout "application"
69
+ end
70
+ end
71
+ ```
72
+
73
+ Note, in your application controller, a `determine_layout` method will be defined which will choose which layout file it needs, if you want to override this in your own controllers, you can always use `super` to reference the original.
74
+
75
+ A few helper methods are also provided (accessible both by your views and controllers):
76
+
77
+ ```ruby
78
+ mobile_request?
79
+ mobile_path(path_to_convert)
80
+ mobile_url(url_to_convert)
81
+ desktop_request?
82
+ desktop_path(path_to_convert)
83
+ desktop_url(url_to_convert)
84
+ ```
85
+
86
+ ## Contributing
87
+
88
+ 1. Fork it
89
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
90
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
91
+ 4. Push to the branch (`git push origin my-new-feature`)
92
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1 @@
1
+ require_relative "mobile_enhancements"
@@ -0,0 +1,62 @@
1
+ module MobileEnhancements
2
+ class Configuration
3
+ def self.default
4
+ new do
5
+ mobile do
6
+ prefix "mobile"
7
+ layout "application"
8
+ format "mobile"
9
+ end
10
+
11
+ desktop do
12
+ layout "application"
13
+ end
14
+ end
15
+ end
16
+
17
+ def initialize(&block)
18
+ instance_eval(&block) if block_given?
19
+ end
20
+
21
+ def mobile(&block)
22
+ @options ||= {}
23
+ @options[__method__] ||= Options.new
24
+ if block_given?
25
+ @options[__method__].instance_eval(&block)
26
+ end
27
+ @options[__method__]
28
+ end
29
+ alias_method :desktop, :mobile
30
+
31
+ def mobile_path_prefix
32
+ mobile.prefix.gsub(/^\/|\/$/, "")
33
+ end
34
+
35
+ def mobile_layout
36
+ mobile.layout
37
+ end
38
+
39
+ def desktop_layout
40
+ desktop.layout
41
+ end
42
+
43
+ def mobile_format
44
+ if mobile.format && mobile.format.to_sym != :html
45
+ mobile.format.to_sym
46
+ end
47
+ end
48
+
49
+ class Options
50
+ def method_missing(name, *args, &block)
51
+ case args.size
52
+ when 0
53
+ (@properties ||= {})[name]
54
+ when 1
55
+ (@properties ||= {})[name] = args.first
56
+ else
57
+ super
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,21 @@
1
+ require "forwardable"
2
+ require "mobile_enhancements"
3
+ require "mobile_enhancements/request_helper"
4
+
5
+ module MobileEnhancements
6
+ module HelperDelegation
7
+ def self.included(base)
8
+ base.extend Forwardable
9
+ base.def_delegators :mobile_enhancement_helpers, *RequestHelper.delegated_methods
10
+ # make the methods available as view helpers if available
11
+ if base.respond_to?(:helper_method)
12
+ base.helper_method *RequestHelper.delegated_methods
13
+ end
14
+ end
15
+
16
+ private
17
+ def mobile_enhancement_helpers
18
+ @mobile_enhancement_helpers ||= RequestHelper.new(request, MobileEnhancements.configuration)
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,23 @@
1
+ require "mobile_enhancements/route_helpers"
2
+ require "mobile_enhancements/helper_delegation"
3
+ require "rails/railtie"
4
+
5
+ module MobileEnhancements
6
+ class Railtie < Rails::Railtie
7
+
8
+ config.to_prepare do
9
+ # setup our route helpers
10
+ ActionDispatch::Routing::Mapper.send(:include, MobileEnhancements::RouteHelpers)
11
+ # setup the path helpers
12
+ ActionController::Base.send(:include, MobileEnhancements::HelperDelegation)
13
+ # setup the layout calculation
14
+ ActionController::Base.layout :determine_layout
15
+ # if we have a custom mobile format
16
+ if format = MobileEnhancements.configuration.mobile_format
17
+ # register it as an alias to the HTML mime-type
18
+ Mime::Type.register_alias "text/html", format
19
+ end
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,61 @@
1
+ require "forwardable"
2
+
3
+ module MobileEnhancements
4
+ class RequestHelper
5
+ extend Forwardable
6
+
7
+ def self.delegated_methods
8
+ instance_methods.select do |name|
9
+ name =~ /^(desktop|mobile)\_/
10
+ end << :determine_layout
11
+ end
12
+
13
+ def_delegators :configuration, :mobile_path_prefix, :mobile_layout, :desktop_layout
14
+
15
+ attr_reader :request, :configuration
16
+
17
+ def initialize(request, configuration)
18
+ @request = request
19
+ @configuration = configuration
20
+ end
21
+
22
+ # returns a string defining which layout file to use
23
+ def determine_layout
24
+ mobile_request? ? mobile_layout : desktop_layout
25
+ end
26
+
27
+ # strips any mobile prefix from the url
28
+ def desktop_url(url = request.url)
29
+ desktop_path(url)
30
+ end
31
+
32
+ # strips any mobile prefix from the path
33
+ def desktop_path(path = request.path)
34
+ path.gsub(/^(.*?\/\/.*?)?\/(#{mobile_path_prefix}\/?)?(.*)$/) do
35
+ "#{$1}/#{$3}"
36
+ end.freeze
37
+ end
38
+
39
+ # ensures a mobile prefix exists in the url
40
+ def mobile_url(url = request.url)
41
+ mobile_path(url)
42
+ end
43
+
44
+ # ensures a mobile prefix exists in the path
45
+ def mobile_path(path = request.path)
46
+ path.gsub(/^(.*?\/\/.*?)?\/(#{mobile_path_prefix}\/?)?(.*)$/) do
47
+ "#{$1}/#{mobile_path_prefix}/#{$3}"
48
+ end.freeze
49
+ end
50
+
51
+ # returns whether or not this is a mobile request
52
+ def mobile_request?
53
+ @mobile_request ||= !!(request.path =~ /^\/#{mobile_path_prefix}(\/.*)?$/)
54
+ end
55
+
56
+ # returns whether or not this is a desktop request
57
+ def desktop_request?
58
+ !mobile_request?
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,25 @@
1
+ require "mobile_enhancements"
2
+
3
+ module MobileEnhancements
4
+ module RouteHelpers
5
+ # all routes defined within the mobile_only block will require the mobile
6
+ # prefix
7
+ def mobile_only(&block)
8
+ scope(mobile_path_prefix, mobile: mobile_path_prefix, &block)
9
+ end
10
+
11
+ # all routes defined within the mobile_optional block will be accessible
12
+ # with and without the mobile prefix
13
+ def mobile_optional(&block)
14
+ scope("(:mobile)", {
15
+ defaults: { mobile: nil },
16
+ mobile: /(#{mobile_path_prefix})?/
17
+ }, &block)
18
+ end
19
+
20
+ private
21
+ def mobile_path_prefix
22
+ MobileEnhancements.configuration.mobile_path_prefix
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ module MobileEnhancements
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,21 @@
1
+ require "mobile_enhancements/version"
2
+ require "mobile_enhancements/configuration"
3
+ require "mobile_enhancements/request_helper"
4
+ require "mobile_enhancements/helper_delegation"
5
+ require "mobile_enhancements/route_helpers"
6
+
7
+ if defined?(Rails)
8
+ require "mobile_enhancements/railtie"
9
+ end
10
+
11
+ module MobileEnhancements
12
+ # sets up the default configuration and returns the configuration singleton
13
+ def self.configuration
14
+ @configuration ||= Configuration.default
15
+ end
16
+
17
+ # used to configure the settings by users
18
+ def self.configure(&block)
19
+ configuration.instance_eval(&block)
20
+ end
21
+ end
@@ -0,0 +1,26 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ require "mobile_enhancements/version"
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "mobile-enhancements"
8
+ s.version = MobileEnhancements::VERSION
9
+ s.authors = ["Ryan Townsend"]
10
+ s.email = ["ryan@ryantownsend.co.uk"]
11
+ s.description = "This gem provides a few features to a Rails app which aid the production of a mobile-targeted UI."
12
+ s.summary = "A few features to aid Rails apps with separate mobile-targeted UIs."
13
+ s.homepage = "https://github.com/ryantownsend/mobile-enhancements"
14
+
15
+ s.files = `git ls-files`.split($/)
16
+ s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ s.test_files = s.files.grep(%r{^(test|spec)/})
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_development_dependency "rake"
21
+ s.add_development_dependency "rb-fsevent"
22
+ s.add_development_dependency "guard-rspec"
23
+ s.add_development_dependency "rspec-rails"
24
+ s.add_development_dependency "simplecov"
25
+ s.add_development_dependency "combustion"
26
+ end
@@ -0,0 +1,7 @@
1
+ class TestController < ActionController::Base
2
+ def one
3
+ render text: __method__
4
+ end
5
+ alias_method :two, :one
6
+ alias_method :three, :one
7
+ end
@@ -0,0 +1,9 @@
1
+ require "mobile_enhancements"
2
+
3
+ MobileEnhancements.configure do
4
+ mobile do
5
+ prefix "m"
6
+ layout "application"
7
+ mime_type "mob"
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ Rails.application.routes.draw do
2
+ get "one", to: "test#one"
3
+
4
+ mobile_optional do
5
+ get "two", to: "test#two"
6
+ end
7
+
8
+ mobile_only do
9
+ get "three", to: "test#three"
10
+ end
11
+ end
@@ -0,0 +1,48 @@
1
+ require "spec_helper"
2
+
3
+ describe MobileEnhancements::Configuration do
4
+ subject do
5
+ MobileEnhancements::Configuration.new
6
+ end
7
+
8
+ context "with no configuration settings defined" do
9
+ it "should return nil for settings" do
10
+ expect(subject.mobile.prefix).to be_nil
11
+ expect(subject.mobile.layout).to be_nil
12
+ expect(subject.desktop.layout).to be_nil
13
+ end
14
+ end
15
+
16
+ describe "defining mobile configuration" do
17
+ before do
18
+ subject.mobile do
19
+ prefix "m"
20
+ layout "mob"
21
+ end
22
+ end
23
+
24
+ it "should store the prefix" do
25
+ expect(subject.mobile.prefix).to eq "m"
26
+ end
27
+
28
+ it "should store the layout" do
29
+ expect(subject.mobile.layout).to eq "mob"
30
+ end
31
+
32
+ it "should raise method missing for undefined options" do
33
+ expect { subject.mobile.banana(1,2) }.to raise_error(NoMethodError)
34
+ end
35
+ end
36
+
37
+ describe "defining desktop configuration" do
38
+ before do
39
+ subject.desktop do
40
+ layout "desktop"
41
+ end
42
+ end
43
+
44
+ it "should store the layout" do
45
+ expect(subject.desktop.layout).to eq "desktop"
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,33 @@
1
+ require "spec_helper"
2
+
3
+ describe MobileEnhancements::HelperDelegation do
4
+ let(:request) { mock(:request) }
5
+
6
+ subject do
7
+ Class.new do
8
+ def self.helper_method(*helpers)
9
+ @helpers ||= []
10
+ @helpers += helpers.flatten
11
+ end
12
+
13
+ def self.helper_methods
14
+ @helpers || []
15
+ end
16
+
17
+ include MobileEnhancements::HelperDelegation
18
+ end.new.tap do |inst|
19
+ inst.stub(:request).and_return(request)
20
+ end
21
+ end
22
+
23
+ MobileEnhancements::RequestHelper.delegated_methods.each do |method|
24
+ it "should delegate ##{method} to RequestHelper" do
25
+ subject.send(:mobile_enhancement_helpers).should_receive(method).and_return(true)
26
+ subject.send(method)
27
+ end
28
+
29
+ it "should define ##{method} as a helper method" do
30
+ expect(subject.class.helper_methods).to include method
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,124 @@
1
+ require "spec_helper"
2
+
3
+ describe MobileEnhancements::RequestHelper do
4
+ let(:path) { "/" }
5
+ let(:url) do
6
+ "http://example.com#{path}"
7
+ end
8
+
9
+ let(:request) do
10
+ mock(:request, url: url, path: path)
11
+ end
12
+
13
+ let(:configuration) do
14
+ MobileEnhancements::Configuration.default
15
+ end
16
+
17
+ subject do
18
+ MobileEnhancements::RequestHelper.new(request, configuration)
19
+ end
20
+
21
+ describe "::delegated_methods" do
22
+ %w(
23
+ mobile_url mobile_path mobile_request?
24
+ desktop_url desktop_path desktop_request?
25
+ determine_layout
26
+ ).each do |method|
27
+ it "should include #{method}" do
28
+ expect(subject.class.delegated_methods.map(&:to_s)).to include method
29
+ end
30
+ end
31
+ end
32
+
33
+ context "when the URL contains a mobile path prefix" do
34
+ let(:path) { "/mobile/items/mobile/iphone" }
35
+
36
+ describe "#determine_layout" do
37
+ it "should return the mobile layout defined in the config" do
38
+ expect(subject.determine_layout).to eq configuration.mobile_layout
39
+ end
40
+ end
41
+
42
+ describe "#mobile_url" do
43
+ it "should return the URL untouched" do
44
+ expect(subject.mobile_url).to eq url
45
+ end
46
+ end
47
+
48
+ describe "#mobile_path" do
49
+ it "should return the path untouched" do
50
+ expect(subject.mobile_path).to eq path
51
+ end
52
+ end
53
+
54
+ describe "#desktop_url" do
55
+ it "should strip the mobile prefix from the URL" do
56
+ expect(subject.desktop_url).to eq "http://example.com/items/mobile/iphone"
57
+ end
58
+ end
59
+
60
+ describe "#mobile_path" do
61
+ it "should strip the mobile prefix from the path" do
62
+ expect(subject.desktop_path).to eq "/items/mobile/iphone"
63
+ end
64
+ end
65
+
66
+ describe "#mobile_request?" do
67
+ it "should return true" do
68
+ expect(subject.mobile_request?).to be_true
69
+ end
70
+ end
71
+
72
+ describe "#desktop_request?" do
73
+ it "should return false" do
74
+ expect(subject.desktop_request?).to be_false
75
+ end
76
+ end
77
+ end
78
+
79
+ context "when the URL does not contain a mobile path prefix" do
80
+ let(:path) { "/items/mobile/iphone" }
81
+
82
+ describe "#determine_layout" do
83
+ it "should return the desktop layout defined in the config" do
84
+ expect(subject.determine_layout).to eq configuration.desktop_layout
85
+ end
86
+ end
87
+
88
+ describe "#mobile_url" do
89
+ it "should prepend the path with a mobile prefix" do
90
+ expect(subject.mobile_url).to eq "http://example.com/mobile#{path}"
91
+ end
92
+ end
93
+
94
+ describe "#mobile_path" do
95
+ it "should prepend the path with a mobile prefix" do
96
+ expect(subject.mobile_path).to eq "/mobile#{path}"
97
+ end
98
+ end
99
+
100
+ describe "#desktop_url" do
101
+ it "should return the URL untouched" do
102
+ expect(subject.desktop_url).to eq url
103
+ end
104
+ end
105
+
106
+ describe "#mobile_path" do
107
+ it "should return the path untouched" do
108
+ expect(subject.desktop_path).to eq path
109
+ end
110
+ end
111
+
112
+ describe "#mobile_request?" do
113
+ it "should return false" do
114
+ expect(subject.mobile_request?).to be_false
115
+ end
116
+ end
117
+
118
+ describe "#desktop_request?" do
119
+ it "should return true" do
120
+ expect(subject.desktop_request?).to be_true
121
+ end
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,43 @@
1
+ require "spec_helper"
2
+
3
+ describe MobileEnhancements::RouteHelpers do
4
+ subject do
5
+ Class.new do
6
+ include MobileEnhancements::RouteHelpers
7
+
8
+ def scopes
9
+ @scopes
10
+ end
11
+
12
+ def scope(*args)
13
+ @scopes ||= []
14
+ @scopes << args
15
+ end
16
+ end.new
17
+ end
18
+
19
+ context "given a mobile_optional block" do
20
+ before do
21
+ subject.mobile_optional do
22
+ resources :items
23
+ end
24
+ end
25
+
26
+ it "should define a scope" do
27
+ expect(subject.scopes.size).to eq 1
28
+ end
29
+ end
30
+
31
+ context "given a mobile_only block" do
32
+ before do
33
+ subject.mobile_only do
34
+ resources :items
35
+ end
36
+ end
37
+
38
+ it "should define a scope" do
39
+ expect(subject.scopes.size).to eq 1
40
+ end
41
+ end
42
+
43
+ end
@@ -0,0 +1,39 @@
1
+ require "spec_helper"
2
+
3
+ describe "standard routing" do
4
+ it "routes /guides to guides#index" do
5
+ expect(get: "/one").to route_to("test#one")
6
+ end
7
+ end
8
+
9
+ describe "mobile-optional routing" do
10
+ it "routes /items to items#index" do
11
+ expect(get: "/two").to route_to({
12
+ controller: "test",
13
+ action: "two",
14
+ mobile: nil
15
+ })
16
+ end
17
+
18
+ it "routes /mobile/items to mobile#index" do
19
+ expect(get: "/#{MobileEnhancements.configuration.mobile_path_prefix}/two").to route_to({
20
+ controller: "test",
21
+ action: "two",
22
+ mobile: MobileEnhancements.configuration.mobile_path_prefix
23
+ })
24
+ end
25
+ end
26
+
27
+ describe "mobile-only routing" do
28
+ it "does not route /pages to pages#index" do
29
+ expect(get: "/three").not_to be_routable
30
+ end
31
+
32
+ it "routes /mobile/pages to pages#index" do
33
+ expect(get: "/#{MobileEnhancements.configuration.mobile_path_prefix}/three").to route_to({
34
+ controller: "test",
35
+ action: "three",
36
+ mobile: MobileEnhancements.configuration.mobile_path_prefix
37
+ })
38
+ end
39
+ end
@@ -0,0 +1,12 @@
1
+ require "simplecov"
2
+ SimpleCov.start do
3
+ add_filter "/spec/"
4
+ end
5
+
6
+ require "combustion"
7
+ Combustion.initialize!(:action_controller)
8
+
9
+ require "mobile_enhancements"
10
+ require "rspec/rails"
11
+
12
+ Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each { |f| require f }
@@ -0,0 +1,8 @@
1
+ RSpec.configure do |config|
2
+ config.expect_with :rspec do |c|
3
+ c.syntax = :expect
4
+ end
5
+
6
+ config.color_enabled = true
7
+ config.order = :random
8
+ end
metadata ADDED
@@ -0,0 +1,184 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mobile-enhancements
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ryan Townsend
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-19 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rb-fsevent
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '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: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: guard-rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '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: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec-rails
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: simplecov
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: combustion
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'
110
+ description: This gem provides a few features to a Rails app which aid the production
111
+ of a mobile-targeted UI.
112
+ email:
113
+ - ryan@ryantownsend.co.uk
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - .gitignore
119
+ - .travis.yml
120
+ - Gemfile
121
+ - Guardfile
122
+ - LICENSE.txt
123
+ - README.md
124
+ - Rakefile
125
+ - lib/mobile-enhancements.rb
126
+ - lib/mobile_enhancements.rb
127
+ - lib/mobile_enhancements/configuration.rb
128
+ - lib/mobile_enhancements/helper_delegation.rb
129
+ - lib/mobile_enhancements/railtie.rb
130
+ - lib/mobile_enhancements/request_helper.rb
131
+ - lib/mobile_enhancements/route_helpers.rb
132
+ - lib/mobile_enhancements/version.rb
133
+ - mobile-enhancements.gemspec
134
+ - spec/internal/app/controllers/test_controller.rb
135
+ - spec/internal/config/initializers/mobile_enhancements.rb
136
+ - spec/internal/config/routes.rb
137
+ - spec/mobile_enhancements/configuration_spec.rb
138
+ - spec/mobile_enhancements/helper_delegation_spec.rb
139
+ - spec/mobile_enhancements/request_helper_spec.rb
140
+ - spec/mobile_enhancements/route_helpers_spec.rb
141
+ - spec/routing/routes_spec.rb
142
+ - spec/spec_helper.rb
143
+ - spec/support/env.rb
144
+ homepage: https://github.com/ryantownsend/mobile-enhancements
145
+ licenses: []
146
+ post_install_message:
147
+ rdoc_options: []
148
+ require_paths:
149
+ - lib
150
+ required_ruby_version: !ruby/object:Gem::Requirement
151
+ none: false
152
+ requirements:
153
+ - - ! '>='
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ segments:
157
+ - 0
158
+ hash: -4122015549436335768
159
+ required_rubygems_version: !ruby/object:Gem::Requirement
160
+ none: false
161
+ requirements:
162
+ - - ! '>='
163
+ - !ruby/object:Gem::Version
164
+ version: '0'
165
+ segments:
166
+ - 0
167
+ hash: -4122015549436335768
168
+ requirements: []
169
+ rubyforge_project:
170
+ rubygems_version: 1.8.24
171
+ signing_key:
172
+ specification_version: 3
173
+ summary: A few features to aid Rails apps with separate mobile-targeted UIs.
174
+ test_files:
175
+ - spec/internal/app/controllers/test_controller.rb
176
+ - spec/internal/config/initializers/mobile_enhancements.rb
177
+ - spec/internal/config/routes.rb
178
+ - spec/mobile_enhancements/configuration_spec.rb
179
+ - spec/mobile_enhancements/helper_delegation_spec.rb
180
+ - spec/mobile_enhancements/request_helper_spec.rb
181
+ - spec/mobile_enhancements/route_helpers_spec.rb
182
+ - spec/routing/routes_spec.rb
183
+ - spec/spec_helper.rb
184
+ - spec/support/env.rb