cake 0.5.8 → 0.6.0
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/bin/cake +113 -235
- data/lib/bake.jar +0 -0
- data/lib/cake.jar +0 -0
- metadata +7 -7
data/bin/cake
CHANGED
@@ -23,7 +23,7 @@ if RUBY_PLATFORM =~ /(mingw|mswin)(32|64)$/
|
|
23
23
|
$win = true
|
24
24
|
|
25
25
|
def daemon(cmd)
|
26
|
-
Process.create(:app_name => cmd).process_id
|
26
|
+
Process.create(:app_name => cmd.join(' ')).process_id
|
27
27
|
end
|
28
28
|
else
|
29
29
|
TERM = 'TERM'
|
@@ -33,14 +33,14 @@ else
|
|
33
33
|
|
34
34
|
class Process::Error; end
|
35
35
|
def daemon(cmd)
|
36
|
-
puts cmd if debug?
|
36
|
+
puts cmd.join(' ') if debug?
|
37
37
|
pid = fork do
|
38
38
|
if not $stdin.tty?
|
39
39
|
$stdout.close
|
40
40
|
$stderr.close
|
41
41
|
end
|
42
42
|
Process.setsid
|
43
|
-
exec(cmd)
|
43
|
+
exec(*cmd)
|
44
44
|
end
|
45
45
|
Process.detach(pid)
|
46
46
|
pid
|
@@ -55,11 +55,17 @@ class IO
|
|
55
55
|
break if c == delim
|
56
56
|
end
|
57
57
|
line
|
58
|
-
rescue Errno::EAGAIN, Errno::EWOULDBLOCK, EOFError
|
58
|
+
rescue Errno::EAGAIN, Errno::EWOULDBLOCK, EOFError => e
|
59
|
+
@eof_reached = true if e.is_a?(EOFError)
|
59
60
|
line
|
60
61
|
end
|
61
62
|
|
63
|
+
def eof_reached?
|
64
|
+
@eof_reached
|
65
|
+
end
|
66
|
+
|
62
67
|
def eof_nonblock?
|
68
|
+
return true if eof_reached?
|
63
69
|
ungetc(read_nonblock(1)[0])
|
64
70
|
false
|
65
71
|
rescue Errno::EAGAIN, Errno::EWOULDBLOCK, EOFError => e
|
@@ -84,8 +90,8 @@ class IO
|
|
84
90
|
return if finished
|
85
91
|
|
86
92
|
while input.ready?
|
87
|
-
|
88
|
-
|
93
|
+
write(input.gets_nonblock(nil))
|
94
|
+
close_write if input.eof_reached?
|
89
95
|
end unless $win or input_wait > 0
|
90
96
|
end
|
91
97
|
end
|
@@ -161,7 +167,8 @@ def parse_opts!
|
|
161
167
|
$opts = {}
|
162
168
|
ARGV[1..-1].each do |opt|
|
163
169
|
case opt
|
164
|
-
when /^@(
|
170
|
+
when /^@([-\w]+)$/ then add_opt!(:context, $1)
|
171
|
+
when /^--$/ then break # Other REs will match, so check first.
|
165
172
|
when /^-(\w+)$/ then $1.split('').each {|c| add_opt!(c, '')}
|
166
173
|
when /^--?([-\w]+)=(.+)$/ then add_opt!($1, *$2.split(','))
|
167
174
|
when /^--?([-\w]+)$/ then add_opt!($1, "")
|
@@ -180,7 +187,7 @@ def verbose?
|
|
180
187
|
end
|
181
188
|
|
182
189
|
def restart?
|
183
|
-
$opts[:
|
190
|
+
$opts[:R] or $opts[:restart]
|
184
191
|
end
|
185
192
|
|
186
193
|
def log(command, *messages)
|
@@ -242,16 +249,18 @@ rescue Errno::EEXIST
|
|
242
249
|
FileUtils.makedirs(dir)
|
243
250
|
end
|
244
251
|
|
252
|
+
GET = system('which wget > /dev/null') ? "wget -O" : "curl -fo" # prefer wget because it retries on incomplete transfers
|
245
253
|
def download(url, path, opts = {})
|
246
254
|
file = File.basename(url)
|
247
255
|
|
248
|
-
if opts[:force] or not File.exists?(path)
|
256
|
+
if opts[:force] or not File.exists?(path)
|
249
257
|
mkdir_force(File.dirname(path))
|
250
|
-
open(url
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
258
|
+
open(url) {} # check to see if the remote file exists
|
259
|
+
puts "Downloading #{url}..."
|
260
|
+
system("#{GET} #{path} #{url}") || begin
|
261
|
+
FileUtils.rm_f(path)
|
262
|
+
raise "unable to fetch #{url} with curl or wget"
|
263
|
+
end
|
255
264
|
end
|
256
265
|
return path unless opts[:dest]
|
257
266
|
|
@@ -278,14 +287,9 @@ def get_clojure(opts = {})
|
|
278
287
|
download("#{repo}/#{path}/clojure-#{version}.jar", "#{$m2}/#{path}/clojure-#{version}.jar", opts)
|
279
288
|
end
|
280
289
|
|
281
|
-
def progress_bar(label, ch = '=', bg = '', width = 77, out = $stdout, progress = 0, total = nil)
|
282
|
-
{ :progress_proc => lambda {|c| progress += ((width * c/total).to_i - progress).times { out.print_flush(ch) }},
|
283
|
-
:content_length_proc => lambda {|t| printf("%s\n[%#{width}s]\r[", label, bg); total = t}}
|
284
|
-
end
|
285
|
-
|
286
290
|
def cake_version(version_type)
|
287
291
|
return version_type unless version_type.kind_of?(Symbol)
|
288
|
-
version = open("#{$releases}/#{version_type}").gets
|
292
|
+
version = open("#{$releases}/#{version_type}").gets.chomp
|
289
293
|
log(:deps, "most recent #{version_type} version is #{version}") if debug?
|
290
294
|
version
|
291
295
|
end
|
@@ -297,8 +301,8 @@ end
|
|
297
301
|
def extract(jar, file, dest = File.dirname(jar))
|
298
302
|
if not File.exists?("#{dest}/#{file}")
|
299
303
|
log(:deps, "extracting #{file} from #{jar}") if verbose?
|
300
|
-
ret = system
|
301
|
-
raise "
|
304
|
+
ret = system("jar xf #{jar} #{file}")
|
305
|
+
raise "error extracting with jar command" unless ret
|
302
306
|
FileUtils.makedirs(dest)
|
303
307
|
FileUtils.move(file, dest)
|
304
308
|
end
|
@@ -314,14 +318,28 @@ def ps
|
|
314
318
|
`jps -v`.split("\n").select {|l| l =~ /cake\.project/}
|
315
319
|
end
|
316
320
|
|
321
|
+
def cake_pids
|
322
|
+
ps.collect {|line| line.split(' ').first.to_i}
|
323
|
+
end
|
324
|
+
|
325
|
+
def killall
|
326
|
+
cake_pids.each do |pid|
|
327
|
+
Process.kill($opts[:"9"] ? KILL : TERM, pid)
|
328
|
+
end.size > 0
|
329
|
+
end
|
330
|
+
|
331
|
+
def tail_log(num_lines)
|
332
|
+
exec("tail -n#{num_lines || 10} -f #{$project}/.cake/cake.log")
|
333
|
+
end
|
334
|
+
|
317
335
|
class JVM
|
318
|
-
attr_reader :
|
336
|
+
attr_reader :classpath, :libpath, :port, :pid, :pidfile, :load_time
|
319
337
|
|
320
|
-
def initialize(classpath, libpath)
|
321
|
-
@type = self.class.name.downcase
|
338
|
+
def initialize(classpath, libpath, java_opts = "")
|
322
339
|
@classpath = make_path(classpath)
|
323
340
|
@libpath = make_path(libpath)
|
324
|
-
@
|
341
|
+
@java_opts = java_opts
|
342
|
+
@pidfile = ".cake/#{ENV['USER']}.pid"
|
325
343
|
@load_time = File.exists?(pidfile) ? File.mtime(pidfile) : Time.now
|
326
344
|
refresh
|
327
345
|
end
|
@@ -330,75 +348,38 @@ class JVM
|
|
330
348
|
not pid.nil?
|
331
349
|
end
|
332
350
|
|
333
|
-
def enabled?
|
334
|
-
true
|
335
|
-
end
|
336
|
-
|
337
|
-
def init
|
338
|
-
reload_stale_files if enabled? and running?
|
339
|
-
start
|
340
|
-
end
|
341
|
-
|
342
351
|
def refresh
|
343
352
|
@pid, @port, @version = IO.read(pidfile).split("\n"); @pid = @pid.to_i; @port = @port.to_i
|
344
353
|
|
345
354
|
Process.kill(0, @pid) # make sure pid is valid
|
346
355
|
TCPSocket.new("localhost", @port).close if @port # make sure jvm is running on port
|
347
356
|
|
348
|
-
kill if @version != $version
|
349
|
-
rescue Errno::ENOENT, Errno::ESRCH, Errno::ECONNREFUSED, Errno::EBADF, Process::Error => e
|
350
|
-
if e.kind_of?(Errno::ECONNREFUSED)
|
351
|
-
log(:cake, "defunct
|
357
|
+
kill if @version != $version or newer?("#{$project}/lib/dev", pidfile)
|
358
|
+
rescue Errno::ENOENT, Errno::ESRCH, Errno::ECONNREFUSED, Errno::EBADF, Errno::EPERM, Process::Error => e
|
359
|
+
if e.kind_of?(Errno::ECONNREFUSED) and cake_pids.include?(@pid)
|
360
|
+
log(:cake, "defunct jvm") if debug?
|
352
361
|
kill(true)
|
353
362
|
end
|
354
363
|
reset! # no pidfile or invalid pid or connection refused
|
355
364
|
end
|
356
365
|
|
357
|
-
def reload
|
358
|
-
refresh
|
359
|
-
init
|
360
|
-
end
|
361
|
-
|
362
|
-
def with_restart
|
363
|
-
kill
|
364
|
-
yield
|
365
|
-
start
|
366
|
-
end
|
367
|
-
|
368
|
-
def reload_stale_files
|
369
|
-
with_socket(nil) do |socket|
|
370
|
-
socket.write ":reload {}"
|
371
|
-
socket.close_write
|
372
|
-
if socket.eof?
|
373
|
-
FileUtils.touch(pidfile)
|
374
|
-
@load_time = Time.now
|
375
|
-
else
|
376
|
-
inspect(socket) if debug?
|
377
|
-
log(:reload, "unable to reload all #{type} files, restarting") if verbose?
|
378
|
-
kill
|
379
|
-
end
|
380
|
-
end
|
381
|
-
end
|
382
|
-
|
383
366
|
def java_opts
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
result = `java -d32 -version 2>&1`
|
389
|
-
'-client -d32' if $? == 0 and result !~ /Cannot run Java in 32 bit mode/
|
367
|
+
enable_server = $config['jvm.server'] == 'true' || `java -d32 -version 2>&1` =~ /Cannot run Java in 32 bit mode/ || $? != 0
|
368
|
+
vm_opts = enable_server ? ['-server', '-d64', '-Xmx2G', '-XX:MaxPermSize=256M'] : ['-client', '-d32', '-Xms128M', '-Xmx256M', '-XX:MaxPermSize=128M']
|
369
|
+
user_opts = "#{ENV['JAVA_OPTS']} #{$config['jvm.opts']}".split.compact
|
370
|
+
[vm_opts, user_opts, @java_opts,'-cp', classpath, %{-Djava.library.path="#{libpath}"}]
|
390
371
|
end
|
391
372
|
|
392
373
|
MIN_PORT = 2**14
|
393
374
|
MAX_PORT = 2**16
|
394
375
|
|
395
376
|
def start
|
396
|
-
return unless enabled?
|
397
377
|
return if running?
|
398
378
|
|
399
|
-
log(:cake, "starting
|
379
|
+
log(:cake, "starting jvm") if verbose?
|
400
380
|
@port = rand(MAX_PORT - MIN_PORT) + MIN_PORT
|
401
|
-
@pid = daemon
|
381
|
+
@pid = daemon ["java", java_opts, "clojure.main", "-e", "(require 'cake.main) (cake.main/start-server #{port})"].flatten.compact
|
382
|
+
log(:cake, "cake started with pid #{@pid} on port #{@port}") if debug?
|
402
383
|
File.open(pidfile, 'w') {|f| f.write("#{pid}\n#{port}\n#{$version}\n") }
|
403
384
|
rescue Errno::EADDRNOTAVAIL => e # port already in use
|
404
385
|
retry
|
@@ -407,19 +388,18 @@ class JVM
|
|
407
388
|
def kill(force = $opts[:"9"])
|
408
389
|
if pid
|
409
390
|
signal = force ? KILL : TERM
|
410
|
-
log(:kill, "sending #{signal} signal to #{
|
391
|
+
log(:kill, "sending #{signal} signal to jvm (#{pid})") if debug?
|
411
392
|
Process.kill(signal, pid)
|
412
393
|
reset!
|
413
394
|
else
|
414
|
-
log(:kill, "
|
395
|
+
log(:kill, "jvm not running") if $command == :kill
|
415
396
|
end
|
416
397
|
end
|
417
398
|
|
418
399
|
def ping
|
419
|
-
return unless enabled?
|
420
400
|
with_socket do |socket|
|
421
401
|
socket.write ":ping {}\n"
|
422
|
-
log($command, "
|
402
|
+
log($command, "jvm not running") unless socket.gets == "pong\n"
|
423
403
|
end
|
424
404
|
end
|
425
405
|
|
@@ -429,7 +409,7 @@ class JVM
|
|
429
409
|
load_history
|
430
410
|
loop do
|
431
411
|
with_socket do |socket|
|
432
|
-
socket.write %{
|
412
|
+
socket.write %{[repl] #{$vars} "#{REPL_PROMPT}"}
|
433
413
|
while @ns = read_until_prompt(socket)
|
434
414
|
line = readline
|
435
415
|
return unless line
|
@@ -441,39 +421,21 @@ class JVM
|
|
441
421
|
save_history
|
442
422
|
end
|
443
423
|
|
444
|
-
|
445
|
-
|
446
|
-
log(:run, "running file #{$script}") if debug?
|
447
|
-
socket.write(":run #{$vars} #{$script.inspect}")
|
448
|
-
socket.duplex($stdin, $stdout)
|
449
|
-
end
|
450
|
-
end
|
451
|
-
|
452
|
-
def eval
|
453
|
-
forms = $opts[:eval].collect do |form|
|
454
|
-
form == '-' ? $stdin.gets(nil) : form
|
455
|
-
end.join(' ')
|
456
|
-
forms = "(doall (map println [#{forms}]))" unless $opts[:q]
|
457
|
-
with_socket do |socket|
|
458
|
-
log(:eval, forms) if debug?
|
459
|
-
socket.write(":eval #{$vars} #{forms} :cake/EOF ")
|
460
|
-
socket.duplex($stdin, $stdout)
|
461
|
-
end
|
462
|
-
end
|
463
|
-
|
464
|
-
EOL = "EOL__#{rand}"
|
465
|
-
def filter
|
466
|
-
forms = $opts[:filter]
|
424
|
+
READLINE = "READLINE__#{rand}"
|
425
|
+
def send_command(command)
|
467
426
|
with_socket do |socket|
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
427
|
+
cmd = [command, READLINE].to_clj
|
428
|
+
log(command, "sending: " + cmd) if debug?
|
429
|
+
socket.write("#{cmd} #{$vars}")
|
430
|
+
socket.duplex($stdin, $stdout) do |line|
|
431
|
+
if line =~ /^#{READLINE}(.*)$/
|
432
|
+
socket.write(prompt($1))
|
433
|
+
elsif line =~ /^@#{READLINE}(.*)$/
|
434
|
+
socket.write(prompt($1, :echo => false))
|
435
|
+
else
|
436
|
+
line
|
474
437
|
end
|
475
438
|
end
|
476
|
-
socket.close_write
|
477
439
|
end
|
478
440
|
end
|
479
441
|
|
@@ -483,13 +445,6 @@ private
|
|
483
445
|
paths.flatten.compact.join(PATH_SEP)
|
484
446
|
end
|
485
447
|
|
486
|
-
def inspect(socket)
|
487
|
-
while line = socket.gets
|
488
|
-
break if line.index('reload-failed:') == 0 and not debug?
|
489
|
-
puts line
|
490
|
-
end
|
491
|
-
end
|
492
|
-
|
493
448
|
def reset!
|
494
449
|
File.unlink(pidfile) if File.exists?(pidfile)
|
495
450
|
@pid, @port = []
|
@@ -509,7 +464,7 @@ private
|
|
509
464
|
sleep 1
|
510
465
|
if retries
|
511
466
|
if (retries -= 1) == 0
|
512
|
-
log :cake, "connection to
|
467
|
+
log :cake, "connection to jvm is taking a long time...",
|
513
468
|
"you can use ^C to abort and use 'cake kill' or 'cake kill -9' to force the jvm to restart"
|
514
469
|
end
|
515
470
|
retry unless retries < -$timeout
|
@@ -581,7 +536,7 @@ private
|
|
581
536
|
def completions(prefix)
|
582
537
|
return [] if prefix.empty?
|
583
538
|
with_socket do |socket|
|
584
|
-
socket.write ~[:completions, {}, ~[prefix, ~@ns]]
|
539
|
+
socket.write ~[:completions, {}, ~[prefix, ~@ns, $opts[:cake]]]
|
585
540
|
completions = []
|
586
541
|
while line = socket.gets
|
587
542
|
completions << line.chomp
|
@@ -589,41 +544,12 @@ private
|
|
589
544
|
completions
|
590
545
|
end
|
591
546
|
end
|
592
|
-
end
|
593
|
-
|
594
|
-
class Cake < JVM
|
595
|
-
READLINE = "READLINE__#{rand}"
|
596
|
-
def send_command(command)
|
597
|
-
with_restart { FileUtils.remove_dir("lib/dev", true) } if $win and [:deps, :clean].include?(command)
|
598
|
-
|
599
|
-
with_socket do |socket|
|
600
|
-
cmd = [command, READLINE].to_clj
|
601
|
-
log(command, "sending: " + cmd) if debug?
|
602
|
-
socket.write("#{cmd} #{$vars}")
|
603
|
-
socket.duplex($stdin, $stdout) do |line|
|
604
|
-
if line =~ /^#{READLINE}(.*)$/
|
605
|
-
socket.write(prompt($1))
|
606
|
-
elsif line =~ /^@#{READLINE}(.*)$/
|
607
|
-
socket.write(prompt($1, :echo => false))
|
608
|
-
else
|
609
|
-
line
|
610
|
-
end
|
611
|
-
end
|
612
|
-
end
|
613
|
-
end
|
614
|
-
|
615
|
-
def java_opts
|
616
|
-
# bootclasspath = %{-Xbootclasspath/a:"#{$clojure}"}
|
617
|
-
["-Xms16M -Xmx64M", ENV['CAKE_JAVA_OPTS'], $config['cake.java_opts'], super].compact.join(' ')
|
618
|
-
end
|
619
|
-
|
620
|
-
private
|
621
547
|
|
622
548
|
def prompt(prompt, opts = {})
|
623
549
|
if opts[:echo] == false
|
624
550
|
output = `stty -echo 2>&1`
|
625
551
|
log($command, output) if verbose?
|
626
|
-
echo_off =
|
552
|
+
echo_off = $? == 0
|
627
553
|
prompt << ' (WARNING, input will be visible on console!)' unless echo_off
|
628
554
|
prompt << ':'
|
629
555
|
end
|
@@ -637,18 +563,8 @@ private
|
|
637
563
|
end
|
638
564
|
end
|
639
565
|
|
640
|
-
class Bake < JVM
|
641
|
-
def java_opts
|
642
|
-
["-Xms128M -Xmx256M", ENV['JAVA_OPTS'], $config['project.java_opts'], super].compact.join(' ')
|
643
|
-
end
|
644
|
-
|
645
|
-
def enabled?
|
646
|
-
Dir['lib/*.jar'].any? or Dir['classes/**/*.class'].any?
|
647
|
-
end
|
648
|
-
end
|
649
|
-
|
650
566
|
def initialize_cake_dirs
|
651
|
-
FileUtils.makedirs("#{$
|
567
|
+
FileUtils.makedirs("#{$project}/.cake/run")
|
652
568
|
FileUtils.makedirs("#{$home}/.cake/run")
|
653
569
|
project_clj = "#{$home}/.cake/project.clj"
|
654
570
|
File.open(project_clj, 'w') do |file|
|
@@ -680,8 +596,9 @@ end
|
|
680
596
|
parse_opts!
|
681
597
|
$script = File.expand_path($opts[:run].first) if $opts[:run]
|
682
598
|
$pwd = Dir.getwd
|
683
|
-
$
|
684
|
-
$
|
599
|
+
$project = project_dir($pwd)
|
600
|
+
$file = File.expand_path(__FILE__)
|
601
|
+
$cakedir = File.dirname(File.dirname(File.expand_path(readlink($file), File.dirname($file))))
|
685
602
|
$releases = "http://releases.clojure-cake.org"
|
686
603
|
$m2 = "#{$home}/.m2/repository"
|
687
604
|
$config = Configuration.new("#{$home}/.cake/config", ".cake/config")
|
@@ -689,7 +606,7 @@ $vars = {:env => ENV.to_hash, :pwd => $pwd, :args => ARGV, :opts => $opts, :
|
|
689
606
|
$timeout = ($config['connect.timeout'] || 20).to_i
|
690
607
|
|
691
608
|
initialize_cake_dirs
|
692
|
-
Dir.chdir($
|
609
|
+
Dir.chdir($project)
|
693
610
|
|
694
611
|
if debug?
|
695
612
|
puts "config: #{$config.inspect}"
|
@@ -700,20 +617,23 @@ end
|
|
700
617
|
lib = "#{$cakedir}/lib"
|
701
618
|
project = "#{$cakedir}/project.clj"
|
702
619
|
|
703
|
-
if File.exists?("#{$cakedir}
|
620
|
+
if File.exists?("#{$cakedir}/src/cake/core.clj") and File.exists?(project)
|
704
621
|
log(:cake, "running from git checkout") if verbose?
|
705
622
|
if $command == :upgrade
|
706
623
|
log(:upgrade, "pulling latest code from git")
|
707
624
|
Dir.chdir($cakedir) { system('git pull') }
|
708
625
|
end
|
709
626
|
|
710
|
-
$version =
|
627
|
+
$version = `cd #{$cakedir} && git describe`.chomp
|
711
628
|
log(:deps, "project.clj version is #{$version}") if debug?
|
712
629
|
|
713
630
|
# Force new cake libs if cake's project.clj has changed.
|
714
|
-
|
631
|
+
if newer?(project, lib)
|
632
|
+
killall
|
633
|
+
FileUtils.remove_dir(lib, true)
|
634
|
+
end
|
715
635
|
|
716
|
-
if Dir["#{lib}/*.jar"].empty?
|
636
|
+
if Dir["#{lib}/*.jar"].empty?
|
717
637
|
# In a new git checkout, need to fetch dependencies.
|
718
638
|
cakejar = get_cake(:version => $version, :dest => lib) rescue get_cake(:version => :current, :dest => lib)
|
719
639
|
extract(cakejar, "bake.jar", "#{lib}/dev")
|
@@ -721,7 +641,7 @@ if File.exists?("#{$cakedir}/.gitignore") and File.exists?(project)
|
|
721
641
|
$clojure = get_clojure(:dest => lib)
|
722
642
|
|
723
643
|
cakepath = ["#{$cakedir}/src", "#{lib}/*", "#{lib}/dev/*"]
|
724
|
-
bakepath =
|
644
|
+
bakepath = "#{$cakedir}/bake"
|
725
645
|
else
|
726
646
|
cakejar = "#{lib}/cake.jar"
|
727
647
|
bakejar = "#{lib}/bake.jar"
|
@@ -759,85 +679,43 @@ else
|
|
759
679
|
end
|
760
680
|
end
|
761
681
|
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
cake = Cake.new(
|
768
|
-
[cakepath, "src", "src/clj", $config['cake.claspath'], "lib/dev/*", "#{$home}/.cake/lib/dev/*"],
|
769
|
-
[$config['cake.library.path'], "lib/dev/native"]
|
770
|
-
)
|
771
|
-
bake = Bake.new(
|
772
|
-
[bakepath, "src", "src/clj", "classes", "resources", "dev", "test", "test/classes", $config['project.classpath'], $opts[:cp], "lib/*", "lib/dev/*", "#{$home}/.cake/lib/dev/*"],
|
773
|
-
[$config['project.library.path'], "lib/native", "lib/dev/native"]
|
682
|
+
cake = JVM.new(
|
683
|
+
[$config['jvm.classpath'], bakepath, cakepath, "src", "src/clj", "lib/dev/*", "#{$home}/.cake/lib/dev/*"],
|
684
|
+
[$config['jvm.library.path'], "lib/ext/native", "lib/native", "lib/dev/native"],
|
685
|
+
["-Dcake.project=#{$project}", "-Dbake.path=#{bakepath}"]
|
774
686
|
)
|
775
687
|
|
776
|
-
if $command == :
|
688
|
+
if $command == :upgrade
|
689
|
+
killall
|
690
|
+
puts "cake upgraded to #{$version}"
|
691
|
+
exit
|
692
|
+
elsif $command == :default and $opts[:version]
|
777
693
|
puts "cake #{$version}"
|
778
694
|
exit
|
779
|
-
elsif $command == :
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
end.size
|
787
|
-
puts "No matching processes belonging to you were found" if num == 0
|
788
|
-
else
|
789
|
-
cake.kill
|
790
|
-
bake.kill
|
791
|
-
end
|
695
|
+
elsif $command == :log
|
696
|
+
tail_log($opts[:log])
|
697
|
+
elsif $command == :killall
|
698
|
+
killall || puts("No matching processes belonging to you were found")
|
699
|
+
exit
|
700
|
+
elsif $command == :kill
|
701
|
+
cake.kill
|
792
702
|
exit
|
793
703
|
elsif $command == :ps
|
794
704
|
puts ps.sort.reverse
|
795
705
|
exit
|
796
|
-
elsif $command == :restart and $opts[:restart] == ["project"]
|
797
|
-
log(:restart, "restarting bake jvm") if debug?
|
798
|
-
bake.kill
|
799
|
-
bake.init
|
800
|
-
exit
|
801
|
-
elsif restart?
|
802
|
-
cake.kill
|
803
|
-
bake.kill
|
804
706
|
end
|
805
707
|
|
806
|
-
cake.
|
807
|
-
|
808
|
-
bake.kill
|
809
|
-
elsif File.exists?('project.clj')
|
810
|
-
if not bake.enabled?
|
811
|
-
cake.send_command(:deps)
|
812
|
-
cake.init
|
813
|
-
end
|
708
|
+
cake.kill if restart?
|
709
|
+
cake.start
|
814
710
|
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
else
|
822
|
-
bake.send($command)
|
823
|
-
end
|
824
|
-
elsif [:reload].include?($command)
|
825
|
-
cake.ping
|
826
|
-
bake.ping
|
711
|
+
if $command == :console
|
712
|
+
num_windows = $opts[:console].first || 1
|
713
|
+
interval = $opts[:i] ? $opts[:i].first : 4
|
714
|
+
system("jconsole -interval=#{interval}" + " #{cake.pid}" * num_windows.to_i + "&")
|
715
|
+
elsif $command == :repl
|
716
|
+
cake.repl
|
827
717
|
else
|
828
|
-
|
829
|
-
cake.send_command(:test)
|
830
|
-
interval = ($opts[:interval].first if $opts[:interval]) || $config['autotest.interval'] || 5
|
831
|
-
while true
|
832
|
-
sleep(interval.to_i)
|
833
|
-
cake.send_command(:autotest)
|
834
|
-
$stdout.print_flush('.')
|
835
|
-
bake.reload
|
836
|
-
cake.reload
|
837
|
-
end
|
838
|
-
else
|
839
|
-
cake.send_command($command)
|
840
|
-
end
|
718
|
+
cake.send_command($command)
|
841
719
|
end
|
842
720
|
|
843
|
-
|
721
|
+
tail_log(0) if $opts[:l]
|
data/lib/bake.jar
CHANGED
Binary file
|
data/lib/cake.jar
CHANGED
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:
|
5
|
-
prerelease:
|
4
|
+
hash: 7
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 6
|
9
|
+
- 0
|
10
|
+
version: 0.6.0
|
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:
|
19
|
+
date: 2011-01-01 00:00:00 -08:00
|
20
20
|
default_executable: cake
|
21
21
|
dependencies: []
|
22
22
|
|
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements: []
|
65
65
|
|
66
66
|
rubyforge_project: cake
|
67
|
-
rubygems_version: 1.
|
67
|
+
rubygems_version: 1.4.1
|
68
68
|
signing_key:
|
69
69
|
specification_version: 3
|
70
70
|
summary: A tasty build tool and concurrent repl for Clojure.
|