detect_browser_os 0.1.0 → 0.1.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 CHANGED
@@ -19,3 +19,6 @@ rdoc
19
19
  pkg
20
20
 
21
21
  ## PROJECT::SPECIFIC
22
+
23
+ # generated gem files
24
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in detect_browser_os.gemspec
4
+ gemspec
data/Rakefile CHANGED
@@ -1,53 +1,2 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "detect_browser_os"
8
- gem.summary = %Q{add css classes to your markup based on the end users browser and operating system.}
9
- gem.description = %Q{add css classes to your markup based on the end users browser and operating system.}
10
- gem.email = "ryan@socialcast.com"
11
- gem.homepage = "http://github.com/wireframe/detect_browser_os"
12
- gem.authors = ["Ryan Sonnek"]
13
- gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
14
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
- end
16
- Jeweler::GemcutterTasks.new
17
- rescue LoadError
18
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
- end
20
-
21
- require 'rake/testtask'
22
- Rake::TestTask.new(:test) do |test|
23
- test.libs << 'lib' << 'test'
24
- test.pattern = 'test/**/test_*.rb'
25
- test.verbose = true
26
- end
27
-
28
- begin
29
- require 'rcov/rcovtask'
30
- Rcov::RcovTask.new do |test|
31
- test.libs << 'test'
32
- test.pattern = 'test/**/test_*.rb'
33
- test.verbose = true
34
- end
35
- rescue LoadError
36
- task :rcov do
37
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
38
- end
39
- end
40
-
41
- task :test => :check_dependencies
42
-
43
- task :default => :test
44
-
45
- require 'rake/rdoctask'
46
- Rake::RDocTask.new do |rdoc|
47
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
-
49
- rdoc.rdoc_dir = 'rdoc'
50
- rdoc.title = "detect_browser_os #{version}"
51
- rdoc.rdoc_files.include('README*')
52
- rdoc.rdoc_files.include('lib/**/*.rb')
53
- end
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -1,54 +1,23 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "detect_browser_os/version"
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{detect_browser_os}
8
- s.version = "0.1.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Ryan Sonnek"]
12
- s.date = %q{2010-08-31}
6
+ s.name = "detect_browser_os"
7
+ s.version = DetectBrowserOs::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Ryan Sonnek"]
10
+ s.email = ["ryan@codecrate.com"]
11
+ s.homepage = "http://github.com/wireframe/detect_browser_os"
12
+ s.summary = %q{detect end users browser and operating system.}
13
13
  s.description = %q{add css classes to your markup based on the end users browser and operating system.}
