autoreporter 0.0.20190730.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 +11 -1
  4. metadata +21 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d71b90746ea28c8830d076e0c5a9f2bd42a68015185c32d7aa58cf71b894f5a
4
- data.tar.gz: 51a31a0f6e1dd0dde5d5080d53c25d3fa98493d0ddbb9634d3240b34581da5c8
3
+ metadata.gz: 9db2e4b822831363eb0fef3a80581770292bfe6a9bd20d58aa5777ab91255dca
4
+ data.tar.gz: 13535d5baac9b3b00ff4e00811dbd763b92745a6e90586b962e78d9231f24940
5
5
  SHA512:
6
- metadata.gz: 465564668f4822696ed203e4606d6af26da94af5fee8907eabe6b7f24fabd5acf8857d5c5c93dc8645e0cfcfcd3a0ad6b54a848bf34efe429ce8db45bbe9a1d7
7
- data.tar.gz: c4820e76de7ddbc1ad804c2e13f178573453ec539e90e7ee5c16a5d1f3d0ed75824b4980bf2a3a783d80051cb3d8d1a12a6d60a7c63a31144afae9a9b9a24a09
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
@@ -50,5 +57,8 @@ class Autoreporter
50
57
  display_result!
51
58
  wait_for_condition!
52
59
  end
60
+ rescue Interrupt
61
+ # Allow clean exit for Ctrl-C
62
+ return
53
63
  end
54
64
  end
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.20190730.1
4
+ version: 0.0.20240602.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Wegrzanowski
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-30 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
@@ -52,7 +66,7 @@ dependencies:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
- description:
69
+ description:
56
70
  email: Tomasz.Wegrzanowski@gmail.com
57
71
  executables:
58
72
  - autoreporter
@@ -65,7 +79,7 @@ homepage: https://github.com/taw/autoreporter
65
79
  licenses:
66
80
  - MIT
67
81
  metadata: {}
68
- post_install_message:
82
+ post_install_message:
69
83
  rdoc_options: []
70
84
  require_paths:
71
85
  - lib
@@ -80,8 +94,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
94
  - !ruby/object:Gem::Version
81
95
  version: '0'
82
96
  requirements: []
83
- rubygems_version: 3.0.3
84
- signing_key:
97
+ rubygems_version: 3.3.26
98
+ signing_key:
85
99
  specification_version: 4
86
100
  summary: Command line report runner
87
101
  test_files: []