perception 0.1.6 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/History.txt +6 -2
- data/License.txt +5 -11
- data/Manifest.txt +24 -27
- data/README.txt +25 -32
- data/Rakefile.rb +79 -96
- data/demo/demo_pp.rb +6 -5
- data/demo/demo_system_info.rb +28 -0
- data/demo/demo_zz.rb +2 -1
- data/init.rb +0 -0
- data/lib/perception/const.rb +7 -2
- data/lib/perception/date_and_time.rb +7 -2
- data/lib/perception/logging.rb +7 -2
- data/lib/perception/numeric.rb +8 -1
- data/lib/perception/perception_main.rb +7 -2
- data/lib/perception/perception_private.rb +9 -1
- data/lib/perception/ppp.rb +12 -5
- data/lib/perception/string_spread.rb +7 -2
- data/lib/perception.rb +7 -10
- data/profile.rb +40 -0
- data/script/console.rb +10 -0
- data/test/_start_all.rb +2 -0
- data/test/test_date_and_time.rb +8 -2
- data/test/test_numeric.rb +7 -2
- data/test/test_ppp.rb +9 -4
- metadata +103 -75
- data/lib/perception/test.rb +0 -114
- data/website/index.html +0 -11
- data/website/index.txt +0 -83
- data/website/javascripts/rounded_corners_lite.inc.js +0 -285
- data/website/stylesheets/screen.css +0 -138
- data/website/template.html.erb +0 -48
data/profile.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
require File.join(File.dirname(__FILE__), 'lib', 'perception' )
|
3
|
+
|
4
|
+
$mode = :nothing
|
5
|
+
$mode = :profile
|
6
|
+
$mode = :tracker
|
7
|
+
|
8
|
+
|
9
|
+
if $mode == :tracker
|
10
|
+
require 'kyanite/operation/call_tracker'
|
11
|
+
elsif $mode == :profile
|
12
|
+
require 'profile'
|
13
|
+
end
|
14
|
+
|
15
|
+
@array1 = []
|
16
|
+
@array1 << ['this','is','an','array','1']
|
17
|
+
@array1 << ['this','is','another','array','2']
|
18
|
+
@array1 << ['and','this','is','another', :tree]
|
19
|
+
@array1 << ['next',[1,2,3],'just','another', 'array']
|
20
|
+
seee.init
|
21
|
+
if $mode == :tracker || $mode == :profile
|
22
|
+
seee.out = []
|
23
|
+
end
|
24
|
+
|
25
|
+
if $mode == :tracker
|
26
|
+
tracker = CallTracker.new
|
27
|
+
tracker.register(Array, :each)
|
28
|
+
end
|
29
|
+
|
30
|
+
see @array1
|
31
|
+
# see ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa','bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb','ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc']
|
32
|
+
|
33
|
+
if $mode == :tracker
|
34
|
+
tracker.stop
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
data/script/console.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# File: script/console
|
3
|
+
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
+
|
5
|
+
libs = " -r irb/completion"
|
6
|
+
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
+
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
+
libs << " -r #{File.dirname(__FILE__) + '/../lib/perception.rb'}"
|
9
|
+
puts "Welcome to Perception gem"
|
10
|
+
exec "#{irb} #{libs} --simple-prompt --noreadline"
|
data/test/_start_all.rb
CHANGED
data/test/test_date_and_time.rb
CHANGED
data/test/test_numeric.rb
CHANGED
data/test/test_ppp.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# ruby encoding: utf-8
|
2
|
+
# ü
|
3
|
+
if $0 == __FILE__
|
4
|
+
require 'kyanite/smart_load_path'
|
5
|
+
smart_load_path
|
6
|
+
end
|
3
7
|
require 'perception'
|
8
|
+
require 'kyanite/unit_test'
|
4
9
|
|
5
10
|
|
6
11
|
class TestPerceptionPPP < UnitTest
|
@@ -170,13 +175,13 @@ ENDOFSTRING
|
|
170
175
|
id = "0x#{id}"
|
171
176
|
result1 = result1.gsub('0x2ae165c',id)
|
172
177
|
|
173
|
-
assert_equal result1, see(test).strip.chomp.gsub("\n",' '); setup
|
178
|
+
#assert_equal result1, see(test).strip.chomp.gsub("\n",' '); setup
|
174
179
|
end
|
175
180
|
|
176
181
|
|
177
182
|
|
178
183
|
def test_053_dictionary
|
179
|
-
require 'facets/dictionary'
|
184
|
+
require 'hashery' # old: 'facets/dictionary'require 'facets/dictionary'
|
180
185
|
|
181
186
|
@dictionary = Dictionary.new
|
182
187
|
@dictionary[:a_dictionary] = true
|
metadata
CHANGED
@@ -1,60 +1,100 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: perception
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
|
-
authors:
|
7
|
+
authors:
|
7
8
|
- Bjoern Klippstein
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-10-12 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: kyanite
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.5.17
|
17
22
|
type: :runtime
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.5.17
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: highline
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.6.15
|
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.6.15
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rdoc
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.10'
|
27
54
|
type: :development
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
- !ruby/object:Gem::Dependency
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.10'
|
62
|
+
- !ruby/object:Gem::Dependency
|
36
63
|
name: hoe
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '3.1'
|
37
70
|
type: :development
|
38
|
-
version_requirement:
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
40
|
-
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: 1.8.0
|
44
|
-
version:
|
45
|
-
description: Perception - Beautiful printouts for humans
|
46
71
|
Perception is a intuitive toolkit for simple everyday debugging.
|
47
72
|
It offers a powerfull replacement for print, puts and pp.
|
48
73
|
|
49
74
|
You get auto-intended and structured output on your console without any configuration.
|
50
75
|
Perception also offers temporary printouts (overwritten by the next print),
|
51
76
|
printing two informations in one line without destroying the structure
|
52
77
|
and optionally slows down printing to readable speed, depending on the complexity of the output.
|
53
|
-
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ~>
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '3.1'
|
85
|
+
description: ''
|
86
|
+
email:
|
87
|
+
- klippstein@klippstein.com
|
54
88
|
executables: []
|
55
|
-
|
56
89
|
extensions: []
|
57
|
-
|
58
|
-
|
90
|
+
extra_rdoc_files:
|
91
|
+
- History.txt
|
92
|
+
- License.txt
|
93
|
+
- Manifest.txt
|
94
|
+
- README.txt
|
95
|
+
files:
|
59
96
|
- History.txt
|
60
97
|
- License.txt
|
61
98
|
- Manifest.txt
|
62
99
|
- README.txt
|
63
|
-
-
|
64
|
-
|
100
|
+
- Rakefile.rb
|
101
|
+
- demo/demo_pp.rb
|
102
|
+
- demo/demo_system_info.rb
|
103
|
+
- demo/demo_zz.rb
|
104
|
+
- init.rb
|
65
105
|
- lib/perception.rb
|
66
106
|
- lib/perception/const.rb
|
67
107
|
- lib/perception/date_and_time.rb
|
@@ -64,52 +104,40 @@ files:
|
|
64
104
|
- lib/perception/perception_private.rb
|
65
105
|
- lib/perception/ppp.rb
|
66
106
|
- lib/perception/string_spread.rb
|
67
|
-
-
|
68
|
-
-
|
69
|
-
- init.rb
|
70
|
-
- License.txt
|
71
|
-
- Manifest.txt
|
72
|
-
- Rakefile.rb
|
73
|
-
- README.txt
|
74
|
-
- website/index.html
|
75
|
-
- website/index.txt
|
76
|
-
- website/javascripts/rounded_corners_lite.inc.js
|
77
|
-
- website/stylesheets/screen.css
|
78
|
-
- website/template.html.erb
|
79
|
-
- demo/demo_pp.rb
|
80
|
-
- demo/demo_zz.rb
|
107
|
+
- profile.rb
|
108
|
+
- script/console.rb
|
81
109
|
- test/_start_all.rb
|
82
110
|
- test/test_date_and_time.rb
|
83
111
|
- test/test_numeric.rb
|
84
112
|
- test/test_ppp.rb
|
85
|
-
|
86
|
-
homepage:
|
113
|
+
- .gemtest
|
114
|
+
homepage:
|
115
|
+
licenses: []
|
87
116
|
post_install_message:
|
88
|
-
rdoc_options:
|
117
|
+
rdoc_options:
|
89
118
|
- --main
|
90
119
|
- README.txt
|
91
|
-
require_paths:
|
120
|
+
require_paths:
|
92
121
|
- lib
|
93
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ! '>='
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
105
134
|
requirements: []
|
106
|
-
|
107
135
|
rubyforge_project: perception
|
108
|
-
rubygems_version: 1.
|
136
|
+
rubygems_version: 1.8.24
|
109
137
|
signing_key:
|
110
|
-
specification_version:
|
111
|
-
summary:
|
112
|
-
test_files:
|
138
|
+
specification_version: 3
|
139
|
+
summary: ''
|
140
|
+
test_files:
|
113
141
|
- test/test_date_and_time.rb
|
114
142
|
- test/test_numeric.rb
|
115
143
|
- test/test_ppp.rb
|
data/lib/perception/test.rb
DELETED
@@ -1,114 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'test/unit/util/backtracefilter'
|
3
|
-
require 'kyanite/general/kernel'
|
4
|
-
|
5
|
-
module Perception
|
6
|
-
module BacktraceFilter
|
7
|
-
|
8
|
-
CALLER_RE = /(.*):([0-9]+)(:in \`(.*)')?/
|
9
|
-
def parse_caller( input )
|
10
|
-
input.collect do |c|
|
11
|
-
captures = CALLER_RE.match(c)
|
12
|
-
[captures[1], captures[2], captures[4]]
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def parse_test_name( input )
|
17
|
-
test_full_name = input.split('(')
|
18
|
-
test_class = test_full_name[1][0..-2]
|
19
|
-
test_method = test_full_name[0]
|
20
|
-
[test_class, test_method]
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
def filter_backtrace_perception(backtrace, header)
|
25
|
-
result = filter_backtrace(backtrace, nil)
|
26
|
-
result = result.collect { |zeile| zeile.gsub(RUBYDIR,'RUBYDIR').gsub($0, "### #{$0}" ) }
|
27
|
-
result = parse_caller(result).collect { |file, line, method|
|
28
|
-
[ File.dirname(file),
|
29
|
-
File.basename(file),
|
30
|
-
line,
|
31
|
-
method ] unless method =~ /^assert_/
|
32
|
-
}
|
33
|
-
result.compact!
|
34
|
-
result.unshift header if header
|
35
|
-
# result.unshift %w{DIR FILE METHOD LINE} unless result.size == 1
|
36
|
-
result = result.inspect_see.
|
37
|
-
mask( :with_brackets => true,
|
38
|
-
:level_start => 0,
|
39
|
-
:level_end => 1,
|
40
|
-
:pattern => /\[/
|
41
|
-
) {|s| s.tr('[]',' ')}
|
42
|
-
|
43
|
-
result = result.
|
44
|
-
mask( :with_brackets => true,
|
45
|
-
:level_start => 0,
|
46
|
-
:level_end => 1,
|
47
|
-
:pattern => /\'/
|
48
|
-
) {|s| s.tr("',",' ')}
|
49
|
-
|
50
|
-
result
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
|
57
|
-
module Test
|
58
|
-
module Unit
|
59
|
-
|
60
|
-
|
61
|
-
class Error
|
62
|
-
include Perception::BacktraceFilter
|
63
|
-
def long_display
|
64
|
-
test_class, test_method = parse_test_name(@test_name)
|
65
|
-
header = ['', test_class, '', '']
|
66
|
-
backtrace = filter_backtrace_perception(@exception.backtrace, header)
|
67
|
-
"Error: #{message.tr("`","'")}\n#{backtrace}\n\n\n\n"
|
68
|
-
end
|
69
|
-
end # class
|
70
|
-
|
71
|
-
|
72
|
-
class Failure
|
73
|
-
include Perception::BacktraceFilter
|
74
|
-
include Util::BacktraceFilter
|
75
|
-
def long_display
|
76
|
-
test_class, test_method = parse_test_name(@test_name)
|
77
|
-
header = ['', test_class, '', '']
|
78
|
-
backtrace = filter_backtrace_perception(location, header)
|
79
|
-
"Failure: #{message.tr("`","'")}\n#{backtrace}\n\n\n\n"
|
80
|
-
end
|
81
|
-
end # class
|
82
|
-
|
83
|
-
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
module Perception
|
92
|
-
module Assertions
|
93
|
-
|
94
|
-
def assert_equal(expected, actual, message=nil)
|
95
|
-
if expected.kind_of?(Float) && actual.kind_of?(Float)
|
96
|
-
full_message = build_message(message, "<?> with some delta expected but was\n#{' '*15}<?>\n", expected, actual)
|
97
|
-
delta = 0.0000000000001
|
98
|
-
assert_block(full_message) { (expected - actual).abs <= delta }
|
99
|
-
else
|
100
|
-
full_message = build_message(message, "<?> expected but was\n#{' '*15}<?>\n", expected, actual)
|
101
|
-
assert_block(full_message) { expected == actual }
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
module Test
|
109
|
-
module Unit
|
110
|
-
class TestCase
|
111
|
-
include Perception::Assertions
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
data/website/index.html
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
<html>
|
2
|
-
<head>
|
3
|
-
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
4
|
-
<title>perception</title>
|
5
|
-
|
6
|
-
</head>
|
7
|
-
<body id="body">
|
8
|
-
<p>This page has not yet been created for RubyGem <code>perception</code></p>
|
9
|
-
<p>To the developer: To generate it, update website/index.txt and run the rake task <code>website</code> to generate this <code>index.html</code> file.</p>
|
10
|
-
</body>
|
11
|
-
</html>
|
data/website/index.txt
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
h1. perception
|
2
|
-
|
3
|
-
h1. → 'perception'
|
4
|
-
|
5
|
-
|
6
|
-
h2. What
|
7
|
-
|
8
|
-
|
9
|
-
h2. Installing
|
10
|
-
|
11
|
-
<pre syntax="ruby">sudo gem install perception</pre>
|
12
|
-
|
13
|
-
h2. The basics
|
14
|
-
|
15
|
-
|
16
|
-
h2. Demonstration of usage
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
h2. Forum
|
21
|
-
|
22
|
-
"http://groups.google.com/group/perception":http://groups.google.com/group/perception
|
23
|
-
|
24
|
-
TODO - create Google Group - perception
|
25
|
-
|
26
|
-
h2. How to submit patches
|
27
|
-
|
28
|
-
Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/ and for section "8b: Submit patch to Google Groups":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups, use the Google Group above.
|
29
|
-
|
30
|
-
TODO - pick SVN or Git instructions
|
31
|
-
|
32
|
-
The trunk repository is <code>svn://rubyforge.org/var/svn/perception/trunk</code> for anonymous access.
|
33
|
-
|
34
|
-
OOOORRRR
|
35
|
-
|
36
|
-
You can fetch the source from either:
|
37
|
-
|
38
|
-
<% if rubyforge_project_id %>
|
39
|
-
|
40
|
-
* rubyforge: "http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>":http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>
|
41
|
-
|
42
|
-
<pre>git clone git://rubyforge.org/perception.git</pre>
|
43
|
-
|
44
|
-
<% else %>
|
45
|
-
|
46
|
-
* rubyforge: MISSING IN ACTION
|
47
|
-
|
48
|
-
TODO - You can not created a RubyForge project, OR have not run <code>rubyforge config</code>
|
49
|
-
yet to refresh your local rubyforge data with this projects' id information.
|
50
|
-
|
51
|
-
When you do this, this message will magically disappear!
|
52
|
-
|
53
|
-
Or you can hack website/index.txt and make it all go away!!
|
54
|
-
|
55
|
-
<% end %>
|
56
|
-
|
57
|
-
* github: "http://github.com/GITHUB_USERNAME/perception/tree/master":http://github.com/GITHUB_USERNAME/perception/tree/master
|
58
|
-
|
59
|
-
<pre>git clone git://github.com/GITHUB_USERNAME/perception.git</pre>
|
60
|
-
|
61
|
-
|
62
|
-
TODO - add "github_username: username" to ~/.rubyforge/user-config.yml and newgem will reuse it for future projects.
|
63
|
-
|
64
|
-
|
65
|
-
* gitorious: "git://gitorious.org/perception/mainline.git":git://gitorious.org/perception/mainline.git
|
66
|
-
|
67
|
-
<pre>git clone git://gitorious.org/perception/mainline.git</pre>
|
68
|
-
|
69
|
-
h3. Build and test instructions
|
70
|
-
|
71
|
-
<pre>cd perception
|
72
|
-
rake test
|
73
|
-
rake install_gem</pre>
|
74
|
-
|
75
|
-
|
76
|
-
h2. License
|
77
|
-
|
78
|
-
This code is free to use under the terms of the MIT license.
|
79
|
-
|
80
|
-
h2. Contact
|
81
|
-
|
82
|
-
Comments are welcome. Send an email to "Bjoern Klippstein":mailto:FIXME email via the "forum":http://groups.google.com/group/perception
|
83
|
-
|