Sha256: 2a925ffd06df5a58118d06d160e298bcc68ecc9e1cde5e897c5e05efb97d67da

Contents?: true

Size: 848 Bytes

Versions: 8

Compression:

Stored size: 848 Bytes

Contents

usage   'sync'
summary 'sync data sources'
description <<-EOS
Sync data source data. This command is useful for updating local item caches
for data sources which rely on slow external APIs.
EOS

module Nanoc::CLI::Commands

  class Sync < ::Nanoc::CLI::CommandRunner

    def run
      # Check arguments
      if arguments.size != 0
        raise Nanoc::Errors::GenericTrivial, "usage: #{command.usage}"
      end

      # Make sure we are in a nanoc site directory
      self.require_site

      # Update all syncable data sources
      self.site.data_sources.each do |data_source|
        unless data_source.method(:sync).owner == Nanoc::DataSource
          puts "Syncing #{data_source.config[:type]} data source: #{data_source.items_root}"
          data_source.sync
        end
      end
    end

  end

end

runner Nanoc::CLI::Commands::Sync

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
nanoc-3.6.7 lib/nanoc/cli/commands/sync.rb
nanoc-3.6.6 lib/nanoc/cli/commands/sync.rb
nanoc-3.6.5 lib/nanoc/cli/commands/sync.rb
nanoc-3.6.4 lib/nanoc/cli/commands/sync.rb
nanoc-3.6.3 lib/nanoc/cli/commands/sync.rb
nanoc-3.6.2 lib/nanoc/cli/commands/sync.rb
nanoc-3.6.1 lib/nanoc/cli/commands/sync.rb
nanoc-3.6.0 lib/nanoc/cli/commands/sync.rb