appear 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9681e2caa004fa47ac9de625c11820765c0d989
4
- data.tar.gz: a8a034aa39551ed9310040e79785b198da7471e9
3
+ metadata.gz: 2195b39f50d42701282eccd5bcca70318d9522d6
4
+ data.tar.gz: c26570e72fae4f929d5c715510d64f671c2dc8ab
5
5
  SHA512:
6
- metadata.gz: 3e1c8106d98906c6a873ce0f767c715e3a6501717c8bd149df3688d3ca1c7a4a0275486d2da2d11f177aa846511d6fac6fb696bfdce835c7f98e1aaf2e6c6b80
7
- data.tar.gz: 664bd25942f049a19902d3a9e34724b6910dd0a01ec3901affe77a7ee8d5b072168ad47f4fc8a38051ccdbda8e9a967317b7ca5a46c2f53aafbe97ebc566d4a7
6
+ metadata.gz: dd03024e868fdeb5a6d19da9d07e7c4387fab5002ebfd9b7a1ff884e4620750c6cbf67cd9273e7c18b208c63914e7b8c93efeccbae52b7552827de880fc4f5a3
7
+ data.tar.gz: 0d4d9a852ed5477fd9cac3b537ec26740292b3c31220ccdc95248995c98ec5bb833921c00edf086da9bf1f668ed5fad6015f6d26279b23dcf4beb0db5da4cd3b
data/CHANGELOG.md CHANGED
@@ -1,8 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.0
4
+
5
+ - You no longer have to pass a PID. If no PID is given, `appear` will default
6
+ to the current process.
7
+ - by default, `appear` will print no output. Pass -v or --verbose for timing
8
+ and logging information. It previously printed the PID and timing
9
+ information by default, and then more extensive logs with --verbose.
10
+ - improved help output
11
+ - added --version command line option
12
+
3
13
  ## 1.0.3
4
14
 
5
- remove some binding.pry that really shouldn't have been there
15
+ - remove some binding.pry that really shouldn't have been there
6
16
 
7
17
  ## 1.0.2
8
18
 
data/README.md CHANGED
@@ -23,16 +23,23 @@ currently only supports macOS.
23
23
  ## usage
24
24
 
25
25
  ```
26
- Usage: appear [options] PID - appear PID in your user interface
26
+ Usage: appear [OPTION]... [PID]
27
+ Appear PID in your user interface.
28
+ Appear will use the current process PID by default.
29
+
30
+ Options:
27
31
  -l, --log-file [PATH] log to a file
28
32
  -v, --verbose tell many tales about how the appear process is going
29
- --record-runs record every executed command as a JSON file
33
+ --record-runs record every executed command as a JSON file in the appear spec folder
34
+ --version show version information, then exit
35
+ -?, -h, --help show this help, then exit
36
+
37
+ Exit status:
38
+ 0 if successfully revealed something,
39
+ 1 if an exception occured,
40
+ 2 if there were no errors, but nothing was revealed.
30
41
  ```
31
42
 
32
- Appear will exit 0 if it managed to reveal something.
33
- Appear will exit 1 if an exception occured.
34
- Appear will exit 2 if there were no errors, but nothing was revealed.
35
-
36
43
  ## supported terminal emulators
37
44
 
38
45
  macOS:
@@ -15,7 +15,12 @@ module Appear
15
15
 
16
16
  def option_parser
17
17
  @option_parser ||= OptionParser.new do |o|
18
- o.banner = 'Usage: appear [options] PID - appear PID in your user interface'
18
+ o.banner = 'Usage: appear [OPTION]... [PID]'
19
+ o.separator 'Appear PID in your user interface.'
20
+ o.separator 'Appear will use the current process PID by default.'
21
+ o.separator ''
22
+ o.separator 'Options:'
23
+
19
24
  o.on('-l', '--log-file [PATH]', 'log to a file') do |file|
20
25
  @config.log_file = file
21
26
  end
@@ -24,26 +29,47 @@ module Appear
24
29
  @config.silent = false if flag
25
30
  end
26
31
 
27
- o.on('--record-runs', 'record every executed command as a JSON file') do |flag|
32
+ o.on('--record-runs', 'record every executed command as a JSON file in the appear spec folder') do |flag|
28
33
  @config.record_runs = flag
29
34
  end
35
+
36
+ o.on('--version', 'show version information, then exit') do
37
+ puts "appear #{Appear::VERSION}"
38
+ puts " author: Jake Teton-Landis"
39
+ puts " repo: https://github.com/airbnb/appear"
40
+ exit 2
41
+ end
42
+
43
+ o.on('-?', '-h', '--help', 'show this help, then exit') do
44
+ puts o
45
+ exit 2
46
+ end
47
+
48
+ o.separator ''
49
+ o.separator 'Exit status:'
50
+ o.separator ' 0 if successfully revealed something,'
51
+ o.separator ' 1 if an exception occured,'
52
+ o.separator ' 2 if there were no errors, but nothing was revealed.'
30
53
  end
31
54
  end
32
55
 
56
+ # @param all_args [Array<String>] something like ARGV
33
57
  def execute(all_args)
34
- argv = option_parser.parse!(all_args)
58
+ argv = option_parser.parse(*all_args)
59
+
60
+ pid = Integer(argv[0] || Process.pid, 10)
35
61
 
36
- pid = argv[0].to_i
37
- if pid == 0
38
- raise InvalidPidError.new("Invalid PID #{argv[0].inspect} given (parsed to 0).")
62
+ start_message = "STARTING. pid: #{pid}"
63
+ if argv.empty?
64
+ start_message += " (current process pid)"
39
65
  end
40
66
 
41
67
  start = Time.now
42
68
  revealer = Appear::Instance.new(@config)
43
- revealer.output("STARTING. pid: #{pid}")
69
+ revealer.log(start_message)
44
70
  result = revealer.call(pid)
45
71
  finish = Time.now
46
- revealer.output("DONE. total time: #{finish - start} seconds, success: #{result}")
72
+ revealer.log("DONE. total time: #{finish - start} seconds, success: #{result}")
47
73
 
48
74
  if result
49
75
  # success! revealed something!
@@ -1,7 +1,7 @@
1
1
  require 'pathname'
2
2
 
3
3
  module Appear
4
- VERSION = '1.0.3'
4
+ VERSION = '1.1.0'
5
5
 
6
6
  # root error for our library; all other errors inherit from this one.
7
7
  class Error < StandardError; end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appear
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Teton-Landis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-09 00:00:00.000000000 Z
11
+ date: 2016-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler