trace-util-adv 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.
- data/README.rdoc +9 -1
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/trace-util-adv.rb +4 -35
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
= trace-util-adv
|
2
2
|
|
3
|
-
|
3
|
+
This gem allows you to easily configure your ruby project for Tracing.
|
4
|
+
This project was originally started in order to better get an understanding of the internal workings of DRYML, a template language of the Rails Hobo project. Soon it became obvious that it could be made into a more generic utility usable in all kinds of Ruby contexts and projects.
|
5
|
+
It has been designed to be non-intrusive, meaning that you can configure and apply it completely externally to your "core" application core.
|
6
|
+
Fx on a Rails project you could create a configure_tracing.rb file, require this gem and configure the use of tracing on your project from here.
|
7
|
+
|
8
|
+
See the README in the lib for more details on the design, usage instructions etc.
|
9
|
+
|
10
|
+
Note: Currently this version is still considered alpha, but it should work.
|
11
|
+
Feel free to fork it, fix it, provide feedback and suggestions ;)
|
4
12
|
|
5
13
|
== Note on Patches/Pull Requests
|
6
14
|
|
data/Rakefile
CHANGED
@@ -13,6 +13,7 @@ begin
|
|
13
13
|
gem.homepage = "http://github.com/kristianmandrup/trace-util-adv"
|
14
14
|
gem.authors = ["Kristian Mandrup"]
|
15
15
|
gem.add_development_dependency "rspec", ">= 1.2.9"
|
16
|
+
gem.files.exclude 'test_*.rb', 'log_files'
|
16
17
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
18
|
end
|
18
19
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/trace-util-adv.rb
CHANGED
@@ -1,35 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
end
|
6
|
-
|
7
|
-
def ensure_unique(name)
|
8
|
-
begin
|
9
|
-
self[name] = yield
|
10
|
-
end while self.class.exists?(name => self[name])
|
11
|
-
end
|
12
|
-
|
13
|
-
module ClassMethods
|
14
|
-
|
15
|
-
def uniquify(*args, &block)
|
16
|
-
options = { :length => 8, :chars => ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a }
|
17
|
-
options.merge!(args.pop) if args.last.kind_of? Hash
|
18
|
-
args.each do |name|
|
19
|
-
before_create do |record|
|
20
|
-
if block
|
21
|
-
record.ensure_unique(name, &block)
|
22
|
-
else
|
23
|
-
record.ensure_unique(name) do
|
24
|
-
Array.new(options[:length]) { options[:chars].to_a[rand(options[:chars].to_a.size)] }.join
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
class ActiveRecord::Base
|
34
|
-
include Uniquify
|
35
|
-
end
|
1
|
+
require "core_extensions"
|
2
|
+
require "trace_calls"
|
3
|
+
require "output_templates"
|
4
|
+
require "duration"
|