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 '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 # the source. ruby_opts = ["-Ilib"] pkg_files = FileList[ 'Rakefile.rb', 'lib/**/*.rb', 'spec/**/*.rb', 'doc/**/*', 'coverage/**/*', 'test_results.html' ] 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 = spec_opts t.ruby_opts = ruby_opts end 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 << '--main' << 'README' << '--title' << "Context -- Contextual UI Framework" t.rdoc_files.include('README', 'COPYING', 'AUTHORS', './lib/**/*.rb', './spec/**/*.rb') end gem_spec = Gem::Specification.new do |s| #### Basic information. s.name = 'context' s.version = Context::VERSION s.summary = "Contextual UI Framework" s.description = <<-EOF Context is a contextual UI framework. It is based on the Model View Presentor model. The idea is that you have model objects that represent the core data in your application. You also have views that represent the user interface input and output. Finally you have "contexts" that represent a user situation in the application. The logic that ties the models and views resides in the contexts. The main advantages to this model are that you can easily write UI unit tests and you can easily create bridge patterns for supporting multiple widget sets (although only GTK+ is supported at the moment). Context is intended to be extremely minimal. Only the top level abstract classes are included. It is *not* a widget set! You have to write your own models, views and contexts. EOF #### Which files are to be included in this gem? Everything! s.files = pkg_files.to_a #### 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-.gem." package_task = Rake::GemPackageTask.new(gem_spec) do |pkg| 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