pipemaster 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,4 +1,7 @@
1
- 0.4.1
1
+ 0.4.2 (2010-02-19)
2
+ * Fix: Pipe command exits with retcode on successful completion.
3
+
4
+ 0.4.1 (2010-02-19)
2
5
  * Added: Service control file in etc/pipemaster (puts this in your /etc/init.d directory)
3
6
  * Added: pipe command gets --retcode/-c option to return exit code in case of failure.
4
7
  * Added: Pipefile uses app { } for application loading block.
@@ -36,13 +36,13 @@ Step 1: Create a Pipemaster file. For example:
36
36
 
37
37
  Step 2: Fire up the Pipemaster server:
38
38
 
39
- $ pipemaster --server
39
+ $ pipemaster
40
40
  I, [2010-02-18T12:57:57.739230 #5460] INFO -- : master process ready
41
41
  I, [2010-02-18T12:57:57.739606 #5460] INFO -- : listening on addr=127.0.0.1:7887 fd=3
42
42
 
43
43
  Step 3: For a new shell, execute a command:
44
44
 
45
- $ echo "Stand down!" | ruby -Ilib bin/pipemaster echo upside
45
+ $ echo "Stand down!" | pipe echo upside
46
46
  Stand upside down!
47
47
 
48
48
 
data/bin/pipe CHANGED
@@ -5,7 +5,7 @@ require "optparse"
5
5
 
6
6
  ENV["PIPE_ENV"] ||= "development"
7
7
  address = nil
8
- ret_code = nil
8
+ retcode = nil
9
9
  tty = false
10
10
 
11
11
  opts = OptionParser.new("", 24, ' ') do |opts|
@@ -22,7 +22,7 @@ opts = OptionParser.new("", 24, ' ') do |opts|
22
22
  end
23
23
 
24
24
  opts.on("-c", "--retcode CODE", "return code in case of failure (default: raise exception)") do |r|
25
- ret_code = r
25
+ retcode = r
26
26
  end
27
27
 
28
28
  opts.on("-h", "--help", "Show this message") do
@@ -40,11 +40,8 @@ end
40
40
 
41
41
  begin
42
42
  input = $stdin if tty || !$stdin.isatty
43
- exit Pipemaster::Client.new(address).capture(input, $stdout).run(*ARGV)
43
+ retcode = Pipemaster::Client.new(address).capture(input, $stdout).run(*ARGV)
44
44
  rescue Exception=>ex
45
- if ret_code
46
- exit ret_code.to_i
47
- else
48
- raise
49
- end
45
+ raise unless retcode
50
46
  end
47
+ exit retcode.to_i
@@ -42,6 +42,7 @@ upgrade)
42
42
  status)
43
43
  sig 0 && echo >&2 "Running" && exit 0
44
44
  echo >&2 "Not running"
45
+ exit 1
45
46
  ;;
46
47
  *)
47
48
  echo >&2 "Usage: $0 <start|stop|status|restart|upgrade|force-stop>"
@@ -402,10 +402,10 @@ module Pipemaster
402
402
  ARGV.replace args
403
403
  command = commands[name.to_sym] or raise ArgumentError, "No command #{name}"
404
404
  command.call *args
405
- logger.info "#{Process.pid} completed"
405
+ logger.info "#{Process.pid} exit"
406
406
  socket.write 0.chr
407
407
  rescue SystemExit => ex
408
- logger.info "#{Process.pid} completed"
408
+ logger.info "#{Process.pid} exit with #{ex.status}"
409
409
  socket.write ex.status.chr
410
410
  rescue Exception => ex
411
411
  logger.info "#{Process.pid} failed: #{ex.message}"
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "pipemaster"
3
- spec.version = "0.4.1"
3
+ spec.version = "0.4.2"
4
4
  spec.author = "Assaf Arkin"
5
5
  spec.email = "assaf@labnotes.org"
6
6
  spec.homepage = "http://github.com/assaf/pipemaster"
@@ -60,10 +60,10 @@ class ServerTest < Test::Unit::TestCase
60
60
  end
61
61
 
62
62
  def test_return_code
63
- start :commands => { :success => lambda { "hi" }, :fail => lambda { fail }, :exit => lambda { exit 5 } }
63
+ start :commands => { :success => lambda { "hi" }, :fail => lambda { fail }, :exit => lambda { exit 8 } }
64
64
  assert_equal 0, hit("127.0.0.1:#@port", :success).first
65
65
  assert_equal 127, hit("127.0.0.1:#@port", :fail).first
66
- assert_equal 5, hit("127.0.0.1:#@port", :exit).first
66
+ assert_equal 8, hit("127.0.0.1:#@port", :exit).first
67
67
  end
68
68
 
69
69
  def test_exit
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pipemaster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Assaf Arkin
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-19 00:00:00 -08:00
12
+ date: 2010-02-20 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -51,7 +51,7 @@ licenses: []
51
51
  post_install_message: To get started run pipemaster --help
52
52
  rdoc_options:
53
53
  - --title
54
- - Pipemaster 0.4.1
54
+ - Pipemaster 0.4.2
55
55
  - --main
56
56
  - README.rdoc
57
57
  - --webcvs