Rakefile 3.2 KB
Newer Older
D
Initial  
David Heinemeier Hansson 已提交
1 2 3 4 5 6 7 8 9 10
require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/packagetask'
require 'rake/gempackagetask'
require 'rake/contrib/rubyforgepublisher'

PKG_BUILD     = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
PKG_NAME      = 'actionpack'
11
PKG_VERSION   = '1.5.1' + PKG_BUILD
D
Initial  
David Heinemeier Hansson 已提交
12 13 14 15 16 17 18 19 20
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"

desc "Default Task"
task :default => [ :test ]

# Run the unit tests

Rake::TestTask.new { |t|
  t.libs << "test"
21 22 23 24
# make sure we include the controller tests (c*) first as on some systems
# this will not happen automatically and the tests (as a whole) will error
  t.test_files=Dir.glob( "test/c*/*_test.rb" ) + Dir.glob( "test/[ft]*/*_test.rb" )
#  t.pattern = 'test/*/*_test.rb'
D
Initial  
David Heinemeier Hansson 已提交
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
  t.verbose = true
}


# Genereate the RDoc documentation

Rake::RDocTask.new { |rdoc|
  rdoc.rdoc_dir = 'doc'
  rdoc.title    = "Action Pack -- On rails from request to response"
  rdoc.options << '--line-numbers --inline-source --main README'
  rdoc.rdoc_files.include('README', 'RUNNING_UNIT_TESTS', 'CHANGELOG')
  rdoc.rdoc_files.include('lib/**/*.rb')
}


# Create compressed packages


dist_dirs = [ "lib", "test", "examples" ]

spec = Gem::Specification.new do |s|
  s.platform = Gem::Platform::RUBY
  s.name = PKG_NAME
  s.version = PKG_VERSION
  s.summary = "Web-flow and rendering framework putting the VC in MVC."
50
  s.description = %q{Eases web-request routing, handling, and response as a half-way front, half-way page controller. Implemented with specific emphasis on enabling easy unit/integration testing that doesn't require a browser.} #'
D
Initial  
David Heinemeier Hansson 已提交
51 52 53 54

  s.author = "David Heinemeier Hansson"
  s.email = "david@loudthinking.com"
  s.rubyforge_project = "actionpack"
55
  s.homepage = "http://www.rubyonrails.org"
D
Initial  
David Heinemeier Hansson 已提交
56 57 58

  s.has_rdoc = true
  s.requirements << 'none'
59

60
  s.add_dependency('activesupport', '= 1.0.1' + PKG_BUILD)
61

D
Initial  
David Heinemeier Hansson 已提交
62 63 64 65 66
  s.require_path = 'lib'
  s.autorequire = 'action_controller'

  s.files = [ "rakefile", "install.rb", "README", "RUNNING_UNIT_TESTS", "CHANGELOG", "MIT-LICENSE", "examples/.htaccess" ]
  dist_dirs.each do |dir|
67
    s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
D
Initial  
David Heinemeier Hansson 已提交
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
  end
  s.files.delete "examples/benchmark.rb"
  s.files.delete "examples/benchmark_with_ar.fcgi"
end
  
Rake::GemPackageTask.new(spec) do |p|
  p.gem_spec = spec
  p.need_tar = true
  p.need_zip = true
end


# Publish beta gem
desc "Publish the API documentation"
task :pgem => [:package] do 
83 84
  Rake::SshFilePublisher.new("davidhh@comox.textdrive.com", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
  `ssh davidhh@comox.textdrive.com './gemupdate.sh'`
D
Initial  
David Heinemeier Hansson 已提交
85 86 87 88 89
end

# Publish documentation
desc "Publish the API documentation"
task :pdoc => [:rdoc] do 
90
  Rake::SshDirPublisher.new("davidhh@comox.textdrive.com", "public_html/ap", "doc").upload
D
Initial  
David Heinemeier Hansson 已提交
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
end


desc "Count lines in the main rake file"
task :lines do
  lines = 0
  codelines = 0
  Dir.foreach("lib/action_controller") { |file_name| 
    next unless file_name =~ /.*rb/
    
    f = File.open("lib/action_controller/" + file_name)

    while line = f.gets
      lines += 1
      next if line =~ /^\s*$/
      next if line =~ /^\s*#/
      codelines += 1
    end
  }
  puts "Lines #{lines}, LOC #{codelines}"
111
end