stable_profile 0.4.0 → 0.4.1

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 +4 -4
  2. data/lib/stable_profile.rb +12 -9
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 302e1a928fc81f6d35e7f00419d6def5389f84ffbee1a49c37d46268c0769fd0
4
- data.tar.gz: 172cc9fffbf9c3601328f23be2ed0c49551d9849131fdb8898f6117b04d99e1d
3
+ metadata.gz: 69f29fc4583e9a306a7aabbf1d9e267e924ea0be97ba6c3c592cc25899a9aa75
4
+ data.tar.gz: aba44a7c4cc527a500c8e547aeda1d51944e1f2da271df0aec434967f88d6e00
5
5
  SHA512:
6
- metadata.gz: dbf59497da62a1ded24a969a699baeb26819b974069db9bd0c126c8c4ea9acecf46b44822b851a39ccf511fc9ede30aaccaebb0dfca296bcd13525db8737db61
7
- data.tar.gz: f0f6877b89257b90aaca0868af3c5eb4209a2dbc007287de54a7e6aa19b3edbf6a73616bd878df52534eab03538d0ca56e81d3e0a67d6b63117087c5e7873c25
6
+ metadata.gz: d1374fbf762bed4ec91bc9207cd225546480bf68d4b94ce978277905d18360ee992aacad83cc19a45444f39ed9481263c7a831774cccbe9ec0b21f01288c7777
7
+ data.tar.gz: c761db15d550d213bc0d629874dc2f50acb693d58fba3b656eb841ae590d863f70fafb231bcbd82b37844ebf2ab5aa56a70724e3af0975a2b320b67224bb5773
@@ -12,12 +12,6 @@ module StableProfile
12
12
  # --iterations 10
13
13
  # --top-slowest-examples 10
14
14
 
15
- class String
16
- def bold
17
- "\e[1m#{self}\e[22m"
18
- end
19
- end
20
-
21
15
  module_function
22
16
 
23
17
  # How many items to output in each category.
@@ -35,7 +29,14 @@ module StableProfile
35
29
  OUTPUT_DIR = 'tmp/multi_profile'
36
30
 
37
31
 
32
+ def bold(string)
33
+ "\e[1m#{string}\e[22m"
34
+ end
35
+
36
+
38
37
  def run
38
+ puts "pwd = #{system('pwd')}"
39
+
39
40
  # Erase and Create the output directory
40
41
  FileUtils.rm_rf(OUTPUT_DIR)
41
42
  FileUtils.mkdir_p(OUTPUT_DIR)
@@ -48,7 +49,9 @@ module StableProfile
48
49
  end
49
50
 
50
51
  # Read the results from the JSON files into an array.
51
- outputs = Dir.glob("#{OUTPUT_DIR}/*.json").map { |file| JSON.parse(File.read(file)) }
52
+ outputs = Dir.glob("#{OUTPUT_DIR}/*.json").map do |file|
53
+ JSON.parse(File.read(file))
54
+ end
52
55
 
53
56
  # Extract the JSON profile structures from the full results.
54
57
  profile_blocks = outputs.map { |output| output.fetch('profile') }
@@ -89,7 +92,7 @@ module StableProfile
89
92
  example = record.fetch(:example)
90
93
 
91
94
  puts " #{example['full_description']}"
92
- puts " #{record[:average_time]} seconds".bold.ljust(27) + " (N=#{record[:run_times].size})".ljust(7) + " #{example['file_path']}:#{example['line_number']}"
95
+ puts bold(" #{record[:average_time]} seconds").ljust(27) + " (N=#{record[:run_times].size})".ljust(7) + " #{example['file_path']}:#{example['line_number']}"
93
96
  end
94
97
 
95
98
  puts
@@ -103,7 +106,7 @@ module StableProfile
103
106
  group = record.fetch(:group)
104
107
 
105
108
  puts " #{group['description']}"
106
- puts " #{record[:average_time]} seconds".bold.ljust(27) + " (N=#{record[:run_times].size})".ljust(7) + " #{group['location']}"
109
+ puts bold(" #{record[:average_time]} seconds").ljust(27) + " (N=#{record[:run_times].size})".ljust(7) + " #{group['location']}"
107
110
  end
108
111
  end
109
112
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stable_profile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robb Shecter