rakelib/workflow.rake
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 21 Nov 2016 23:24:30 +0000
changeset 78 2d09a485772f
parent 68 61d8bee7c4d4
child 79 1058962ee3ef
permissions -rw-r--r--
Push active bookmark (if any) when running task `workflow:push-staging` or... ...task `workflow:push-upstream`.

# This file contains various tasks usefull for Smalltalk/X jv-branch 
# development. Currently it only supports working with Mercurial repositories,
# Honestly, there's not much one can do with CVS, we're using it only for
# packages that have not been converted to Mercurial. 

namespace :'workflow' do
  # A helper function to :push-upstream and push-staging tasks
  def push(remote, user, pass)  
    project.packages_and_application.each do | pkg |
      if not pkg.nested_package? then
        repo = Rake::Stx::Configuration::Repository::find(pkg.repository)
        if repo.type == :'hg' then
          hg = HG::Repository.new(BUILD_DIR / pkg.directory)
          opts = {
            :user => user,
            :pass => pass,
          }      
          if hg.bookmark() then
            opts[:bookmarks] = '.'
          else 
            opts[:rev] = '.'
          end
          hg.push(remote, **opts)
        end
      end
    end
  end

  desc "Push currently checked out revisions to upstream repositories (to be called after all tests pass on all configurations)"
  task :'push-upstream', :user, :pass do | t, args |
    push('default', args[:user] || nil, args[:pass] || nil)
  end
  task :'push-upstream' => :'setup'

  desc "Push currently checked out revisions to staging repositories (to be by developer to test her changes)"
  task :'push-staging', :user, :pass do | t, args |
    push('staging', args[:user] || nil, args[:pass] || nil)
  end
  task :'push-staging' => :'setup'
end