Return-Path: X-Original-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5EB499D92 for ; Tue, 1 May 2012 17:50:00 +0000 (UTC) Received: (qmail 3982 invoked by uid 500); 1 May 2012 17:50:00 -0000 Delivered-To: apmail-incubator-callback-commits-archive@incubator.apache.org Received: (qmail 3954 invoked by uid 500); 1 May 2012 17:50:00 -0000 Mailing-List: contact callback-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-commits@incubator.apache.org Received: (qmail 3947 invoked by uid 99); 1 May 2012 17:50:00 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 May 2012 17:50:00 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id EE0F1133ED; Tue, 1 May 2012 17:49:59 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mwbrooks@apache.org To: callback-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: docs commit: CB-564 Add Rake task to generate version releases. Message-Id: <20120501174959.EE0F1133ED@tyr.zones.apache.org> Date: Tue, 1 May 2012 17:49:59 +0000 (UTC) Updated Branches: refs/heads/master 494b36273 -> 162925a1a CB-564 Add Rake task to generate version releases. Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/commit/162925a1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/tree/162925a1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/diff/162925a1 Branch: refs/heads/master Commit: 162925a1a67819588fb5199fdf330cba5c3e0978 Parents: 494b362 Author: Michael Brooks Authored: Tue May 1 07:41:13 2012 -0700 Committer: Michael Brooks Committed: Tue May 1 13:48:57 2012 -0400 ---------------------------------------------------------------------- README.md | 8 ++++++++ Rakefile | 42 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/162925a1/README.md ---------------------------------------------------------------------- diff --git a/README.md b/README.md index 24afe76..3b2048c 100644 --- a/README.md +++ b/README.md @@ -132,3 +132,11 @@ __Run all specs:__ __Run a specific spec:__ spec spec/phonegap/add_title_spec.rb + +Generated a Version Release +--------------------------- + +There is a Rake task to increment the version, generate the version directory, and update the edge documentation. + + # generate version 1.7.0 + rake version[1.7.0] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/162925a1/Rakefile ---------------------------------------------------------------------- diff --git a/Rakefile b/Rakefile index 05c4b3c..20ba1bb 100644 --- a/Rakefile +++ b/Rakefile @@ -18,6 +18,9 @@ require 'rubygems' require 'rake' require 'spec/rake/spectask' +require 'fileutils' + +task :default => :spec desc "Run specs" Spec::Rake::SpecTask.new('spec') do |t| @@ -27,4 +30,41 @@ Spec::Rake::SpecTask.new('spec') do |t| end task :spec -task :default => :spec +desc "Increment the version - generates a release and updates the edge documentation" +task :version, :nextVersion do |t, args| + # get current and next version + nextVersion = args[:nextVersion].strip + prevVersion = File.read('VERSION').sub(/rc\d+$/, '').strip # remove release candidate + + # update edge documentation to reference next version + _nextVersion = nextVersion.sub(/rc\d+$/, '') # cordova file references do not include the RC + unless prevVersion == _nextVersion + files = Dir.glob(File.join('docs', 'en', 'edge', '**', '*')) + + files.sort.each do |file| + next if File.directory?(file) or file !~ /md|html/ + content = File.read(file) + content.gsub!(prevVersion, _nextVersion) + File.open(file, 'w') { |f| f.write(content) } + end + end + + # generate a release + edge_dir = File.join('docs', 'en', 'edge') + release_dir = File.join('docs', 'en', nextVersion) + FileUtils.cp_r(edge_dir, release_dir) + + # update VERSION file + File.open('VERSION', 'w') do |f| + f.write(nextVersion) + end + + # echo results + puts "Generated version #{nextVersion}" + puts "" + puts "Next steps:" + puts " 1. Review the update using `git status`" + puts " 2. Commit the changes as 'Version #{nextVersion}'" + puts " 3. Tag the commit as '#{nextVersion}'" + puts "" +end \ No newline at end of file