lib/reap/tasks.rb in reap-6.0.1 vs lib/reap/tasks.rb in reap-6.0.2
- old
+ new
@@ -68,18 +68,65 @@
desc "Email project announcement" unless desc
task name do
data = data.to_openobject
- data.title ||= master.title
- data.version ||= master.version
- data.from ||= master.email
+ data.title ||= master.title
+ data.description ||= master.description
+ data.version ||= master.version
+ data.from ||= master.email
Reap::Announce.new( data ).write_and_email
end
end
+ # == Backup
+ #
+ # Backup your project to a backup directory.
+ # The location of the backup will be under the
+ # backup +dir+ given in the backup section of the
+ # ProjectInfo file, then under the name of the
+ # project's dir and a subdirectory of today's date.
+ # For example, today reap itself was backed up to:
+ #
+ # ../BACKUPS/reap/2006-06-21/reap
+ #
+ # Backup specific settings:
+ #
+ # dir The backup directory (eg. '../BACKUPS').
+
+ def backup( name, &data )
+
+ desc "Backup project folder" unless desc
+
+ task name do
+ data = data.to_openobject
+ if data.dir
+ bdir = ::File.join( ::File.basename(Dir.pwd), Time.now.strftime("%Y_%m_%d") )
+ bdir = ::File.join( data.dir, bdir )
+ if File.exist?( bdir ) and not $FORCE
+ tell bdir
+ tell "Backup folder already exists. Use -f to overwrite."
+ else
+ if $PRETEND
+ puts "rm -r #{bdir}"
+ puts "mkdir -p #{bdir}"
+ puts "cp -r #{Dir.pwd} #{bdir}"
+ else
+ FileUtils.rm_r( bdir ) if File.exist?( bdir )
+ FileUtils.mkdir_p( bdir )
+ FileUtils.cp_r( Dir.pwd, bdir)
+ end
+ tell "Completed backup to '#{bdir}'."
+ end
+ else
+ tell "No backup 'dir' setting given for backup task."
+ end
+ end
+
+ end
+
# == Doap
#
# This task generates an XML DOAP project file.
#
# DOAP is an XML/RTF format for describing a project. It contains
@@ -105,11 +152,11 @@
avail :doap do
ProjectInfo.exists?
end
- # == Extract Tests
+ # == ExTest (Extract Tests)
#
# This task scans every package script looking for sections of the form:
#
# =begin test
# ...
@@ -172,10 +219,11 @@
avail :info do
ProjectInfo.exists?
end
+#--
# # == Installer
# #
# # The installer task generates a specialized
# # install.rb script specifically for your
# # project. It currently does not support c/c++
@@ -201,28 +249,29 @@
# # ins: !!installer
# # template: |
# # bin bin * .
# # lib lib **/* $name/$version
# #
-#
+#
# def installer( name, &data )
-#
+#
# require 'reap/class/installer'
-#
+#
# desc "Generate install.rb script" unless desc
-#
+#
# task name do
# data = data.to_openobject
-#
+#
# data.name ||= master.name
# data.version ||= master.version
-#
+#
# i = Reap::Installer.new( data )
# puts i.compile #_and_write
# end
-#
+#
# end
+#++
# == Count
#
# Count the file and lines of code in your project.
#
@@ -317,10 +366,11 @@
# architecture Can be any, i368, i686, ppc, etc.
# dependencies List of packages this program depends.
# recommends List of packages that can be used with this package.
# replaces List of packages this one replaces.
# executables Executable files in this distribution.
+ # rules (see below)
#
# RubyGems specific settings:
#
# autorequire
# platform
@@ -332,9 +382,48 @@
#
# gems
# pacman
# debian
#
+ # Finally there is one last parameter that you can use for creating packages
+ # called 'rules'. The rules setting allows you to define how files are
+ # copied into the distribution package, so instead of a one to one copy
+ # of the included files, you can actually have a file placed in a different
+ # location within the distribution. This can be very handy if you wish to
+ # develop you project with one layout, but need to distribute it with another.
+ #
+ # The rules parameter is a literal string that consists of one rule per line.
+ # A line consists three space separated entries.
+ #
+ # from_path, file_glob, to_path
+ #
+ # If no 'to_path' is given then it is considered the same as the 'from_path'.
+ # It also supports two variables $name and $version which will be substitued
+ # any of these entries. Here is a possible example:
+ #
+ # rules: |
+ # lib **/* lib/$name/$version
+ #
+ # This will move any file under lib/ to the equivalent location under lib/$name/$version/.
+ # The default set of rules is a mirror image transfer, spelled out it would be:
+ #
+ # rules: |
+ # bin *
+ # ext **/*
+ # lib **/*
+ # data **/*
+ # conf **/*
+ #
+ # If your using Rolls against a normal project folder the alterntive is to create
+ # versioned paths, probably as follows:
+ #
+ # rules: |
+ # ext/$name **/* ext/$name/$version
+ # lib/$name **/* lib/$name/$version
+ # data/$name **/* ext/$name/$version
+ # conf/$name **/* ext/$name/$version ?
+ #
+ # Please note that the rules parameter is a new feature and is still considered beta.
def package( name, &data )
require 'reap/class/package'