require 'rake' require 'spec/rake/spectask' require 'rake/rdoctask' require 'rubygems' require 'rake/gempackagetask' require 'rake/testtask' require 'lib/Context/Version' 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 => [:rcov, :rdoc] st = Spec::Rake::SpecTask.new(:spec) do |t| t.spec_files = spec_files t.ruby_opts = ruby_opts end 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 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. rd = Rake::RDocTask.new(:rdoc) do |t| t.rdoc_dir = 'doc' t.title = "Context -- Contextual UI Framework" t.options << '--inline-source' << '--main' << 'Context' << '--title' << "Context -- Contextual UI Framework" t.rdoc_files.include('./lib/**/*.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' 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' #### 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" end package_task = Rake::GemPackageTask.new(gem_spec) do |pkg| pkg.need_zip = true pkg.need_tar = true end