class Pod::Command::RepoRsync::Update

Public Class Methods

new(argv) click to toggle source
Calls superclass method
# File lib/pod/command/repo_rsync/update.rb, line 19
def initialize(argv)
  @name, @ssh_argv = argv.shift_argument, argv.shift_argument
  super
end

Public Instance Methods

run() click to toggle source

def validate!

super
unless @name
  help! "Updating a spec-repo needs a `NAME`."
end

end

# File lib/pod/command/repo_rsync/update.rb, line 31
def run
  update(@name, @ssh_argv, $skip) #todo: dusty
end

Private Instance Methods

rsync_source_named(name) click to toggle source

@return [Source] The rsync source with the given name. If no rsync source

with given name is found it raises.

@param [String] name

The name of the source.
# File lib/pod/command/repo_rsync/update.rb, line 98
def rsync_source_named(name)
  if Gem::Dependency.new("", '>= 1.0').match?('', Pod::VERSION)
    specified_source = Pod::Config.instance.sources_manager.aggregate.sources.find { |s| s.name == name }
  else
    specified_source = SourcesManager.aggregate.sources.find { |s| s.name == name }
  end
  unless specified_source
    raise Informative, "Unable to find the `#{name}` repo."
  end
  unless RsyncSource.rsync_repo?(specified_source.repo)
    raise Informative, "The `#{name}` repo is not a rsync repo."
  end
  RsyncSource.new(specified_source.repo)
end
update(source_name = nil, argv = nil, skip = nil) click to toggle source

Updates the local copy of the spec-repo with the given name

@param [String] source_name name

@return [void]

# File lib/pod/command/repo_rsync/update.rb, line 54
def update(source_name = nil, argv = nil, skip = nil)
  if source_name
    sources = [rsync_source_named(source_name)]
  else
    sources =  RsyncSource.rsync_sources
  end

  sources.each do |source|
    UI.section "Updating spec repo `#{source.name}`" do
      Dir.chdir(source.repo) do
        begin
          cmd = "rsync #{argv || source.argv || ""} -rtl#{config.verbose? ? "v" : ""} --exclude=.rsync_config --exclude=.skip --delete \"#{source.url}\" \"#{source.repo}/\" | grep -v /$"

          source_skip = source.name.gsub('-','_') + "_skip"
          env_skip =  ENV[source_skip]
          no_repo_update = ENV["NO_REPO_UPDATE"]
          if "false" == env_skip
            UI.puts cmd if config.verbose?
            system(cmd)
          elsif "true" == source.skip || "true" == env_skip || "true" == no_repo_update
            print " skip update repo \n"
          else
            print " update repo  \n"
            UI.puts cmd if config.verbose?
            system(cmd)
          end
         # system(cmd)
        rescue Informative => e
          UI.warn 'CocoaPods was not able to update the ' \
          "`#{source.name}` repo. If this is an unexpected issue " \
          'and persists you can inspect it running ' \
          '`pod repo-rsync update --verbose`'
        end
      end
    end
  end
end