mtrace 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (9) hide show
  1. data/.document +5 -0
  2. data/LICENSE +20 -0
  3. data/README.md +24 -0
  4. data/Rakefile +51 -0
  5. data/VERSION +1 -0
  6. data/example.rb +5 -0
  7. data/lib/mtrace.rb +11 -0
  8. data/screenshot.png +0 -0
  9. metadata +72 -0
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 jugyo
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,24 @@
1
+ mtrace
2
+ ====
3
+
4
+ trace calling methods with set\_trace\_func
5
+
6
+ Install
7
+ ----
8
+
9
+ gem install mtrace
10
+
11
+ Usage
12
+ ----
13
+
14
+ require 'mtrace'
15
+
16
+ Example
17
+ ----
18
+
19
+ ![screenshot.png](mtrace/raw/master/screenshot.png)
20
+
21
+ Copyright
22
+ ----
23
+
24
+ Copyright (c) 2010 jugyo. See LICENSE for details.
@@ -0,0 +1,51 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "mtrace"
8
+ gem.summary = %Q{trace calling methods}
9
+ gem.description = %Q{trace calling methods with set_trace_func}
10
+ gem.email = "jugyo.org@gmail.com"
11
+ gem.homepage = "http://github.com/jugyo/mtrace"
12
+ gem.authors = ["jugyo"]
13
+ end
14
+ Jeweler::GemcutterTasks.new
15
+ rescue LoadError
16
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
17
+ end
18
+
19
+ require 'rake/testtask'
20
+ Rake::TestTask.new(:test) do |test|
21
+ test.libs << 'lib' << 'test'
22
+ test.pattern = 'test/**/test_*.rb'
23
+ test.verbose = true
24
+ end
25
+
26
+ begin
27
+ require 'rcov/rcovtask'
28
+ Rcov::RcovTask.new do |test|
29
+ test.libs << 'test'
30
+ test.pattern = 'test/**/test_*.rb'
31
+ test.verbose = true
32
+ end
33
+ rescue LoadError
34
+ task :rcov do
35
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
36
+ end
37
+ end
38
+
39
+ task :test => :check_dependencies
40
+
41
+ task :default => :test
42
+
43
+ require 'rake/rdoctask'
44
+ Rake::RDocTask.new do |rdoc|
45
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
46
+
47
+ rdoc.rdoc_dir = 'rdoc'
48
+ rdoc.title = "mtrace #{version}"
49
+ rdoc.rdoc_files.include('README*')
50
+ rdoc.rdoc_files.include('lib/**/*.rb')
51
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,5 @@
1
+ def fib(n)
2
+ return n if n == 0 or n == 1
3
+ fib(n-1) + fib(n-2) if n > 1
4
+ end
5
+ fib(4)
@@ -0,0 +1,11 @@
1
+ mtrace_indent = 0
2
+ set_trace_func lambda {|event, file, line, id, binding, klass|
3
+ case event
4
+ when 'call'
5
+ puts "\e[90m| " * mtrace_indent + "\e[35m#{klass}\e[90m#\e[36m#{id} \e[90m#{file}:#{line}\e[0m"
6
+ mtrace_indent += 1
7
+ when 'return'
8
+ mtrace_indent -= 1
9
+ end
10
+ mtrace_indent = 0 if mtrace_indent < 0
11
+ }
Binary file
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mtrace
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - jugyo
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-10-08 00:00:00 +09:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: trace calling methods with set_trace_func
22
+ email: jugyo.org@gmail.com
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files:
28
+ - LICENSE
29
+ - README.md
30
+ files:
31
+ - .document
32
+ - LICENSE
33
+ - README.md
34
+ - Rakefile
35
+ - VERSION
36
+ - example.rb
37
+ - lib/mtrace.rb
38
+ - screenshot.png
39
+ has_rdoc: true
40
+ homepage: http://github.com/jugyo/mtrace
41
+ licenses: []
42
+
43
+ post_install_message:
44
+ rdoc_options:
45
+ - --charset=UTF-8
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ segments:
54
+ - 0
55
+ version: "0"
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ requirements: []
65
+
66
+ rubyforge_project:
67
+ rubygems_version: 1.3.7
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: trace calling methods
71
+ test_files: []
72
+