trace-util-adv 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -14,6 +14,8 @@ begin
14
14
  gem.authors = ["Kristian Mandrup"]
15
15
  gem.add_development_dependency "rspec", ">= 1.2.9"
16
16
  gem.files.exclude 'test', 'log_files'
17
+ gem.add_dependency 'require-magic'
18
+
17
19
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
18
20
  end
19
21
  Jeweler::GemcutterTasks.new
data/TODO.txt CHANGED
@@ -1,7 +1,11 @@
1
1
  TODO:
2
2
  ----
3
+
4
+ =====
5
+ 0.4.0
6
+ =====
3
7
  - Clean up Appenders, Templates and Targets
4
- - Convenience Appenders
8
+ - Convenience Appenders?
5
9
  - LogFile
6
10
  - HtmlFile
7
11
  - XmlFile
@@ -13,12 +17,11 @@ TODO:
13
17
  - File
14
18
  - String
15
19
  - Stream (STDOUT, STDERR)
16
- - Stack
17
-
18
- - Add listener to Target?
19
-
20
- - Simplify with Listener model?
20
+ - Stack (of Strings and/or Events?)
21
21
 
22
+ - Simplify with Listener model?
23
+ - Add listeners to Target and/or Appender?
24
+
22
25
  ---
23
26
  Add time to context for before- and after handle calls. Enable tracing time output
24
27
  Allow for comparing time it takes to complete method and act upon it!
@@ -34,24 +37,7 @@ Introduce new rule outcomes
34
37
  :include_yield - set temp outcome to include and then yield, allowing other rule to exclude
35
38
  :exclude_yield - set temp outcome to exclude and then yield, allowing other rule to include
36
39
 
37
- Refactor MsgContextRule
38
- -----------------------
39
- - see message_filters.rb
40
- - BaseFilter should extend this.
41
-
42
- Refactor design
43
- - Modularize even more!
44
-
45
- Test String appender
46
- - log string to file
47
-
48
- Test library in general
49
- - functions as expected?
50
- - easy to use?
51
40
  - create RSpec tests?
52
41
 
53
-
54
-
55
-
56
42
  ExtJS:
57
43
  http://www.extjswithrails.com/2008/03/fitting-ext-js-into-rails-architecture.html
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -1,4 +1,5 @@
1
1
  require 'filters/filter'
2
2
  rfolders = Require.rfolder('filters', {:folders => ['simple', 'composite', 'list', 'msg_context', 'executor'], :root_files => :after, :exclude => 'include'})
3
3
 
4
+ puts rfolders.inspect
4
5
 
@@ -5,23 +5,25 @@ module Tracing
5
5
 
6
6
  def initialize(options)
7
7
  super(options)
8
- # puts "create inst.var filter: #{options.inspect}"
8
+ puts "create inst.var filter: #{options.inspect}"
9
9
  @rules = options[:var_rules] || options[:vars_filter] || {}
10
10
  @var_name = options[:var_name]
11
+ @on_class = options[:class] || false
11
12
  end
12
13
 
13
14
  def allow_action(msg, context)
14
15
  puts "InstanceVarFilter.allow_action"
15
- obj = context[:self]
16
- puts "var_name: #{var_name}"
17
- if var_name.kind_of?(Symbol) || var_name.kind_of?(String)
18
- value = obj.instance_variable_get("@#{var_name}")
19
- puts "value: #{value}"
20
- return name_allow_action(value)
21
- else
22
- puts "return default :yield"
23
- :yield
24
- end
16
+ # obj = context[:self]
17
+ # obj = obj.class if @on_class
18
+ # puts "var_name: #{var_name}"
19
+ # if var_name.kind_of?(Symbol) || var_name.kind_of?(String)
20
+ # value = obj.instance_variable_get("@#{var_name}")
21
+ # puts "value: #{value}"
22
+ # return name_allow_action(value)
23
+ # else
24
+ # puts "return default :yield"
25
+ # :yield
26
+ # end
25
27
  end
26
28
 
27
29
  end
@@ -1,5 +1,3 @@
1
- require 'templates/trace_output_handler'
2
-
3
1
  module Tracing
4
2
  class BaseTemplate
5
3
  include Tracing::OutputHandler
@@ -1,5 +1,3 @@
1
- require 'trace_ext'
2
-
3
1
  module Tracing
