explorer 0.0.3 → 0.0.4

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: 6868f036ef96d91102731a1f805024563e7a8e84
4
- data.tar.gz: 2072dfb48e958eb3800b0a3179e82af2c53d6153
3
+ metadata.gz: 98c521d0a44b160340aada8309f8dd0d477a5ed1
4
+ data.tar.gz: 914098ac5bf5a11069543362fa6784cbbb69a283
5
5
  SHA512:
6
- metadata.gz: ce3d4c72345746c75b82294c9e860bdc4bc89436991d79c32bac09778198e7da978699d098c38eaaecee66854a2b244e310fe83e52e22768d0ad0c63aaea544f
7
- data.tar.gz: 358e8b32723334191182b56f87b6c066628b52123ea1c6f23086c4c8a1dc035179c0a243299e396fd80e1bec1d8a3c950171f9cb83c0d3b8b268475c3cbe9802
6
+ metadata.gz: ea0b143c3fd4db514d9151bdaa3fdf79020169cdd1716c31c518d9ffcd7a77f1dea2f791136dbe5de8e5a50c4afe36b8a54e9df648eceb751dfbc5018888d12a
7
+ data.tar.gz: 803f6d1d50a28a59fef4e0d485ed7ea7554561db0d54210fdacd2d2a6f8bd6e8d33e22299f8c63afe0ef59ea930444ebf6d4b217d0498d8b3e947b4727d730fd
data/README.md CHANGED
@@ -11,6 +11,16 @@ Install it yourself as:
11
11
 
12
12
  $ gem install explorer
13
13
 
14
+ `.dev` domain support can be installed with:
15
+
16
+ $ explore setup install
17
+
18
+ And uninstalled with:
19
+
20
+ $ explore setup uninstall
21
+
22
+ This will override Invoker or Pow! installation files.
23
+
14
24
  ## Usage
15
25
 
16
26
  Run the following command to start up the server
@@ -9,6 +9,7 @@ module Explorer
9
9
  Celluloid.logger = nil # Silence celluloid
10
10
 
11
11
  ipc = IPCClient.new
12
+ trap(:INT) { Thread.new { ipc.shutdown }.join }
12
13
  ipc.tail
13
14
  rescue Errno::ENOENT
14
15
  puts Rainbow('Explore is not running').color(:red).bright
@@ -44,9 +44,10 @@ module Explorer
44
44
  @socket.puts msg.to_json
45
45
 
46
46
  loop do
47
- line = @socket.readline
47
+ line = @socket.gets
48
48
  io.puts line
49
49
  end
50
+ rescue IOError
50
51
  end
51
52
 
52
53
  def cmd_add(label, cmd, dir=nil)
@@ -1,35 +1,41 @@
1
+ require 'rainbow'
2
+
1
3
  module Explorer
2
4
  class LogWatcher
5
+ COLORS = [:red, :green, :yellow, :blue, :magenta, :cyan]
6
+ include Celluloid
7
+
3
8
  def initialize
4
9
  @watchers = []
5
- @mutex = Mutex.new
10
+ @label_colors = {}
6
11
  end
7
12
 
8
- # TODO: terminate
9
-
10
13
  def add(watcher)
11
- @mutex.synchronize do
12
- @watchers << watcher
13
- end
14
+ @watchers << watcher
14
15
  end
15
16
 
16
17
  def remove(watcher)
17
- @mutex.synchronize do
18
- @watcher.close
19
- @watchers.delete watcher
20
- end
18
+ watcher.close unless watcher.closed?
19
+ @watchers.delete watcher
21
20
  end
22
21
 
23
22
  def log(label, line)
24
- @mutex.synchronize do
25
- @watchers.each do |watcher|
26
- begin
27
- watcher.puts "#{label}: #{line}"
28
- rescue
29
- remove(watcher)
30
- end
23
+ @watchers.each do |watcher|
24
+ begin
25
+ color = @label_colors[label] ||= next_color
26
+ watcher.puts Rainbow(label).color(color).bright + " : " + line
27
+ rescue => e
28
+ remove(watcher)
31
29
  end
32
30
  end
33
31
  end
32
+
33
+ private
34
+
35
+ def next_color
36
+ color = COLORS.shift
37
+ COLORS.push color
38
+ color
39
+ end
34
40
  end
35
41
  end
@@ -33,7 +33,7 @@ module Explorer
33
33
  def terminate
34
34
  @group.terminate if @group
35
35
  @process_manager.terminate if @process_manager
36
- # TODO: @log_watcher.terminate if @log_watcher
36
+ @log_watcher.terminate if @log_watcher
37
37
  end
38
38
 
39
39
  def run!
@@ -1,3 +1,3 @@
1
1
  module Explorer
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: explorer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Peters
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-09 00:00:00.000000000 Z
11
+ date: 2015-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler