sinatra-ie6nomore 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.
@@ -5,16 +5,16 @@ the nasty bug ridden monstrosity called IE6.
5
5
 
6
6
  Check the {"IE6 No More"}[www.ie6nomore.com] site for more information.
7
7
 
8
- === Install
8
+ == Install
9
9
 
10
10
 
11
11
  sudo gem install kematzy-sinatra-ie6nomore
12
12
 
13
- === Usage
13
+ == Usage
14
14
 
15
15
  Three steps
16
16
 
17
- ==== Step 1
17
+ === Step 1
18
18
 
19
19
  Require the Sinatra::IE6NoMore gem
20
20
 
@@ -22,7 +22,7 @@ Require the Sinatra::IE6NoMore gem
22
22
 
23
23
  require 'sinatra/ie6nomore'
24
24
 
25
- ==== Step 2
25
+ === Step 2
26
26
 
27
27
  Include in your app.
28
28
 
@@ -35,14 +35,14 @@ Include in your app.
35
35
  end
36
36
 
37
37
 
38
- ==== Step 3
38
+ === Step 3
39
39
 
40
40
  Add this to your <tt>/views/layout.erb</tt> file.
41
41
 
42
42
  <html>
43
43
  <body>
44
44
 
45
- <%= ie6nomore %>
45
+ <%= ie6_no_more %>
46
46
 
47
47
  </body>
48
48
  </html>
@@ -67,7 +67,7 @@ And in your HTML you'll see an output like this:
67
67
  <![endif]-->
68
68
 
69
69
 
70
- === Configuration Options
70
+ == Configuration Options
71
71
 
72
72
  * <tt>:locale</tt> => Locale (Default = :en)
73
73
 
@@ -79,7 +79,9 @@ And in your HTML you'll see an output like this:
79
79
 
80
80
  * <tt>:text_color</tt> => The div text color. (Default = "black")
81
81
 
82
- === Localizations
82
+ * <tt>:debug</tt> => Whether to encapsulate the code with IE Comments or not. So you can see how it looks like when developing on NON-IE 6 browsers. (Default = false)
83
+
84
+ == Localizations
83
85
 
84
86
  Currently supported localizations are:
85
87
 
@@ -92,6 +94,20 @@ Currently supported localizations are:
92
94
  * Swedish (se)
93
95
 
94
96
 
97
+ == Development Use
98
+
99
+ When you are developing a Non-IE6 site, you might want to check how the site looks like with the IE6NoMore
100
+ banner.
101
+
102
+ <html>
103
+ <body>
104
+
105
+ <%= ie6_no_more(:debug => true) %>
106
+
107
+ </body>
108
+ </html>
109
+
110
+
95
111
  == TODOs
96
112
 
97
113
  * Rake task to harvest all IE6NoMore images and store them on local server.
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ begin
9
9
  gem.email = "kematzy@gmail.com"
10
10
  gem.homepage = "http://github.com/kematzy/sinatra-ie6nomore"
11
11
  gem.authors = ["kematzy"]
12
- gem.add_dependency('sinatra', '>= 0.9.2')
12
+ gem.add_dependency('sinatra', '>= 0.9.4')
13
13
  gem.add_development_dependency('spec', '>= 1.2.7')
14
14
  gem.add_development_dependency('rspec_hpricot_matchers', '>= 1.0.0')
15
15
 
@@ -54,26 +54,17 @@ task :default => :spec
54
54
 
55
55
  require 'rake/rdoctask'
56
56
  Rake::RDocTask.new do |rdoc|
57
- if File.exist?('VERSION.yml')
58
- config = YAML.load(File.read('VERSION.yml'))
59
- version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
60
- else
61
- version = ""
62
- end
57
+ version = File.exist?('VERSION') ? IO.read('VERSION').chomp : "[Unknown]"
63
58
 
64
59
  rdoc.rdoc_dir = 'rdoc'
65
- rdoc.title = "sinatra-ie6nomore #{version}"
60
+ rdoc.title = "Sinatra::IE6NoMore v#{version}"
66
61
  rdoc.rdoc_files.include('README*')
67
62
  rdoc.rdoc_files.include('lib/**/*.rb')
68
63
  end
69
64
 
70
65
  desc 'Build the rdoc HTML Files'
71
66
  task :docs do
