You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by as...@apache.org on 2008/04/16 00:29:10 UTC
svn commit: r648439 - in /incubator/buildr/docter/trunk: .gitignore
CHANGELOG Rakefile rakelib/apache.rake rakelib/package.rake
rakelib/release.rake rakelib/setup.rake
Author: assaf
Date: Tue Apr 15 15:29:07 2008
New Revision: 648439
URL: http://svn.apache.org/viewvc?rev=648439&view=rev
Log:
1.1.3 Release:
* Changed: Now using Syntax by default for syntax highlighting, which works
equally well on JRuby.
* Changed: Fixed copying of resources with nested directories.
* Removed: Dependency on Facets.
Added:
incubator/buildr/docter/trunk/.gitignore
incubator/buildr/docter/trunk/rakelib/package.rake
incubator/buildr/docter/trunk/rakelib/setup.rake
Modified:
incubator/buildr/docter/trunk/CHANGELOG
incubator/buildr/docter/trunk/Rakefile
incubator/buildr/docter/trunk/rakelib/apache.rake
incubator/buildr/docter/trunk/rakelib/release.rake
Added: incubator/buildr/docter/trunk/.gitignore
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/.gitignore?rev=648439&view=auto
==============================================================================
--- incubator/buildr/docter/trunk/.gitignore (added)
+++ incubator/buildr/docter/trunk/.gitignore Tue Apr 15 15:29:07 2008
@@ -0,0 +1 @@
+pkg
Modified: incubator/buildr/docter/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/CHANGELOG?rev=648439&r1=648438&r2=648439&view=diff
==============================================================================
--- incubator/buildr/docter/trunk/CHANGELOG (original)
+++ incubator/buildr/docter/trunk/CHANGELOG Tue Apr 15 15:29:07 2008
@@ -1,4 +1,4 @@
-1.1.3 (Pending)
+1.1.3 (2008-04-15)
* Changed: Now using Syntax by default for syntax highlighting, which works
equally well on JRuby.
* Changed: Fixed copying of resources with nested directories.
Modified: incubator/buildr/docter/trunk/Rakefile
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/Rakefile?rev=648439&r1=648438&r2=648439&view=diff
==============================================================================
--- incubator/buildr/docter/trunk/Rakefile (original)
+++ incubator/buildr/docter/trunk/Rakefile Tue Apr 15 15:29:07 2008
@@ -14,106 +14,44 @@
# the License.
-require 'rubygems'
require 'rake/gempackagetask'
require 'rake/rdoctask'
require 'rubyforge'
-#
# Gem specification comes first, other tasks rely on it.
-spec = Gem::Specification.new do |spec|
- spec.name = 'docter'
- spec.version = File.read(__FILE__.pathmap('%d/lib/docter.rb')).scan(/VERSION\s*=\s*(['"])(.*)\1/)[0][1]
- spec.author = 'Apache Buildr'
- spec.email = 'buildr-user@incubator.apache.org'
- spec.homepage = 'http://incubator.apache.org/buildr/'
- spec.summary = 'We has docs'
- spec.files = FileList['lib/**/*', 'README', 'CHANGELOG', 'LICENSE', 'NOTICE', 'DISCLAIMER',
- 'Rakefile'].collect
- spec.require_path = 'lib'
- spec.has_rdoc = true
- spec.extra_rdoc_files = ['README', 'CHANGELOG', 'LICENSE', 'NOTICE', 'DISCLAIMER']
- spec.rdoc_options << '--title' << "Docter -- #{spec.summary}" <<
- '--main' << 'README' << '--line-numbers' << '--inline-source' << '-p' <<
- '--webcvs' << 'http://svn.apache.org/repos/asf/incubator/buildr/docter/trunk/'
- spec.rubyforge_project = 'buildr'
-
- # Tested against these dependencies.
- spec.add_dependency 'RedCloth', '~> 3.0'
- spec.add_dependency 'haml', '~> 1.8'
- spec.add_dependency 'mongrel', '~> 1.1'
- spec.add_dependency 'syntax', '~> 1.0'
-end
-
-
-def ruby(*args)
- options = Hash === args.last ? args.pop : {}
- options[:verbose] ||= false
- cmd = []
- cmd << 'sudo' if options.delete(:sudo) && !Gem.win_platform?
- cmd << Config::CONFIG['ruby_install_name']
- cmd << '-S' << options.delete(:command) if options[:command]
- sh *cmd.push(*args.flatten).push(options)
-end
-
-# Setup environment for running this Rakefile (RSpec, Docter, etc).
-desc "If you're building from sources, run this task one to setup the necessary dependencies."
-task 'setup' do
- # Install all Buildr and documentation dependencies.
- gems = Gem::SourceIndex.from_installed_gems
- dependencies = specify(RUBY_PLATFORM).dependencies
- dependencies << Gem::Dependency.new('docter', '~>1.1')
- dependencies << Gem::Dependency.new('ultraviolet', '~>0.10') unless RUBY_PLATFORM =~ /java/
- dependencies << Gem::Dependency.new('rcov', '~>0.8') unless RUBY_PLATFORM =~ /java/
- dependencies.select { |dep| gems.search(dep.name, dep.version_requirements).empty? }.
- each do |dep|
- ruby 'install', dep.name, '-v', dep.version_requirements.to_s, :command=>'gem', :sudo=>true
- end
-end
-
-begin
- require 'highline/import'
-rescue LoadError
- fail 'HighLine required, please run rake setup first'
+def spec
+ Gem::Specification.new do |spec|
+ spec.name = 'docter'
+ spec.version = File.read(__FILE__.pathmap('%d/lib/docter.rb')).scan(/VERSION\s*=\s*(['"])(.*)\1/)[0][1]
+ spec.author = 'Apache Buildr'
+ spec.email = 'buildr-user@incubator.apache.org'
+ spec.homepage = 'http://incubator.apache.org/buildr/'
+ spec.summary = 'We has docs'
+ spec.files = FileList['lib/**/*', 'README', 'CHANGELOG', 'LICENSE', 'NOTICE', 'DISCLAIMER',
+ 'Rakefile'].collect
+ spec.require_path = 'lib'
+ spec.has_rdoc = true
+ spec.extra_rdoc_files = ['README', 'CHANGELOG', 'LICENSE', 'NOTICE', 'DISCLAIMER']
+ spec.rdoc_options << '--title' << "Docter -- #{spec.summary}" <<
+ '--main' << 'README' << '--line-numbers' << '--inline-source' << '-p' <<
+ '--webcvs' << 'http://svn.apache.org/repos/asf/incubator/buildr/docter/trunk/'
+ spec.rubyforge_project = 'buildr'
+
+ # Tested against these dependencies.
+ spec.add_dependency 'RedCloth', '~> 3.0'
+ spec.add_dependency 'haml', '~> 1.8'
+ spec.add_dependency 'mongrel', '~> 1.1'
+ spec.add_dependency 'syntax', '~> 1.0'
+ end
end
-# Packaging and local installation.
-pkg = Rake::GemPackageTask.new(spec) do |pkg|
- pkg.need_tar = true
- pkg.need_zip = true
-end
-
-desc 'Install the package locally'
-task :install=>:package do |task|
- say "Installing #{spec.file_name} ... "
- system 'gem', 'install', "pkg/#{spec.name}-#{spec.version}.gem"
- ruby 'install', File.expand_path(pkg.gem_file, pkg.package_dir), :command=>'gem', :sudo=>true
-end
-
-desc 'Uninstall previously installed packaged'
-task :uninstall do |task|
- say "Uninstalling #{spec.name} ... "
- ruby 'uninstall', spec.name, :command=>'gem', :sudo=>true
- say 'Done'
-end
-
-
-desc 'Generate RDoc documentation'
-rdoc = Rake::RDocTask.new(:rdoc) do |rdoc|
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = spec.name
- rdoc.options = spec.rdoc_options
- rdoc.rdoc_files.include('lib/**/*.rb')
- rdoc.rdoc_files.include spec.extra_rdoc_files
-end
-
-task('clobber') { rm_rf [rdoc.rdoc_dir.to_s] }
-
-
namespace 'release' do
# License requirement.
task 'check'=>'apache:license'
+ task 'make' do
+ task('release:rubyforge').invoke
+ end
end
Modified: incubator/buildr/docter/trunk/rakelib/apache.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/rakelib/apache.rake?rev=648439&r1=648438&r2=648439&view=diff
==============================================================================
--- incubator/buildr/docter/trunk/rakelib/apache.rake (original)
+++ incubator/buildr/docter/trunk/rakelib/apache.rake Tue Apr 15 15:29:07 2008
@@ -21,33 +21,30 @@
# Tasks specific to Apache projects (license, release, etc).
namespace 'apache' do
- LICENSE_REQUIRED = ['lib', 'doc', 'spec', 'Rakefile', 'rakelib']
- LICENSE_EXCLUDED = []
-
desc 'Check that source files contain the Apache license'
task 'license' do
- say 'Checking that files contain the Apache license ... '
- required = FileList[].include(LICENSE_REQUIRED.map { |path| File.directory?(path) ? "#{path}/**/*" : path }).
- exclude(*LICENSE_EXCLUDED).select { |fn| File.file?(fn) }
- required.each do |fn|
+ print 'Checking that files contain the Apache license ... '
+ excluded = ['.class', '.png', '.jar', '.tif', 'README', 'LICENSE', 'CHANGELOG', 'DISCLAIMER', 'NOTICE', 'KEYS']
+ required = FileList[spec.files].exclude(*excluded).exclude(*Array($license_excluded)).select { |fn| File.file?(fn) }
+ missing = required.reject { |fn|
comments = File.read(fn).scan(/(\/\*(.*?)\*\/)|^#\s+(.*?)$|<!--(.*?)-->/m).
map { |match| match.compact }.flatten.join("\n")
- fail "File #{fn} missing Apache License, please add it before making a release!" unless
- comments =~ /Licensed to the Apache Software Foundation/ && comments =~ /http:\/\/www.apache.org\/licenses\/LICENSE-2.0/
- end
- say 'OK'
+ comments =~ /Licensed to the Apache Software Foundation/ && comments =~ /http:\/\/www.apache.org\/licenses\/LICENSE-2.0/
+ }
+ fail "#{missing.join(', ')} missing Apache License, please add it before making a release!" unless missing.empty?
+ puts 'OK'
end
- file 'incubating'=>'pkg' do
+ file 'incubating'=>'package' do
rm_rf 'incubating'
mkpath 'incubating'
- say 'Creating -incubating packages ... '
+ print 'Creating -incubating packages ... '
packages = FileList['pkg/*.{gem,zip,tgz}'].map do |package|
package.pathmap('incubating/%n-incubating%x').tap do |incubating|
cp package, incubating
end
end
- say 'Done'
+ puts 'Done'
end
task 'sign', :incubating do |task, args|
@@ -55,17 +52,17 @@
sources = FileList[args.incubating ? 'incubating/*' : 'pkg/*']
gpg_user = ENV['GPG_USER'] or fail 'Please set GPG_USER (--local-user) environment variable so we know which key to use.'
- say 'Signing release files ...'
+ print 'Signing release files ...'
sources.each do |fn|
contents = File.open(fn, 'rb') { |file| file.read }
File.open(fn + '.md5', 'w') { |file| file.write MD5.hexdigest(contents) << ' ' << File.basename(fn) }
File.open(fn + '.sha1', 'w') { |file| file.write SHA1.hexdigest(contents) << ' ' << File.basename(fn) }
sh 'gpg', '--local-user', gpg_user, '--armor', '--output', fn + '.asc', '--detach-sig', fn, :verbose=>true
end
- say 'Done'
+ puts 'Done'
end
- task 'upload', :project, :incubating, :depends=>['KEYS', 'sign'] do |task, args|
+ task 'upload', :project, :incubating, :depends=>['site', 'KEYS', 'sign'] do |task, args|
fail 'No project specified' unless project
target = 'people.apache.org:/www.apache.org/dist/'
@@ -74,11 +71,20 @@
dir = task('sign').prerequisite.find { |prereq| File.directory?(prereq.name) }
fail 'Please enhance sign task with directory containing files to release' unless dir
- say 'Uploading packages to Apache dist ...'
+ puts 'Uploading packages to Apache dist ...'
args = FileList["#{dir}/*", 'KEYS'].flatten << target
sh 'rsync', '-progress', *args
- say 'Done'
+ puts 'Done'
end
+end
+
+
+task 'clobber' do
+ rm_rf 'incubating'
+end
+
+namespace 'release' do
+ task 'check'=>'apache:license'
end
Added: incubator/buildr/docter/trunk/rakelib/package.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/rakelib/package.rake?rev=648439&view=auto
==============================================================================
--- incubator/buildr/docter/trunk/rakelib/package.rake (added)
+++ incubator/buildr/docter/trunk/rakelib/package.rake Tue Apr 15 15:29:07 2008
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+
+require 'rake/gempackagetask'
+
+
+desc 'Clean up all temporary directories used for running tests, creating documentation, packaging, etc.'
+task 'clobber'
+
+Rake::GemPackageTask.new(spec) do |pkg|
+ pkg.need_tar = pkg.need_zip = true
+end
+
+current = Rake::GemPackageTask.new(spec)
+desc 'Install the package locally'
+task 'install'=>"#{current.package_dir}/#{current.gem_file}" do |task|
+ print "Installing #{spec.name} ... "
+ args = [Config::CONFIG['ruby_install_name'], '-S', 'gem', 'install', "#{current.package_dir}/#{current.gem_file}"]
+ args.unshift('sudo') unless windows?
+ sh *args
+ puts 'Done'
+end
+
+desc 'Uninstall previously installed packaged'
+task 'uninstall' do |task|
+ print "Uninstalling #{spec.name} ... "
+ args = [Config::CONFIG['ruby_install_name'], '-S', 'gem', 'uninstall', spec.name, '--version', spec.version.to_s]
+ args.unshift('sudo') unless windows?
+ sh *args
+ puts 'Done'
+end
Modified: incubator/buildr/docter/trunk/rakelib/release.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/rakelib/release.rake?rev=648439&r1=648438&r2=648439&view=diff
==============================================================================
--- incubator/buildr/docter/trunk/rakelib/release.rake (original)
+++ incubator/buildr/docter/trunk/rakelib/release.rake Tue Apr 15 15:29:07 2008
@@ -1,3 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+
+begin
+ require 'rubyforge'
+rescue LoadError
+ puts 'Please run rake setup to install the RubyForge gem'
+ task 'setup' do
+ install_gem 'rubyforge'
+ end
+ task 'release:check' do
+ fail 'Please run rake setup to install the RubyForge gem'
+ end
+end
+
+
namespace 'release' do
# This task does all prerequisites checks before starting the release, for example,
@@ -11,11 +40,11 @@
# Does CHANGELOG reflects current release?
task 'check' do
- say 'Checking that CHANGELOG indicates most recent version and today\'s date ... '
- expecting = "#{ruby_spec.version} (#{Time.now.strftime('%Y-%m-%d')})"
- header = File.readlines('CHANGELOG').first
+ print 'Checking that CHANGELOG indicates most recent version and today\'s date ... '
+ expecting = "#{spec.version} (#{Time.now.strftime('%Y-%m-%d')})"
+ header = File.readlines('CHANGELOG').first.chomp
fail "Expecting CHANGELOG to start with #{expecting}, but found #{header} instead" unless expecting == header
- say 'OK'
+ puts 'OK'
end
# No local changes.
@@ -23,5 +52,60 @@
status = `svn status`
fail "Cannot release unless all local changes are in SVN:\n#{status}" unless status.empty?
end
+
+ desc 'Make a release'
+ task 'make'=>'release:prepare' do |task|
+ task.enhance do
+ task('release:wrapup').invoke
+ end
+ end
+
+ task 'rubyforge'=>'package' do
+ # Read the changes for this release.
+ print 'Looking for changes between this release and previous one ... '
+ pattern = /(^(\d+\.\d+(?:\.\d+)?)\s+\(\d{4}-\d{2}-\d{2}\)\s*((:?^[^\n]+\n)*))/
+ changelog = File.read('CHANGELOG')
+ changes = changelog.scan(pattern).inject({}) { |hash, set| hash[set[1]] = set[2] ; hash }
+ current = changes[spec.version.to_s]
+ current = changes[spec.version.to_s.split('.')[0..-2].join('.')] if !current && spec.version.to_s =~ /\.0$/
+ fail "No changeset found for version #{spec.version}" unless current
+ puts 'OK'
+
+ print "Uploading #{spec.version} to RubyForge ... "
+ files = Dir.glob('pkg/*.{gem,tgz,zip}')
+ rubyforge = RubyForge.new
+ rubyforge.login
+ File.open('.changes', 'w'){|f| f.write(current)}
+ rubyforge.userconfig.merge!('release_changes' => '.changes', 'preformatted' => true)
+ rubyforge.add_release spec.rubyforge_project.downcase, spec.name.downcase, spec.version, *files
+ rm '.changes'
+ puts 'Done'
+ end
+
+ # Tag this release in SVN.
+ task 'tag' do
+ print "Tagging release as tags/#{spec.version} ... "
+ cur_url = `svn info`.scan(/URL: (.*)/)[0][0]
+ new_url = cur_url.sub(/(trunk$)|(branches\/\w*)$/, "tags/#{spec.version.to_s}")
+ sh 'svn', 'copy', cur_url, new_url, '-m', "Release #{spec.version.to_s}", :verbose=>false
+ puts "OK"
+ end
+
+ # Update lib/buildr.rb to next vesion number, add new entry in CHANGELOG.
+ task 'next_version'=>'tag' do
+ next_version = spec.version.to_ints.zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
+ print "Updating lib/buildr.rb to next version number (#{next_version}) ... "
+ buildr_rb = File.read(__FILE__.pathmap('%d/lib/buildr.rb')).
+ sub(/(VERSION\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" }
+ File.open(__FILE__.pathmap('%d/lib/buildr.rb'), 'w') { |file| file.write buildr_rb }
+ puts "OK"
+
+ print 'Adding new entry to CHANGELOG ... '
+ changelog = File.read('CHANGELOG')
+ File.open('CHANGELOG', 'w') { |file| file.write "#{next_version} (Pending)\n\n#{changelog}" }
+ puts "OK"
+ end
+
+ #task 'wrapup'=>['tag', 'next_version']
end
Added: incubator/buildr/docter/trunk/rakelib/setup.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/rakelib/setup.rake?rev=648439&view=auto
==============================================================================
--- incubator/buildr/docter/trunk/rakelib/setup.rake (added)
+++ incubator/buildr/docter/trunk/rakelib/setup.rake Tue Apr 15 15:29:07 2008
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+# True if running on the Windows operating sytem. Different from Gem.win_platform?
+# which returns true if running on the Windows platform of MRI, false when using JRuby.
+
+
+require 'rubygems/source_info_cache'
+
+
+def windows?
+ Config::CONFIG['host_os'] =~ /windows|cygwin|bccwin|cygwin|djgpp|mingw|mswin|wince/i
+end
+
+
+# Finds and returns path to executable. Consults PATH environment variable.
+# Returns nil if executable not found.
+def which(name)
+ if windows?
+ path = ENV['PATH'].split(File::PATH_SEPARATOR).map { |path| path.gsub('\\', '/') }.map { |path| "#{path}/#{name}.{exe,bat,com}" }
+ else
+ path = ENV['PATH'].split(File::PATH_SEPARATOR).map { |path| "#{path}/#{name}" }
+ end
+ FileList[path].existing.first
+end
+
+
+def install_gem(name, ver_requirement = nil)
+ dep = Gem::Dependency.new(name, ver_requirement)
+ if Gem::SourceIndex.from_installed_gems.search(dep).empty?
+ spec = Gem::SourceInfoCache.search(dep).last
+ fail "#{dep} not found in local or remote repository!" unless spec
+ puts "Installing #{spec} ..."
+ args = [Config::CONFIG['ruby_install_name'], '-S', 'gem', 'install', spec.name, '-v', spec.version.to_s]
+ args.unshift('sudo') unless windows?
+ sh *args
+ end
+end
+
+# Setup environment for running this Rakefile (RSpec, Docter, etc).
+desc "If you're building from sources, run this task one to setup the necessary dependencies."
+missing = spec.dependencies.select { |dep| Gem::SourceIndex.from_installed_gems.search(dep).empty? }
+task 'setup' do
+ missing.each do |dep|
+ install_gem dep.name, dep.version_requirements
+ end
+end
+puts "Missing Gems #{missing.join(', ')}, please run rake setup first!" unless missing.empty?
Re: svn commit: r648439 - in /incubator/buildr/docter/trunk: .gitignore CHANGELOG Rakefile rakelib/apache.rake rakelib/package.rake rakelib/release.rake rakelib/setup.rake
Posted by Assaf Arkin <ar...@intalio.com>.
Sorry for the pollution, just doing a practice run to prepare for release.
Assaf
Re: svn commit: r648439 - in /incubator/buildr/docter/trunk: .gitignore CHANGELOG Rakefile rakelib/apache.rake rakelib/package.rake rakelib/release.rake rakelib/setup.rake
Posted by Assaf Arkin <ar...@intalio.com>.
Sorry for the pollution, just doing a practice run to prepare for release.
Assaf