snooper 0.1.1 → 0.1.2

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: 33a03916304ce2358c800167e7da1210292763f9
4
- data.tar.gz: baefb42d770b614581de477473e1cbf76694495e
3
+ metadata.gz: 639959cfe2996f00f5bd6976df7d9b5fcf85fa5b
4
+ data.tar.gz: 516550f8991ab1a1342df9a850284d7f9dfaa2f9
5
5
  SHA512:
6
- metadata.gz: e912b9a42729048baed4f817a20a1ea2931eca59e047b48aa1b994577a54791376a0fa1f3b1bd2ca0011647abbc7cc78c2f97f36b5350485f72ad3a1e8f7e527
7
- data.tar.gz: 4605662ee5e03bfa4f7a5d484fc08c18bb4410974ee4fd8d7782ae7d14a69faba501b4edd2db1358141ee3a8b4e4196d6ebad2c51f09431b5feffebbcc56913c
6
+ metadata.gz: 6d870d3135e8a14f9acc8e2392267ee37d0b5ef1f1fa2c9bae8304c55906c80e283ddbda99f58c797e899aa1528a84e677b059ead3e4330fc0fc5146618163bb
7
+ data.tar.gz: 4f0479712a392d3d3fd64ffc56087552c0f00908dd2ce3972d963c1a385c3c837b9b7ca6397c9cbc9a7ed0fbb0a7842382c1e1f634a19c39449484e3279db0b5
data/lib/snooper/snoop.rb CHANGED
@@ -35,6 +35,19 @@ module Snooper
35
35
  @command = args[:command]
36
36
  end
37
37
 
38
+ ##
39
+ # Time Command
40
+ #
41
+ # Run a command and time how long it takes. The exit status of the command
42
+ # and the time taken to run the command are both returned.
43
+
44
+ def time_command(command)
45
+ before = Time.new
46
+ result = system command
47
+ after = Time.new
48
+ return result, after - before
49
+ end
50
+
38
51
  ##
39
52
  # Change callback
40
53
  #
@@ -55,10 +68,11 @@ module Snooper
55
68
  puts "#{statusline} #{changes.length.to_s.magenta.bold} changes"
56
69
 
57
70
  # run the test suite and check the result
58
- if system @command then
59
- puts statusbar "✓ All tests passed", &:white_on_green
71
+ res, time = time_command @command
72
+ if res then
73
+ puts statusbar "✓ All tests passed (#{time}s)", &:white_on_green
60
74
  else
61
- puts statusbar "✗ Tests failed", &:white_on_red
75
+ puts statusbar "✗ Tests failed (#{time}s)", &:white_on_red
62
76
  end
63
77
 
64
78
  # return to listening
@@ -6,5 +6,5 @@ module Snooper
6
6
  # This should conform to SemVer. If this is changed it should be the only
7
7
  # thing that changes in the comit.
8
8
 
9
- VERSION = '0.1.1'
9
+ VERSION = '0.1.2'
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snooper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Speak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-04 00:00:00.000000000 Z
11
+ date: 2013-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored
@@ -84,10 +84,8 @@ files:
84
84
  - lib/snooper/version.rb
85
85
  - lib/snooper.rb
86
86
  - bin/snooper
87
- - man/snooper-config.7
88
87
  - man/snooper-config.7.html
89
88
  - man/snooper-config.7.ronn
90
- - man/snooper.1
91
89
  - man/snooper.1.html
92
90
  - man/snooper.1.ronn
93
91
  - LICENCE.md
