Skip to content
This repository has been archived by the owner on Nov 19, 2018. It is now read-only.

Commit

Permalink
Added new deliver download_screenshots action
Browse files Browse the repository at this point in the history
  • Loading branch information
KrauseFx committed May 26, 2015
1 parent ee12e67 commit ed79ac1
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 11 deletions.
39 changes: 29 additions & 10 deletions bin/deliver
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $:.push File.expand_path("../../lib", __FILE__)

require 'deliver'
require 'commander'
require 'deliver/download_screenshots'

HighLine.track_eof = false

Expand Down Expand Up @@ -43,18 +44,18 @@ class FastlaneApplication

def run_deliver(options)
path = (Deliver::Helper.fastlane_enabled?? './fastlane' : '.')
Dir.chdir(path) do # switch the context
if File.exists?(deliver_path)
# Everything looks alright, use the given Deliverfile
options.default :beta => false, :skip_deploy => false
Deliver::Deliverer.new(deliver_path, force: options.force, is_beta_ipa: options.beta, skip_deploy: options.skip_deploy)
else
Deliver::Helper.log.warn("No Deliverfile found at path '#{deliver_path}'.")
if agree("Do you want to create a new Deliverfile at the current directory? (y/n)", true)
Deliver::DeliverfileCreator.create(enclosed_directory)
end
Dir.chdir(path) do # switch the context
if File.exists?(deliver_path)
# Everything looks alright, use the given Deliverfile
options.default :beta => false, :skip_deploy => false
Deliver::Deliverer.new(deliver_path, force: options.force, is_beta_ipa: options.beta, skip_deploy: options.skip_deploy)
else
Deliver::Helper.log.warn("No Deliverfile found at path '#{deliver_path}'.")
if agree("Do you want to create a new Deliverfile at the current directory? (y/n)", true)
Deliver::DeliverfileCreator.create(enclosed_directory)
end
end
end
end

command :init do |c|
Expand All @@ -70,6 +71,24 @@ class FastlaneApplication
end
end

command :download_screenshots do |c|
c.syntax = 'deliver download_screenshots'
c.description = "Downloads all existing screenshots from iTunes Connect and stores them in the screenshots folder"
c.option '-a', '--app_identifier String', String, 'The App Identifier (e.g. com.krausefx.app)'
c.option '-u', '--username String', String, 'Your Apple ID'
c.action do |args, options|
set_username(options.username)

app_identifier = options.app_identifier || CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier) || ask("Please enter the app's bundle identifier: ")
app = Deliver::App.new(app_identifier: app_identifier)

path = (Deliver::Helper.fastlane_enabled?? './fastlane' : '.')
path = File.join(path, "deliver")

Deliver::DownloadScreenshots.run(app, path)
end
end

command :testflight do |c|
c.syntax = 'deliver testflight'
c.description = "Uploads a given ipa file to the new Apple TestFlight"
Expand Down
2 changes: 1 addition & 1 deletion lib/assets/summary.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
deliver couldn't find any screenshots. Due to a bug in iTunes Transporter this will <b>remove</b> the existing screenshots on iTunes Connect.
</p>
<p>
Please make sure to store your screenshots in the screenshots folder. If you want to download your existing screenshots, run <i>deliver init</i> in a different directory.
Please make sure to store your screenshots in the screenshots folder. If you want to download your existing screenshots, run <i>deliver download_screenshots</i>.
</p>
</div>
<% end %>
Expand Down
14 changes: 14 additions & 0 deletions lib/deliver/download_screenshots.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module Deliver
class DownloadScreenshots
def self.run(app, path)
begin
Helper.log.info "Downloading all existing screenshots...".green
ItunesConnect.new.download_existing_screenshots(app, path)
Helper.log.info "Successfully downloaded all existing screenshots".green
rescue Exception => ex
Helper.log.error ex
Helper.log.error "Couldn't download already existing screenshots from iTunesConnect.".red
end
end
end
end

0 comments on commit ed79ac1

Please sign in to comment.