From 33014f81a23f75859d2e336c9153a41c311cbc08 Mon Sep 17 00:00:00 2001 From: Jason Harrelson Date: Thu, 18 Jun 2009 11:19:17 -0500 Subject: [PATCH] Release 0.2.9. --- History.txt | 5 + guilded.gemspec | 4 +- lib/guilded.rb | 2 +- lib/guilded/browser_detector.rb | 92 +++++++++++-------- .../inactive_record/human_attribute_hint.rb | 3 - 5 files changed, 60 insertions(+), 46 deletions(-) diff --git a/History.txt b/History.txt index 423c764..dea5e50 100644 --- a/History.txt +++ b/History.txt @@ -1,3 +1,8 @@ += 0.2.9 2009-06-18 + +* Added rescue code if the browser name or version fails. + + = 0.2.8 2009-06-12 * Removed some code from the InactiveRecord:Base extension for human attrbiute hint that returns unless diff --git a/guilded.gemspec b/guilded.gemspec index dd48f3a..6e61f31 100644 --- a/guilded.gemspec +++ b/guilded.gemspec @@ -2,11 +2,11 @@ Gem::Specification.new do |s| s.name = %q{guilded} - s.version = "0.2.8" + s.version = "0.2.9" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["C. Jason Harrelson (midas)"] - s.date = %q{2009-06-12} + s.date = %q{2009-06-18} s.description = %q{Guilded is a framework for building web based components centered around current web standards and best practices. The current framework is written in ruby, but could be ported to other languages. Guilded intends to provide a toolset for creating and consuming reusable web components. Currently, this problem domain is filled with JavaScript frameworks. These frameworks are wonderful and work very well. However, they do not degrade gracefully and are not accessible. Guilded seeks to provide the same level of "componentization" and ease of use without sacrificing degradability and accessibility. Guilded will achieve these goals by applying each technology at our disposal to do what it was intended. XHTML will be employed for content. CSS used for layout and styling. Behavior will be added to a component with JavaScript through progressive enhancement. The user will have the best experience with a Guilded component when CSS and JavaScript are enabled in their browser, but will still be able to use the component when CSS and JavaScript are disabled. Guilded will use jQuery as it's base JavaScript framework. jQuery was chosen because it lends itself to progressive enhancement due to the way it was authored. In addition, the tight integration of jQuery's selectors with CSS selectors is also highly desirable. When authoring a Guilded component, it is encouraged to write the behavior code as a jQuery plugin. This will allow the jQuery plugin to be used outside of the Guilded project, if desired. Guilded also seeks to provide a standardized CSS framework for creating layouts that are reusable and predictable. Guilded will utilize the currently existing RubyGems system to package its components. A new Guilded component will be packaged in a Gem and have a dependency on the Guilded gem. The Guilded gem contains the framework to build Guilded components.} s.email = ["jason@lookforwardenterprises.com"] s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"] diff --git a/lib/guilded.rb b/lib/guilded.rb index a69d299..d3f95c7 100644 --- a/lib/guilded.rb +++ b/lib/guilded.rb @@ -73,7 +73,7 @@ # <%= g_load_alerter :skin => 'blueish', :id => 'load_alerter' %> # module Guilded - VERSION = '0.2.8' + VERSION = '0.2.9' end ActionView::Base.send( :include, Guilded::Rails::ViewHelpers ) if defined?( ActionView ) \ No newline at end of file diff --git a/lib/guilded/browser_detector.rb b/lib/guilded/browser_detector.rb index 596abe3..8639ead 100644 --- a/lib/guilded/browser_detector.rb +++ b/lib/guilded/browser_detector.rb @@ -34,37 +34,43 @@ def browser_is?( options={} ) # * +request+ - The request object. # def browser_name - @browser_name ||= begin - ua = @request.env['HTTP_USER_AGENT'] - if ua.nil? - 'unknown' - else - ua = ua.downcase + begin + @browser_name ||= begin + ua = @request.env['HTTP_USER_AGENT'] + if ua.nil? + 'unknown' + else + ua = ua.downcase - if ua.index( 'msie' ) && !ua.index( 'opera' ) && !ua.index( 'webtv' ) - if ua.index( 'windows ce' ) - 'ie' + '_ce' #+ ua[ua.index( 'msie' ) + 5].chr + if ua.index( 'msie' ) && !ua.index( 'opera' ) && !ua.index( 'webtv' ) + if ua.index( 'windows ce' ) + 'ie' + '_ce' #+ ua[ua.index( 'msie' ) + 5].chr + else + 'ie' # + ua[ua.index( 'msie' ) + 5].chr + end + elsif ua.include?( 'chrome' ) + 'chrome' + elsif ua.include?( 'netscape' ) + 'netscape' + elsif ua.include?( 'gecko/' ) + 'firefox' + elsif ua.include?( 'opera' ) + 'opera' + elsif ua.include?( 'konqueror' ) + 'konqueror' + elsif ua.include?( 'applewebkit/' ) + 'safari' + elsif ua.include?( 'mozilla/' ) + 'firefox' + elsif ua.include?( 'firefox' ) + 'firefox' else - 'ie' # + ua[ua.index( 'msie' ) + 5].chr + 'unknown' end - elsif ua.index( 'netscape' ) - 'netscape' - elsif ua.index( 'gecko/' ) - 'firefox' - elsif ua.index( 'opera' ) - 'opera' - elsif ua.index( 'konqueror' ) - 'konqueror' - elsif ua.index( 'applewebkit/' ) - 'safari' - elsif ua.index( 'mozilla/' ) - 'firefox' - elsif ua.index( 'firefox' ) - 'firefox' - else - 'unknown' end end + rescue + 'unknown' end end @@ -83,22 +89,28 @@ def browser_full_name # * +request+ - The request object. # def browser_version - @browser_version ||= begin - ua = @request.env['HTTP_USER_AGENT'].downcase + begin + @browser_version ||= begin + ua = @request.env['HTTP_USER_AGENT'].downcase - if browser_name == 'opera' - ua[ua.index( 'opera' ) + 6].chr - elsif browser_name == 'firefox' - ua[ua.index( 'firefox' ) + 8].chr - elsif browser_name == 'netscape' - ua[ua.index( 'netscape' ) + 9].chr - elsif browser_name.index( 'ie' ) - ua[ua.index( 'msie' ) + 5].chr - elsif browser_name.index( 'safari' ) - ua[ua.index( 'version' ) + 8].chr - else - 'unknown' + if browser_name == 'opera' + ua[ua.index( 'opera' ) + 6].chr + elsif browser_name == 'chrome' + ua[ua.index( 'chrome' ) + 7].chr + elsif browser_name == 'firefox' + ua[ua.index( 'firefox' ) + 8].chr + elsif browser_name == 'netscape' + ua[ua.index( 'netscape' ) + 9].chr + elsif browser_name.index( 'ie' ) + ua[ua.index( 'msie' ) + 5].chr + elsif browser_name.index( 'safari' ) + ua[ua.index( 'version' ) + 8].chr + else + '0' + end end + rescue + '0' end end diff --git a/lib/guilded/rails/inactive_record/human_attribute_hint.rb b/lib/guilded/rails/inactive_record/human_attribute_hint.rb index 0110cd3..4066dc0 100644 --- a/lib/guilded/rails/inactive_record/human_attribute_hint.rb +++ b/lib/guilded/rails/inactive_record/human_attribute_hint.rb @@ -1,9 +1,6 @@ module InactiveRecord class Base class <human_attribute_name. More descriptive text can be set. Example: - # attr_human_name 'num_employees' => 'Number of employees' def attr_human_hint(attributes) # :nodoc: #return unless table_exists?