sundae 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/History.txt +5 -0
  2. data/lib/sundae.rb +14 -10
  3. metadata +2 -2
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.9.2 / 2009-04-28
2
+
3
+ * 1 minor enhancement
4
+ * less manual tasks required if you want to move mnts
5
+
1
6
  === 0.9.1 / 2009-04-27
2
7
 
3
8
  * 1 minor enhancement
data/lib/sundae.rb CHANGED
@@ -7,7 +7,7 @@ require 'find'
7
7
  # together using symbolic links.
8
8
  #
9
9
  module Sundae
10
- VERSION = "0.9.1"
10
+ VERSION = "0.9.2"
11
11
 
12
12
  DEFAULT_CONFIG_FILE = File.expand_path(File.join(ENV['HOME'], '.sundae'))
13
13
 
@@ -274,14 +274,18 @@ module Sundae
274
274
  # Create a symbolic link to <em>target</em> from <em>link_name</em>.
275
275
  #
276
276
  def self.create_file_link(target, link_name)
277
- raise ArgumentError unless File.file?(target)
278
- unless File.exist?(link_name)
279
- FileUtils.ln_s(target, link_name)
280
- else
281
- unless (File.symlink?(link_name) &&
282
- (File.expand_path(File.readlink(link_name)) == File.expand_path(target)))
283
- raise "Could not link #{target} to #{link_name}"
277
+ raise ArgumentError, "#{target} does not exist" unless File.file?(target)
278
+ if File.exist?(link_name)
279
+ raise ArgumentError, "#{link_name} cannot be overwritten" unless File.symlink?(link_name)
280
+ if (not File.exist?(File.readlink(link_name)))
281
+ FileUtils.ln_sf(target, link_name)
282
+ else
283
+ unless (File.expand_path(File.readlink(link_name)) == File.expand_path(target))
284
+ raise ArgumentError, "#{link_name} points to #{File.readlink(link_name)}, not #{target}" unless File.symlink?(link_name)
285
+ end
284
286
  end
287
+ else
288
+ FileUtils.ln_s(target, link_name)
285
289
  end
286
290
  end
287
291
 
@@ -291,8 +295,8 @@ module Sundae
291
295
  #
292
296
  def self.create_directory_link(target, link_name)
293
297
  raise ArgumentError unless File.directory?(target)
294
- unless File.exist?(link_name)
295
- FileUtils.ln_s(target, link_name)
298
+ if (not File.exist?(link_name)) || (File.symlink?(link_name) && (not File.exist?(File.readlink(link_name))))
299
+ FileUtils.ln_sf(target, link_name)
296
300
  else
297
301
  case File.ftype(link_name)
298
302
  when 'file'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sundae
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Don
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-27 00:00:00 -04:00
12
+ date: 2009-04-28 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency