Rakefile.rb in context-0.0.16 vs Rakefile.rb in context-0.0.22
- old
+ new
@@ -1,13 +1,28 @@
require 'rake'
+require 'rubygems'
require 'spec/rake/spectask'
+# Debian forces the installation of a very old version of rdoc
+# in /usr/lib/ruby if you install rubygems. So I need to override
+# it here.
+gem 'rdoc', ">= 2.2"
+require 'rdoc'
require 'rake/rdoctask'
-require 'rubygems'
require 'rake/gempackagetask'
require 'rake/testtask'
+require 'fileutils'
require 'lib/Context/Version'
+#======================== Setup ================================
+
+# Rubyforge details
+rubyforge_project = "jldrill"
+rubyforge_maintainer = "mikekchar@rubyforge.org"
+
+
+# Spec options
+spec_opts = ['-f html:test_results.html']
spec_files = FileList[
'spec/**/*_spec.rb'
]
# This just makes sure that spec is looking in the right directories for
@@ -21,44 +36,38 @@
'coverage/**/*',
'test_results.html'
]
-task :default => [:rcov, :rdoc]
+task :default => [:spec]
+desc "Run the tests (default). Output goes to test_results.html"
st = Spec::Rake::SpecTask.new(:spec) do |t|
t.spec_files = spec_files
t.ruby_opts = ruby_opts
+ t.spec_opts = spec_opts
end
+desc "Run the tests and find the code coverage. Test results are in test_results.html. Coverage is in coverage/index.html"
rc = Spec::Rake::SpecTask.new(:rcov) do |t|
t.spec_files = spec_files
t.rcov = true
t.rcov_opts = ["--exclude rspec", "--exclude rcov", "--exclude syntax",
"--exclude _spec"]
- t.spec_opts = ["--format html:test_results.html"]
- t.ruby_opts = ruby_opts
+ t.spec_opts = spec_opts
+ t.ruby_opts = ruby_opts
end
-ht = Spec::Rake::SpecTask.new(:heckle) do |t|
- t.spec_files = spec_files
- t.spec_opts = ["--heckle Context"]
- t.ruby_opts = ruby_opts
-end
-
-# Build the RDOC documentation tree.
+desc "Build the RDOC development documentation. output goes to doc/index.html"
rd = Rake::RDocTask.new(:rdoc) do |t|
t.rdoc_dir = 'doc'
t.title = "Context -- Contextual UI Framework"
- t.options << '--inline-source' <<
- '--main' << 'Context' <<
+ t.options << '--main' << 'README' <<
'--title' << "Context -- Contextual UI Framework"
- t.rdoc_files.include('./lib/**/*.rb')
+ t.rdoc_files.include('README', 'COPYING', 'AUTHORS', './lib/**/*.rb', './spec/**/*.rb')
end
-# Build tar, zip and gem files.
-# NOTE: The name of this task is automatically set to :package
gem_spec = Gem::Specification.new do |s|
#### Basic information.
s.name = 'context'
@@ -87,21 +96,58 @@
#### Load-time details: library and application (you will need one or both).
# Use these for libraries.
s.require_path = 'lib'
+ #### Dependencies
+
+ s.add_dependency("gtk2")
+
#### Documentation and testing.
s.has_rdoc = true
s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a
s.rdoc_options = rd.options
#### Author and project details.
s.author = "Mike Charlton"
s.email = "mikekchar@gmail.com"
s.homepage = "http://sakabatou.dnsdojo.org"
+ s.rubyforge_project = rubyforge_project
end
+desc "Creates the gem files for context. Packages are placed in pkg and called context-<version>.gem."
package_task = Rake::GemPackageTask.new(gem_spec) do |pkg|
- pkg.need_zip = true
- pkg.need_tar = true
+ pkg.need_zip = false
+ pkg.need_tar = false
+end
+
+desc "Cleans the debian tree."
+task :clean_debian do
+ FileUtils.rm_rf "debian/libcontext-ruby"
+ FileUtils.rm_rf Dir.glob("debian/*debhelper*")
+ FileUtils.rm_rf "debian/files"
+ FileUtils.rm_rf "configure-stamp"
+ FileUtils.rm_rf "build-stamp"
+end
+
+desc "Cleans everything for a pristine source directory."
+task :clean => [:clobber_rcov, :clobber_rdoc, :clobber_package, :clean_debian]
+
+desc "Create the debian source tree and copy the required files over. The files will end up in debian/libcontext-ruby"
+task :debian_dir => [:clean_debian, :rdoc] do
+ # Create the new directory structure
+ FileUtils.mkdir_p "debian/libcontext-ruby/usr/lib/ruby/1.8"
+ FileUtils.mkdir_p "debian/libcontext-ruby/usr/share/doc/libcontext-ruby/html"
+
+ # Copy the libcontext-ruby files
+ FileUtils.cp_r Dir.glob("lib/*"), "debian/libcontext-ruby/usr/lib/ruby/1.8"
+ FileUtils.cp_r Dir.glob("doc/*"), "debian/libcontext-ruby/usr/share/doc/libcontext-ruby/html"
+end
+
+desc "Clean everything, run tests, and build all the documentation."
+task :build => [:clean, :rcov, :rdoc]
+
+desc "Build a debian package. Note: This will *not* make a source package. Also, the .deb and .changes file will be put in the parent directory."
+task :deb => [:clean_debian] do
+ sh "dpkg-buildpackage -b -tc -rfakeroot -i.bzr"
end