4
2
  module TraceCalls
5
3
 
@@ -1,14 +1,6 @@
1
- require 'extensions/include'
2
- require 'appenders/include'
3
- require "templates/include"
4
- require 'output_handler/output_handler'
5
- require 'action_handler/action_handler'
6
- require 'filters/filter_use'
7
- require "duration"
8
-
9
1
  module Tracing
10
2
  module TraceExt
11
- include Tracing::Filter::Exec
3
+ Tracing::Filter::Executor
12
4
 
13
5
  class << self
14
6
  attr_accessor :configuration
@@ -10,6 +10,16 @@ InstanceVar_filter = {
10
10
  }
11
11
  }
12
12
 
13
+ InstanceVar_filter2 = {
14
+ :name => 'check template path',
15
+ :var_name => 'template_path',
16
+ :var_rules => {
17
+ :include => [/taglib/],
18
+ :exclude => [/rapid/],
19
+ :default => :exclude
20
+ }
21
+ }
22
+
13
23
  class Obj
14
24
  attr_accessor :template_path
15
25
 
@@ -20,30 +30,32 @@ end
20
30
 
21
31
  class TestInstanceVarFilter < Test::Unit::TestCase
22
32
 
23
- def test_varfilter_hash_to_class
24
- var_filter = InstanceVar_filter
25
- result = var_filter.filter_class
26
- assert_equal Tracing::InstanceVarFilter, result, "Should result in var filter"
27
- end
28
-
29
- def test_varfilter_hash_to_class
30
- var_filter = InstanceVar_filter
31
- result = var_filter.create_filter
32
- assert_equal Tracing::InstanceVarFilter, result.class, "Should result in var filter"
33
- end
34
-
35
-
36
- def test_varfilter_from_hash
37
- var_filter = InstanceVar_filter
38
- config = {:filters => var_filter}
39
- result = config.filters
40
- assert_equal Tracing::InstanceVarFilter, result.class, "Should result in var filter"
41
- end
33
+ # def test_varfilter_hash_to_class
34
+ # var_filter = InstanceVar_filter
35
+ # result = var_filter.filter_class
36
+ # assert_equal Tracing::InstanceVarFilter, result, "Should result in var filter"
37
+ # end
38
+ #
39
+ # def test_varfilter_hash_to_class
40
+ # var_filter = InstanceVar_filter
41
+ # result = var_filter.create_filter
42
+ # assert_equal Tracing::InstanceVarFilter, result.class, "Should result in var filter"
43
+ # end
44
+ #
45
+ #
46
+ # def test_varfilter_from_hash
47
+ # var_filter = InstanceVar_filter
48
+ # config = {:filters => var_filter}
49
+ # result = config.filters
50
+ # assert_equal Tracing::InstanceVarFilter, result.class, "Should result in var filter"
51
+ # end
42
52
 
43
- # see allow_action in InstanceVarFilter, refactor :yield, :include .. as return values!?
44
- def test_varfilter__class_and_varmatch
45
- var_filter = InstanceVar_filter
46
- context = {:class_name => "Hobo::Dryml", :vars => {"template_path" => "a/taglib/x"}, :self => Obj.new("a/taglib/x") }.context
53
+ def test_varfilter__class_and_varmatch_2
54
+ var_filter = InstanceVar_filter2
55
+ obj = Obj.new("taglib")
56
+
57
+ puts obj.inspect
58
+ context = {:class_name => "Hobo::Dryml", :vars => ["template_path"], :self => obj }.context
47
59
 
48
60
  options = {:filters => var_filter}
49
61
  exec = Tracing::Filter::Executor.new(options)
@@ -52,27 +64,40 @@ class TestInstanceVarFilter < Test::Unit::TestCase
52
64
  assert_equal true, result, "Filter should allow passage"
53
65
  end
54
66
 
55
- def test_varfilter__varnot_match
67
+
68
+ # see allow_action in InstanceVarFilter, refactor :yield, :include .. as return values!?
69
+ def test_varfilter__class_and_varmatch
56
70
  var_filter = InstanceVar_filter
71
+ context = {:class_name => "Hobo::Dryml", :vars => ["template_path"], :self => Obj.new("a/taglib/x") }.context
57
72
 
