From 66d4f9b4a051f4bca34858b2ffeb030531e030f5 Mon Sep 17 00:00:00 2001 From: geermc4 Date: Tue, 15 Jan 2013 17:17:27 -0800 Subject: [PATCH 1/3] Added options has_mobile_fu so you can define :only or :except This will make it so html gets rendered if not defined --- lib/mobile_fu.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/mobile_fu.rb b/lib/mobile_fu.rb index 70c6163..dc8d5ec 100644 --- a/lib/mobile_fu.rb +++ b/lib/mobile_fu.rb @@ -27,13 +27,14 @@ module ClassMethods # has_mobile_fu(true) # end - def has_mobile_fu(test_mode = false) + def has_mobile_fu(options) include ActionController::MobileFu::InstanceMethods - if test_mode + if options[:test_mode] before_filter :force_mobile_format else - before_filter :set_mobile_format + options.delete(:test_mode) + before_filter :set_mobile_format, options end helper_method :is_mobile_device? From 88c51623ca1fda821077ed26082d89c3904df4d5 Mon Sep 17 00:00:00 2001 From: geermc4 Date: Tue, 15 Jan 2013 17:25:32 -0800 Subject: [PATCH 2/3] making it a gem --- README.rdoc | 4 ++-- lib/{mobile_fu.rb => mobile-fu.rb} | 0 mobile-fu.gemspec | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) rename lib/{mobile_fu.rb => mobile-fu.rb} (100%) create mode 100644 mobile-fu.gemspec diff --git a/README.rdoc b/README.rdoc index 3084fdf..729eaa0 100644 --- a/README.rdoc +++ b/README.rdoc @@ -9,9 +9,9 @@ of the request from :html to :mobile. The master branch of this plugin is Rails 3 compatible. -To use the Rails 3 compatible version of this plugin, please install it like so: +To use the Rails 3 compatible version of this plugin, add it to your Gemfile: - rails plugin install git://github.com/brendanlim/mobile-fu.git + gem 'mobile-fu', :git => 'git://github.com/brendanlim/mobile-fu.git' == Rails 2 Compatibility diff --git a/lib/mobile_fu.rb b/lib/mobile-fu.rb similarity index 100% rename from lib/mobile_fu.rb rename to lib/mobile-fu.rb diff --git a/mobile-fu.gemspec b/mobile-fu.gemspec new file mode 100644 index 0000000..45e3499 --- /dev/null +++ b/mobile-fu.gemspec @@ -0,0 +1,20 @@ +# encoding: UTF-8 +Gem::Specification.new do |s| + s.platform = Gem::Platform::RUBY + s.name = 'mobile-fu' + s.version = '0.1' + s.summary = 'Automatically detect mobile requests from mobile devices in your Rails application' + s.required_ruby_version = '>= 1.8.7' + + s.author = 'Brendan G. Lim' + s.email = 'brendangl@gmail.com' + + s.files = `git ls-files`.split("\n") + s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + s.require_path = 'lib' + s.requirements << 'none' + + s.add_dependency 'spree_core', '~> 1.3.0.rc1' + s.add_dependency 'ooor', '~> 1.7.1' +end + From cb1adb9a2e4e27b7a2af943a205440a6de4c183c Mon Sep 17 00:00:00 2001 From: geermc4 Date: Tue, 15 Jan 2013 17:31:38 -0800 Subject: [PATCH 3/3] removing some extra dependencies i added by mistake --- mobile-fu.gemspec | 3 --- 1 file changed, 3 deletions(-) diff --git a/mobile-fu.gemspec b/mobile-fu.gemspec index 45e3499..a6e4f17 100644 --- a/mobile-fu.gemspec +++ b/mobile-fu.gemspec @@ -13,8 +13,5 @@ Gem::Specification.new do |s| s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.require_path = 'lib' s.requirements << 'none' - - s.add_dependency 'spree_core', '~> 1.3.0.rc1' - s.add_dependency 'ooor', '~> 1.7.1' end