Sha256: 34ab675774e6b40867f9faa6c9cbc4d0c26f9dc58c9abb3b44ed86aeed3dc0bd

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

module Braid
  module Commands
    class List < Command
      def run(path = nil, options = {})
        with_reset_on_error do
          path ? list_one(path, options) : list_all(options)
        end
      end

      protected
      def list_all(options = {})
        options.reject! { |k, v| %w(revision head).include?(k) }
        print "\n"
        msg "Listing all mirrors.\n=======================================================\n"
        config.mirrors.each do |path|
          mirror = config.get!(path)
          print path.to_s
          print ' [LOCKED]' if mirror.locked?
          setup_remote(mirror)
          msg "Fetching new commits for '#{mirror.path}'." if verbose?
          mirror.fetch
          new_revision    = validate_new_revision(mirror, options['revision'])
          print ' (Remote Modified)' if new_revision.to_s != mirror.base_revision.to_s
          local_file_count = git.read_ls_files(mirror.path).split.size
          if 0 == local_file_count
            print ' (Removed Locally)'
          elsif !mirror.diff.empty?
            print ' (Locally Modified)'
          end
          print "\n"
        end
        print "\n"
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
braid-1.0.1 lib/braid/commands/list.rb
braid-1.0.0 lib/braid/commands/list.rb
realityforge-braid-0.9.9 lib/braid/commands/list.rb