58
- context = {:class_name => 'Blip::Blap', :vars => {"template_path" => "a/taglib/x"}, :self => Obj.new("taglib/x") }.context
59
-
60
- puts "Context:" + context.inspect
61
-
62
73
  options = {:filters => var_filter}
63
74
  exec = Tracing::Filter::Executor.new(options)
64
75
  result = exec.filters_allow?('msg', context)
65
- assert_equal false, result, "Filter should NOT allow passage"
66
- end
67
-
68
- def test_varfilter__varexcluded
69
- var_filter = InstanceVar_filter
70
- context = {:class_name => 'Blip::Blap', :vars => {"template_path" => "a/taglib/x"}, :self => Obj.new("a/rapid_x") }.context
71
-
72
- options = {:filters => var_filter}
73
- exec = Tracing::Filter::Executor.new(options)
74
- result = exec.filters_allow?('msg', context)
75
- assert_equal false, result, "Filter should NOT allow passage"
76
+
77
+ assert_equal true, result, "Filter should allow passage"
76
78
  end
79
+
80
+ # def test_varfilter__varnot_match
81
+ # var_filter = InstanceVar_filter
82
+ #
83
+ # context = {:class_name => 'Blip::Blap', :vars => ["template_path" => "a/taglib/x"], :self => Obj.new("taglib/x") }.context
84
+ #
85
+ # puts "Context:" + context.inspect
86
+ #
87
+ # options = {:filters => var_filter}
88
+ # exec = Tracing::Filter::Executor.new(options)
89
+ # result = exec.filters_allow?('msg', context)
90
+ # assert_equal false, result, "Filter should NOT allow passage"
91
+ # end
92
+ #
93
+ # def test_varfilter__varexcluded
94
+ # var_filter = InstanceVar_filter
95
+ # context = {:class_name => 'Blip::Blap', :vars => ["template_path" => "a/taglib/x"], :self => Obj.new("a/rapid_x") }.context
96
+ #
97
+ # options = {:filters => var_filter}
98
+ # exec = Tracing::Filter::Executor.new(options)
99
+ # result = exec.filters_allow?('msg', context)
100
+ # assert_equal false, result, "Filter should NOT allow passage"
101
+ # end
77
102
 
78
103
  end
File without changes
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{trace-util-adv}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kristian Mandrup"]
12
- s.date = %q{2009-11-21}
12
+ s.date = %q{2009-11-22}
13
13
  s.description = %q{
14
14
  Configure tracing using context sensitive filters, appenders, output templates in a completely non-intrusive fashion.
15
15
  Tracing can even be applied runtime as a response when certain conditions occur}
@@ -133,6 +133,7 @@ Gem::Specification.new do |s|
133
133
  "test/filters/simple/test_instancevar_filter.rb",
134
134
  "test/filters/simple/test_method_filter.rb",
135
135
  "test/filters/simple/test_module_filter.rb",
136
+ "test/listeners/test_listeners.rb",
136
137
  "test/samples/include.rb",
137
138
  "test/samples/sample_classes.rb",
138
139
  "test/samples/sample_composite_filters.rb",
@@ -159,11 +160,14 @@ Gem::Specification.new do |s|
159
160
 
160
161
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
161
162
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
163
+ s.add_runtime_dependency(%q<require-magic>, [">= 0"])
162
164
  else
163
165
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
166
+ s.add_dependency(%q<require-magic>, [">= 0"])
164
167
  end
165
168
  else
166
169
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
170
+ s.add_dependency(%q<require-magic>, [">= 0"])
167
171
  end
168
172
  end
169
173
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trace-util-adv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kristian Mandrup
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-21 00:00:00 +01:00
12
+ date: 2009-11-22 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,6 +22,16 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 1.2.9
24
24
  version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: require-magic
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
25
35
  description: |-
26
36
 
27
37
  Configure tracing using context sensitive filters, appenders, output templates in a completely non-intrusive fashion.
@@ -171,6 +181,7 @@ test_files:
171
181
  - test/filters/simple/test_instancevar_filter.rb
172
182
  - test/filters/simple/test_method_filter.rb
173
183
  - test/filters/simple/test_module_filter.rb
184
+ - test/listeners/test_listeners.rb
174
185
  - test/samples/include.rb
175
186
  - test/samples/sample_classes.rb
176
187
  - test/samples/sample_composite_filters.rb