Sha256: 7dd5db33ac23b16a171ac5a8f37b35867a5f10330173ec921854fc6e3d7ebd05
Contents?: true
Size: 1.82 KB
Versions: 3
Compression:
Stored size: 1.82 KB
Contents
#!/usr/bin/env ruby # Copyright (c) 2009, Keith Salisbury (www.globalkeith.com) # All rights reserved. # All the svn stuff should go in here... require 'fileutils' module Subtrac class Svn def initialize(svn_dir, binding) # create svn directory if required @svn_dir = svn_dir File.create_if_missing(@svn_dir) @temp_dir = Subtrac::temp_dir @binding = binding end # creates a new svn repository for the project def create_project(project) # get the client for this project client = project.client # create the client folder File.create_if_missing(File.join(@svn_dir,client.path)) # create the project folder project.svn_dir = File.join(@svn_dir,client.path,project.path) # TODO: Need to handle this exception... if (File.directory? project.svn_dir) then raise StandardError, "A project called #{project} already exists in the #{client} repository. Please delete it or choose an alternate project name and run this script again." end # create a new subversion repository say("Creating a new subversion repository...") `svnadmin create #{project.svn_dir}` # copy template svn project to a temp folder, then svn import it into the repo say("Create temporary project directory and copy template files...") svn_template_dir = File.join(project.template,"svn") project_temp_dir = File.join(@temp_dir,project.path) FileUtils.cp_r(svn_template_dir,project_temp_dir) # import into svn say("Importing temporary project into the new subversion repository...") `svn import #{project_temp_dir} file:///#{project.svn_dir} --message "initial import"` # delete the temporary directory FileUtils.rm_r(project_temp_dir, :force => true) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ktec-subtrac-0.1.33 | lib/subtrac/svn.rb |
ktec-subtrac-0.1.34 | lib/subtrac/svn.rb |
ktec-subtrac-0.1.36 | lib/subtrac/svn.rb |