critique 0.1.1 → 0.1.2
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/lib/critique/version.rb +1 -1
- metadata +13 -15
- data/spec/process.rb +0 -83
data/lib/critique/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: critique
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
|
-
requirement: &
|
16
|
+
requirement: &70104981364420 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70104981364420
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70104981363940 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70104981363940
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70104981363500 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70104981363500
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rr
|
49
|
-
requirement: &
|
49
|
+
requirement: &70104981363080 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70104981363080
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: simplecov
|
60
|
-
requirement: &
|
60
|
+
requirement: &70104981348560 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70104981348560
|
69
69
|
description: critiques your code
|
70
70
|
email:
|
71
71
|
- corey@coolerator.net
|
@@ -87,7 +87,6 @@ files:
|
|
87
87
|
- lib/critique/profiling.rb
|
88
88
|
- lib/critique/version.rb
|
89
89
|
- spec/critique_spec.rb
|
90
|
-
- spec/process.rb
|
91
90
|
- spec/spec_helper.rb
|
92
91
|
homepage: https://github.com/coreyti/critique
|
93
92
|
licenses: []
|
@@ -109,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
108
|
version: '0'
|
110
109
|
segments:
|
111
110
|
- 0
|
112
|
-
hash:
|
111
|
+
hash: -2334102478796458154
|
113
112
|
requirements: []
|
114
113
|
rubyforge_project:
|
115
114
|
rubygems_version: 1.8.11
|
@@ -118,5 +117,4 @@ specification_version: 3
|
|
118
117
|
summary: critiques your code
|
119
118
|
test_files:
|
120
119
|
- spec/critique_spec.rb
|
121
|
-
- spec/process.rb
|
122
120
|
- spec/spec_helper.rb
|
data/spec/process.rb
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
require 'profiling'
|
2
|
-
|
3
|
-
unless ARGV.size == 2
|
4
|
-
puts "usage: ruby process.rb <filename.ext> <config>"
|
5
|
-
puts " e.g.,"
|
6
|
-
puts " ruby process.rb video.mov all"
|
7
|
-
puts " ruby process.rb video.mov 8k"
|
8
|
-
puts " ruby process.rb video.mov 10m"
|
9
|
-
end
|
10
|
-
|
11
|
-
filename = ARGV[0]
|
12
|
-
config = ARGV[1]
|
13
|
-
|
14
|
-
unless filename && File.exists?(filename)
|
15
|
-
puts "\n\nfile does not exist."
|
16
|
-
exit 1
|
17
|
-
end
|
18
|
-
|
19
|
-
class Processor
|
20
|
-
extend Profiling
|
21
|
-
include Profiling
|
22
|
-
|
23
|
-
attr_reader :path, :size
|
24
|
-
|
25
|
-
def initialize(path)
|
26
|
-
@path = path
|
27
|
-
@size = File.size(path)
|
28
|
-
end
|
29
|
-
|
30
|
-
def read_all
|
31
|
-
heading(:all)
|
32
|
-
|
33
|
-
profile do |p|
|
34
|
-
File.read(path) # NOTE: doing nothing with it
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def read_bytes(num)
|
39
|
-
bytes = num.to_i
|
40
|
-
bytes = (bytes * 1024) if num =~ /.*k$/i
|
41
|
-
bytes = (bytes * 1024 * 1024) if num =~ /.*m$/i
|
42
|
-
|
43
|
-
heading(:part, bytes)
|
44
|
-
|
45
|
-
profile do |p|
|
46
|
-
offset = 0
|
47
|
-
length = bytes
|
48
|
-
|
49
|
-
while offset < size
|
50
|
-
remain = size - offset
|
51
|
-
amount = (remain < length) ? remain : length
|
52
|
-
|
53
|
-
$stdout.print '.' # TODO: move to Profiling
|
54
|
-
$stdout.flush
|
55
|
-
|
56
|
-
File.read(path, amount, offset) # NOTE: doing nothing with it
|
57
|
-
offset += amount
|
58
|
-
end
|
59
|
-
|
60
|
-
$stdout.puts
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def heading(mode, length = nil)
|
65
|
-
puts [' ', ('-' * 76)].join
|
66
|
-
puts " process.rb... reading #{size} bytes (#{[mode, length].compact.join(' ')})"
|
67
|
-
puts [' ', ('-' * 76)].join
|
68
|
-
end
|
69
|
-
|
70
|
-
# def self.cls_method
|
71
|
-
# profile do |p|
|
72
|
-
# # p.info("method body")
|
73
|
-
# "return value"
|
74
|
-
# end
|
75
|
-
# end
|
76
|
-
end
|
77
|
-
|
78
|
-
if config == 'all'
|
79
|
-
Processor.new(filename).read_all
|
80
|
-
else
|
81
|
-
Processor.new(filename).read_bytes(config)
|
82
|
-
end
|
83
|
-
# Processor.cls_method
|