You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by mw...@apache.org on 2012/05/01 19:49:59 UTC
docs commit: CB-564 Add Rake task to generate version releases.
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 <mi...@michaelbrooks.ca>
Authored: Tue May 1 07:41:13 2012 -0700
Committer: Michael Brooks <mi...@michaelbrooks.ca>
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