rudeki 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
- # Putlog
1
+ # RUDEKI
2
+
3
+ rudeki is acronym RUby DEbug KIt
4
+
5
+ Gem can show where are used methods puts, p.
2
6
 
3
- TODO: Write a gem description
4
7
 
5
8
  ## Installation
6
9
 
@@ -18,4 +21,24 @@ Or install it yourself as:
18
21
 
19
22
  ## Usage
20
23
 
21
- TODO: Write usage instructions here
24
+ In default configuration you should only require rudeki in application.
25
+
26
+ More about configuration below
27
+
28
+ Rudeki::Config.set do |conf|
29
+ # Select which methods you what highlight.
30
+ # Default ars p, puts
31
+ conf.methods = [:p]
32
+
33
+ # If you want see where are generated errors you should set on true
34
+ # Default is true
35
+ conf.errors = false
36
+ end
37
+
38
+ You should see something like
39
+
40
+ pry(main)> puts "rudeki"
41
+ ╔═════════ METHOD - PUTS ═════
42
+ puts -> (pry):2:in `<main>'
43
+ rudeki
44
+ ╚═════════════════════════════
data/lib/rudeki/config.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require 'yaml'
4
4
 
5
5
  module Rudeki
6
+ # Configuration of Rudeki
6
7
  module Config
7
8
 
8
9
  RAW_CONFIG = File.read(File.expand_path("../config.yml", __FILE__))
@@ -12,5 +13,9 @@ module Rudeki
12
13
  self.class.class_eval { attr_accessor name.intern }
13
14
  end
14
15
 
16
+ def self.set
17
+ yield self
18
+ end
19
+
15
20
  end # module Config
16
21
  end # module Rudeki
@@ -1,5 +1,5 @@
1
1
  ---
2
- :character: ! '*'
2
+ :errors: true
3
3
  :methods:
4
- - puts
5
- - p
4
+ - :puts
5
+ - :p
@@ -1,3 +1,3 @@
1
1
  module Rudeki
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/rudeki.rb CHANGED
@@ -1,25 +1,38 @@
1
1
  # encoding: utf-8
2
+
2
3
  require "rudeki/config"
3
4
 
4
- Rudeki::Config.methods.each do |method|
5
- Kernel::send(:alias_method, "old_#{method}".intern, "#{method}".intern)
6
- # TODO
5
+ def puts(arg)
6
+ if Rudeki::Config.methods.include?(:puts)
7
+ Kernel.puts("╔═════════ METHOD - PUTS ═════")
8
+ Kernel.puts(" puts -> #{caller.first.to_s}")
9
+ Kernel.puts(arg)
10
+ Kernel.puts("╚═════════════════════════════")
11
+ else
12
+ Kernel.puts(arg)
13
+ end
7
14
  end
8
15
 
9
- def puts(arg)
10
- old_puts("╔═════════ METHOD - PUTS ═════")
11
- old_puts(" puts -> #{caller.first.to_s}")
12
- old_puts(arg)
13
- old_puts("╚═════════════════════════════")
16
+ def p(arg)
17
+ if Rudeki::Config.methods.include?(:p)
18
+ Kernel.puts("╔═════════ METHOD - P ═════")
19
+ Kernel.puts(" p -> #{caller.first.to_s}")
20
+ Kernel.puts(arg)
21
+ Kernel.puts("╚═════════════════════════════")
22
+ else
23
+ Kernel.p(arg)
24
+ end
14
25
  end
15
26
 
16
27
  class StandardError
17
28
  def initialize(value = "RUDEKI ERROR")
29
+ if Rudeki::Config.errors
30
+ Kernel.puts "╔══════════ ERROR ══════════"
31
+ Kernel.puts "║ message: #{message}"
32
+ Kernel.puts "║ #{caller.join("\n║ ")}"
33
+ Kernel.puts "╚═══════════════════════════"
34
+ end
18
35
  super(value)
19
- Kernel.puts "╔══════════ ERROR ══════════"
20
- Kernel.puts "║ message: #{message}"
21
- Kernel.puts "║ #{caller.join("\n║ ")}"
22
- Kernel.puts "╚═══════════════════════════"
23
36
  end
24
37
  end
25
38
 
data/rudeki.gemspec CHANGED
@@ -5,8 +5,8 @@ Gem::Specification.new do |gem|
5
5
  gem.authors = ["Michał Szyma"]
6
6
  gem.email = ["raglub.ruby@gmail.com"]
7
7
  gem.date = "2012-05-08"
8
- gem.description = %q{Gem show you where are used methods puts.}
9
- gem.summary = %q{Gem show you where are used methods puts.}
8
+ gem.description = %q{Gem can show where are used methods puts, p}
9
+ gem.summary = %q{Gem can show where are used methods puts, p. }
10
10
  gem.homepage = ""
11
11
 
12
12
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
data/spec/rudeki_spec.rb CHANGED
@@ -1,8 +1,14 @@
1
1
  # encoding: utf-8
2
2
  require 'rudeki'
3
3
 
4
- describe "Rudeki" do
5
- it "putter" do
4
+ Rudeki::Config.set do |conf|
5
+ conf.methods = [:p]
6
+ end
7
+
8
+ #STDIN.readline(puts "3213")
9
+ #STDOUT.print
10
+ describe Rudeki do
11
+ it "should properly show frames of method puts" do
6
12
  puts 123
7
13
  end
8
14
  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.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ bindir: bin
11
11
  cert_chain: []
12
12
  date: 2012-05-08 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: Gem show you where are used methods puts.
14
+ description: Gem can show where are used methods puts, p
15
15
  email:
16
16
  - raglub.ruby@gmail.com
17
17
  executables: []
@@ -52,5 +52,5 @@ rubyforge_project:
52
52
  rubygems_version: 1.8.24
53
53
  signing_key:
54
54
  specification_version: 3
55
- summary: Gem show you where are used methods puts.
55
+ summary: Gem can show where are used methods puts, p.
56
56
  test_files: []