autoreporter 0.0.20230707.1 → 0.0.20240602.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/autoreporter +2 -0
  3. data/lib/autoreporter.rb +8 -1
  4. metadata +16 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3057aa188265ad6b9f00bbebf4c411283d3816ff78d86f2f00e563dd6aedbf39
4
- data.tar.gz: 47f294af68aadb949727f68fd72c4794d6a4e38d25e4780e0c1c5b2f3214f607
3
+ metadata.gz: 9db2e4b822831363eb0fef3a80581770292bfe6a9bd20d58aa5777ab91255dca
4
+ data.tar.gz: 13535d5baac9b3b00ff4e00811dbd763b92745a6e90586b962e78d9231f24940
5
5
  SHA512:
6
- metadata.gz: dfe52569e56154cbb9848474257affd8b9fc18d2327af6c09b34ac01d2577ee634c2df41a5523a357102f912fca741618a96ecbef0af613e328d5c56ada18ae9
7
- data.tar.gz: 22abcd5ce7c2d1bee06faafa9ea5d5b5f1efa8ffa932ed24e896529c16b879022778b206f8b8a99ddc574a3fc8cd228124cbb191a56af82a42d99e9e9a637f91
6
+ metadata.gz: d9aa68ab3f363b2524209846dd309908ddbc12ca01c5631a7d5222ef10229013361cb9eba366c4f44877691b9492b58a74e28b4eb9e69079f91b8b0956edd79b
7
+ data.tar.gz: 3f7690eb031254666107fdb2379b349e6bc64843e1a9d1b509a6a999240662cfc61d0d3600f9e9a2504fc6f586bcb2a8ed403e9a341d894833c91a00f5ad0958
data/bin/autoreporter CHANGED
@@ -7,6 +7,7 @@ opts = Optimist::options do
7
7
  opt :delay, "delay between autorefleshes", type: :integer, default: 60
8
8
  opt :cmd, "Command to run", type: :string, multi: true
9
9
  opt :verbose, "verbose mode", default: false
10
+ opt :file, "Also save to file", type: :string
10
11
  end
11
12
 
12
13
  opts[:cmd] << ARGV.shelljoin unless ARGV.empty?
@@ -20,4 +21,5 @@ ar = Autoreporter.new
20
21
  ar.commands = opts[:cmd]
21
22
  ar.delay = opts[:delay]
22
23
  ar.verbose = opts[:verbose]
24
+ ar.file = opts[:file]
23
25
  ar.call
data/lib/autoreporter.rb CHANGED
@@ -1,15 +1,17 @@
1
1
  require "open3"
2
2
  require "shellwords"
3
3
  require "timeout"
4
+ require "strings-ansi"
4
5
 
5
6
  class Autoreporter
6
- attr_accessor :delay, :commands, :verbose
7
+ attr_accessor :delay, :commands, :verbose, :file
7
8
 
8
9
  def initialize
9
10
  @output = nil
10
11
  @delay = 60
11
12
  @verbose = false
12
13
  @commands = []
14
+ @file = nil
13
15
  end
14
16
 
15
17
  def run_command(cmd)
@@ -31,6 +33,11 @@ class Autoreporter
31
33
  def display_result!
32
34
  clear_terminal!
33
35
  puts *@output
36
+ if @file
37
+ open(@file, "w") do |f|
38
+ f.puts *@output.map{|s| Strings::ANSI.sanitize(s)}
39
+ end
40
+ end
34
41
  end
35
42
 
36
43
  # Wait for either @delay seconds
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoreporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20230707.1
4
+ version: 0.0.20240602.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Wegrzanowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-07 00:00:00.000000000 Z
11
+ date: 2024-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: optimist
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: strings-ansi
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rspec
29
43
  requirement: !ruby/object:Gem::Requirement