sinatra-settings 0.1.0 → 0.1.2

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/CHANGES ADDED
@@ -0,0 +1,15 @@
1
+
2
+ rel 0.1.2 (2010-08-29)
3
+
4
+ * Issue: #1 added 'classic' Sinatra app support
5
+ * Some minor changes in the settings output.
6
+
7
+ rel 0.1.1 (2010-03-01)
8
+
9
+ * Bug fix: #1 added nl2br method
10
+ * Added Extensions output, listing loaded extensions and version if available.
11
+
12
+
13
+ rel 0.1.0 (2010-02-23)
14
+
15
+ * intial release of gem / code
@@ -12,9 +12,6 @@ With a heavy dose of inspiration taken from Sinatra's Show Exception output page
12
12
 
13
13
  == Installation
14
14
 
15
- # Add Gemcutter to your RubyGems sources
16
- $ gem sources -a http://gemcutter.com
17
-
18
15
  $ (sudo)? gem install sinatra-settings
19
16
 
20
17
  == Dependencies
@@ -23,7 +20,7 @@ This Gem depends upon the following:
23
20
 
24
21
  === Runtime:
25
22
 
26
- * sinatra ( >= 1.0.a )
23
+ * sinatra ( >= 1.0 )
27
24
 
28
25
 
29
26
  === Development & Tests:
@@ -51,6 +48,16 @@ in your sub-classed Sinatra app:
51
48
  end
52
49
 
53
50
 
51
+ In your "classic" Sinatra app, you just require the extension like this:
52
+
53
+ require 'rubygems'
54
+ require 'sinatra'
55
+ require 'sinatra/settings'
56
+
57
+ <snip...>
58
+
59
+
60
+
54
61
  Then at the bottom of your App's layout - <tt>layout.(erb|haml)</tt> add the following:
55
62
 
56
63
 
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ begin
10
10
  gem.email = "kematzy@gmail.com"
11
11
  gem.homepage = "http://github.com/kematzy/sinatra-settings"
12
12
  gem.authors = ["kematzy"]
13
- gem.add_dependency "sinatra", ">= 0.10.1"
13
+ gem.add_dependency "sinatra", ">= 1.0"
14
14
  gem.add_development_dependency "sinatra-tests", ">= 0.1.6"
15
15
  gem.add_development_dependency "rspec", ">= 1.3.0"
16
16
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.2
@@ -1,7 +1,4 @@
1
1
 
2
- require 'sinatra/base'
3
-
4
-
5
2
  module Sinatra
6
3
 
7
4
  # :stopdoc:
@@ -46,7 +43,7 @@ module Sinatra
46
43
  #
47
44
  # === Runtime:
48
45
  #
49
- # * sinatra ( >= 1.0.a )
46
+ # * sinatra ( >= 1.0 )
50
47
  #
51
48
  #
52
49
  # === Development & Tests:
@@ -73,6 +70,15 @@ module Sinatra
73
70
  # <snip...>
74
71
  # end
75
72
  #
73
+ # In your "classic" Sinatra app, you just require the extension like this:
74
+ #
75
+ # require 'rubygems'
76
+ # require 'sinatra'
77
+ # require 'sinatra/settings'
78
+ #
79
+ # <snip...>
80
+ #
81
+ #
76
82
  #
77
83
  # Then at the bottom of your App's layout - <tt>layout.(erb|haml)</tt> add the following:
78
84
  #
@@ -135,7 +141,7 @@ module Sinatra
135
141
 
136
142
  module Settings
137
143
 
138
- VERSION = '0.1.0' unless const_defined?(:VERSION)
144
+ VERSION = '0.1.2' unless const_defined?(:VERSION)
139
145
  def self.version; "Sinatra::Settings v#{VERSION}"; end
140
146
 
141
147
 
@@ -147,6 +153,18 @@ module Sinatra
147
153
  alias_method :h, :escape_html
148
154
  end
149
155
 
156
+ unless respond_to?(:nl2br)
157
+ ##
158
+ # Convert new lines (\n) into +<br>+ tags in the given text
159
+ #
160
+ # ==== Examples
161
+ #
162
+ # @api public
163
+ def nl2br(txt)
164
+ txt.gsub("\n", '<br>')
165
+ end
166
+ end
167
+
150
168
 
151
169
  ##
152
170
  # Convenience helper method that returns a Hash, nicely
@@ -218,12 +236,12 @@ TEMPLATE = <<HTML
218
236
  /* table.req tr td.code { white-space: pre-wrap; word-wrap: break-word; } */
219
237
  table.req tr td.key { width: 200px; overflow:hidden; }
220
238
  table.req tr td.code div { width: 650px; overflow:hidden; }
221
-
239
+ .quiet { color: #aaa; }
222
240
  </style>
223
241
 
224
242
  <div id="debug">
225
243
 
226
- <h2>PAGE DEBUG</h2>
244
+ <h2>APP INFORMATION</h2>
227
245
 
228
246
  <div id="get">
229
247
  <h3>GET</h3>
@@ -329,7 +347,7 @@ TEMPLATE = <<HTML
329
347
  <% r.each { |route| %>
330
348
  <tr>
331
349
  <td class="key"><%=h route.split(' ').first %></td>
332
- <td class="code"><div><%= request.script_name %><%=h route.split(' ')[1] %></div></td>
350
+ <td class="code"><div><%= request.script_name %><a href="<%=h route.split(' ')[1].sub(/\\?$/,'') %>"><%=h route.split(' ')[1] %></a></div></td>
333
351
  </tr>
334
352
  <% } %>
335
353
  </table>
@@ -371,6 +389,29 @@ TEMPLATE = <<HTML
371
389
 
372
390
  <hr>
373
391
 
392
+ <div id="extensions">
393
+ <h3>EXTENSIONS (registered)</h3>
394
+ <table class="req">
395
+ <tr>
396
+ <th>Name</th>
397
+ <th>Version</th>
398
+ </tr>
399
+ <% self.class.extensions.each do |ext| %>
400
+ <tr>
401
+ <td class="key"><%=h ext %></td>
402
+ <% if ext.const_defined?(:VERSION) %>
403
+ <td class="code"><div><%= ext.const_get(:VERSION) %></div></td>
404
+ <% else %>
405
+ <td class="code"><div>Unknown <span class="quiet">(no constant :VERSION defined in extension)</span></div></td>
406
+ <% end %>
407
+ </tr>
408
+ <% end %>
409
+ </table>
410
+ <div class="clear"></div>
411
+ </div> <!-- /EXTENSIONS -->
412
+
413
+ <hr>
414
+
374
415
  <div id="rack">
375
416
  <h3 id="env-info">Rack ENV</h3>
376
417
  <table class="req">
@@ -424,5 +465,6 @@ HTML
424
465
 
425
466
  end #/module Settings
426
467
 
468
+ register(Sinatra::Settings)
469
+
427
470
  end #/module Sinatra
428
-
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sinatra-settings}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["kematzy"]
12
- s.date = %q{2010-02-23}
12
+ s.date = %q{2010-08-29}
13
13
  s.description = %q{Want an overview of all Sinatra settings (formerly options) in your app? This Sinatra Extension makes that dead simple.}
