cake 0.4.2 → 0.4.3

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.
Files changed (4) hide show
  1. data/bin/cake +20 -10
  2. data/lib/bake.jar +0 -0
  3. data/lib/cake.jar +0 -0
  4. metadata +4 -4
data/bin/cake CHANGED
@@ -327,11 +327,15 @@ class JVM
327
327
  Process.kill(0, @pid) # make sure pid is valid
328
328
  TCPSocket.new("localhost", @port).close if @port # make sure jvm is running on port
329
329
 
330
- return if @version == $version
331
- Process.kill(TERM, @pid)
332
- reset!
330
+ if @version != $version
331
+ kill
332
+ reset!
333
+ end
333
334
  rescue Errno::ENOENT, Errno::ESRCH, Errno::ECONNREFUSED, Errno::EBADF, Process::Error => e
334
- log(:start, "defunct #{type} jvm") if debug? and e.kind_of?(Errno::ECONNREFUSED)
335
+ if e.kind_of?(Errno::ECONNREFUSED)
336
+ log(:start, "defunct #{type} jvm") if debug?
337
+ kill
338
+ end
335
339
  reset! # no pidfile or invalid pid or connection refused
336
340
  end
337
341
 
@@ -428,7 +432,11 @@ class JVM
428
432
  end
429
433
 
430
434
  def kill
431
- Process.kill($opts[:"9"] ? KILL : TERM, pid) if pid
435
+ return unless pid
436
+ signal = $opts[:"9"] ? KILL : TERM
437
+ log(:kill, "sending #{signal} signal to #{type} jvm") if debug?
438
+ Process.kill(signal, pid)
439
+ reset!
432
440
  end
433
441
 
434
442
  def files
@@ -615,14 +623,12 @@ private
615
623
  end
616
624
 
617
625
  class Cake < JVM
618
- attr_accessor :bakeport
619
-
620
626
  READLINE = "READLINE__#{rand}"
621
627
  def send_command(command)
622
628
  with_restart { FileUtils.remove_dir("lib/dev", true) } if $win and [:deps, :clean].include?(command)
623
629
 
624
630
  with_socket do |socket|
625
- cmd = [command, bakeport, READLINE].to_clj
631
+ cmd = [command, READLINE].to_clj
626
632
  log(command, "sending: " + cmd) if debug?
627
633
  socket.write("#{cmd} #{$vars}")
628
634
  socket.duplex($stdin, $stdout) do |line|
@@ -701,7 +707,7 @@ $cakedir = File.dirname(File.dirname(readlink(__FILE__)))
701
707
  $repo = "http://clojars.org/repo/cake/cake"
702
708
  $confdir = ".cake"
703
709
  $config = Configuration.new("#{$home}/.cake/config", ".cake/config")
704
- $vars = {:env => ENV.to_hash, :pwd => $pwd, :args => ARGV, :opts => $opts}.to_clj
710
+ $vars = {:env => ENV.to_hash, :pwd => $pwd, :args => ARGV, :opts => $opts, :script => $0}.to_clj
705
711
 
706
712
  Dir.chdir($bakedir)
707
713
  FileUtils.makedirs($confdir)
@@ -771,6 +777,11 @@ elsif $command == :kill
771
777
  elsif $command == :ps
772
778
  puts ps.sort.reverse
773
779
  exit
780
+ elsif $command == :restart and $opts[:restart] == ["project"]
781
+ log(:restart, "restarting bake jvm") if debug?
782
+ bake.kill
783
+ bake.init
784
+ exit
774
785
  elsif restart?
775
786
  cake.stop
776
787
  bake.stop
@@ -804,7 +815,6 @@ elsif [:start, :reload, :restart].include?($command)
804
815
  bake.ping
805
816
  end
806
817
  else
807
- cake.bakeport = bake.port
808
818
  if $command == :autotest
809
819
  cake.send_command(:autotest)
810
820
  interval = $opts[:autotest].last.to_i if $opts[:autotest]
Binary file
Binary file
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cake
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 2
10
- version: 0.4.2
9
+ - 3
10
+ version: 0.4.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Justin Balthrop
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-08-19 00:00:00 -07:00
19
+ date: 2010-08-20 00:00:00 -07:00
20
20
  default_executable: cake
21
21
  dependencies: []
22
22