Module: Pod::Lazy

Included in:
Command::Install, Command::Update
Defined in:
lib/cocoapods-lazy/main.rb,
lib/cocoapods-lazy/logger.rb,
lib/cocoapods-lazy/repository.rb,
lib/cocoapods-lazy/remote_storage.rb

Defined Under Namespace

Classes: Logger, RemoteStorage, Repository

Instance Method Summary collapse

Instance Method Details

#initialize(argv) ⇒ Object



11
12
13
14
15
# 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

#optionsObject



40
41
42
43
44
45
# File 'lib/cocoapods-lazy/main.rb', line 40

def options
  [
    ['--no-fetch', 'Skip fetch action'], 
    ['--no-store', 'Skip store action'],
  ].concat(super)
end

#runObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 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