xcode_trash_remover 2.0.1 → 2.0.2
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +17 -4
- data/assets/.DS_Store +0 -0
- data/assets/output2.png +0 -0
- data/bin/xcclean +29 -8
- data/lib/xcode_trash_remover/core.rb +33 -45
- data/lib/xcode_trash_remover/size_helper.rb +1 -1
- data/lib/xcode_trash_remover/version.rb +1 -1
- data/lib/xcode_trash_remover/xcode_dir.rb +15 -11
- data/xcode_trash_remover.gemspec +1 -1
- metadata +4 -3
- data/assets/output.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43d44a018d892666abf6d4f94e8c211377157960
|
4
|
+
data.tar.gz: d9aefd7b01fb1c8b4a7b8878383721510860212e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f19d75a95f3a2ccacc04cefaa004cc7af5647211ec4d7bbbbc21a837e686b3ecce78848f7253d9591d0b87be0bcc4e422352dc80d26d76292bc3fc825b4649d7
|
7
|
+
data.tar.gz: f2e4f1d1658cf5058bdfc7b237dfa0bfd90addf5cc3d502911f521bb883531b3851c3014b31e6bcec94cd0399cf1bb93d5020d9a80c1e559e1375aeb16628dc8
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -8,10 +8,23 @@ This is a simple script to remove Xcode's trash files that are generated under d
|
|
8
8
|
|
9
9
|
## Usage
|
10
10
|
|
11
|
-
|
11
|
+
`$ xcclean` to check your directories.
|
12
12
|
|
13
|
-
|
13
|
+
`$ xcclean -rm` to **remove** the files.
|
14
14
|
|
15
|
-
|
15
|
+
<img src = https://raw.githubusercontent.com/FrankKair/xcode-trash-remover/master/assets/output2.png width="45%" height="45%"/>
|
16
|
+
|
17
|
+
## Directories
|
18
|
+
|
19
|
+
- `Derived Data`: Intermediate build information.
|
20
|
+
|
21
|
+
- `Archives`: Info about the target. Used for debbuging deployd applications.
|
22
|
+
|
23
|
+
- `XCPGDevices`: Xcode Playground files.
|
24
|
+
|
25
|
+
- `CoreSimulator/Devices`: Simulators and devices. That's where Xcode stores the apps' data.
|
26
|
+
|
27
|
+
## Warning
|
28
|
+
|
29
|
+
You should only use this program if you're sure you're not going to use the information contained in these folders.
|
16
30
|
|
17
|
-
<img src = https://raw.githubusercontent.com/FrankKair/xcode-trash-remover/master/assets/output.png width="30%" height="30%"/>
|
data/assets/.DS_Store
ADDED
Binary file
|
data/assets/output2.png
ADDED
Binary file
|
data/bin/xcclean
CHANGED
@@ -1,13 +1,34 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
require 'optparse'
|
2
3
|
require 'xcode_trash_remover'
|
3
4
|
|
4
|
-
puts '== Xcode Trash Remover =='
|
5
|
-
XcodeTrashRemover::Core.check_volumes
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
ARGV[0] = '--help' if ARGV.empty?
|
7
|
+
unless ARGV[0].include?('--') || ARGV[0].include?('-')
|
8
|
+
puts "invalid option: #{ARGV[0]}"
|
9
|
+
end
|
10
|
+
|
11
|
+
options = {}
|
12
|
+
opt_parser = OptionParser.new do |opt|
|
13
|
+
opt.on('--check', 'Checks the volumes') do |o|
|
14
|
+
options[:check] = o
|
15
|
+
end
|
16
|
+
opt.on('--remove', 'Removes the files from your system') do |o|
|
17
|
+
options[:remove] = o
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
begin
|
22
|
+
opt_parser.parse!
|
23
|
+
options.keys.each do |k|
|
24
|
+
case k
|
25
|
+
when :check
|
26
|
+
XcodeTrashRemover::Core.check_volumes
|
27
|
+
when :remove
|
28
|
+
XcodeTrashRemover::Core.check_volumes
|
29
|
+
XcodeTrashRemover::Core.remove_trash
|
30
|
+
end
|
31
|
+
end
|
32
|
+
rescue StandardError => e
|
33
|
+
puts e.to_s unless e.message == 'exit'
|
13
34
|
end
|
@@ -7,41 +7,29 @@ module XcodeTrashRemover
|
|
7
7
|
def check_volumes
|
8
8
|
puts 'Dir size'
|
9
9
|
puts
|
10
|
-
puts "DerivedData #{
|
10
|
+
puts "DerivedData #{deriveddata_size.pretty}"
|
11
11
|
puts "Archives #{archives_size.pretty}"
|
12
|
-
puts "XCPGDevices #{
|
13
|
-
puts "CoreSimulator #{
|
12
|
+
puts "XCPGDevices #{xcpgdevices_size.pretty}"
|
13
|
+
puts "CoreSimulator #{coresimulator_devices_size.pretty}"
|
14
14
|
puts
|
15
15
|
end
|
16
16
|
|
17
17
|
def remove_trash
|
18
18
|
total = total_size
|
19
|
-
print_total_size(total)
|
20
19
|
remove_dirs
|
21
|
-
puts "#{total.pretty} removed!"
|
22
|
-
end
|
23
20
|
|
24
|
-
|
25
|
-
puts '
|
26
|
-
puts '
|
27
|
-
puts
|
21
|
+
puts "Total #{total.pretty}"
|
22
|
+
puts '-'
|
23
|
+
puts 'The directories are empty. No trash files.' if total.zero?
|
24
|
+
puts "#{total.pretty} removed!" unless total.zero?
|
28
25
|
end
|
29
26
|
|
30
27
|
private
|
31
28
|
|
32
|
-
def print_total_size(size)
|
33
|
-
puts "Total #{size.pretty}"
|
34
|
-
puts '-'
|
35
|
-
if size.zero?
|
36
|
-
puts 'The directories are empty. No trash files.'
|
37
|
-
exit(0)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
29
|
def remove_dirs
|
42
30
|
dirs = [
|
43
|
-
XcodeDir.
|
44
|
-
XcodeDir.
|
31
|
+
XcodeDir.deriveddata, XcodeDir.archives,
|
32
|
+
XcodeDir.xcpgdevices, XcodeDir.coresimulator_devices
|
45
33
|
]
|
46
34
|
|
47
35
|
dirs.each do |dir|
|
@@ -51,38 +39,38 @@ module XcodeTrashRemover
|
|
51
39
|
end
|
52
40
|
end
|
53
41
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
end
|
61
|
-
|
62
|
-
def playground_devices_size
|
63
|
-
trash_size(XcodeDir.playground_devices)
|
64
|
-
end
|
42
|
+
dirs = %w[
|
43
|
+
deriveddata
|
44
|
+
archives
|
45
|
+
xcpgdevices
|
46
|
+
coresimulator_devices
|
47
|
+
]
|
65
48
|
|
66
|
-
|
67
|
-
|
49
|
+
dirs.each do |dir|
|
50
|
+
define_method("#{dir}_size") do
|
51
|
+
case dir
|
52
|
+
when 'deriveddata'
|
53
|
+
trash_size(XcodeDir.deriveddata)
|
54
|
+
when 'archives'
|
55
|
+
trash_size(XcodeDir.archives)
|
56
|
+
when 'xcpgdevices'
|
57
|
+
trash_size(XcodeDir.xcpgdevices)
|
58
|
+
when 'coresimulator_devices'
|
59
|
+
trash_size(XcodeDir.coresimulator_devices)
|
60
|
+
end
|
61
|
+
end
|
68
62
|
end
|
69
63
|
|
70
64
|
def total_size
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
total += core_simulator_size
|
76
|
-
total
|
65
|
+
[deriveddata_size,
|
66
|
+
archives_size,
|
67
|
+
xcpgdevices_size,
|
68
|
+
coresimulator_devices_size].reduce(:+)
|
77
69
|
end
|
78
70
|
|
79
71
|
def trash_size(dir)
|
80
72
|
return 0 if dir.empty?
|
81
|
-
size
|
82
|
-
dir.each do |subdir|
|
83
|
-
size += SizeHelper.dir_size(subdir)
|
84
|
-
end
|
85
|
-
size
|
73
|
+
dir.reduce(0) { |size, subdir| size += SizeHelper.dir_size(subdir) }
|
86
74
|
end
|
87
75
|
|
88
76
|
def remove_dir(dir)
|
@@ -2,20 +2,24 @@ module XcodeTrashRemover
|
|
2
2
|
module XcodeDir
|
3
3
|
extend self
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
# Creates:
|
6
|
+
# deriveddata, archives
|
7
|
+
# xcpgdevices and coresimulator_devices
|
8
|
+
# methods.
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
dir_names = %w[
|
11
|
+
Xcode/DerivedData
|
12
|
+
Xcode/Archives
|
13
|
+
XCPGDevices
|
14
|
+
CoreSimulator/Devices
|
15
|
+
]
|
12
16
|
|
13
|
-
|
14
|
-
|
15
|
-
end
|
17
|
+
dir_names.each do |dir|
|
18
|
+
trimmed_dir_name = dir.downcase.tr('/', '_').to_s.gsub('xcode_', '')
|
16
19
|
|
17
|
-
|
18
|
-
|
20
|
+
define_method(trimmed_dir_name) do
|
21
|
+
root(dir)
|
22
|
+
end
|
19
23
|
end
|
20
24
|
|
21
25
|
private
|
data/xcode_trash_remover.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcode_trash_remover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Kair
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,7 +66,8 @@ files:
|
|
66
66
|
- LICENSE.txt
|
67
67
|
- README.md
|
68
68
|
- Rakefile
|
69
|
-
- assets
|
69
|
+
- assets/.DS_Store
|
70
|
+
- assets/output2.png
|
70
71
|
- bin/xcclean
|
71
72
|
- lib/xcode_trash_remover.rb
|
72
73
|
- lib/xcode_trash_remover/core.rb
|
data/assets/output.png
DELETED
Binary file
|