rudeki 0.0.5 → 0.0.6
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.md +3 -0
- data/lib/rudeki/config.rb +1 -0
- data/lib/rudeki/config.yml +1 -1
- data/lib/rudeki/version.rb +1 -1
- data/lib/rudeki.rb +32 -35
- data/rudeki.gemspec +11 -7
- data/spec/rudeki_spec.rb +40 -2
- metadata +39 -6
data/README.md
CHANGED
@@ -34,6 +34,9 @@ More about configuration below
|
|
34
34
|
> # If you want see where are generated errors you should set on true
|
35
35
|
> # Default is false
|
36
36
|
> conf.errors = true
|
37
|
+
|
38
|
+
> # set logdev for logger gem
|
39
|
+
> conf.logdev = STDOUT
|
37
40
|
> end
|
38
41
|
|
39
42
|
You should see something like
|
data/lib/rudeki/config.rb
CHANGED
data/lib/rudeki/config.yml
CHANGED
data/lib/rudeki/version.rb
CHANGED
data/lib/rudeki.rb
CHANGED
@@ -1,67 +1,64 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require "rudeki/config"
|
4
|
-
|
4
|
+
require "logger"
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
@
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
def logger(message)
|
14
|
-
Kernel.puts message
|
6
|
+
# Kernel.puts
|
7
|
+
def rudeki_info(message)
|
8
|
+
if @logger.nil?
|
9
|
+
@logger = Logger.new(Rudeki::Config.logdev || STDOUT)
|
10
|
+
@logger.formatter = proc { |severity, datetime, progname, msg| "#{msg}\n" }
|
11
|
+
end
|
12
|
+
@logger.info(message)
|
15
13
|
end
|
16
14
|
|
17
15
|
# Show quarantine block
|
18
16
|
module Rudeki
|
19
|
-
|
20
17
|
def self.quarantine
|
21
18
|
yield
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
rudeki_info "╔═════════ RUDEKI::quarantine isn't continues ═════════"
|
20
|
+
rudeki_info " method quarantine is used in:"
|
21
|
+
rudeki_info " #{caller[0]}"
|
22
|
+
rudeki_info "╚══════════════════════════════════════════════════════"
|
26
23
|
rescue => e
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
24
|
+
rudeki_info "╔═════════ RUDEKI::quarantine is continues ════════════"
|
25
|
+
rudeki_info " message:"
|
26
|
+
rudeki_info " #{e.message}"
|
27
|
+
rudeki_info " backtrace:"
|
28
|
+
rudeki_info " #{e.backtrace.join("\n ")}"
|
29
|
+
rudeki_info "╚══════════════════════════════════════════════════════"
|
33
30
|
end
|
34
31
|
end
|
35
32
|
|
36
33
|
def puts(arg)
|
37
34
|
if Rudeki::Config.methods.include?(:puts)
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
35
|
+
rudeki_info "╔═════════ METHOD - PUTS ═════"
|
36
|
+
rudeki_info " puts -> #{caller.first.to_s}"
|
37
|
+
rudeki_info arg
|
38
|
+
rudeki_info "╚═════════════════════════════"
|
42
39
|
else
|
43
|
-
|
40
|
+
rudeki_info arg
|
44
41
|
end
|
45
42
|
end
|
46
43
|
|
47
44
|
def p(arg)
|
48
45
|
if Rudeki::Config.methods.include?(:p)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
46
|
+
rudeki_info "╔═════════ METHOD - P ═════"
|
47
|
+
rudeki_info " p -> #{caller.first.to_s}"
|
48
|
+
rudeki_info arg
|
49
|
+
rudeki_info "╚═════════════════════════════"
|
53
50
|
else
|
54
|
-
|
51
|
+
rudeki_info arg
|
55
52
|
end
|
56
53
|
end
|
57
54
|
|
58
55
|
class StandardError
|
59
56
|
def initialize(value = "RUDEKI ERROR")
|
60
57
|
if Rudeki::Config.errors
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
58
|
+
rudeki_info "╔══════════ ERROR ══════════"
|
59
|
+
rudeki_info "║ message: #{message}"
|
60
|
+
rudeki_info "║ #{caller.join("\n║ ")}"
|
61
|
+
rudeki_info "╚═══════════════════════════"
|
65
62
|
end
|
66
63
|
super(value)
|
67
64
|
end
|
data/rudeki.gemspec
CHANGED
@@ -1,18 +1,22 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
|
2
3
|
require File.expand_path('../lib/rudeki/version', __FILE__)
|
3
4
|
|
4
5
|
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "rudeki"
|
5
7
|
gem.authors = ["Michał Szyma"]
|
6
8
|
gem.email = ["raglub.ruby@gmail.com"]
|
7
|
-
gem.
|
8
|
-
gem.
|
9
|
-
gem.
|
10
|
-
gem.
|
9
|
+
gem.version = Rudeki::VERSION
|
10
|
+
gem.platform = Gem::Platform::RUBY
|
11
|
+
gem.date = "2012-06-01"
|
12
|
+
gem.description = %q{Gem can show where are used methodsi: puts, p. You can locate the bugs}
|
13
|
+
gem.summary = %q{Gem can show where are used methods: puts, p.}
|
14
|
+
gem.homepage = "https://github.com/raglub/rudeki"
|
11
15
|
|
12
|
-
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
13
16
|
gem.files = `git ls-files`.split("\n")
|
14
17
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
15
|
-
gem.name = "rudeki"
|
16
18
|
gem.require_paths = ["lib"]
|
17
|
-
|
19
|
+
|
20
|
+
gem.add_development_dependency "rspec", ">= 2.10.0"
|
21
|
+
gem.add_dependency "logger", ">= 1.2.8"
|
18
22
|
end
|
data/spec/rudeki_spec.rb
CHANGED
@@ -1,12 +1,50 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'rudeki'
|
3
3
|
|
4
|
+
def result_path
|
5
|
+
@result_path ||= File.expand_path("../tmp/result", __FILE__)
|
6
|
+
@result_path
|
7
|
+
end
|
8
|
+
|
4
9
|
Rudeki::Config.set do |conf|
|
5
|
-
conf.methods = [:p]
|
10
|
+
conf.methods = [:p, :puts]
|
11
|
+
conf.logdev = result_path
|
6
12
|
end
|
7
13
|
|
8
14
|
describe Rudeki do
|
15
|
+
|
16
|
+
before(:each) do
|
17
|
+
File.delete(result_path) if result_path.include?("rudeki/spec/tmp/result") and File.exist?(result_path)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should properly show frames of method p" do
|
21
|
+
p "Test method p"
|
22
|
+
result = File.read(result_path)
|
23
|
+
result.should include("╔═════════ METHOD - P ═")
|
24
|
+
result.should include("/rudeki/spec/rudeki_spec.rb:")
|
25
|
+
result.should include("Test method p")
|
26
|
+
result.should include("╚═════════")
|
27
|
+
end
|
28
|
+
|
9
29
|
it "should properly show frames of method puts" do
|
10
|
-
|
30
|
+
puts "Test method puts"
|
31
|
+
result = File.read(result_path)
|
32
|
+
result.should include("╔═════════ METHOD - PUTS ═")
|
33
|
+
result.should include("/rudeki/spec/rudeki_spec.rb:")
|
34
|
+
result.should include("Test method puts")
|
35
|
+
result.should include("╚═════════")
|
11
36
|
end
|
37
|
+
|
38
|
+
it "should properly show frames of method quarantine" do
|
39
|
+
Rudeki.quarantine do
|
40
|
+
id.id = 100
|
41
|
+
end
|
42
|
+
result = File.read(result_path)
|
43
|
+
|
44
|
+
result.should include("╔═════════ RUDEKI::quarantine is continues ═══")
|
45
|
+
result.should include("message:")
|
46
|
+
result.should include("undefined local variable or method `id' for #")
|
47
|
+
result.should include("backtrace:")
|
48
|
+
end
|
49
|
+
|
12
50
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rudeki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,9 +9,42 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
13
|
-
dependencies:
|
14
|
-
|
12
|
+
date: 2012-06-01 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.10.0
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.10.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: logger
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.2.8
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.2.8
|
46
|
+
description: ! 'Gem can show where are used methodsi: puts, p. You can locate the
|
47
|
+
bugs'
|
15
48
|
email:
|
16
49
|
- raglub.ruby@gmail.com
|
17
50
|
executables: []
|
@@ -29,7 +62,7 @@ files:
|
|
29
62
|
- lib/rudeki/version.rb
|
30
63
|
- rudeki.gemspec
|
31
64
|
- spec/rudeki_spec.rb
|
32
|
-
homepage:
|
65
|
+
homepage: https://github.com/raglub/rudeki
|
33
66
|
licenses: []
|
34
67
|
post_install_message:
|
35
68
|
rdoc_options: []
|
@@ -52,5 +85,5 @@ rubyforge_project:
|
|
52
85
|
rubygems_version: 1.8.24
|
53
86
|
signing_key:
|
54
87
|
specification_version: 3
|
55
|
-
summary: Gem can show where are used methods puts, p.
|
88
|
+
summary: ! 'Gem can show where are used methods: puts, p.'
|
56
89
|
test_files: []
|