glinda 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/Glinda.gemspec +8 -8
  2. data/README.md +10 -1
  3. data/VERSION +1 -1
  4. data/lib/glinda.rb +38 -1
  5. metadata +81 -28
data/Glinda.gemspec CHANGED
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{glinda}
8
- s.version = "0.1.1"
7
+ s.name = "glinda"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["rschmukler"]
12
- s.date = %q{2012-09-08}
13
- s.description = %q{Toto, expanded}
14
- s.email = %q{ryan@slingingcode.com}
12
+ s.date = "2012-10-14"
13
+ s.description = "Toto, expanded"
14
+ s.email = "ryan@slingingcode.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
17
  "README.md"
@@ -45,10 +45,10 @@ Gem::Specification.new do |s|
45
45
  "spec/templates/repo.rhtml",
46
46
  "spec/templates/tags.rhtml"
47
47
  ]
48
- s.homepage = %q{http://github.com/rschmukler/glinda}
48
+ s.homepage = "http://github.com/rschmukler/glinda"
49
49
  s.require_paths = ["lib"]
50
- s.rubygems_version = %q{1.6.2}
51
- s.summary = %q{Toto, expanded}
50
+ s.rubygems_version = "1.8.24"
51
+ s.summary = "Toto, expanded"
52
52
 
53
53
  if s.respond_to? :specification_version then
54
54
  s.specification_version = 3
data/README.md CHANGED
@@ -42,7 +42,16 @@ You may access a list of tags in all articles by using
42
42
 
43
43
  If a tag is passed such as: `/tags/wizards` you can access the tag in
44
44
  the `tags.rhtml` view by calling the variable `tag`. You may access all
45
- articles tagged with the specified tag by calling `archives`
45
+ articles tagged with the specified tag by calling `archives` when in the
46
+ `/tags/tag_name` page
47
+
48
+ ### 2. NewRelic Support
49
+
50
+ Glinda support NewRelic analytics. To enable support you must add
51
+ `gem 'newrelic_rpm'` to your Gemfile for your application. Once the
52
+ library is added, the various classes of Glinda have been extended to
53
+ support NewRelic tracking. The implementation is heavily based on the
54
+ suggestions of the [JKFill Blog](http://jkfill.com/2011/03/27/using-new-relic-in-a-rack-app)
46
55
 
47
56
  philosophy
48
57
  ----------
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.0
data/lib/glinda.rb CHANGED
@@ -4,7 +4,18 @@ require 'erb'
4
4
  require 'rack'
5
5
  require 'digest'
6
6
  require 'open-uri'
7
- require 'pry'
7
+
8
+ begin
9
+ require 'newrelic_rpm'
10
+ require 'new_relic/agent/instrumentation/rack'
11
+ require 'new_relic/agent/instrumentation/controller_instrumentation'
12
+ ERB.class_eval do
13
+ include NewRelic::Agent::MethodTracer
14
+ add_method_tracer :initialize
15
+ add_method_tracer :result
16
+ end
17
+ rescue LoadError
18
+ end
8
19
 
9
20
  if RUBY_PLATFORM =~ /win32/
10
21
  require 'maruku'
@@ -60,6 +71,15 @@ module Glinda
60
71
  end
61
72
 
62
73
  class Site
74
+ if defined? NewRelic
75
+ include NewRelic::Agent::MethodTracer
76
+ add_method_tracer :index
77
+ add_method_tracer :archives
78
+ add_method_tracer :article
79
+ add_method_tracer :/
80
+ add_method_tracer :go
81
+ end
82
+
63
83
  def initialize config
64
84
  @config = config
65
85
  end
@@ -183,6 +203,10 @@ module Glinda
183
203
 
184
204
  class Context
185
205
  include Template
206
+ if defined? NewRelic
207
+ include NewRelic::Agent::MethodTracer
208
+ add_method_tracer :to_html, 'Custom/#{self.class.name}/to_html/#{args.first}'
209
+ end
186
210
  attr_reader :env
187
211
 
188
212
  def initialize ctx = {}, config = {}, path = "/", env = {}
@@ -223,6 +247,10 @@ module Glinda
223
247
 
224
248
  class Repo < Hash
225
249
  include Template
250
+ if defined? NewRelic
251
+ include NewRelic::Agent::MethodTracer
252
+ add_method_tracer :to_html, 'Custom/#{self.class.name}/to_html/#{args.first}'
253
+ end
226
254
 
227
255
  README = "https://github.com/%s/%s/raw/master/README.%s"
228
256
 
@@ -241,6 +269,10 @@ module Glinda
241
269
 
242
270
  class Archives < Array
243
271
  include Template
272
+ if defined? NewRelic
273
+ include NewRelic::Agent::MethodTracer
274
+ add_method_tracer :to_html, 'Custom/#{self.class.name}/to_html/#{args.first}'
275
+ end
244
276
 
245
277
  def initialize articles, config
246
278
  self.replace articles
@@ -260,6 +292,10 @@ module Glinda
260
292
 
261
293
  class Article < Hash
262
294
  include Template
295
+ if defined? NewRelic
296
+ include NewRelic::Agent::MethodTracer
297
+ add_method_tracer :to_html, 'Custom/#{self.class.name}/to_html/#{args.first}'
298
+ end
263
299
 
264
300
  def initialize obj, config = {}
265
301
  @obj, @config = obj, config
@@ -367,6 +403,7 @@ module Glinda
367
403
 
368
404
  class Server
369
405
  attr_reader :config, :site
406
+ include NewRelic::Agent::Instrumentation::ControllerInstrumentation if defined? NewRelic
370
407
 
371
408
  def initialize config = {}, &blk
372
409
  @config = config.is_a?(Config) ? config : Config.new(config)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glinda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-08 00:00:00.000000000 -05:00
13
- default_executable:
12
+ date: 2012-10-14 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rdiscount
17
- requirement: &2157562360 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ! '>='
@@ -22,10 +21,15 @@ dependencies:
22
21
  version: '0'
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *2157562360
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
26
30
  - !ruby/object:Gem::Dependency
27
31
  name: builder
28
- requirement: &2157559960 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
29
33
  none: false
30
34
  requirements:
31
35
  - - ! '>='
@@ -33,10 +37,15 @@ dependencies:
33
37
  version: '0'
34
38
  type: :runtime
35
39
  prerelease: false
36
- version_requirements: *2157559960
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
37
46
  - !ruby/object:Gem::Dependency
38
47
  name: fuubar
39
- requirement: &2157558040 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
40
49
  none: false
41
50
  requirements:
42
51
  - - ! '>='
@@ -44,10 +53,15 @@ dependencies:
44
53
  version: '0'
45
54
  type: :development
46
55
  prerelease: false
47
- version_requirements: *2157558040
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
48
62
  - !ruby/object:Gem::Dependency
49
63
  name: rake
50
- requirement: &2157555200 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
51
65
  none: false
52
66
  requirements:
53
67
  - - ! '>='
@@ -55,10 +69,15 @@ dependencies:
55
69
  version: '0'
56
70
  type: :development
57
71
  prerelease: false
58
- version_requirements: *2157555200
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
59
78
  - !ruby/object:Gem::Dependency
60
79
  name: jeweler
61
- requirement: &2157553100 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
62
81
  none: false
63
82
  requirements:
64
83
  - - ! '>='
@@ -66,10 +85,15 @@ dependencies:
66
85
  version: '0'
67
86
  type: :development
68
87
  prerelease: false
69
- version_requirements: *2157553100
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
70
94
  - !ruby/object:Gem::Dependency
71
95
  name: gemcutter
72
- requirement: &2157550360 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
73
97
  none: false
74
98
  requirements:
75
99
  - - ! '>='
@@ -77,10 +101,15 @@ dependencies:
77
101
  version: '0'
78
102
  type: :development
79
103
  prerelease: false
80
- version_requirements: *2157550360
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
81
110
  - !ruby/object:Gem::Dependency
82
111
  name: pry
83
- requirement: &2157548980 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
84
113
  none: false
85
114
  requirements:
86
115
  - - ! '>='
@@ -88,10 +117,15 @@ dependencies:
88
117
  version: '0'
89
118
  type: :development
90
119
  prerelease: false
91
- version_requirements: *2157548980
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
92
126
  - !ruby/object:Gem::Dependency
93
127
  name: rspec
94
- requirement: &2157547300 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
95
129
  none: false
96
130
  requirements:
97
131
  - - ! '>='
@@ -99,10 +133,15 @@ dependencies:
99
133
  version: '0'
100
134
  type: :development
101
135
  prerelease: false
102
- version_requirements: *2157547300
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
103
142
  - !ruby/object:Gem::Dependency
104
143
  name: builder
105
- requirement: &2157544480 !ruby/object:Gem::Requirement
144
+ requirement: !ruby/object:Gem::Requirement
106
145
  none: false
107
146
  requirements:
108
147
  - - ! '>='
@@ -110,10 +149,15 @@ dependencies:
110
149
  version: '0'
111
150
  type: :runtime
112
151
  prerelease: false
113
- version_requirements: *2157544480
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
114
158
  - !ruby/object:Gem::Dependency
115
159
  name: rack
116
- requirement: &2157539800 !ruby/object:Gem::Requirement
160
+ requirement: !ruby/object:Gem::Requirement
117
161
  none: false
118
162
  requirements:
119
163
  - - ! '>='
@@ -121,10 +165,15 @@ dependencies:
121
165
  version: '0'
122
166
  type: :runtime
123
167
  prerelease: false
124
- version_requirements: *2157539800
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
125
174
  - !ruby/object:Gem::Dependency
126
175
  name: rdiscount
127
- requirement: &2157536780 !ruby/object:Gem::Requirement
176
+ requirement: !ruby/object:Gem::Requirement
128
177
  none: false
129
178
  requirements:
130
179
  - - ! '>='
@@ -132,7 +181,12 @@ dependencies:
132
181
  version: '0'
133
182
  type: :runtime
134
183
  prerelease: false
135
- version_requirements: *2157536780
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
136
190
  description: Toto, expanded
137
191
  email: ryan@slingingcode.com
138
192
  executables: []
@@ -168,7 +222,6 @@ files:
168
222
  - spec/templates/layout.rhtml
169
223
  - spec/templates/repo.rhtml
170
224
  - spec/templates/tags.rhtml
171
- has_rdoc: true
172
225
  homepage: http://github.com/rschmukler/glinda
173
226
  licenses: []
174
227
  post_install_message:
@@ -183,7 +236,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
183
236
  version: '0'
184
237
  segments:
185
238
  - 0
186
- hash: 2552251103154411482
239
+ hash: 3170741692906220625
187
240
  required_rubygems_version: !ruby/object:Gem::Requirement
188
241
  none: false
189
242
  requirements:
@@ -192,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
245
  version: '0'
193
246
  requirements: []
194
247
  rubyforge_project:
195
- rubygems_version: 1.6.2
248
+ rubygems_version: 1.8.24
196
249
  signing_key:
197
250
  specification_version: 3
198
251
  summary: Toto, expanded