72
- if File.exist?('VERSION')
73
- version = File.read('VERSION')
74
- else
75
- version = "undefined"
76
- end
67
+ version = File.exist?('VERSION') ? IO.read('VERSION').chomp : "[Unknown]"
77
68
 
78
69
  sh "sdoc -N --title 'Sinatra::IE6NoMore v#{version}' lib/sinatra README.rdoc"
79
70
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -2,7 +2,7 @@ require 'sinatra/base'
2
2
  require 'yaml'
3
3
 
4
4
  module Sinatra
5
-
5
+
6
6
  # = Sinatra::IE6NoMore Extension
7
7
  #
8
8
  # A simple extension in support of the IE6 No More[www.ie6nomore.com] campaign to rid the world of
@@ -47,7 +47,7 @@ module Sinatra
47
47
  # <html>
48
48
  # <body>
49
49
  #
50
- # <%= ie6nomore %>
50
+ # <%= ie6_no_more %>
51
51
  #
52
52
  # </body>
53
53
  # </html>
@@ -77,7 +77,7 @@ module Sinatra
77
77
  #
78
78
  module IE6NoMore
79
79
 
80
- VERSION = '0.1.0' unless const_defined?(:VERSION)
80
+ VERSION = '0.1.1' unless const_defined?(:VERSION)
81
81
  def self.version; "Sinatra::IE6NoMore v#{VERSION}"; end
82
82
 
83
83
  ##
@@ -91,6 +91,7 @@ module Sinatra
91
91
  # * <tt>:border</tt> => The div border color. (Default = "1px solid #F7941D")
92
92
  # * <tt>:background</tt> => The div background color. (Default = "#FEEFDA")
93
93
  # * <tt>:text_color</tt> => The div text color. (Default = "black")
94
+ # * <tt>:debug</tt> => Whether to encapsulate the code with the IE Comments or not. (Default = false)
94
95
  #
95
96
  # ==== Examples
96
97
  #
@@ -101,6 +102,10 @@ module Sinatra
101
102
  # ie6_no_more(:border => "2px dashed green", :background => 'black', :text_color => 'white' )
102
103
  # => different color scheme for text, border & background colors
103
104
  #
105
+ # To see how it looks like when developing on a NON-IE 6 browsers.
106
+ #
107
+ # ie6_no_more(:debug => true) => removes the encapsulating IE comments.
108
+ #
104
109
  # @api public
105
110
  def ie6_no_more(options = {})
106
111
  o = {
@@ -109,13 +114,15 @@ module Sinatra
109
114
  :border => "1px solid #F7941D",
110
115
  :background => "#FEEFDA",
111
116
  :text_color => "black",
117
+ :debug => false
112
118
  }.merge(options)
113
119
 
114
120
  localizations = load_i18n
115
121
  # set the localisation
116
122
  i18n = localizations[o[:locale].to_s]
117
123
 
118
- html = %Q[<!--[if lt IE 7]>\n]
124
+ html = ''
125
+ html << %Q[<!--[if lt IE 7]>\n] unless o[:debug] # == true
119
126
  html << %Q[<div style="border: #{o[:border]}; background: #{o[:background]}; text-align: center; clear: both; height: 75px; position: relative;">\n]
120
127
  html << %Q[ <div style="position: absolute; right: 3px; top: 3px; font-family: courier new; font-weight: bold;"><a href="#" onclick="javascript:this.parentNode.parentNode.style.display="none"; return false;"><img src="#{o[:img_host]}/ie6nomore-cornerx.jpg" style="border: none;" alt="#{i18n['close']}"/></a></div>\n]
121
128
  html << %Q[ <div style="width: 640px; margin: 0 auto; text-align: left; padding: 0; overflow: hidden; color: #{o[:text_color]};">\n]
@@ -129,11 +136,11 @@ module Sinatra
129
136
  html << %Q[ <div style="width: 73px; float: left;"><a href="#{i18n['safari_url']}" target="_blank"><img src="#{o[:img_host]}/ie6nomore-safari.jpg" style="border: none;" alt="#{i18n['get']} Safari 4"/></a></div>\n]
130
137
  html << %Q[ <div style="float: left;"><a href="#{i18n['chrome_url']}" target="_blank"><img src="#{o[:img_host]}/ie6nomore-chrome.jpg" style="border: none;" alt="#{i18n['get']} Google Chrome"/></a></div>\n]
131
138
  html << %Q[ </div>\n]
