rack-environmental 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 1.2.0 (July 18, 2010)
2
+ * The indicator no longer appears when you print the web page.
3
+ * Added a z-index to the indicator to keep it on top.
4
+ * Added an id to the indicator div so that users can have more control over it if they
5
+ wish to further tweak it with CSS or JavaScript.
6
+
1
7
  1.1.1 (December 5, 2009)
2
8
  * BUGFIX: :background option always produced a blue background. Now it uses :color.
3
9
 
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2009 Wyatt M. Greene
3
+ Copyright (c) 2009, 2010 Wyatt M. Greene
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/Rakefile CHANGED
@@ -6,8 +6,8 @@ begin
6
6
  require 'jeweler'
7
7
  Jeweler::Tasks.new do |s|
8
8
  s.name = "rack-environmental"
9
- s.version = "1.1.1"
10
- s.add_dependency 'rack-plastic', '>= 0.0.3'
9
+ s.version = "1.2.0"
10
+ s.add_dependency 'rack-plastic', '>= 0.1.1'
11
11
  s.author = "Wyatt Greene"
12
12
  s.email = "techiferous@gmail.com"
13
13
  s.summary = "Rack middleware that adds an indicator of your application environment"
@@ -29,5 +29,5 @@ begin
29
29
  end
30
30
  Jeweler::GemcutterTasks.new
31
31
  rescue LoadError
32
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
32
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
33
33
  end
@@ -6,6 +6,7 @@ module Rack
6
6
  def change_nokogiri_doc(doc)
7
7
  initialize_environment_options
8
8
  add_to_top_of_web_page(doc, create_sticker(doc))
9
+ add_to_top_of_web_page(doc, create_print_suppression_node(doc))
9
10
  if @environment_options[:background]
10
11
  body = doc.at_css("body")
11
12
  background_style = "background-color: #{@environment_options[:color] || default_color};"
@@ -48,10 +49,18 @@ module Rack
48
49
  def create_sticker(doc)
49
50
  return nil if @environment_name.nil?
50
51
  div = create_node(doc, "div", @environment_name.to_s)
52
+ div['id'] = 'rack_environmental'
51
53
  div['style'] = style(@environment_options)
52
54
  div
53
55
  end
54
56
 
57
+ def create_print_suppression_node(doc)
58
+ return nil if @environment_name.nil?
59
+ style = create_node(doc, "style", '@media print { #rack_environmental {display:none;} }')
60
+ style['type'] = 'text/css'
61
+ style
62
+ end
63
+
55
64
  def style(options)
56
65
  style = ""
57
66
  style << "font-family: Verdana, Arial, sans-serif;"
@@ -77,6 +86,7 @@ module Rack
77
86
  style << "top: #{options[:top] || 5}px;"
78
87
  style << "left: #{options[:left] || 5}px;"
79
88
  style << "opacity: #{options[:opacity] || 0.7};"
89
+ style << "z-index: 1000;"
80
90
  style << "-moz-border-radius: 5px; -khtml-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px;"
81
91
  else
82
92
  style << "margin: 0px;"
@@ -20,6 +20,10 @@ get '/' do
20
20
  </head>
21
21
  <body>
22
22
  <div id="container">
23
+ <div style="position: fixed; top: 20px; left: 20px; background-color: yellow;">
24
+ This is a fixed position div. The environmental indicator should be on top
25
+ of this.
26
+ </div>
23
27
  <p>
24
28
  What my associate is trying to say is that our new brake pads are really cool.
25
29
  You're not even gonna believe it.
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-environmental
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ hash: 31
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 2
9
+ - 0
10
+ version: 1.2.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - Wyatt Greene
@@ -9,19 +15,25 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2009-12-05 00:00:00 -05:00
18
+ date: 2010-07-18 00:00:00 -04:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: rack-plastic
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
23
- version: 0.0.3
24
- version:
29
+ hash: 25
30
+ segments:
31
+ - 0
32
+ - 1
33
+ - 1
34
+ version: 0.1.1
35
+ type: :runtime
36
+ version_requirements: *id001
25
37
  description: "\n Rack::Environmental indicates which environment your web application is running\n in (staging, test, etc.).\n "
26
38
  email: techiferous@gmail.com
27
39
  executables: []
@@ -104,21 +116,27 @@ rdoc_options:
104
116
  require_paths:
105
117
  - lib
106
118
  required_ruby_version: !ruby/object:Gem::Requirement
119
+ none: false
107
120
  requirements:
108
121
  - - ">="
109
122
  - !ruby/object:Gem::Version
123
+ hash: 3
124
+ segments:
125
+ - 0
110
126
  version: "0"
111
- version:
112
127
  required_rubygems_version: !ruby/object:Gem::Requirement
128
+ none: false
113
129
  requirements:
114
130
  - - ">="
115
131
  - !ruby/object:Gem::Version
132
+ hash: 3
133
+ segments:
134
+ - 0
116
135
  version: "0"
117
- version:
118
136
  requirements:
119
137
  - none
120
138
  rubyforge_project:
121
- rubygems_version: 1.3.5
139
+ rubygems_version: 1.3.7
122
140
  signing_key:
123
141
  specification_version: 3
124
142
  summary: Rack middleware that adds an indicator of your application environment