Permalink
Browse files

Add Rake tasks

  • Loading branch information...
smtlaissezfaire committed Aug 4, 2009
1 parent a970a34 commit d8d05c9a0ba6db683d83f255a56a487457532566
Showing with 91 additions and 0 deletions.
  1. +6 −0 Rakefile
  2. +10 −0 rakefiles/flog.rake
  3. +16 −0 rakefiles/rdoc.rake
  4. +20 −0 rakefiles/rspec.rake
  5. +16 −0 rakefiles/sloc.rake
  6. +23 −0 rakefiles/tags.rake
View
@@ -0,0 +1,6 @@
+
+Dir.glob(File.dirname(__FILE__) + "/rakefiles/**/**").each do |file|
+ load file
+end
+
+task :default => :spec
View
@@ -0,0 +1,10 @@
+desc "Feel the pain of my code, and submit a refactoring patch"
+task :flog do
+ puts %x(find lib | grep ".rb$" | xargs flog)
+end
+
+task :flog_to_disk => :create_doc_directory do
+ puts "Flogging..."
+ %x(find lib | grep ".rb$" | xargs flog > doc/flog.txt)
+ puts "Done Flogging...\n"
+end
View
@@ -0,0 +1,16 @@
+require 'rake'
+require 'hanna/rdoctask'
+
+DOC_DIRECTORY = File.dirname(__FILE__) + "/../doc"
+
+Rake::RDocTask.new do |rdoc|
+ rdoc.rdoc_dir = DOC_DIRECTORY
+ rdoc.title = 'MY_PROJECT_NAME (FIXME)'
+ rdoc.options << '--line-numbers' << '--inline-source'
+
+ rdoc.options << '--webcvs=http://github.com/mislav/will_paginate/tree/master/'
+
+ ["README.rdoc", "GPL_LICENSE", "MIT_LICENSE", "lib/**/*.rb"].each do |file|
+ rdoc.rdoc_files.include(file)
+ end
+end
View
@@ -0,0 +1,20 @@
+require 'spec/rake/spectask'
+require 'spec/rake/verify_rcov'
+
+desc 'Run the specs'
+Spec::Rake::SpecTask.new do |t|
+ t.warning = false
+ t.spec_opts = ["--color"]
+end
+
+desc "Create the html specdoc"
+Spec::Rake::SpecTask.new(:specdoc => :create_doc_directory) do |t|
+ t.spec_opts = ["--format", "html:doc/specdoc.html"]
+end
+
+desc "Run all examples with RCov"
+Spec::Rake::SpecTask.new(:rcov) do |t|
+ t.rcov = true
+ t.rcov_opts = ['--exclude', 'spec']
+ t.rcov_dir = "doc/rcov"
+end
View
@@ -0,0 +1,16 @@
+def sloc
+ `sloccount #{File.dirname(__FILE__)}/../lib #{File.dirname(__FILE__)}/../ext`
+end
+
+desc "Output sloccount report. You'll need sloccount installed."
+task :sloc do
+ puts "Counting lines of code"
+ puts sloc
+end
+
+desc "Write sloccount report"
+task :output_sloc => :create_doc_directory do
+ File.open(File.dirname(__FILE__) + "/doc/lines_of_code.txt", "w") do |f|
+ f << sloc
+ end
+end
View
@@ -0,0 +1,23 @@
+# Build the TAGS file for Emacs
+# Taken with slight modifications from
+# http://blog.lathi.net/articles/2007/11/07/navigating-your-projects-in-emacs
+#
+# Thanks Jim Weirich
+
+module Emacs
+ module Tags
+ def self.ruby_files
+ @ruby_files ||= FileList['**/*.rb'].exclude("pkg")
+ end
+ end
+end
+
+namespace :tags do
+ task :emacs do
+ puts "Making Emacs TAGS file"
+ sh "ctags -e #{Emacs::Tags.ruby_files}", :verbose => false
+ end
+end
+
+desc "Build the emacs tags file"
+task :tags => ["tags:emacs"]

0 comments on commit d8d05c9

Please sign in to comment.