mrdbg 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +15 -0
  2. data/lib/mrdbg.rb +77 -0
  3. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzJjOWIyZTczYjhiOWI2YTA3NjVhMWU4MWY2YzQyMDMwMGEwODcwOQ==
5
+ data.tar.gz: !binary |-
6
+ MjI0MjBmMzI4MjA1MDU5NzEwNDMwMzY3MjRiMTJjZTVlN2JjNGRlNQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZWIyMTNhZTVlZjQ2YjFlYjM3NjE0YTgwY2QyNzI4MmIwNWY5NGJhYmYyNWVh
10
+ Y2RkNDg2MDVlYjEyNmIxOTgzMDBkYjFhOTI3NWE0NjU5NjgxZWQwMmEyYzc5
11
+ Yjg3MjUwYjBiZmI5MTgzNDg0Mjk0NDYzOTEzNTAyNTdkODFmOWI=
12
+ data.tar.gz: !binary |-
13
+ NGM4MGU1MzJkOGQ4YzMzYmNjZDZlMGRlYzg4NmYzNzI4MjRiOGM5OGM3Yjli
14
+ MWM2OWYwMWM4NmI5ZDEyZGJjZDc1MWVmN2Y4MWY2MWY1YjQxNWU0ZDJmYjI1
15
+ NTRhYmNiMTgwM2NjMTVjNWZjZmUxNDNmYjk1M2FmODA4MmVlNWU=
data/lib/mrdbg.rb ADDED
@@ -0,0 +1,77 @@
1
+ require "readline"
2
+
3
+ class mrdbg
4
+
5
+ def set_red s
6
+ return "#{RED}#{s}#{COLOREND}"
7
+ end
8
+
9
+ def set_blue s
10
+ return "#{BLUE}#{s}#{COLOREND}"
11
+ end
12
+
13
+ def set_yellow s
14
+ return "#{YELLOW}#{s}#{COLOREND}"
15
+ end
16
+
17
+ def set_bold s
18
+ return "#{BOLD}#{s}#{BOLDEND}"
19
+ end
20
+
21
+ def d(s)
22
+ color_s = "\033[1m\033[33m"
23
+ color_f = "\033[0m\033[22m"
24
+ line= (caller.first.split ":")[1]
25
+ puts "#{color_s}#{Time.new.strftime("%H:%M:%S")} line:#{line} -- #{s.to_s}#{color_f}"
26
+ end
27
+ def l(n,s)
28
+ if n <= LOGLEVEL then
29
+ color_s = "\033[1m\033[34m"
30
+ color_f = "\033[0m\033[22m"
31
+ space = " " * n
32
+ puts "#{color_s}#{Time.new.strftime("%H:%M:%S")} #{space} #{s.to_s}#{color_f}"
33
+ end
34
+ end
35
+ def e(n,s)
36
+ color_s = "\033[1m\033[31m"
37
+ color_f = "\033[0m\033[22m"
38
+ space = " " *n
39
+ puts "#{color_s}#{Time.new.strftime("%H:%M:%S")} #{space} #{s.to_s}#{color_f}"
40
+ end
41
+ def b bind
42
+ color_s = "\033[1m\033[31m"
43
+ color_f = "\033[0m\033[22m"
44
+ line= (caller.first.split ":")[1]
45
+ vars = (eval('local_variables',bind) | eval('instance_variables',bind)).map{|v| "#{v.to_s}= #{eval(v.to_s,bind)}"}.join ";"
46
+ puts "#{color_s}#{Time.new.strftime("%H:%M:%S")} line:#{line} -- #{vars}#{color_f}"
47
+ begin
48
+ print "\033[31m"
49
+ begin
50
+ s = Readline.readline("dbg> ",true).strip
51
+ if s == "" then break end
52
+ eval ("puts ' = ' + (#{s}).to_s"),bind
53
+ rescue => e
54
+ puts " > Error ocurred: \033[1m#{e.backtrace[0]}: #{e.message}\033[22m"
55
+ end while true
56
+ ensure
57
+ print "\033[0m"
58
+ end
59
+ end
60
+ def x bind
61
+ color_s = "\033[1m\033[33m"
62
+ color_f = "\033[0m\033[22m"
63
+ puts "#{color_s}Execuation mode: #{color_f}"
64
+ begin
65
+ print "\033[33m"
66
+ begin
67
+ s = Readline.readline("exe> ",true).strip
68
+ if s == "" then break end
69
+ eval ("puts ' = ' + (#{s}).to_s"),bind
70
+ rescue => e
71
+ puts " > Error ocurred: \033[1m#{e.backtrace[0]}: #{e.message}\033[22m"
72
+ end while true
73
+ ensure
74
+ print "\033[0m"
75
+ end
76
+ end
77
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mrdbg
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Mehrdad Abdi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-26 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A set of functions for debugging purpose in ruby code
14
+ email: newmrd@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/mrdbg.rb
20
+ homepage: https://github.com/mabdi/mrdbg
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.0.7
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: mrd debug tool
44
+ test_files: []
45
+ has_rdoc: