cake 0.4.15 → 0.4.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/bin/cake +27 -21
  2. data/lib/bake.jar +0 -0
  3. data/lib/cake.jar +0 -0
  4. data/lib/clojure.jar +0 -0
  5. metadata +4 -4
data/bin/cake CHANGED
@@ -101,7 +101,7 @@ class Object
101
101
  when Hash then '{' + collect {|k,v| k.to_clj + ' ' + v.to_clj}.join(' ') + '}'
102
102
  when Array then '[' + collect {|i| i.to_clj}.join(' ') + ']'
103
103
  when Symbol then ":#{to_s}"
104
- else inspect.gsub(/(\\a|\\e|\\v)/) {|c| CLJ_SUB[c]}
104
+ else inspect.gsub(/(\\a|\\e|\\v|\\x)/) {|c| CLJ_SUB[c]}
105
105
  end
106
106
  end
107
107
 
@@ -109,6 +109,7 @@ class Object
109
109
  '\a' => '\007',
110
110
  '\e' => '\033',
111
111
  '\v' => '\013',
112
+ '\x' => 'x', # This will mangle some strings in ruby 1.9.1, but it is better than breaking altogether.
112
113
  }
113
114
 
114
115
  define_method(:~) { Unquoted.new(self) }
@@ -153,10 +154,10 @@ def parse_opts!
153
154
  $opts = {}
154
155
  ARGV[1..-1].each do |opt|
155
156
  case opt
156
- when /^-(\w+)$/ then $1.split('').each {|c| add_opt!(c, '')}
157
- when /^--?([-\w]+)=([\S]+)$/ then add_opt!($1, *$2.split(','))
158
- when /^--?([-\w]+)$/ then add_opt!($1, "")
159
- else add_opt!($command, opt)
157
+ when /^-(\w+)$/ then $1.split('').each {|c| add_opt!(c, '')}
158
+ when /^--?([-\w]+)=(.+)$/ then add_opt!($1, *$2.split(','))
159
+ when /^--?([-\w]+)$/ then add_opt!($1, "")
160
+ else add_opt!($command, opt)
160
161
  end
161
162
  end
162
163
  $opts.freeze
@@ -230,12 +231,12 @@ rescue NotImplementedError, Errno::EINVAL
230
231
  file
231
232
  end
232
233
 
233
- def download(url, dir, opts = {})
234
+ def download(url, path, opts = {})
234
235
  file = File.basename(url)
235
- path = "#{dir}/#{file}"
236
+ path = "#{path}/#{file}" if File.directory?(path)
236
237
 
237
238
  if opts[:force] or not File.exists?(path)
238
- FileUtils.makedirs(dir)
239
+ FileUtils.makedirs(File.dirname(path))
239
240
  open(url, progress_bar(url)) do |remote|
240
241
  open(path, "wb") do |local|
241
242
  while (buf = remote.read(8192)); local.write buf; end
@@ -256,7 +257,6 @@ rescue OpenURI::HTTPError
256
257
  end
257
258
 
258
259
  def get_cake(opts = {})
259
- log(:deps, "Fetching cake dependencies...") unless @got_cake; @got_cake = true
260
260
  version = cake_version(opts[:version] || :current)
261
261
  download("#{$github}/jars/cake-#{version}.jar", "#{$m2}/cake/cake/#{snapshot(version)}", opts)
262
262
  end
@@ -273,10 +273,10 @@ def progress_bar(label, ch = '=', bg = '', width = 77, out = $stdout, progress =
273
273
  :content_length_proc => lambda {|t| printf("%s\n[%#{width}s]\r[", label, bg); total = t}}
274
274
  end
275
275
 
276
- def cake_version(version)
277
- return version unless version.kind_of?(Symbol)
278
- version = open("#{$github}/#{version}").gets
279
- log(:deps, "most recent standalone version is #{version}") if debug?
276
+ def cake_version(version_type)
277
+ return version_type unless version_type.kind_of?(Symbol)
278
+ version = open("#{$github}/#{version_type}").gets
279
+ log(:deps, "most recent #{version_type} version is #{version}") if debug?
280
280
  version
281
281
  end
282
282
 
@@ -725,7 +725,7 @@ $cakedir = File.dirname(File.dirname(readlink(__FILE__)))
725
725
  $github = "http://github.com/ninjudd/cake-standalone/raw/master"
726
726
  $m2 = "#{$home}/.m2/repository"
727
727
  $config = Configuration.new("#{$home}/.cake/config", ".cake/config")
728
- $vars = {:env => ENV.to_hash, :pwd => $pwd, :args => ARGV, :opts => $opts, :script => $0}.to_clj
728
+ $vars = {:shellenv => ENV.to_hash, :pwd => $pwd, :args => ARGV, :opts => $opts, :script => $0}.to_clj
729
729
  $timeout = ($config['connect.timeout'] || 20).to_i
730
730
 
731
731
  Dir.chdir($bakedir)
@@ -753,15 +753,14 @@ if File.exists?("#{$cakedir}/.gitignore") and File.exists?(project)
753
753
  # Force new cake libs if cake's project.clj has changed.
754
754
  FileUtils.remove_dir(lib, true) if newer?(project, lib) and not $config['cake.disable-auto-deps']
755
755
 
756
- if Dir["#{lib}/*.jar"].empty? or Dir["#{lib}/dev/*.jar"].empty?
757
- # In a new git checkout, need to fetch dependencies.
756
+ if Dir["#{lib}/*.jar"].empty?
757
+ # In a new git checkout, need to fetch dependencies.
758
758
  cakejar = get_cake(:version => $version, :dest => lib) rescue get_cake(:version => :current, :dest => lib)
759
- extract(cakejar, "bake.jar", "#{lib}/dev")
760
759
  end
761
760
  $clojure = get_clojure(:dest => lib)
762
761
 
763
- cakepath = ["#{$cakedir}/src", "#{lib}/*:#{lib}/dev/*"]
764
- bakepath = ["#{$cakedir}/bake", "#{lib}/dev/*"]
762
+ cakepath = ["#{$cakedir}/src", "#{lib}/*"]
763
+ bakepath = ["#{$cakedir}/bake"]
765
764
  else
766
765
  cakejar = "#{lib}/cake.jar"
767
766
  bakejar = "#{lib}/bake.jar"
@@ -783,7 +782,14 @@ else
783
782
  log(:cake, "running from standalone script") if verbose?
784
783
  download("#{$github}/cake", __FILE__, :force => true) if $command == :upgrade
785
784
 
786
- $version = cake_version(:stable)
785
+ version_file = "#{$home}/.cake/stable_version"
786
+ if File.exists?(version_file) and $command != :upgrade
787
+ $version = IO.read(version_file)
788
+ else
789
+ $version = cake_version(:stable)
790
+ File.open(version_file, "w") {|f| f.write($version)}
791
+ end
792
+
787
793
  cakejar = get_cake(:version => $version)
788
794
  $clojure = get_clojure
789
795
 
@@ -802,7 +808,7 @@ cake = Cake.new(
802
808
  [$config['cake.library.path'], "lib/dev/native"]
803
809
  )
804
810
  bake = Bake.new(
805
- [bakepath, "src", "src/clj", "classes", "test", $config['project.classpath'], "lib/*", "lib/dev/*", "#{$home}/.cake/lib/dev/*"],
811
+ [bakepath, "src", "src/clj", "classes", "resources", "dev", "test", $config['project.classpath'], "lib/*", "lib/dev/*", "#{$home}/.cake/lib/dev/*"],
806
812
  [$config['project.library.path'], "lib/native", "lib/dev/native"]
807
813
  )
808
814
 
Binary file
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: 17
4
+ hash: 47
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 15
10
- version: 0.4.15
9
+ - 16
10
+ version: 0.4.16
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-09-09 00:00:00 -07:00
19
+ date: 2010-09-21 00:00:00 -07:00
20
20
  default_executable: cake
21
21
  dependencies: []
22
22