lace 0.5.2 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7f0f417d0dbe5369de03faab17bf6deaca9fb97974d297ba00737111a83b3ee
4
- data.tar.gz: 6506f85738991370546e31f9b2f1fa890ac73266c4acebfe0efc7df151819186
3
+ metadata.gz: c099e1777a54e926881eea3385e686dfa6cfd0aace314d2edc43bd7b48bd09fb
4
+ data.tar.gz: e81e28bf19c1dc61011d2e43da482f7f138f87146b8007d730f6be331b8d01d7
5
5
  SHA512:
6
- metadata.gz: 822ca5da353445be87fb1d31f2c4cb3bd0a8582bbbaecbf64572878e092fb83f63cf226407767414ea2b0e6a0d69d02b299da914ffbea869912301f4b8226915
7
- data.tar.gz: 3d5039c97612a34c1daadb8239e41b620d33f5b6db0a91b029a1e3b80b39acc32663de850959fb75d8548b74fb40171293d63342136cc85d8a1e42c79771d47d
6
+ metadata.gz: 9a52adb48bf56917bb98bddca0f30823d7f3ca267a196c4c39a297d73628117a8b7f92076820eda276a1b6d58f23f06134f187d7001c440f6dfc549559bd5272
7
+ data.tar.gz: b531d0596d7e2ef42aa56a24225ee748ba24ca3b780dd10990beb4b82fa6961e65545df0c65f73a10f4d108abf33b6098dbd2f2ab4252430362427488dcc3efc
data/bin/lace CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- #Copyright 2009-2014 Max Howell and other contributors.
3
+ # Copyright 2009-2014 Max Howell and other contributors.
4
4
  #
5
- #Redistribution and use in source and binary forms, with or without
6
- #modification, are permitted provided that the following conditions
7
- #are met:
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions
7
+ # are met:
8
8
  #
9
9
  # 1. Redistributions of source code must retain the above copyright
10
10
  # notice, this list of conditions and the following disclaimer.
@@ -12,39 +12,32 @@
12
12
  # notice, this list of conditions and the following disclaimer in the
13
13
  # documentation and/or other materials provided with the distribution.
14
14
  #
15
- #THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16
- #IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
- #OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
- #IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19
- #INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
- #NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
- #DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
- #THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
- #(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
- #THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
+ # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16
+ # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
+ # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
+ # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19
+ # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
+ # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
+ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
25
 
26
- std_trap = trap("INT") { exit! 130 } # no backtrace thanks
26
+ std_trap = trap('INT') { exit! 130 } # no backtrace thanks
27
27
  require 'pathname'
28
28
 
29
- LIB_PATH = Pathname.new(__FILE__).realpath.dirname.parent.join("lib").to_s
29
+ LIB_PATH = Pathname.new(__FILE__).realpath.dirname.parent.join('lib').to_s
30
30
  $:.unshift(LIB_PATH)
31
31
 
32
32
  require 'lace'
33
33
 
34
- require "extend/ARGV"
35
- require "extend/pathname"
34
+ require 'extend/ARGV'
35
+ require 'extend/pathname'
36
36
 
37
37
  ARGV.extend(LaceArgvExtension)
38
38
 
39
- def require? path
40
- require path.to_s.chomp
41
- rescue LoadError => e
42
- # HACK :( because we should raise on syntax errors but
43
- # not if the file doesn't exist. TODO make robust!
44
- raise unless e.to_s.include? path
45
- end
46
-
47
- case ARGV.first when '-h', '--help', '--usage', '-?', 'help', nil
39
+ case ARGV.first
40
+ when '-h', '--help', '--usage', '-?', 'help', nil
48
41
  require 'cmd/help'
49
42
  puts Lace.help_s
50
43
  exit ARGV.first ? 0 : 1
@@ -53,41 +46,35 @@ when '--version', '-v'
53
46
  exit 0
54
47
  end
55
48
 
56
-
57
49
  begin
58
- trap("INT", std_trap) # restore default CTRL-C handler
59
- if Process.uid.zero?
60
- raise "Refusing to run as sudo"
61
- end
50
+ trap('INT', std_trap) # restore default CTRL-C handler
51
+ raise 'Refusing to run as sudo' if Process.uid.zero?
62
52
 
63
- aliases = {'ls' => 'list',
64
- 'info' => 'inspect',
65
- '--upgrade' => 'upgrade',
66
- 'rm' => 'remove'}
53
+ aliases = { 'ls' => 'list',
54
+ 'info' => 'inspect',
55
+ '--upgrade' => 'upgrade',
56
+ 'rm' => 'remove' }
67
57
 