132
- html << %Q[</div>\n<![endif]-->\n]
139
+ html << %Q[</div>\n]
140
+ html << %Q[<![endif]-->\n] unless o[:debug] # == true
133
141
  html
134
142
  end
135
143
 
136
-
137
144
  private
138
145
 
139
146
  ##
@@ -0,0 +1,59 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{sinatra-ie6nomore}
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["kematzy"]
12
+ s.date = %q{2009-09-14}
13
+ s.email = %q{kematzy@gmail.com}
14
+ s.extra_rdoc_files = [
15
+ "LICENSE",
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".document",
20
+ ".gitignore",
21
+ "LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "lib/sinatra/ie6nomore.i18n.yml",
26
+ "lib/sinatra/ie6nomore.rb",
27
+ "sinatra-ie6nomore.gemspec",
28
+ "spec/sinatra/ie6nomore_spec.rb",
29
+ "spec/spec_helper.rb"
30
+ ]
31
+ s.homepage = %q{http://github.com/kematzy/sinatra-ie6nomore}
32
+ s.rdoc_options = ["--charset=UTF-8"]
33
+ s.require_paths = ["lib"]
34
+ s.rubygems_version = %q{1.3.5}
35
+ s.summary = %q{'IE6 No More' Sinatra Extension to make the eradication of IE6 easier}
36
+ s.test_files = [
37
+ "spec/sinatra/ie6nomore_spec.rb",
38
+ "spec/spec_helper.rb"
39
+ ]
40
+
41
+ if s.respond_to? :specification_version then
42
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
43
+ s.specification_version = 3
44
+
45
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
46
+ s.add_runtime_dependency(%q<sinatra>, [">= 0.9.4"])
47
+ s.add_development_dependency(%q<spec>, [">= 1.2.7"])
48
+ s.add_development_dependency(%q<rspec_hpricot_matchers>, [">= 1.0.0"])
49
+ else
50
+ s.add_dependency(%q<sinatra>, [">= 0.9.4"])
51
+ s.add_dependency(%q<spec>, [">= 1.2.7"])
52
+ s.add_dependency(%q<rspec_hpricot_matchers>, [">= 1.0.0"])
53
+ end
54
+ else
55
+ s.add_dependency(%q<sinatra>, [">= 0.9.4"])
56
+ s.add_dependency(%q<spec>, [">= 1.2.7"])
57
+ s.add_dependency(%q<rspec_hpricot_matchers>, [">= 1.0.0"])
58
+ end
59
+ end
@@ -86,6 +86,15 @@ describe "Sinatra" do
86
86
  @markup.should have_tag('img[@src=http://example.com/images/ie6nomore-cornerx.jpg]')
87
87
  end
88
88
 
89
+ it "should show the HTML without IE comments when :debug => true " do
90
+ erb_app %Q[<%= ie6_no_more(:debug => true ) %>]
91
+ markup = last_response.body
92
+ # markup.should have_tag('debug')
93
+ markup.should_not match(/<!--\[if lt IE 7\]/)
94
+ markup.should_not match(/<!\[endif\]-->$/)
95
+
96
+ end
97
+
89
98
  end #/ with options
90
99
 
91
100
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-ie6nomore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kematzy
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-18 00:00:00 +08:00
12
+ date: 2009-09-14 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.9.2
23
+ version: 0.9.4
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: spec
@@ -60,7 +60,7 @@ files:
60
60
  - VERSION
61
61
  - lib/sinatra/ie6nomore.i18n.yml
62
62
  - lib/sinatra/ie6nomore.rb
63
- - spec/sinatra-ie6nomore_spec.rb
63
+ - sinatra-ie6nomore.gemspec
64
64
  - spec/sinatra/ie6nomore_spec.rb
65
65
  - spec/spec_helper.rb
66
66
  has_rdoc: true
@@ -93,5 +93,4 @@ specification_version: 3
93
93
  summary: "'IE6 No More' Sinatra Extension to make the eradication of IE6 easier"
94
94
  test_files:
95
95
  - spec/sinatra/ie6nomore_spec.rb
96
- - spec/sinatra-ie6nomore_spec.rb
97
96
  - spec/spec_helper.rb
@@ -1,7 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe "SinatraIe6nomore" do
4
- it "fails" do
5
- fail "hey buddy, you should probably rename this file and start specing for real"
6
- end
7
- end