Class: Unmacer

Inherits:
Object
  • Object
show all
Defined in:
lib/unmacer.rb

Constant Summary collapse

SPOTLIGHT =
'.Spotlight-V100'
FSEVENTS =
'.fseventsd'
TRASHES =
'.Trashes'
REVISIONS =
'.DocumentRevisions-V100'
MBACKUPS =
'.MobileBackups'
MACOSX =
'__MACOSX'
DSSTORE =
'.DS_Store'
ICON =
"Icon\cM"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeUnmacer

Returns a new instance of Unmacer.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/unmacer.rb', line 27

def initialize
  self.verbose                   = false
  self.pretend                   = false
  self.keep_spotlight            = false
  self.keep_fsevents             = false
  self.keep_trashes              = false
  self.keep_document_revisions   = false
  self.keep_mobile_backups       = false
  self.keep_macosx               = false
  self.keep_dsstore              = false
  self.keep_apple_double         = false
  self.keep_apple_double_orphans = false
  self.keep_custom_folder_icons  = false
end

Instance Attribute Details

#keep_apple_doubleObject

Returns the value of attribute keep_apple_double.



5
6
7
# File 'lib/unmacer.rb', line 5

def keep_apple_double
  @keep_apple_double
end

#keep_apple_double_orphansObject

Returns the value of attribute keep_apple_double_orphans.



5
6
7
# File 'lib/unmacer.rb', line 5

def keep_apple_double_orphans
  @keep_apple_double_orphans
end

#keep_custom_folder_iconsObject

Returns the value of attribute keep_custom_folder_icons.



5
6
7
# File 'lib/unmacer.rb', line 5

def keep_custom_folder_icons
  @keep_custom_folder_icons
end

#keep_document_revisionsObject

Returns the value of attribute keep_document_revisions.



5
6
7
# File 'lib/unmacer.rb', line 5

def keep_document_revisions
  @keep_document_revisions
end

#keep_dsstoreObject

Returns the value of attribute keep_dsstore.



5
6
7
# File 'lib/unmacer.rb', line 5

def keep_dsstore
  @keep_dsstore
end

#keep_fseventsObject

Returns the value of attribute keep_fsevents.



5
6
7
# File 'lib/unmacer.rb', line 5

def keep_fsevents
  @keep_fsevents
end

#keep_macosxObject

Returns the value of attribute keep_macosx.



5
6
7
# File 'lib/unmacer.rb', line 5

def keep_macosx
  @keep_macosx
end

#keep_mobile_backupsObject

Returns the value of attribute keep_mobile_backups.



5
6
7
# File 'lib/unmacer.rb', line 5

def keep_mobile_backups
  @keep_mobile_backups
end

#keep_spotlightObject

Returns the value of attribute keep_spotlight.



5
6
7
# File 'lib/unmacer.rb', line 5

def keep_spotlight
  @keep_spotlight
end

#keep_trashesObject

Returns the value of attribute keep_trashes.



5
6
7
# File 'lib/unmacer.rb', line 5

def keep_trashes
  @keep_trashes
end

#pretendObject

Returns the value of attribute pretend.



5
6
7
# File 'lib/unmacer.rb', line 5

def pretend
  @pretend
end

#verboseObject

Returns the value of attribute verbose.



5
6
7
# File 'lib/unmacer.rb', line 5

def verbose
  @verbose
end

Instance Method Details

#find_skipping_root(path) ⇒ Object



51
52
53
54
55
56
57
58
59
60
# File 'lib/unmacer.rb', line 51

def find_skipping_root(path)
  root_seen = false
  Find.find(path) do |f|
    if !root_seen
      root_seen = true
    else
      yield f
    end
  end
end

#unmac!(dirnames) ⇒ Object



42
43
44
45
46
47
48
49
# File 'lib/unmacer.rb', line 42

def unmac!(dirnames)
  Array(dirnames).each do |dirname|
    unmac_root(dirname)
    find_skipping_root(dirname) do |f|
      unmac_folder(f) if File.directory?(f)
    end
  end
end