68
58
  cmd = ARGV.shift
69
59
  cmd = aliases[cmd] if aliases[cmd]
70
60
 
71
- if require? "cmd/" + cmd
61
+ if Lace.require_command "cmd/#{cmd}"
72
62
  Lace.send cmd.to_s.gsub('-', '_').downcase
73
63
  else
74
64
  onoe "Unknown command: #{cmd}"
75
65
  exit 1
76
66
  end
77
-
78
67
  rescue ResourceNotSpecified
79
- abort "This command requires a resource argument"
80
- rescue UsageError
81
- onoe "Invalid usage"
82
- abort ARGV.usage
68
+ abort 'This command requires a resource argument'
83
69
  rescue SystemExit
84
- puts "Kernel.exit" if ARGV.verbose?
70
+ puts 'Kernel.exit' if ARGV.verbose?
85
71
  raise
86
- rescue Interrupt => e
72
+ rescue Interrupt
87
73
  puts # seemingly a newline is typical
88
74
  exit 130
89
75
  rescue RuntimeError, SystemCallError => e
90
76
  raise if e.message.empty?
77
+
91
78
  onoe e
92
79
  exit 1
93
80
  rescue Exception => e
data/lib/cmd/activate.rb CHANGED
@@ -1,11 +1,13 @@
1
1
  require 'lace/package'
2
2
  require 'lace/exceptions'
3
3
 
4
- module Lace extend self
4
+ module Lace
5
+ extend self
6
+
5
7
  def activate
6
8
  package_name = ARGV.shift
7
9
  raise ResourceNotSpecified unless package_name
10
+
8
11
  PackageUtils.activate package_name
9
12
  end
10
13
  end
11
-
data/lib/cmd/apply.rb ADDED
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'lace/package'
4
+ require 'lace/exceptions'
5
+ require 'fileutils'
6
+
7
+ module Lace
8
+ module_function
9
+
10
+ def apply
11
+ package_name = ARGV.shift
12
+ raise ResourceNotSpecified unless package_name
13
+
14
+ ohai "Applying package #{package_name}"
15
+ package = Package.new(package_name, ARGV.first)
16
+
17
+ diff = PackageUtils.diff(package_name)
18
+
19
+ if diff.in_sync?
20
+ puts 'Everything is already in sync. Nothing to do.'
21
+ return
22
+ end
23
+
24
+ diff.added.each do |f|
25
+ dest_path = home_relative(f, package)
26
+ next unless ARGV.confirm?("Link #{f.basename} to #{dest_path}?")
27
+
28
+ package.link_file_or_directory(f, f.as_dotfile(Dir.home, package.path), force: true)
29
+ ohai 'Linked'
30
+ end
31
+
32
+ diff.removed.each do |f|
33
+ next unless ARGV.confirm?("Remove link for #{f.basename} from #{home_relative(f, package)}?")
34
+
35
+ package.unlink_file(f, force: true)
36
+ ohai 'Removed'
37
+ end
38
+
39
+ apply_blocked(diff.blocked, package)
40
+ end
41
+
42
+ # Entries blocked by a file, folder or foreign link: back them up with
43
+ # --force, otherwise list them and fail so the gap stays visible.
44
+ def apply_blocked(blocked, package)
45
+ return if blocked.empty?
46
+
47
+ unless ARGV.force?
48
+ blocked.each { |f| puts "[!] #{f.basename} -> #{home_relative(f, package)}" }
49
+ ofail "#{blocked.size} entries are blocked; rerun with --force to back up what is in their place"
50
+ return
51
+ end
52
+
53
+ blocked.each do |f|
54
+ next unless ARGV.confirm?("Back up #{home_relative(f, package)} and link #{f.basename}?")
55
+
56
+ package.link_file(f)
57
+ ohai 'Linked'
58
+ end
59
+ end
60
+
61
+ def home_relative(file, package)
62
+ file.as_dotfile(Dir.home, package.path).to_path.gsub(Dir.home, '$HOME')
63
+ end
64
+ end
@@ -1,11 +1,13 @@
1
1
  require 'lace/package'
2
2
  require 'lace/exceptions'
3
3
 
4
- module Lace extend self
4
+ module Lace
5
+ extend self
6
+
5
7
  def deactivate
6
8
  package_name = ARGV.shift
7
9
  raise ResourceNotSpecified unless package_name
10
+
8
11
  PackageUtils.deactivate package_name
9
12
  end
10
13
  end
