quartermaster 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/README.txt CHANGED
@@ -4,7 +4,9 @@
4
4
 
5
5
  == DESCRIPTION:
6
6
 
7
- A collection of shortcuts and helpers for leveraging a request's env in Rails, such as including a browser-specific stylesheet if one exists or putting a short version of the user agent in the CSS classes of the body tag. This removes the need for most hacks or conditional comments since you can now do get browser-specific with your CSS rules (ex. body.ie6 div { ... })
7
+ A collection of shortcuts and helpers for leveraging a request's env in Rails, such as including a browser-specific stylesheet if one exists or putting a short version of the user agent in the CSS classes of the body tag.
8
+
9
+ This eliminates the need for most hacks or conditional comments since you can now get browser-specific with your CSS rules (ex. body.ie6 div { ... })
8
10
 
9
11
  == FEATURES/PROBLEMS:
10
12
 
@@ -33,6 +35,7 @@ Another trade-off if you're using stylesheet_link_tag_for_browser is that you ha
33
35
  == INSTALL:
34
36
 
35
37
  * sudo gem install quartermaster
38
+ * In config/environment.rb (or something in config/initializers/), just require 'quartermaster'. It automatically adds its helpers to ActionView::Base
36
39
 
37
40
  == LICENSE:
38
41
 
data/lib/quartermaster.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Quartermaster
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
 
4
4
  module Helper
5
5
  # Uses the output of +browser_from_user_agent+ to figure out what stylesheets to look for and then uses +stylesheet_link_tag+
@@ -19,7 +19,7 @@ module Quartermaster
19
19
 
20
20
  # Returns a space-separated string of the OS and the short user agents for the requesting browser
21
21
  def user_agent_for_css
22
- "#{os_from_user_agent} #{browser_from_user_agent.join(' ')}"
22
+ "#{os_from_user_agent} #{browser_from_user_agent.join(' ')}".chomp(' ')
23
23
  end
24
24
 
25
25
  # Returns an array containing the base browser name and a version-specific name (except for Konqueror) for the given +user_agent+ which defaults to Rails' +request.user_agent+
@@ -32,7 +32,7 @@ module Quartermaster
32
32
  when /rv:([^)]+)\) gecko/ then "gecko gecko#{$1}"
33
33
  when /applewebkit\/(\d)/ then "webkit webkit#{$1}"
34
34
  when /konqueror/ then 'konqueror'
35
- end.split(' ')
35
+ end.to_s.split(' ')
36
36
  end
37
37
 
38
38
  # Returns a short version of the OS name for the given +user_agent+ which defaults to Rails' +request.user_agent+
@@ -158,4 +158,15 @@ describe 'Quartermaster' do
158
158
  end
159
159
  end
160
160
  end
161
+
162
+ describe 'when request is from an unrecognized user agent' do
163
+ before(:each) do
164
+ @request = mock('Request', :user_agent => 'An unknown user agent')
165
+ @qm.stub!(:request).and_return(@request)
166
+ end
167
+
168
+ it "should return an empty string for the CSS classes" do
169
+ @qm.user_agent_for_css.should == ''
170
+ end
171
+ end
161
172
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quartermaster
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Myron
@@ -30,7 +30,7 @@ cert_chain:
30
30
  arkBVHd8TABNoJ+MQvwL/7sCwSTiTg==
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2008-05-06 00:00:00 -07:00
33
+ date: 2008-05-08 00:00:00 -07:00
34
34
  default_executable:
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
@@ -42,7 +42,7 @@ dependencies:
42
42
  - !ruby/object:Gem::Version
43
43
  version: 1.5.1
44
44
  version:
45
- description: A collection of shortcuts and helpers for leveraging a request's env in Rails, such as including a browser-specific stylesheet if one exists or putting a short version of the user agent in the CSS classes of the body tag. This removes the need for most hacks or conditional comments since you can now do get browser-specific with your CSS rules (ex. body.ie6 div { ... })
45
+ description: A collection of shortcuts and helpers for leveraging a request's env in Rails, such as including a browser-specific stylesheet if one exists or putting a short version of the user agent in the CSS classes of the body tag. This eliminates the need for most hacks or conditional comments since you can now get browser-specific with your CSS rules (ex. body.ie6 div { ... })
46
46
  email:
47
47
  - dave.myron@contentfree.com
48
48
  executables: []
metadata.gz.sig CHANGED
Binary file