bin/snapshot in snapshot-1.11.1 vs bin/snapshot in snapshot-1.12.0
- old
+ new
@@ -8,10 +8,11 @@
HighLine.track_eof = false
class SnapshotApplication
include Commander::Methods
+ # rubocop:disable Metrics/MethodLength
def run
program :version, Snapshot::VERSION
program :description, 'CLI for \'snapshot\' - Automate taking localized screenshots of your iOS app on every device'
program :help, 'Author', 'Felix Krause <snapshot@krausefx.com>'
program :help, 'Website', 'https://fastlane.tools'
@@ -27,13 +28,11 @@
command :run do |c|
c.syntax = 'snapshot'
c.description = 'Take new screenshots based on the Snapfile.'
c.action do |args, options|
- o = options.__hash__.dup
- o.delete(:verbose)
- Snapshot.config = FastlaneCore::Configuration.create(Snapshot::Options.available_options, o)
+ load_config(options)
Snapshot::DependencyChecker.check_simulators
Snapshot::Runner.new.work
end
end
@@ -71,12 +70,39 @@
Snapshot::ResetSimulators.clear_everything!(versions)
end
end
+ command :clear_derived_data do |c|
+ c.syntax = 'snapshot clear_derived_data -f path'
+ c.description = "Clear the directory where build products and other derived data will go"
+
+ c.action do |args, options|
+ load_config(options)
+ derived_data_path = Snapshot.config[:derived_data_path]
+
+ if !derived_data_path
+ Snapshot::UI.user_error! "No derived_data_path"
+ elsif !Dir.exist?(derived_data_path)
+ Snapshot::UI.important "Path #{derived_data_path} does not exist"
+ else
+ FileUtils.rm_rf(derived_data_path)
+ Snapshot::UI.success "Removed #{derived_data_path}"
+ end
+ end
+ end
+
default_command :run
run!
+ end
+
+ private
+
+ def load_config(options)
+ o = options.__hash__.dup
+ o.delete(:verbose)
+ Snapshot.config = FastlaneCore::Configuration.create(Snapshot::Options.available_options, o)
end
end
begin
FastlaneCore::UpdateChecker.start_looking_for_update('snapshot')