11
-
data/lib/cmd/diff.rb CHANGED
@@ -12,12 +12,21 @@ module Lace
12
12
 
13
13
  package = Package.new(package_name, ARGV.first)
14
14
  diff = PackageUtils.diff package_name
15
- ohai 'The following files would be added [+] or removed [-]'
16
- diff.added.each do |f|
17
- puts "[+] #{f.basename} -> #{f.as_dotfile(Dir.home, package.path).to_path.gsub(Dir.home, '$HOME')}"
15
+
16
+ if diff.in_sync?
17
+ ohai 'Everything is already in sync.'
18
+ return
18
19
  end
19
- diff.removed.each do |f|
20
- puts "[-] #{f.basename} -> #{f.as_dotfile(Dir.home, package.path).to_path.gsub(Dir.home, '$HOME')}"
20
+
21
+ ohai 'The following files would be added [+] or removed [-], or are blocked [!]'
22
+ { '+' => diff.added, '-' => diff.removed, '!' => diff.blocked }.each do |mark, files|
23
+ files.each do |f|
24
+ puts "[#{mark}] #{f.basename} -> #{f.as_dotfile(Dir.home, package.path).to_path.gsub(Dir.home, '$HOME')}"
25
+ end
21
26
  end
27
+ return if diff.blocked.empty?
28
+
29
+ puts 'Blocked entries have a file, folder or foreign link in their place; ' \
30
+ '`lace apply --force` backs it up and links the entry.'
22
31
  end
23
32
  end
data/lib/cmd/fetch.rb CHANGED
@@ -1,19 +1,14 @@
1
1
  require 'lace/package'
2
2
  require 'lace/exceptions'
3
3
 
4
- module Lace extend self
4
+ module Lace
5
+ extend self
6
+
5
7
  def fetch
6
8
  resource = ARGV.shift
7
- desired_package_name = ARGV.value "name"
9
+ desired_package_name = ARGV.value 'name'
8
10
  raise ResourceNotSpecified unless resource
9
- package_name, target_folder = PackageUtils.fetch(resource, desired_package_name)
10
- begin
11
- Package.new(package_name, false)
12
- rescue PackageFactsNotFound => e
13
- onoe e.message
14
- onoe "Removing fetched files"
15
- FileUtils.rm_rf(target_folder)
16
- Lace.failed = true
17
- end
11
+
12
+ PackageUtils.fetch(resource, desired_package_name)
18
13
  end
19
14
  end
data/lib/cmd/help.rb CHANGED
@@ -1,39 +1,47 @@
1
- HELP = <<-EOS
2
- Example usage:
3
- Synopsis:
4
- lace <cmd> <pkg-uri/name> [<flavor>] [--name=<name>] [--version] [--no-hooks] [--force]
1
+ HELP = <<~EOS
2
+ Example usage:
3
+ Synopsis:
4
+ lace <cmd> <pkg-uri/name> [<flavor>] [--name=<name>] [--version] [--no-hooks] [--force]
5
5
 
6
- lace ls
6
+ lace ls
7
7
 
8
- lace fetch <pkg-uri>
9
- lace fetch <pkg-uri>
8
+ lace fetch <pkg-uri>
9
+ lace fetch <pkg-uri> --name=<name>
10
10
 
11
- lace setup <pkg-uri>
12
- lace setup <pkg-uri> <flavor>
11
+ lace setup <pkg-name>
12
+ lace setup <pkg-name> <flavor>
13
+ lace setup <file>.lace
13
14
 
14
- lace activate <pkg-name>
15
- lace activate <pkg-name> <flavor>
15
+ lace activate <pkg-name>
16
+ lace activate <pkg-name> <flavor>
16
17
 
17
- lace deactivate <pkg-name>
18
- lace deactivate <pkg-name> <flavor>
18
+ lace deactivate <pkg-name>
19
+ lace deactivate <pkg-name> <flavor>
19
20
 
20
- lace remove <pkg-name>
21
- lace update <pkg-name>
21
+ lace diff <pkg-name>
22
+ lace apply <pkg-name> [--yes] [--force]
22
23
 
23
- Troubleshooting:
24
- lace help
25
- lace info <pkg-name>
26
- lace validate <local-directory>
27
- lace --version
24
+ lace remove <pkg-name>
25
+ lace update <pkg-name>
28
26
 
29
- For further help visit:
30
- https://github.com/kairichard/lace
27
+ Troubleshooting:
28
+ lace help
29
+ lace info <pkg-name>
30
+ lace where <pkg-name>
31
+ lace validate <local-directory>
32
+ lace --version
33
+
34
+ For further help visit:
35
+ https://github.com/kairichard/lace
31
36
  EOS
