stable_profile 0.3.0 → 0.4.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72cdf56228644321ee03613558301f8779ce0cb750f57f22635211f8e0b8eae0
4
- data.tar.gz: 6ba45c85f9b6b143d26805a24712d974c591261bf815e44df380e48d9fac5ac6
3
+ metadata.gz: 69f29fc4583e9a306a7aabbf1d9e267e924ea0be97ba6c3c592cc25899a9aa75
4
+ data.tar.gz: aba44a7c4cc527a500c8e547aeda1d51944e1f2da271df0aec434967f88d6e00
5
5
  SHA512:
6
- metadata.gz: a6d61a57dd4b91a4cab8ea1c4e357dbc02215c66611af3ebd17bd4046f8286d6b25903b544bda350ef739945564d3963f421c50f52f990145102d506501353b7
7
- data.tar.gz: 04f0a46f63b4bfd0b0a7c2bfc0c12f5d30b5756ec8be32978d69cc84ec10be4ef4d387bf26c07023ef8bf1da4f77f837e72c748ce46633460186d8a5a47899be
6
+ metadata.gz: d1374fbf762bed4ec91bc9207cd225546480bf68d4b94ce978277905d18360ee992aacad83cc19a45444f39ed9481263c7a831774cccbe9ec0b21f01288c7777
7
+ data.tar.gz: c761db15d550d213bc0d629874dc2f50acb693d58fba3b656eb841ae590d863f70fafb231bcbd82b37844ebf2ab5aa56a70724e3af0975a2b320b67224bb5773
@@ -1,4 +1,6 @@
1
1
  require 'thor'
2
+ require 'stable_profile'
3
+
2
4
 
3
5
  module StableProfile
4
6
  class CLI < Thor
@@ -4,6 +4,7 @@ require 'fileutils'
4
4
  require 'json'
5
5
  require 'ruby-progressbar'
6
6
 
7
+
7
8
  module StableProfile
8
9
  class Error < StandardError; end
9
10
 
@@ -11,12 +12,6 @@ module StableProfile
11
12
  # --iterations 10
12
13
  # --top-slowest-examples 10
13
14
 
14
- class String
15
- def bold
16
- "\e[1m#{self}\e[22m"
17
- end
18
- end
19
-
20
15
  module_function
21
16
 
22
17
  # How many items to output in each category.
@@ -34,7 +29,14 @@ module StableProfile
34
29
  OUTPUT_DIR = 'tmp/multi_profile'
35
30
 
36
31
 
32
+ def bold(string)
33
+ "\e[1m#{string}\e[22m"
34
+ end
35
+
36
+
37
37
  def run
38
+ puts "pwd = #{system('pwd')}"
39
+
38
40
  # Erase and Create the output directory
39
41
  FileUtils.rm_rf(OUTPUT_DIR)
40
42
  FileUtils.mkdir_p(OUTPUT_DIR)
@@ -47,7 +49,9 @@ module StableProfile
47
49
  end
48
50
 
49
51
  # Read the results from the JSON files into an array.
50
- 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
51
55
 
52
56
  # Extract the JSON profile structures from the full results.
53
57
  profile_blocks = outputs.map { |output| output.fetch('profile') }
@@ -88,7 +92,7 @@ module StableProfile
88
92
  example = record.fetch(:example)
89
93
 
90
94
  puts " #{example['full_description']}"
91
- 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']}"
92
96
  end
93
97
 
94
98
  puts
@@ -102,7 +106,7 @@ module StableProfile
102
106
  group = record.fetch(:group)
103
107
 
104
108
  puts " #{group['description']}"
105
- 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']}"
106
110
  end
107
111
  end
108
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.3.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robb Shecter