data/man/snooper-config.7 DELETED
@@ -1,44 +0,0 @@
1
- .\" generated with Ronn/v0.7.3
2
- .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
- .
4
- .TH "SNOOPER\-CONFIG" "7" "June 2013" "" ""
5
- .
6
- .SH "NAME"
7
- \fBsnooper\-config\fR \- Configure for Espionage
8
- .
9
- .SH "DESCRIPTION"
10
- Configuration of \fBsnooper\fR is controlled through a YAML file\.
11
- .
12
- .SH "FORMAT"
13
- snooper(1) expects a YAML document of key\-value pairs; each pair specifies an option\. Unknown options are ignored\. Options that can contain a list of values may also be given a single value\.
14
- .
15
- .SH "OPTIONS"
16
- String options
17
- .
18
- .TP
19
- \fBbase_path:\fR \fIdirectory\fR
20
- Specifies the \fIdirectory\fR that \fBsnooper\fR should base all relative paths from\. This is also the working directory that commands will inherit\.
21
- .
22
- .TP
23
- \fBcommand:\fR \fIcommand_string\fR
24
- Specifies the command string to execute when a file change is detected\.
25
- .
26
- .P
27
- String Array options
28
- .
29
- .TP
30
- \fBpaths:\fR \fIdirectories\fR
31
- Specifies a list of \fIdirectories\fR to watch\. Directories can be either relative or absolute paths\. If no paths are specified the default is to watch \fBbase_path\fR\.
32
- .
33
- .TP
34
- \fBfilters:\fR \fIfilters\fR, \fBignored:\fR \fIfilters\fR
35
- Specifies a list of regular expressions \fIfilters\fR to use to filter the changes\. These should be in a format understood by ruby(1)\'s Regex\.new method\. If none are given then all changes in watched directories trigger testing\.
36
- .
37
- .IP
38
- \fINote\fR: as these are regular expressions \fB\e\.c\fR will match both \fBfoo\.c\fR and \fBbar\.cfg\fR, \fB\e\.c$\fR will only match \fB\.c\fR files\.
39
- .
40
- .SH "SEE ALSO"
41
- snooper(1)
42
- .
43
- .SH "AUTHORS"
44
- Will Speak (@willspeak)
data/man/snooper.1 DELETED
@@ -1,45 +0,0 @@
1
- .\" generated with Ronn/v0.7.3
2
- .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
- .
4
- .TH "SNOOPER" "1" "June 2013" "" ""
5
- .
6
- .SH "NAME"
7
- \fBsnooper\fR \- Spy on Tests
8
- .
9
- .SH "SYNOPSIS"
10
- \fBsnooper\fR \fIoptions\fR [\fIcommand_line\fR]*
11
- .
12
- .SH "DESCRIPTION"
13
- \fBSnooper\fR is a lightweight test automation tool, it monitors files and folders while you work and re\-runs your tests when you change something\. Snooper doesn\'t care what language you\'re using or what framework you are testing with, it\'s all configureable\.
14
- .
15
- .SH "OPTIONS"
16
- Most configuration takes place in the snooper\-config(7) file\. You can however override the command that is run\. This is useful if you are only working on a subsection of a project that has it\'s own tests\.
17
- .
18
- .TP
19
- \fB\-c\fR, \fB\-\-config\fR \fIconfigfile\fR
20
- Specify the configuration file to use\. The default is \fB\.snooper\.yaml\fR in the current directory\.
21
- .
22
- .TP
23
- \fIcommand_line\fR
24
- One or more \fIcommand_line\fRs to execute when source files change\. Overides any commands specified in the configuration file\.
25
- .
26
- .SH "EXAMPLES"
27
- \fB$ snooper\fR
28
- .
29
- .P
30
- To run snooper in the current directory, configured by the \fB\.snooper\.yaml\fR file\.
31
- .
32
- .P
33
- \fB$ snooper \-\-config snooperrc "echo Hello World!"\fR
34
- .
35
- .P
36
- To snoop using the cofiguration in \fIsnooperrc\fR executing \fBecho Hello World!\fR when files change\.
37
- .
38
- .SH "BUGS"
39
- Think you\'ve found a bug? Report it \fIhttp://github\.com/iwillspeak/snooper/issues\fR\.
40
- .
41
- .SH "SEE ALSO"
42
- snooper\-config(7)
43
- .
44
- .SH "AUTHORS"
45
- Will Speak (@willspeak)