cake 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/cake +55 -35
- data/lib/bake.jar +0 -0
- data/lib/cake.jar +0 -0
- metadata +4 -4
data/bin/cake
CHANGED
@@ -79,7 +79,7 @@ class IO
|
|
79
79
|
end
|
80
80
|
input_wait -= interval
|
81
81
|
return if finished
|
82
|
-
|
82
|
+
|
83
83
|
while input.ready?
|
84
84
|
return if input.eof?
|
85
85
|
write(input.gets)
|
@@ -178,9 +178,11 @@ def admin_command?
|
|
178
178
|
[:start, :stop, :reload, :restart].include?($command)
|
179
179
|
end
|
180
180
|
|
181
|
-
def log(command, *
|
182
|
-
|
183
|
-
|
181
|
+
def log(command, *messages)
|
182
|
+
messages.each do |message|
|
183
|
+
message.split("\n").each do |line|
|
184
|
+
printf("%11s %s\n", "[#{command}]", line) unless line.empty?
|
185
|
+
end
|
184
186
|
end
|
185
187
|
end
|
186
188
|
|
@@ -228,23 +230,27 @@ rescue NotImplementedError, Errno::EINVAL
|
|
228
230
|
file
|
229
231
|
end
|
230
232
|
|
233
|
+
def download(url, path)
|
234
|
+
log(:deps, "downloading #{url}")
|
235
|
+
open(url) do |remote|
|
236
|
+
open(path, "wb") do |local|
|
237
|
+
while (buf = remote.read(8192))
|
238
|
+
local.write buf
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
231
244
|
def get_cake(version, dest = nil, opts = {})
|
232
245
|
jar = version =~ /(.*)-SNAPSHOT/ ? "cake-#{$1}-#{snapshot(version)}.jar" : "cake-#{version}.jar"
|
233
246
|
repo = File.expand_path("~/.m2/repository/cake/cake/#{version}")
|
234
247
|
path = "#{repo}/#{jar}"
|
235
248
|
|
236
249
|
if not File.exists?(path)
|
237
|
-
log(:deps, "fetching cake libraries. this may take a moment...") unless @logged; @logged = true
|
238
250
|
url = "#{$repo}/#{version}/#{jar}"
|
239
|
-
log(:deps, "
|
251
|
+
log(:deps, "fetching cake libraries. this may take a moment...") unless @logged; @logged = true
|
240
252
|
FileUtils.makedirs(repo)
|
241
|
-
|
242
|
-
open(path, "wb") do |file|
|
243
|
-
while (buf = jarfile.read(8192))
|
244
|
-
file.write buf
|
245
|
-
end
|
246
|
-
end
|
247
|
-
end
|
253
|
+
download(url, path)
|
248
254
|
end
|
249
255
|
return path unless dest
|
250
256
|
|
@@ -260,10 +266,12 @@ rescue OpenURI::HTTPError => e
|
|
260
266
|
end
|
261
267
|
|
262
268
|
def current_version
|
263
|
-
open("#{$repo}/maven-metadata.xml") do |file|
|
269
|
+
version = open("#{$repo}/maven-metadata.xml") do |file|
|
264
270
|
doc = REXML::Document.new file
|
265
271
|
doc.elements['metadata'].elements['versioning'].elements['versions'].elements.to_a('version').last.get_text.to_s
|
266
272
|
end
|
273
|
+
log(:deps, "most recent clojars version is #{version}") if debug?
|
274
|
+
version
|
267
275
|
end
|
268
276
|
|
269
277
|
def snapshot(version)
|
@@ -323,7 +331,7 @@ class JVM
|
|
323
331
|
end
|
324
332
|
|
325
333
|
def refresh
|
326
|
-
@pid, @port, @version = IO.read(pidfile).split("\n"); @pid = @pid.to_i; @port = @port.to_i
|
334
|
+
@pid, @port, @version = IO.read(pidfile).split("\n"); @pid = @pid.to_i; @port = @port.to_i
|
327
335
|
Process.kill(0, @pid) # make sure pid is valid
|
328
336
|
TCPSocket.new("localhost", @port).close if @port # make sure jvm is running on port
|
329
337
|
|
@@ -447,7 +455,7 @@ class JVM
|
|
447
455
|
else
|
448
456
|
Find.find(path) do |f|
|
449
457
|
Find.prune if f == "#{$bakedir}/src/jvm"
|
450
|
-
files << f if f =~ /\.(clj|class)$/ and File.exists?(f) and not File.directory?(f)
|
458
|
+
files << f if f =~ /\.(clj|class|jar)$/ and File.exists?(f) and not File.directory?(f)
|
451
459
|
end if File.exists?(path)
|
452
460
|
end
|
453
461
|
end
|
@@ -655,14 +663,16 @@ private
|
|
655
663
|
|
656
664
|
def prompt(prompt, opts = {})
|
657
665
|
if opts[:echo] == false
|
658
|
-
|
666
|
+
output = `stty -echo 2>&1`
|
667
|
+
log($command, output) if verbose?
|
668
|
+
echo_off = $?.exitstatus == 0
|
659
669
|
prompt << " (WARNING, input will be visible on console!)" unless echo_off
|
660
670
|
end
|
661
671
|
input = Readline.readline(prompt + ": ") || ''
|
662
672
|
input + "\n"
|
663
673
|
ensure
|
664
674
|
if echo_off
|
665
|
-
system(
|
675
|
+
system('stty echo')
|
666
676
|
puts
|
667
677
|
end
|
668
678
|
end
|
@@ -720,7 +730,14 @@ end
|
|
720
730
|
# Bootstrap cake dependencies.
|
721
731
|
lib = "#{$cakedir}/lib"
|
722
732
|
if File.exists?("#{$cakedir}/.gitignore") and File.exists?("#{$cakedir}/project.clj")
|
733
|
+
log(:cake, "running from git checkout") if verbose?
|
734
|
+
if $command == :upgrade
|
735
|
+
log(:upgrade, "pulling latest code from git")
|
736
|
+
system('git pull')
|
737
|
+
end
|
738
|
+
|
723
739
|
$version = IO.read("#{$cakedir}/project.clj").split("\n").first.match(/defproject cake \"(.*)\"/)[1]
|
740
|
+
log(:deps, "project.clj version is #{$version}") if debug?
|
724
741
|
if Dir["#{lib}/*.jar"].empty? or Dir["#{lib}/dev/*.jar"].empty?
|
725
742
|
# In a new git checkout, need to fetch dependencies.
|
726
743
|
begin
|
@@ -740,16 +757,26 @@ else
|
|
740
757
|
bakejar = "#{lib}/bake.jar"
|
741
758
|
if File.exists?(cakejar) and File.exists?(bakejar)
|
742
759
|
# Inside a gem install.
|
760
|
+
log(:cake, "running from gem") if verbose?
|
761
|
+
if $command == :upgrade
|
762
|
+
log(:upgrade, "checking for updates to cake gem")
|
763
|
+
system('gem update cake')
|
764
|
+
end
|
765
|
+
|
743
766
|
$version = File.basename(File.dirname(lib)).split('-')[1]
|
744
767
|
cakepath = cakejar
|
745
768
|
bakepath = bakejar
|
746
769
|
else
|
747
|
-
#
|
748
|
-
|
749
|
-
|
750
|
-
|
770
|
+
# Standalone script.
|
771
|
+
log(:cake, "running from standalone script") if verbose?
|
772
|
+
download("http://github.com/ninjudd/cake/raw/master/bin/cake", __FILE__) if $command == :upgrade
|
773
|
+
|
774
|
+
$version = current_version
|
775
|
+
cakepath = get_cake($version)
|
776
|
+
bakepath = extract(cakepath, "bake-#{$version}.jar")
|
751
777
|
end
|
752
778
|
end
|
779
|
+
exec("cake deps") if $command == :upgrade
|
753
780
|
|
754
781
|
cake = Cake.new(
|
755
782
|
[cakepath, "src", "src/clj", $config['cake.claspath'], "lib/dev/*", "#{$home}/.cake/lib/dev/*"],
|
@@ -816,21 +843,14 @@ elsif [:start, :reload, :restart].include?($command)
|
|
816
843
|
end
|
817
844
|
else
|
818
845
|
if $command == :autotest
|
819
|
-
cake.send_command(:
|
820
|
-
interval = $opts[:
|
821
|
-
interval = interval || ($config['autotest.interval'].to_i if $config['autotest.interval']) || 1
|
822
|
-
run_tests = true
|
823
|
-
ran = false
|
846
|
+
cake.send_command(:test)
|
847
|
+
interval = ($opts[:interval].first if $opts[:interval]) || $config['autotest.interval'] || 5
|
824
848
|
while true
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
end
|
830
|
-
cake.send_command(:test, args) if run_tests
|
831
|
-
run_tests = bake.reload
|
849
|
+
sleep(interval.to_i)
|
850
|
+
cake.send_command(:autotest)
|
851
|
+
$stdout.print_flush('.')
|
852
|
+
bake.reload
|
832
853
|
cake.reload
|
833
|
-
sleep(interval)
|
834
854
|
end
|
835
855
|
else
|
836
856
|
cake.send_command($command)
|
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:
|
4
|
+
hash: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 7
|
10
|
+
version: 0.4.7
|
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
|
+
date: 2010-08-24 00:00:00 -07:00
|
20
20
|
default_executable: cake
|
21
21
|
dependencies: []
|
22
22
|
|