Rake problem - how do I create 6 zip files rather than 1

Discussion in 'Ruby' started by Mark Pawelek, Apr 5, 2012.

  1. Mark Pawelek

    Mark Pawelek Guest

    First of all, apologies for posting a rake question here but I can't find a rake forum and since my company changed their email system to google mail I can't find any of my groups from my work PC

    Q1: Is there a rake forum. If so, where is it?

    Q2: See below:

    How do I get my rake build script (rakefile.rb) to give me 6 zip files?

    It is only giving me 1 zip file.

    There are two projects each corresponding to a website and 3 servers to release to giving a total of 6 expected zip files:


    Only 1 actual zip file appears. The last one:


    I guess that all 6 zip files are being created but that the previous 5 are all overwritten

    Why is this happening and what's a good way to fix the probem?

    PS: This runs on a Windows PC. The build uses rake/albacore

    In a nutshell, do I need to run 6 zip tasks or is there another way to do the zips without running from a zip task - can I use a generic task that invokes 6 zips?
    # Here are some parts of my rakefile relating to the zip_websites task
    BUILD_MODE = ENV["config"] || 'Debug' # OR 'Debug', 'Release'

    Live_server_sites = ['Integration', 'Park_Royal', 'Watford']
    Websites = [ :Admin, :Client ]

    task :default => [:clean, :clean_all_builds, :svn_update, :compile, :unit_test, :publish_client, :publish_admin, :post_publish, :clean_build, :zip_websites]

    def zipit(zip, project, server)
    #copy correct web.config first
    if server == 'Integration'
    fextension = server
    fextension = server + '_Staging'

    File.delete "#{PUBLISH_DIR}/#{project}/web.config"
    File.copy_stream("#{PUBLISH_DIR}/#{project}/Config/web.config.#{fextension}", "#{PUBLISH_DIR}/#{project}/web.config")

    # zip-up the project
    zip.directories_to_zip = ["#{PUBLISH_DIR}/#{project}"]
    output_file = "#{project}_#{BUILD_MODE}_#{server}_#{Date.today.to_s.gsub('-','')}.zip"
    # e.g. Admin_Release_Park_Royal_20110526.zip
    zip.output_file = output_file
    zip.output_path = "#{PUBLISH_DIR}"
    return output_file

    desc "Zip published websites"
    zip :zip_websites do |zip|
    if BUILD_MODE == 'Release'
    Live_server_sites.each do |server|
    Websites.each { |site| zipit zip, site, server }
    Mark Pawelek, Apr 5, 2012
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.