# This sets up a security=0 server but in Unicode mode, not sure about other # 'recommended' settings class BaseSystemSettings < SystemSettingsModel @unicode = true @security_level = 3 end class SuperUser < UserModel @super = true @login = 'super' @password = 'superuser1A!' end class MaxUser < UserModel def rank 10 end @login = 'mmustermann' @full_name = 'Max Mustermann' @password = 'mustermann1A!' end class JohnDoeUser < UserModel def rank 11 end @login = 'jdoe' @full_name = 'John Doe' @password = 'johndoe1A!' end class TriggersUser < UserModel def rank 12 end @login = 'triggers' @full_name = 'Trigger Account' @password = 'triggers1A!' end class JohnDoeSpecialUser < UserModel def rank 13 end @login = 'j\doe' @full_name = 'Johnny Doe' @password = 'johndoe1A!' end class StreamChangelistModel < InitModel inheritable_attributes :description, :adds, :edits, :user, :view, :client # Please make this descriptive @description = 'Init changelist' # An array of 'file definitions' @adds = [] # An array of 'file definitions' expected to already exist @edits = [] # The user we should operate as if you don't want to do this as the super # user @user = nil # Don't use the default //depot/... mapping, use this instead @view = nil #======================================================================== # Internal implementation #======================================================================== def self.abstract true end attr_accessor :description, :adds, :edits, :user, :view, :client def initialize @description = self.class.description @adds = self.class.adds @edits = self.class.edits @user = self.class.user @view = self.class.view @client = self.class.client end def execute(p4, models=nil, super_user=nil) puts @client.inspect puts @description.inspect p4.client = @client client = p4.fetch_client(@client) change_spec = p4.fetch_change client_path = client._root change_spec._description = description results = p4.save_change(change_spec) change_id = results[0].gsub(/^Change (\d+) created./, '\1') puts "Preparing changelist #{change_id} with #{@adds.length} adds and #{@edits.length} edits" @adds.each do |add| add_path = File.join(client_path, add.path) dir = File.dirname(add_path) if dir && !dir.empty? if !Dir.exist?(dir) FileUtils.mkpath(dir) end end if add.content IO.write(add_path, add.content) elsif add.local_path FileUtils.copy(add.local_path, add_path) end results = p4.run_add('-c', change_id, add_path) puts "Added file #{add_path} to #{change_id}: #{results}" end @edits.each do |edit| edit_path = File.join(client_path, edit.path) results = p4.run_edit('-c', change_id, edit_path) puts "Editing file #{edit_path} on #{change_id}: #{results}" if edit.content IO.write(edit_path, edit.content) else FileUtils.copy(edit.local_path, edit_path) end end p4.run_submit('-c', change_id) end end class Changelist1 < ChangelistModel def rank 1000 end @description = 'A few basic adds' @adds = [ FileDefinition.new( path: 'depot/main/My Project/README', content: <<-STOP.gsub(/^ {8}/, '') This is the readme for My Project STOP ), FileDefinition.new( path: 'depot/dev/Experimental/README', content: <<-STOP.gsub(/^ {8}/, '') This is an experimental project README. STOP ) ] end class Changelist2 < ChangelistModel def rank 1001 end @description = 'Edits' @user = 'jdoe' @edits = [ FileDefinition.new( path: 'depot/main/My Project/README', content: <<-STOP.gsub(/^ {8}/, '') This is the readme for My Project The README has been edited. STOP ) ] end class Changelist3 < StreamChangelistModel def rank 1003 end @client = 'main' @description = 'A few basic adds' @adds = [ FileDefinition.new( path: 'main/README', content: <<-STOP.gsub(/^ {8}/, '') This is the readme for My Project STOP ), FileDefinition.new( path: 'dev/Experimental/README', content: <<-STOP.gsub(/^ {8}/, '') This is an experimental project README. STOP ) ] end class Changelist4 < StreamChangelistModel def rank 1004 end @client = 'main' @description = 'Edits' @user = 'jdoe' @edits = [ FileDefinition.new( path: 'dev/Experimental/README', content: <<-STOP.gsub(/^ {8}/, '') This is the readme for My Project The README has been edited. STOP ) ] end class StreamCloudDepot < DepotModel def rank 900 # before the changelists end @depot = 'my_project' @description = 'A cloud test depot' @type = 'stream' end class DeleteDefaultDepot < InitModel def rank 925 end def self.abstract true end def execute(p4, models=nil, super_user=nil) p4.run_depot('-d', 'depot') end end class DeleteDepot < DeleteDefaultDepot end # for the InitModel stuff to pick this up, you hace to define a base class # that responds to the 'abstract' first, then make a new instance off the base class StreamMainline < InitModel def rank 950 end def self.abstract true end def execute(p4, models=nil, super_user=nil) stream = p4.fetch_stream('-t','mainline','//my_project/main') stream._name = 'My~20Project' p4.save_stream(stream) # also create a dev stream stream = p4.fetch_stream('-t','development','-P','//my_project/main','//my_project/dev') p4.save_stream(stream) # make a stream client for main name = 'main' client = p4.fetch_client('-S','//my_project/main',name) dir = File.join(Conventions.client_root_dir, name) if Dir.exist?(dir) FileUtils.rm_r(dir) end if !Dir.exist?(dir) FileUtils.mkpath(dir) end client._root = dir p4.save_client(client) # make a stream client for dev name = 'dev' client = p4.fetch_client('-S','//my_project/dev',name) dir = File.join(Conventions.client_root_dir, name) if Dir.exist?(dir) FileUtils.rm_r(dir) end if !Dir.exist?(dir) FileUtils.mkpath(dir) end client._root = dir p4.save_client(client) end end class StreamInstance < StreamMainline end class StreamTestDepot < DepotModel def rank 2000 end @depot = 'stream-test' @description = 'A test depot' @type = 'stream' end class GitFusionDepot < DepotModel def rank 2001 end @depot = '.git-fusion' @description = 'Empty Git Fusion depot' end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#4 | 16271 | Doug Scheirer |
- delete the default //depot for cloud tests - mark more tests as pending - refactored sync tests a little to make cloud compatib;e - fixed a bug in the sync 'locked' logic |
||
#3 | 16148 | Doug Scheirer | Merge from main | ||
#2 | 16040 | Doug Scheirer | I think the pending tests is at a minimum for cloud enabled, so readyto integrate up? | ||
#1 | 16024 | Doug Scheirer | Some cloud spec forking, got the mock_raymond to spin up in cloud testing, split normal vs cloud spec output |