rakelib/workflow.rake
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 02 Nov 2016 10:39:54 +0000
changeset 68 61d8bee7c4d4
child 78 2d09a485772f
permissions -rw-r--r--
Added new tasks - `workflow:push-upstream` and `workflow:push-staging` ...to push currently checked out revisios to upstream or staging repositories. * `workflow:push-staging` is meant to be used by developers to push changes to staging repositories in order to build them on CI and check whether all are correct. * `workflow:push-upstream` is to be used on CI server to push changes to an upstream (or canonical) repositories once all test pass on all platforms and configurations.

# 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)
    opts = {
      :user => user,
      :pass => pass,
      :rev => '.',
    }
    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)
          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