32
37
 
33
- module Lace extend self
38
+ module Lace
39
+ extend self
40
+
34
41
  def help
35
42
  puts HELP
36
43
  end
44
+
37
45
  def help_s
38
46
  HELP
39
47
  end
data/lib/cmd/inspect.rb CHANGED
@@ -3,29 +3,35 @@ require 'erb'
3
3
  require 'lace/package'
4
4
  require 'lace/exceptions'
5
5
 
6
- INSPECT = <<-EOS
7
- Inspection of <%= package.name %>:
8
- active: <%= package.is_active? %>
9
- flavors: <%= package.flavors %>
10
- version: <%= package.version %>
11
- homepage: <%= package.homepage %>
12
- upgradeable: <%= package.upgradeable? %>
13
- manifest: <%= package.manifest %>
6
+ INSPECT = <<~EOS
7
+ Inspection of <%= package.name %>:
8
+ active: <%= package.active %>
9
+ <% unless package.unlinked.empty? -%>
10
+ not linked: <%= package.unlinked.join("\n" + ' ' * 15) %>
11
+ <% end -%>
12
+ flavors: <%= package.flavors %>
13
+ version: <%= package.version %>
14
+ homepage: <%= package.homepage %>
15
+ upgradeable: <%= package.upgradeable? %>
16
+ manifest: <%= package.manifest %>
14
17
  EOS
15
18
 
16
- module Lace extend self
19
+ module Lace
20
+ extend self
21
+
17
22
  def inspect
18
23
  resource = ARGV.shift
19
24
  raise ResourceNotSpecified unless resource
25
+
20
26
  package = PackagePresenter.new Package.new(resource, false)
21
- puts ERB.new(INSPECT).result(binding)
27
+ puts ERB.new(INSPECT, trim_mode: '-').result(binding)
22
28
  end
23
29
  end
24
30
 
25
31
  class PackagePresenter
26
32
  attr_accessor :pkg
27
33
 
28
- def initialize obj
34
+ def initialize(obj)
29
35
  @pkg = obj
30
36
  end
31
37
 
@@ -33,18 +39,37 @@ class PackagePresenter
33
39
  @pkg.name
34
40
  end
35
41
 
36
- def is_active?
37
- pkg.is_active?
42
+ def activation
43
+ @activation ||= @pkg.activation
44
+ end
45
+
46
+ # "true", "false", or "partially" with the flavor that is partly linked.
47
+ def active
48
+ case activation.state
49
+ when :active then 'true'
50
+ when :inactive then 'false'
51
+ when :partial then activation.flavor ? "partially (#{activation.flavor})" : 'partially'
52
+ else raise ArgumentError, "unknown activation state: #{activation.state.inspect}"
53
+ end
54
+ end
55
+
56
+ # For a partly linked package: each entry not linked, and why.
57
+ def unlinked
58
+ return [] unless activation.state == :partial
59
+
60
+ activation.unlinked.map do |file, state|
61
+ "#{file.as_dotfile(Dir.home, @pkg.path).to_path.gsub(Dir.home, '$HOME')} (#{state})"
62
+ end
38
63
  end
39
64
 
40
65
  def flavors
41
- flavors_as_string.empty? ? "nil" : flavors_as_string
66
+ flavors_as_string.empty? ? 'nil' : flavors_as_string
42
67
  end
43
68
 
44
69
  def flavors_as_string
45
- if @pkg.facts.flavors
46
- return @pkg.facts.flavors.join ", "
47
- end
70
+ return unless @pkg.facts.flavors
71
+
72
+ @pkg.facts.flavors.join ', '
48
73
  end
49
74
 
50
75
  def version
data/lib/cmd/list.rb CHANGED
@@ -1,25 +1,48 @@
1
1
  require 'lace/package'
2
2
 
3
- module Lace extend self
3
+ module Lace
4
+ extend self
5
+
6
+ # [*] fully linked, [~] partly linked, [ ] not linked.
7
+ STATE_MARKS = { active: '*', partial: '~', inactive: ' ' }.freeze
4
8
 
5
9
  def active_packages
6
10
  installed_packages.select(&:is_active?)
7
11
  end
8
12
 
9
13
  def installed_packages
10
- Dir.glob(File.join(Lace.pkgs_folder, "**")).sort.map do |p|
11
- Package.new(Pathname.new(p).basename.to_s, false)
14
+ package_folders.select { |folder| manifest?(folder) }.map do |folder|
15
+ Package.new(folder.basename.to_s, false)
12
16
  end
