lib/deliver/commands_generator.rb in deliver-1.4.0 vs lib/deliver/commands_generator.rb in deliver-1.5.0

- old
+ new

@@ -12,10 +12,12 @@ self.new.run ensure FastlaneCore::UpdateChecker.show_update_status('deliver', Deliver::VERSION) end + # rubocop:disable Metrics/AbcSize + # rubocop:disable Metrics/MethodLength def run program :version, Deliver::VERSION program :description, Deliver::DESCRIPTION program :help, 'Author', 'Felix Krause <deliver@krausefx.com>' program :help, 'Website', 'https://fastlane.tools' @@ -76,9 +78,34 @@ path = (FastlaneCore::Helper.fastlane_enabled? ? './fastlane' : '.') Deliver::DownloadScreenshots.run(options, path) end end + + command :download_metadata do |c| + c.syntax = 'deliver download_metadata' + c.description = "Downloads existing metadata and stores it locally. This overwrites the local files." + + c.action do |args, options| + options = FastlaneCore::Configuration.create(Deliver::Options.available_options, options.__hash__) + options.load_configuration_file("Deliverfile") + Deliver::Runner.new(options) # to login... + + path = (FastlaneCore::Helper.fastlane_enabled? ? './fastlane' : '.') + + res = ENV["DELIVER_FORCE_OVERWRITE"] + res ||= agree("Do you want to overwrite existing metadata on path '#{File.expand_path(path)}/metadata'? (y/n)", true) + if res + require 'deliver/setup' + v = options[:app].latest_version + Deliver::Setup.new.generate_metadata_files(v, path) + else + return 0 + end + end + end + # rubocop:enable Metrics/AbcSize + # rubocop:enable Metrics/MethodLength default_command :run run! end