14
- s.email = %q{ryan@socialcast.com}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".document",
21
- ".gitignore",
22
- "LICENSE",
23
- "README.rdoc",
24
- "Rakefile",
25
- "VERSION",
26
- "detect_browser_os.gemspec",
27
- "lib/detect_browser_os.rb",
28
- "test/helper.rb",
29
- "test/test_detect_browser_os.rb"
30
- ]
31
- s.homepage = %q{http://github.com/wireframe/detect_browser_os}
32
- s.rdoc_options = ["--charset=UTF-8"]
33
- s.require_paths = ["lib"]
34
- s.rubygems_version = %q{1.3.7}
35
- s.summary = %q{add css classes to your markup based on the end users browser and operating system.}
36
- s.test_files = [
37
- "test/helper.rb",
38
- "test/test_detect_browser_os.rb"
39
- ]
40
14
 
41
- if s.respond_to? :specification_version then
42
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
43
- s.specification_version = 3
15
+ s.rubyforge_project = "detect_browser_os"
44
16
 
45
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
- s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
47
- else
48
- s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
49
- end
50
- else
51
- s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
52
- end
53
- end
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
54
21
 
22
+ s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
23
+ end
@@ -5,10 +5,22 @@ end
5
5
 
6
6
  def detect_os(user_agent = request.user_agent)
7
7
  ua = (user_agent || "").downcase
8
-
9
- ua.include?('mac') || ua.include?('darwin') ? ua.include?('iphone') ? 'iphone' : ua.include?('ipod') ? 'ipod' : 'mac' :
10
- ua.include?('x11') || ua.include?('linux') ? 'linux' :
11
- ua.include?('win') ? 'win' : nil
8
+
9
+ if ua.include?('iphone')
10
+ 'iphone'
11
+ elsif ua.include?('ipad')
12
+ 'ipad'
13
+ elsif ua.include?('ipod')
14
+ 'ipod'
15
+ elsif ua.include?('mac') || ua.include?('darwin')
16
+ 'mac'
17
+ elsif ua.include?('x11') || ua.include?('linux')
18
+ 'linux'
19
+ elsif ua.include?('win')
20
+ 'win'
21
+ else
22
+ nil
23
+ end
12
24
  end
13
25
  def detect_browser(user_agent = request.user_agent)
14
26
  ua = (user_agent || "").downcase
@@ -19,9 +31,8 @@ def detect_browser(user_agent = request.user_agent)
19
31
  o.join(" ")
20
32
  when /webtv/ ; "gecko"
21
33
  when /msie (\d)/ ; "ie ie#{$1}"
22
- when %r{firefox/2} ; "gecko ff2"
23
34
  when %r{firefox/3.5} ; "gecko ff3 ff3_5"
24
- when %r{firefox/3} ; "gecko ff3"
35
+ when %r{firefox} ; "gecko ff#{(ua.match(/firefox\/(\d+)/) || ['',''])[1]}"
25
36
  when /konqueror/ ; "konqueror"
26
37
  when /applewebkit\/([\d.]+).? \([^)]*\) ?(?:version\/(\d+))?.*$/
27
38
  o = %W(webkit)
@@ -0,0 +1,3 @@
1
+ module DetectBrowserOs
2
+ VERSION = "0.1.1"
3
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: detect_browser_os
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease: false
4
+ hash: 25
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Sonnek
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-31 00:00:00 -05:00
19
- default_executable:
18
+ date: 2011-09-12 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: thoughtbot-shoulda
@@ -33,32 +32,32 @@ dependencies:
33
32
  type: :development
34
33
  version_requirements: *id001
35
34
  description: add css classes to your markup based on the end users browser and operating system.
36
- email: ryan@socialcast.com
35
+ email:
36
+ - ryan@codecrate.com
37
37
  executables: []
38
38
 
39
39
  extensions: []
40
40
 
41
- extra_rdoc_files:
42
- - LICENSE
43
- - README.rdoc
41
+ extra_rdoc_files: []
42
+
44
43
  files:
45
44
  - .document
46
45
  - .gitignore
46
+ - Gemfile
47
47
  - LICENSE
48
48
  - README.rdoc
49
49
  - Rakefile
50
- - VERSION
51
50
  - detect_browser_os.gemspec
52
51
  - lib/detect_browser_os.rb
52
+ - lib/detect_browser_os/version.rb
53
53
  - test/helper.rb
54
54
  - test/test_detect_browser_os.rb
55
- has_rdoc: true
56
55
  homepage: http://github.com/wireframe/detect_browser_os
57
56
  licenses: []
58
57
 
59
58
  post_install_message:
60
- rdoc_options:
61
- - --charset=UTF-8
59
+ rdoc_options: []
60
+
62
61
  require_paths:
63
62
  - lib
64
63
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -81,11 +80,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
80
  version: "0"
82
81
  requirements: []
83
82
 
84
- rubyforge_project:
85
- rubygems_version: 1.3.7
83
+ rubyforge_project: detect_browser_os
84
+ rubygems_version: 1.8.5
86
85
  signing_key:
87
86
  specification_version: 3
88
- summary: add css classes to your markup based on the end users browser and operating system.
87
+ summary: detect end users browser and operating system.
89
88
  test_files:
90
89
  - test/helper.rb
91
90
  - test/test_detect_browser_os.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.0