module Pod::Lazy

Public Class Methods

new(argv) click to toggle source
Calls superclass method
# File lib/cocoapods-lazy/main.rb, line 11
def initialize(argv)
  super
  @should_store = argv.flag?('store', true)
  @should_fetch = argv.flag?('fetch', true)
end

Public Instance Methods

options() click to toggle source
Calls superclass method
# File lib/cocoapods-lazy/main.rb, line 40
def options
  [
    ['--no-fetch', 'Skip fetch action'], 
    ['--no-store', 'Skip store action'],
  ].concat(super)
end
run() click to toggle source
Calls superclass method
# File lib/cocoapods-lazy/main.rb, line 17
def run
  Pod::Lazy::Logger.info "Redirection to cocoapods-lazy"
  lazy_config = load_credential()
  unless lazy_config.nil?
    Pod::Lazy::Logger.info "cocoapods-lazy is enabled in Podfile"
    Pod::Lazy::Logger.info "Lazy config:\n#{lazy_config}"
    remote_storage = Pod::Lazy::RemoteStorage.new(lazy_config)
    repository = Pod::Lazy::Repository.new(remote_storage)
    repository.fetch() if @should_fetch
    Pod::Lazy::Logger.info "Run origin command"
    super
    if repository.should_store && @should_store
      Pod::Lazy::Logger.info "Storing..."
      repository.store()
    end
    Pod::Lazy::Logger.info "Flow cocoapods-lazy if finished"
  else
    Pod::Lazy::Logger.info "cocoapods-lazy is not enabled in Podfile"
    Pod::Lazy::Logger.info "Run origin command"
    super
  end
end

Private Instance Methods

load_credential() click to toggle source
# File lib/cocoapods-lazy/main.rb, line 49
def load_credential
  path = Pathname.new('Podfile')
  Podfile.from_file(path)
  Pod::Podfile::DSL.config
end