Sha256: 1d07e5166d808f5f768fc8b69e5b95cc6268f921f78e49b5b0e2815e135abe0a

Contents?: true

Size: 1.43 KB

Versions: 11

Compression:

Stored size: 1.43 KB

Contents

require 'commands/init/init_model'
require 'commands/init/p4_helpers'

module Commands
  module Init

    class DepotModel < InitModel
      include Commands::Init::P4Helpers

      inheritable_attributes :depot, :description, :type, :address, :suffix, :map, :spec_map

      # The depot name
      @depot = nil

      @description = 'Init depot'

      @type = 'local'

      @address = nil

      @suffix = nil

      @map = 'depot/...'

      @spec_map = nil

      #========================================================================
      # Internal implementation
      #========================================================================

      def self.abstract
        true
      end

      attr_accessor :depot, :description, :type, :address, :suffix, :map, :spec_map

      def initialize
        @depot = self.class.depot
        @description = self.class.description
        @type = self.class.type
        @address = self.class.address
        @suffix = self.class.suffix
        @map = self.class.map
        @spec_map = self.class.spec_map
      end

      def execute(p4, models=nil, super_user=nil)
        d = p4.fetch_depot(depot)
        d._depot = depot
        d._description = description if description
        d._type = type if type
        d._address = address if address
        d._suffix = suffix if suffix
        d._map = map if map
        d._spec_map = spec_map if spec_map
        p4.save_depot(d)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
p4util-0.4.3 ./lib/commands/init/depot_model.rb
p4util-0.4.2 ./lib/commands/init/depot_model.rb
p4util-0.4.1 ./lib/commands/init/depot_model.rb
p4util-0.4 ./lib/commands/init/depot_model.rb
p4util-0.3.1 ./lib/commands/init/depot_model.rb
p4util-0.3.0 ./lib/commands/init/depot_model.rb
p4util-0.2 ./lib/commands/init/depot_model.rb
p4util-0.1.6 ./lib/commands/init/depot_model.rb
p4util-0.1.5 ./lib/commands/init/depot_model.rb
p4util-0.1.4 ./lib/commands/init/depot_model.rb
p4util-0.1.3 ./lib/commands/init/depot_model.rb