14
14
  s.email = %q{kematzy@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.files = [
20
20
  ".document",
21
21
  ".gitignore",
22
+ "CHANGES",
22
23
  "LICENSE",
23
24
  "README.rdoc",
24
25
  "Rakefile",
@@ -32,7 +33,7 @@ Gem::Specification.new do |s|
32
33
  s.homepage = %q{http://github.com/kematzy/sinatra-settings}
33
34
  s.rdoc_options = ["--charset=UTF-8"]
34
35
  s.require_paths = ["lib"]
35
- s.rubygems_version = %q{1.3.6}
36
+ s.rubygems_version = %q{1.3.7}
36
37
  s.summary = %q{A Sinatra Extension that shows your app's settings and other debug information}
37
38
  s.test_files = [
38
39
  "spec/sinatra/settings_spec.rb",
@@ -43,17 +44,17 @@ Gem::Specification.new do |s|
43
44
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
45
  s.specification_version = 3
45
46
 
46
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
47
- s.add_runtime_dependency(%q<sinatra>, [">= 0.10.1"])
47
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
+ s.add_runtime_dependency(%q<sinatra>, [">= 1.0"])
48
49
  s.add_development_dependency(%q<sinatra-tests>, [">= 0.1.6"])
49
50
  s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
50
51
  else
51
- s.add_dependency(%q<sinatra>, [">= 0.10.1"])
52
+ s.add_dependency(%q<sinatra>, [">= 1.0"])
52
53
  s.add_dependency(%q<sinatra-tests>, [">= 0.1.6"])
53
54
  s.add_dependency(%q<rspec>, [">= 1.3.0"])
54
55
  end
55
56
  else
56
- s.add_dependency(%q<sinatra>, [">= 0.10.1"])
57
+ s.add_dependency(%q<sinatra>, [">= 1.0"])
57
58
  s.add_dependency(%q<sinatra-tests>, [">= 0.1.6"])
58
59
  s.add_dependency(%q<rspec>, [">= 1.3.0"])
59
60
  end
@@ -179,7 +179,7 @@ describe "Sinatra" do
179
179
  erb_app "<%= show_settings_output? %>"
180
180
  # body.should have_tag(:debug)
181
181
  body.should have_tag('div#debug') do |div|
182
- div.should have_tag('h2', 'PAGE DEBUG')
182
+ div.should have_tag('h2', 'APP INFORMATION')
183
183
  div.should have_tag('div#get > table.req')
184
184
 
185
185
  div.should have_tag('div#params > table.req')
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-settings
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 31
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 1
8
- - 0
9
- version: 0.1.0
9
+ - 2
10
+ version: 0.1.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - kematzy
@@ -14,30 +15,33 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-02-23 00:00:00 +08:00
18
+ date: 2010-08-29 00:00:00 +08:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: sinatra
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 15
27
30
  segments:
28
- - 0
29
- - 10
30
31
  - 1
31
- version: 0.10.1
32
+ - 0
33
+ version: "1.0"
32
34
  type: :runtime
33
35
  version_requirements: *id001
34
36
  - !ruby/object:Gem::Dependency
35
37
  name: sinatra-tests
36
38
  prerelease: false
37
39
  requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
38
41
  requirements:
39
42
  - - ">="
40
43
  - !ruby/object:Gem::Version
44
+ hash: 23
41
45
  segments:
42
46
  - 0
43
47
  - 1
@@ -49,9 +53,11 @@ dependencies:
49
53
  name: rspec
50
54
  prerelease: false
51
55
  requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
52
57
  requirements:
53
58
  - - ">="
54
59
  - !ruby/object:Gem::Version
60
+ hash: 27
55
61
  segments:
56
62
  - 1
57
63
  - 3
@@ -71,6 +77,7 @@ extra_rdoc_files:
71
77
  files:
72
78
  - .document
73
79
  - .gitignore
80
+ - CHANGES
74
81
  - LICENSE
75
82
  - README.rdoc
76
83
  - Rakefile
@@ -90,23 +97,27 @@ rdoc_options:
90
97
  require_paths:
91
98
  - lib
92
99
  required_ruby_version: !ruby/object:Gem::Requirement
100
+ none: false
93
101
  requirements:
94
102
  - - ">="
95
103
  - !ruby/object:Gem::Version
104
+ hash: 3
96
105
  segments:
97
106
  - 0
98
107
  version: "0"
99
108
  required_rubygems_version: !ruby/object:Gem::Requirement
109
+ none: false
100
110
  requirements:
101
111
  - - ">="
102
112
  - !ruby/object:Gem::Version
113
+ hash: 3
103
114
  segments:
104
115
  - 0
105
116
  version: "0"
106
117
  requirements: []
107
118
 
108
119
  rubyforge_project:
109
- rubygems_version: 1.3.6
120
+ rubygems_version: 1.3.7
110
121
  signing_key:
111
122
  specification_version: 3
112
123
  summary: A Sinatra Extension that shows your app's settings and other debug information