colortail 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Changelog.markdown CHANGED
@@ -1,3 +1,6 @@
1
+ ### colortail 0.1.2 2010-04-19
2
+ * Added multi-threading to allow for tailing multiple files
3
+
1
4
  ### colortail 0.1.1 2010-04-19
2
5
 
3
6
  * Fixed help menu to work properly
data/README.markdown CHANGED
@@ -15,20 +15,56 @@ By default, ColorTail does absolutely nothing other than just tail a file normal
15
15
 
16
16
  ## Conifguring ColorTail ##
17
17
 
18
- Configuring ColorTail is easy. In your home directory, create a file .colortailrc. This file will contain a group of ruby arrays similar to the ones laid out in the example config **examples/colortail.rb**. These arrays are called groups. Any group can be loaded via the command line using the **-g** switch (more on this below).
18
+ Configuring ColorTail is easy. In your home directory, create a file .colortailrc. This file will contain a group of ruby arrays similar to the ones laid out in the example config [examples/colortail.rb](http://www.codaset.com/elubow/colortail/source/master/blob/examples/colortail.rb). These arrays are called groups. Any group can be loaded via the command line using the **-g** switch (more on this below).
19
19
 
20
20
  The standard configuration file is **.colortailrc**. It needs to be in the format of a Ruby hash.
21
21
 
22
+ The full list of choices for colors and combinations are listed below.
23
+
24
+ #### Colors ####
25
+
26
+ * none - Yes you can have no color. This means display normally.
27
+ * black
28
+ * red
29
+ * green
30
+ * yellow
31
+ * blue
32
+ * magenta - (purple-ish)
33
+ * cyan
34
+ * white
35
+
36
+ #### Attributes ####
37
+
38
+ * bright
39
+ * dim
40
+ * underscore
41
+ * blink
42
+ * reverse
43
+ * hidden - simply don't show the text
44
+
45
+ ### Configuration Example ###
46
+
47
+ The example given in the configuration file is good for tailing a syslog file that has lines that are naemd with their syslog level. There are a lot of potential uses. Check the wiki page of [example groupings](http://www.codaset.com/elubow/colortail/wiki/example-groupings) to see how others are using ColorTail.
48
+
22
49
  ## Usage ##
23
50
 
24
- Using ColorTail is similar to using tail. The main assumption is that you will always be _indefinitely_ tail'ing a file. Currently ColorTail only allows for tailing 1 file.
51
+ Using ColorTail is similar to using tail. The main assumption is that you will always be _indefinitely_ tail'ing a file.
25
52
 
26
53
  #### Tailing with groups
27
54
 
28
- The command below will tail the **/var/log/messages** file using the syslog group. The example config **examples/colortail.rb** shows a _syslog_ grouping that is used in command below:
55
+ The command below will tail the **/var/log/messages** file using the syslog group. The example config [examples/colortail.rb](http://www.codaset.com/elubow/colortail/source/master/blob/examples/colortail.rb) shows a _syslog_ grouping that is used in command below:
29
56
 
30
57
  # colortail -g syslog /var/log/messages
31
58
 
59
+ ## Caveats and Intended Behaviors ##
60
+
61
+ ColorTail intentionally does not die when a file specified on the command line doesn't exist.
62
+
63
+ ## Additionial Information ##
64
+
65
+ * Homepage: [http://www.codaset.com/elubow/colortail](http://www.codaset.com/elubow/colortail)
66
+ * Wiki: [Home](http://www.codaset.com/elubow/colortail/wiki)
67
+
32
68
  ## Author ##
33
69
 
34
70
  Eric Lubow <eric at lubow dot org>
data/TODO.markdown CHANGED
@@ -1,5 +1,6 @@
1
1
  * General
2
- * Added multithreading to allow for tailing multiple files simultaneously
2
+ * Allow different groupings per file
3
+ * Allow multiple color groupings per file
3
4
 
4
5
  * Add Testing
5
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/colortail.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{colortail}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Eric Lubow"]
@@ -15,8 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.email = %q{eric@lubow.org}
16
16
  s.executables = ["colortail"]
17
17
  s.extra_rdoc_files = [
18
- "ChangeLog.markdown",
19
- "LICENSE",
18
+ "LICENSE",
20
19
  "README.markdown"
21
20
  ]
22
21
  s.files = [
data/lib/colortail.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'rubygems'
2
+ require 'thread'
2
3
  require 'file/tail'
3
4
 
4
5
  dir = File.dirname(__FILE__) + '/colortail'
@@ -39,13 +39,30 @@ module ColorTail
39
39
  logger.add_color_matcher( @match_group )
40
40
  end
41
41
 
42
+
43
+ # Create a thread for each file
44
+ threads = []
45
+ files.each do |file|
46
+ threads[files.index(file)] = Thread.new {
47
+ tailer = ColorTail::TailFile.new( file )
48
+
49
+ # First display the last 10 lines of each file in ARGV
50
+ tailer.interval = 10
51
+ tailer.backward( 10 )
42
52
 
43
- # XXX TODO Just tail the first file
44
- tailer = ColorTail::TailFile.new( files[0] )
45
- tailer.interval = 10
46
- tailer.backward( 10 )
47
- tailer.tail { |line| logger.log( files[0], line ) }
53
+ # Tail the file and show new lines
54
+ tailer.tail { |line| logger.log( file, line ) }
55
+ }
56
+ end
57
+
58
+ # Let the threads do their real work
59
+ threads.each do |thread|
60
+ thread.join
61
+ end
62
+
48
63
  end
64
+
65
+ return 0
49
66
  end
50
67
  end
51
68
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colortail
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
  - Eric Lubow
@@ -39,7 +39,6 @@ executables:
39
39
  extensions: []
40
40
 
41
41
  extra_rdoc_files:
42
- - ChangeLog.markdown
43
42
  - LICENSE
44
43
  - README.markdown
45
44
  files:
@@ -59,7 +58,6 @@ files:
59
58
  - lib/colortail/configuration.rb
60
59
  - test/helper.rb
61
60
  - test/test_colortail.rb
62
- - ChangeLog.markdown
63
61
  has_rdoc: true
64
62
  homepage: http://codaset.com/elubow/colortail
65
63
  licenses: []
data/ChangeLog.markdown DELETED
@@ -1,7 +0,0 @@
1
- ### colortail 0.1.1 2010-04-19
2
-
3
- * Fixed help menu to work properly
4
-
5
- ### colortail 0.1.0 2010-04-19
6
-
7
- * Initial release