13
17
  end
14
18
 
19
+ # Folders without a manifest: a half-fetched or broken package.
20
+ def broken_package_folders
21
+ package_folders.reject { |folder| manifest?(folder) }
22
+ end
23
+
24
+ def package_folders
25
+ Pathname.glob(Lace.pkgs_folder / '*').select(&:directory?).sort
26
+ end
27
+
28
+ def manifest?(folder)
29
+ (folder / PackageFacts::MANIFEST).exist?
30
+ end
31
+
15
32
  def list
16
- if installed_packages.length > 0
17
- installed_packages.map do |package|
18
- puts "[#{Tty.green}#{package.is_active? ? "*" : " "}#{Tty.reset}] #{package.name}#{package.is_modified? ? " (has local changes)":""}"
19
- end
20
- else
21
- puts "There are no pkgs installed"
33
+ packages = installed_packages
34
+ broken = broken_package_folders
35
+ if packages.empty? && broken.empty?
36
+ puts 'There are no pkgs installed'
37
+ return
22
38
  end
23
- end
24
39
 
40
+ packages.each do |package|
41
+ mark = STATE_MARKS.fetch(package.activation.state)
42
+ description = package.facts.description
43
+ puts "[#{Tty.green}#{mark}#{Tty.reset}] #{package.name}#{" - #{description}" if description}" \
44
+ "#{' (has local changes)' if package.is_modified?}"
45
+ end
46
+ broken.each { |folder| ofail "#{folder.basename} has no #{PackageFacts::MANIFEST}" }
47
+ end
25
48
  end
data/lib/cmd/remove.rb CHANGED
@@ -1,11 +1,13 @@
1
1
  require 'lace/package'
2
2
  require 'lace/exceptions'
3
3
 
4
- module Lace extend self
4
+ module Lace
5
+ extend self
6
+
5
7
  def remove
6
8
  package_name = ARGV.shift
7
9
  raise ResourceNotSpecified unless package_name
10
+
8
11
  PackageUtils.remove package_name
9
12
  end
10
13
  end
11
-
data/lib/cmd/setup.rb CHANGED
@@ -6,8 +6,16 @@ require 'lace/exceptions'
6
6
  module Lace
7
7
  module_function
8
8
 
9
+ # `lace setup <package> [flavor]`, or `lace setup <file>.lace` for all
10
+ # packages a pkg.lace lists.
9
11
  def setup
10
- package_name = ARGV.shift
11
- PackageUtils.setup package_name
12
+ target = ARGV.shift
13
+ raise ResourceNotSpecified unless target
14
+
15
+ if PkgLace.path?(target)
16
+ PackageUtils.setup_all(PkgLace.new(target))
17
+ else
18
+ PackageUtils.setup target
19
+ end
12
20
  end
13
21
  end
data/lib/cmd/update.rb CHANGED
@@ -1,10 +1,13 @@
1
1
  require 'lace/package'
2
2
  require 'lace/exceptions'
3
3
 
4
- module Lace extend self
4
+ module Lace
5
+ extend self
6
+
5
7
  def update
6
8
  resource = ARGV.shift
7
9
  raise ResourceNotSpecified unless resource
10
+
8
11
  PackageUtils.update resource
9
12
  end
10
13
  end
data/lib/cmd/upgrade.rb CHANGED
@@ -1,21 +1,24 @@
1
1
  require 'lace/package'
2
2
  require 'lace/exceptions'
3
3
 
4
- module Lace extend self
4
+ module Lace
5
+ extend self
6
+
5
7
  def upgrade
6
8
  require 'cmd/list'
7
9
  if Lace.active_packages.empty?
8
10
  upgrade_lace_folder
9
11
  else
10
- onoe "Please deactivate all packages before continuing"
12
+ onoe 'Please deactivate all packages before continuing'
11
13
  Lace.failed = true
12
14
  end
13
15
  end
16
+
14
17
  def upgrade_lace_folder
15
- old_dir = Pathname.new(ENV["HOME"])/".cassias"
16
- if old_dir.exist?
17
- File.rename old_dir, Lace.pkgs_folder
18
- old_dir.rmdir_if_possible
19
- end
18
+ old_dir = Pathname.new(ENV.fetch('HOME', nil)) / '.cassias'
19
+ return unless old_dir.exist?
20
+
21
+ File.rename old_dir, Lace.pkgs_folder
22
+ old_dir.rmdir_if_possible
20
23
  end
21
24
  end