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:

    Admin_Release_Integration_20120405.zip
    Client_Release_Integration_20120405.zip
    Admin_Release_Park_Royal_20120405.zip
    Client_Release_Park_Royal_20120405.zip
    Admin_Release_Watford_20120405.zip
    Client_Release_Watford_20120405.zip

    Only 1 actual zip file appears. The last one:

    Client_Release_Watford_20120405.zip

    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
    elsif
    fextension = server + '_Staging'
    end

    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
    end

    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 }
    end
    end
    end
     
    Mark Pawelek, Apr 5, 2012
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Hunsley
    Replies:
    1
    Views:
    624
    Andrew Thompson
    Sep 16, 2004
  2. peppermonkey
    Replies:
    1
    Views:
    264
    Gregory Brown
    Feb 10, 2007
  3. thufir
    Replies:
    3
    Views:
    231
    Thufir
    Apr 12, 2008
  4. MoshiachNow
    Replies:
    2
    Views:
    290
    Ilya Zakharevich
    Oct 4, 2006
  5. texasreddog
    Replies:
    3
    Views:
    117
    Peter Wyzl
    May 16, 2007
Loading...

Share This Page