log_switch 0.4.0 → 1.1.0
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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +133 -0
- data/Gemfile +3 -2
- data/LICENSE +24 -0
- data/README.md +142 -0
- data/Rakefile +28 -15
- data/lib/log_switch/version.rb +1 -1
- data/lib/log_switch.rb +134 -71
- data/log_switch.gemspec +33 -32
- data/spec/log_switch_spec.rb +97 -87
- data/spec/spec_helper.rb +5 -13
- metadata +54 -353
- data/.gemtest +0 -1
- data/History.rdoc +0 -51
- data/README.rdoc +0 -192
- data/lib/log_switch/mixin.rb +0 -31
- data/spec/coverage/assets/0.5.3/app.js +0 -88
- data/spec/coverage/assets/0.5.3/fancybox/blank.gif +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_close.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_loading.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_nav_left.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_nav_right.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_e.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_n.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_ne.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_nw.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_s.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_se.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_sw.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_w.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_title_left.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_title_main.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_title_over.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_title_right.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancybox-x.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancybox-y.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancybox.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/jquery.fancybox-1.3.1.css +0 -363
- data/spec/coverage/assets/0.5.3/fancybox/jquery.fancybox-1.3.1.pack.js +0 -44
- data/spec/coverage/assets/0.5.3/favicon_green.png +0 -0
- data/spec/coverage/assets/0.5.3/favicon_red.png +0 -0
- data/spec/coverage/assets/0.5.3/favicon_yellow.png +0 -0
- data/spec/coverage/assets/0.5.3/highlight.css +0 -129
- data/spec/coverage/assets/0.5.3/highlight.pack.js +0 -1
- data/spec/coverage/assets/0.5.3/jquery-1.6.2.min.js +0 -18
- data/spec/coverage/assets/0.5.3/jquery.dataTables.min.js +0 -152
- data/spec/coverage/assets/0.5.3/jquery.timeago.js +0 -141
- data/spec/coverage/assets/0.5.3/jquery.url.js +0 -174
- data/spec/coverage/assets/0.5.3/loading.gif +0 -0
- data/spec/coverage/assets/0.5.3/magnify.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/jquery-ui-1.8.4.custom.css +0 -295
- data/spec/coverage/assets/0.5.3/stylesheet.css +0 -383
- data/spec/coverage/assets/0.7.1/application.css +0 -1110
- data/spec/coverage/assets/0.7.1/application.js +0 -626
- data/spec/coverage/assets/0.7.1/fancybox/blank.gif +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_close.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_loading.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_nav_left.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_nav_right.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_e.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_n.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_ne.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_nw.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_s.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_se.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_sw.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_w.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_title_left.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_title_main.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_title_over.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_title_right.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancybox-x.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancybox-y.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancybox.png +0 -0
- data/spec/coverage/assets/0.7.1/favicon_green.png +0 -0
- data/spec/coverage/assets/0.7.1/favicon_red.png +0 -0
- data/spec/coverage/assets/0.7.1/favicon_yellow.png +0 -0
- data/spec/coverage/assets/0.7.1/loading.gif +0 -0
- data/spec/coverage/assets/0.7.1/magnify.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/spec/coverage/index.html +0 -81
- data/spec/log_switch/coverage/assets/0.5.3/app.js +0 -88
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/blank.gif +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/fancy_close.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/fancy_loading.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/fancy_nav_left.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/fancy_nav_right.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/fancy_shadow_e.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/fancy_shadow_n.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/fancy_shadow_ne.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/fancy_shadow_nw.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/fancy_shadow_s.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/fancy_shadow_se.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/fancy_shadow_sw.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/fancy_shadow_w.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/fancy_title_left.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/fancy_title_main.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/fancy_title_over.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/fancy_title_right.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/fancybox-x.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/fancybox-y.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/fancybox.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/jquery.fancybox-1.3.1.css +0 -363
- data/spec/log_switch/coverage/assets/0.5.3/fancybox/jquery.fancybox-1.3.1.pack.js +0 -44
- data/spec/log_switch/coverage/assets/0.5.3/favicon_green.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/favicon_red.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/favicon_yellow.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/highlight.css +0 -129
- data/spec/log_switch/coverage/assets/0.5.3/highlight.pack.js +0 -1
- data/spec/log_switch/coverage/assets/0.5.3/jquery-1.6.2.min.js +0 -18
- data/spec/log_switch/coverage/assets/0.5.3/jquery.dataTables.min.js +0 -152
- data/spec/log_switch/coverage/assets/0.5.3/jquery.timeago.js +0 -141
- data/spec/log_switch/coverage/assets/0.5.3/jquery.url.js +0 -174
- data/spec/log_switch/coverage/assets/0.5.3/loading.gif +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/magnify.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/spec/log_switch/coverage/assets/0.5.3/smoothness/jquery-ui-1.8.4.custom.css +0 -295
- data/spec/log_switch/coverage/assets/0.5.3/stylesheet.css +0 -383
- data/spec/log_switch/coverage/index.html +0 -81
- data/spec/log_switch/mixin_spec.rb +0 -89
data/README.rdoc
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
= log_switch
|
|
2
|
-
|
|
3
|
-
http://github.com/turboladen/log_switch
|
|
4
|
-
|
|
5
|
-
== DESCRIPTION
|
|
6
|
-
|
|
7
|
-
While developing other gems that required a single class/singleton style logger,
|
|
8
|
-
I got tired of repeating the code to create that logger and mix it in to my base
|
|
9
|
-
class. I just wanted to be able to require something, then be able to do:
|
|
10
|
-
|
|
11
|
-
MyLib.log "some message"
|
|
12
|
-
|
|
13
|
-
I also wanted to be able to programmatically turn on/off logging by doing something
|
|
14
|
-
like:
|
|
15
|
-
|
|
16
|
-
MyLib.log = false
|
|
17
|
-
|
|
18
|
-
This gem allows just that. Well, almost...
|
|
19
|
-
|
|
20
|
-
== FEATURES/PROBLEMS
|
|
21
|
-
|
|
22
|
-
Features:
|
|
23
|
-
|
|
24
|
-
* +require+ and +extend+ to mix in to your class/module to get a single point of logging
|
|
25
|
-
* Switch on/off logging
|
|
26
|
-
* Use whatever Logger you want
|
|
27
|
-
|
|
28
|
-
== SYNOPSIS
|
|
29
|
-
|
|
30
|
-
=== Basic Use
|
|
31
|
-
|
|
32
|
-
Get your app logging with a single point of logging:
|
|
33
|
-
|
|
34
|
-
require 'log_switch'
|
|
35
|
-
|
|
36
|
-
class MyThing
|
|
37
|
-
extend LogSwitch
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
MyThing.log "I like you, Ruby." # => D, [2011-10-07T14:40:26.697084 #30080] DEBUG -- : I like you, Ruby.
|
|
41
|
-
|
|
42
|
-
...and then you can simply switch off logging by doing:
|
|
43
|
-
|
|
44
|
-
MyThing.log = false
|
|
45
|
-
MyThing.log "You're my favorite." # => No logging occurs!
|
|
46
|
-
|
|
47
|
-
By default, LogSwitch sets the log level to +:debug+. You can change the default
|
|
48
|
-
log level as you go:
|
|
49
|
-
|
|
50
|
-
MyThing.log_level = :warn
|
|
51
|
-
MyThing.log "Crap!" # => W, [2011-10-07T15:30:54.012502 #32892] WARN -- : Crap!
|
|
52
|
-
|
|
53
|
-
You can pass in the log level for your Logger type too:
|
|
54
|
-
|
|
55
|
-
MyThing.log "Stuff!", :info # => I, [2011-10-07T15:28:49.480741 #32892] INFO -- : Stuff!
|
|
56
|
-
MyThing.log "Meow", :fatal # => F, [2011-10-07T15:32:21.207867 #32892] FATAL -- : Meow
|
|
57
|
-
|
|
58
|
-
If you have another Logger object you want to write to, no problem:
|
|
59
|
-
|
|
60
|
-
some_other_logger = Logger.new 'log.txt'
|
|
61
|
-
MyThing.logger = some_other_logger
|
|
62
|
-
MyThing.log "hi!"
|
|
63
|
-
File.open('log.txt', 'r').read # => Logfile created on 2011-10-07 15:50:19 -0700 by logger.rb/25413
|
|
64
|
-
# D, [2011-10-07T15:51:16.385798 #34026] DEBUG -- : hi!
|
|
65
|
-
|
|
66
|
-
=== Hooks
|
|
67
|
-
|
|
68
|
-
You can also make sure code gets executed before each call to +.log+. While
|
|
69
|
-
this really only makes sense when you're logging from multiple places and/or
|
|
70
|
-
you're not sure when the first call to your logger will occur (unlike this
|
|
71
|
-
example), say you want to makes sure your log directory exists before trying
|
|
72
|
-
to write the log file to it:
|
|
73
|
-
|
|
74
|
-
log_directory = File.expand_path('my_log_dir')
|
|
75
|
-
|
|
76
|
-
MyThing.before do
|
|
77
|
-
FileUtils.mkdir_p(full_directory) unless Dir.exists? log_directory
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
log_file = log_directory + "/sweet_log_bro.txt"
|
|
81
|
-
MyThing.logger = Logger.new(log_file)
|
|
82
|
-
MyThing.log "Thanks brah!" # This calls the #before hook, thus
|
|
83
|
-
# creating the directory.
|
|
84
|
-
MyThing.log "I'm hungry..." # This also calls the #before hook...
|
|
85
|
-
|
|
86
|
-
You might just want want a one-time before hook--in that case, +.log+ will call
|
|
87
|
-
a plain old block that you pass to it, right before writing to the log file.
|
|
88
|
-
Here's the above example, using the one-timer:
|
|
89
|
-
|
|
90
|
-
log_directory = File.expand_path('my_log_dir')
|
|
91
|
-
|
|
92
|
-
log_file = log_directory + "/sweet_log_bro.txt"
|
|
93
|
-
MyThing.logger = Logger.new(log_file)
|
|
94
|
-
|
|
95
|
-
MyThing.log("Thanks brah!") do
|
|
96
|
-
FileUtils.mkdir_p(full_directory) unless Dir.exists? log_directory
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
# No block gets called here (assuming the +#before+ hook from above hasn't been defined)
|
|
100
|
-
MyThing.log "I'm hungry..."
|
|
101
|
-
|
|
102
|
-
=== Mixin for lazy people like me
|
|
103
|
-
|
|
104
|
-
All that stuff above describes how you can extend some class of yours to make it
|
|
105
|
-
a singleton logger (well, not that you can't have it do other stuff too...). If
|
|
106
|
-
you're using this in a sizeable project, however, it can get tiresome typing out
|
|
107
|
-
<tt>MyThing.log "message"</tt> over and over again; for me, it's usually more
|
|
108
|
-
like <tt>MyThing::Logger.log "message"</tt>. The {LogSwitch::Mixin} mixin
|
|
109
|
-
lets you shorten things up.
|
|
110
|
-
|
|
111
|
-
If you've extended {LogSwitch} into a class...
|
|
112
|
-
|
|
113
|
-
class MyThing
|
|
114
|
-
class Logger
|
|
115
|
-
extend LogSwitch
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
...then you can mix in {LogSwitch::Mixin} to your other classes that you want to
|
|
120
|
-
use +MyThing::Logger.log+:
|
|
121
|
-
|
|
122
|
-
class MyThing
|
|
123
|
-
class WidgetMaker
|
|
124
|
-
include LogSwitch::Mixin
|
|
125
|
-
|
|
126
|
-
def make_widget
|
|
127
|
-
log "Making widget...", :info # This will delegate to MyThing::Logger.log
|
|
128
|
-
end
|
|
129
|
-
end
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
This lets you still use a single logger throughout your classes, but shortens
|
|
133
|
-
the amount of typing you have to do.
|
|
134
|
-
|
|
135
|
-
=== Prepend class name of #log caller to the message
|
|
136
|
-
|
|
137
|
-
When you've got a bunch of different classes doing logging, it's easy to get
|
|
138
|
-
lost in all the text. Adding the class name of the class that's logging a
|
|
139
|
-
message can make this easier to read. Now log_switch will do that for you, if
|
|
140
|
-
you use its Mixin.
|
|
141
|
-
|
|
142
|
-
# lib/my_thing/logger.rb
|
|
143
|
-
class MyThing::Logger
|
|
144
|
-
extend LogSwitch
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
MyThing::Logger.log_class_name = true
|
|
148
|
-
|
|
149
|
-
# lib/my_thing/barrel_roller.rb
|
|
150
|
-
class MyThing::BarrelRoller
|
|
151
|
-
include LogSwitch::Mixin
|
|
152
|
-
|
|
153
|
-
def do_one
|
|
154
|
-
log "I did a barrel roll!"
|
|
155
|
-
end
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
# somewhere else...
|
|
159
|
-
barrel_roller = MyThing::BarrelRoller.new
|
|
160
|
-
barrel_roller.do_one # => D, [2012-11-12T21:11:32.133414 #16645] DEBUG -- : <MyThing::BarrelRoller> I did a barrel roll!
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
== REQUIREMENTS
|
|
164
|
-
|
|
165
|
-
* Rubies (tested):
|
|
166
|
-
* MRI 1.9.3
|
|
167
|
-
* MRI 1.9.2
|
|
168
|
-
* MRI 1.8.7
|
|
169
|
-
* ree 1.8.7-2011.03
|
|
170
|
-
* JRuby 1.6.5
|
|
171
|
-
* Rubinius 1.2.4
|
|
172
|
-
* RubyGems:
|
|
173
|
-
* None!
|
|
174
|
-
|
|
175
|
-
== INSTALL
|
|
176
|
-
|
|
177
|
-
$ gem install log_switch
|
|
178
|
-
|
|
179
|
-
== DEVELOPERS
|
|
180
|
-
|
|
181
|
-
After checking out the source, run:
|
|
182
|
-
|
|
183
|
-
$ bundle install
|
|
184
|
-
|
|
185
|
-
This task will install any missing dependencies for you.
|
|
186
|
-
|
|
187
|
-
== THANKS
|
|
188
|
-
|
|
189
|
-
I need to thank the http://github.com/rubiii/savon project for most of the code
|
|
190
|
-
here. Somehow I ran across how they do logging and started following suit. The
|
|
191
|
-
code in +log_switch+ is almost identical to Savon's logging.
|
|
192
|
-
|
data/lib/log_switch/mixin.rb
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
module LogSwitch
|
|
2
|
-
module Mixin
|
|
3
|
-
|
|
4
|
-
# When this module is included, this method gets called and defines a +#log+
|
|
5
|
-
# method on the including class.
|
|
6
|
-
#
|
|
7
|
-
# @param [Class] klass The class that's including this module.
|
|
8
|
-
# @raise [RuntimeError] If {LogSwitch.extender} isn't set (which gets set
|
|
9
|
-
# when you +extend+ your class with {LogSwitch}).
|
|
10
|
-
def self.included(klass)
|
|
11
|
-
if LogSwitch.extender
|
|
12
|
-
klass.send :define_method, :log do |*args|
|
|
13
|
-
if LogSwitch.extender.log_class_name? &&
|
|
14
|
-
LogSwitch.extender.logger.class == Logger
|
|
15
|
-
|
|
16
|
-
if args.size == 1
|
|
17
|
-
args = "<#{klass}> #{args.join}"
|
|
18
|
-
else
|
|
19
|
-
msg = args.delete_at 0
|
|
20
|
-
args.unshift("<#{klass}> #{msg}")
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
LogSwitch.extender.log *args
|
|
25
|
-
end
|
|
26
|
-
else
|
|
27
|
-
raise "No class has been extended by LogSwitch yet."
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
$(document).ready(function() {
|
|
2
|
-
// Configuration for fancy sortable tables for source file groups
|
|
3
|
-
$('.file_list').dataTable({
|
|
4
|
-
"aaSorting": [[ 1, "asc" ]],
|
|
5
|
-
"bPaginate": false,
|
|
6
|
-
"bJQueryUI": true,
|
|
7
|
-
"aoColumns": [
|
|
8
|
-
null,
|
|
9
|
-
{ "sType": "percent" },
|
|
10
|
-
null,
|
|
11
|
-
null,
|
|
12
|
-
null,
|
|
13
|
-
null,
|
|
14
|
-
null
|
|
15
|
-
]
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// Syntax highlight all files up front - deactivated
|
|
19
|
-
// $('.source_table pre code').each(function(i, e) {hljs.highlightBlock(e, ' ')});
|
|
20
|
-
|
|
21
|
-
// Syntax highlight source files on first toggle of the file view popup
|
|
22
|
-
$("a.src_link").click(function() {
|
|
23
|
-
// Get the source file element that corresponds to the clicked element
|
|
24
|
-
var source_table = $($(this).attr('href'));
|
|
25
|
-
|
|
26
|
-
// If not highlighted yet, do it!
|
|
27
|
-
if (!source_table.hasClass('highlighted')) {
|
|
28
|
-
source_table.find('pre code').each(function(i, e) {hljs.highlightBlock(e, ' ')});
|
|
29
|
-
source_table.addClass('highlighted');
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
// Set-up of popup for source file views
|
|
34
|
-
$("a.src_link").fancybox({
|
|
35
|
-
'hideOnContentClick': true,
|
|
36
|
-
'centerOnScroll': true,
|
|
37
|
-
'width': '90%',
|
|
38
|
-
'padding': 0,
|
|
39
|
-
'transitionIn': 'elastic'
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
// Hide src files and file list container after load
|
|
43
|
-
$('.source_files').hide();
|
|
44
|
-
$('.file_list_container').hide();
|
|
45
|
-
|
|
46
|
-
// Add tabs based upon existing file_list_containers
|
|
47
|
-
$('.file_list_container h2').each(function(){
|
|
48
|
-
var container_id = $(this).parent().attr('id');
|
|
49
|
-
var group_name = $(this).find('.group_name').first().html();
|
|
50
|
-
var covered_percent = $(this).find('.covered_percent').first().html();
|
|
51
|
-
|
|
52
|
-
$('.group_tabs').append('<li><a href="#' + container_id + '">' + group_name + ' ('+ covered_percent +')</a></li>');
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
$('.group_tabs a').each( function() {
|
|
56
|
-
$(this).addClass($(this).attr('href').replace('#', ''));
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// Make sure tabs don't get ugly focus borders when active
|
|
60
|
-
$('.group_tabs a').live('focus', function() { $(this).blur(); });
|
|
61
|
-
|
|
62
|
-
var favicon_path = $('link[rel="shortcut icon"]').attr('href');
|
|
63
|
-
$('.group_tabs a').live('click', function(){
|
|
64
|
-
if (!$(this).parent().hasClass('active')) {
|
|
65
|
-
$('.group_tabs a').parent().removeClass('active');
|
|
66
|
-
$(this).parent().addClass('active');
|
|
67
|
-
$('.file_list_container').hide();
|
|
68
|
-
$(".file_list_container" + $(this).attr('href')).show();
|
|
69
|
-
window.location.href = window.location.href.split('#')[0] + $(this).attr('href').replace('#', '#_');
|
|
70
|
-
|
|
71
|
-
// Force favicon reload - otherwise the location change containing anchor would drop the favicon...
|
|
72
|
-
// Works only on firefox, but still... - Anyone know a better solution to force favicon on local file?
|
|
73
|
-
$('link[rel="shortcut icon"]').remove();
|
|
74
|
-
$('head').append('<link rel="shortcut icon" type="image/png" href="'+ favicon_path +'" />');
|
|
75
|
-
};
|
|
76
|
-
return false;
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
if (jQuery.url.attr('anchor')) {
|
|
80
|
-
$('.group_tabs a.'+jQuery.url.attr('anchor').replace('_', '')).click();
|
|
81
|
-
} else {
|
|
82
|
-
$('.group_tabs a:first').click();
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
$("abbr.timeago").timeago();
|
|
86
|
-
$('#loading').fadeOut();
|
|
87
|
-
$('#wrapper').show();
|
|
88
|
-
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|