Permalink
Browse files

slim down rakefile

  • Loading branch information...
1 parent 752b5e8 commit 34cdd071c7fbe0e53b8ffa8be2faf6c4d946c251 Bryce Kerley committed Feb 4, 2009
Showing with 60 additions and 108 deletions.
  1. +33 −108 Rakefile
  2. +27 −0 tasks/scan.rake
View
141 Rakefile
@@ -1,108 +1,33 @@
-require 'rubygems'
-require 'rake/testtask'
-require 'rake/rdoctask'
-require 'rake/gempackagetask'
-
-PKG_NAME = 'radius'
-PKG_VERSION = '0.5.2'
-PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
-RUBY_FORGE_PROJECT = PKG_NAME
-RUBY_FORGE_USER = 'jlong'
-
-RELEASE_NAME = PKG_VERSION
-RUBY_FORGE_GROUPID = '1262'
-RUBY_FORGE_PACKAGEID = '1538'
-
-RDOC_TITLE = "Radius -- Powerful Tag-Based Templates"
-RDOC_EXTRAS = ["README", "QUICKSTART", "ROADMAP", "CHANGELOG"]
-
-task :default => :test
-
-desc 'pdf of the ragel scanner'
-file 'doc/scan.pdf' => 'lib/radius/parser/scan.dot' do |t|
- cd 'lib/radius/parser' do
- sh "dot -Tpdf -o ../../../doc/scan.pdf scan.dot"
- end
-end
-
-file 'lib/radius/parser/scan.dot' => ['lib/radius/parser/scan.rl'] do |t|
- cd 'lib/radius/parser' do
- sh "ragel -Vp scan.rl > scan.dot"
- end
-end
-
-desc 'turn the scan.rl file into a ruby file'
-file 'lib/radius/parser/scan.rb' => ['lib/radius/parser/scan.rl'] do |t|
- cd 'lib/radius/parser' do
- sh "ragel -R scan.rl"
- end
-end
-
-task :doc => [:rdoc, 'doc/scan.pdf']
-
-Rake::TestTask.new do |t|
- t.pattern = 'test/**/*_test.rb'
-end
-
-Rake::RDocTask.new :rdoc do |rd|
- rd.title = 'Radius -- Powerful Tag-Based Templates'
- rd.main = "README"
- rd.rdoc_files.include("lib/**/*.rb")
- rd.rdoc_files.include(RDOC_EXTRAS)
- rd.rdoc_dir = 'doc'
-end
-
-spec = Gem::Specification.new do |s|
- s.name = PKG_NAME
- s.version = PKG_VERSION
- s.summary = 'Powerful tag-based template system.'
- s.description = "Radius is a small, but powerful tag-based template language for Ruby\nsimilar to the ones used in MovableType and TextPattern. It has tags\nsimilar to HTML or XML, but can be used to generate any form of plain\ntext (not just HTML)."
- s.homepage = 'http://radius.rubyforge.org'
- s.rubyforge_project = RUBY_FORGE_PROJECT
- s.platform = Gem::Platform::RUBY
- s.requirements << 'none'
- s.require_path = 'lib'
- s.autorequire = 'radius'
- s.has_rdoc = true
- s.rdoc_options << '--title' << RDOC_TITLE << '--line-numbers' << '--main' << 'README'
- s.extra_rdoc_files = RDOC_EXTRAS
- files = FileList['**/*']
- files.exclude 'doc'
- files.exclude '**/._*'
- s.files = files.to_a
-end
-
-Rake::GemPackageTask.new(spec) do |pkg|
- pkg.need_zip = true
- pkg.need_tar = true
-end
-
-desc "Uninstall Gem"
-task :uninstall_gem do
- sh "gem uninstall radius" rescue nil
-end
-
-desc "Build and install Gem from source"
-task :install_gem => [:package, :uninstall_gem] do
- dir = File.join(File.dirname(__FILE__), 'pkg')
- chdir(dir) do
- latest = Dir['radius-*.gem'].last
- sh "gem install #{latest}"
- end
-end
-
-# --- Ruby forge release manager by florian gross -------------------------------------------------
-#
-# task found in Tobias Luetke's library 'liquid'
-#
-
-desc "Publish the release files to RubyForge."
-task :release => [:gem, :package] do
- files = ["gem", "tgz", "zip"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
-
- system("rubyforge login --username #{RUBY_FORGE_USER}")
-
- files.each do |file|
- system("rubyforge add_release #{RUBY_FORGE_GROUPID} #{RUBY_FORGE_PACKAGEID} \"#{RELEASE_NAME}\" #{file}")
- end
-end
+%w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
+require File.dirname(__FILE__) + '/lib/radius'
+
+# Generate all the Rake tasks
+# Run 'rake -T' to see list of generated tasks (from gem root directory)
+$hoe = Hoe.new('radius', Radius::VERSION) do |p|
+ p.developer('John W. Long', 'me@johnwlong.com')
+ p.author = [
+ "John W. Long (me@johnwlong.com)",
+ "David Chelimsky (dchelimsky@gmail.com)",
+ "Bryce Kerley (bkerley@brycekerley.net)"
+ ]
+ p.changes = p.paragraphs_of("CHANGELOG", 1..2).join("\n\n")
+ p.rubyforge_name = p.name # TODO this is default value
+ # p.extra_deps = [
+ # ['activesupport','>= 2.0.2'],
+ # ]
+ p.extra_dev_deps = [
+ ['newgem', ">= #{::Newgem::VERSION}"]
+ ]
+
+ p.clean_globs |= %w[**/.DS_Store tmp *.log]
+ path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
+ p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
+ p.rsync_args = '-av --delete --ignore-errors'
+ p.test_globs = "test/**/*_test.rb"
+end
+
+require 'newgem/tasks' # load /tasks/*.rake
+Dir['tasks/**/*.rake'].each { |t| load t }
+
+# TODO - want other tests/tasks run by default? Add them to the list
+# task :default => [:spec, :features]
View
@@ -0,0 +1,27 @@
+namespace :scan do
+ desc 'Generate the parser'
+ task 'build' => ['lib/radius/parser/scan.rb']
+
+ desc 'Generate a PDF state graph from the parser'
+ task 'graph' => ['doc/scan.pdf']
+
+ desc 'turn the scan.rl file into a ruby file'
+ file 'lib/radius/parser/scan.rb' => ['lib/radius/parser/scan.rl'] do |t|
+ cd 'lib/radius/parser' do
+ sh "ragel -R scan.rl"
+ end
+ end
+
+ desc 'pdf of the ragel scanner'
+ file 'doc/scan.pdf' => 'lib/radius/parser/scan.dot' do |t|
+ cd 'lib/radius/parser' do
+ sh "dot -Tpdf -o ../../../doc/scan.pdf scan.dot"
+ end
+ end
+
+ file 'lib/radius/parser/scan.dot' => ['lib/radius/parser/scan.rl'] do |t|
+ cd 'lib/radius/parser' do
+ sh "ragel -Vp scan.rl > scan.dot"
+ end
+ end
+end

0 comments on commit 34cdd07

Please sign in to comment.