Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

root/branches/2-1-caching/actionpack/Rakefile

Revision 8330, 4.7 kB (checked in by david, 10 months ago)

Make ready for 2.0.1

Line 
1 require 'rubygems'
2 require 'rake'
3 require 'rake/testtask'
4 require 'rake/rdoctask'
5 require 'rake/packagetask'
6 require 'rake/gempackagetask'
7 require 'rake/contrib/rubyforgepublisher'
8 require File.join(File.dirname(__FILE__), 'lib', 'action_pack', 'version')
9
10 PKG_BUILD     = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
11 PKG_NAME      = 'actionpack'
12 PKG_VERSION   = ActionPack::VERSION::STRING + PKG_BUILD
13 PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
14
15 RELEASE_NAME  = "REL #{PKG_VERSION}"
16
17 RUBY_FORGE_PROJECT = "actionpack"
18 RUBY_FORGE_USER    = "webster132"
19
20 desc "Default Task"
21 task :default => [ :test ]
22
23 # Run the unit tests
24
25 desc "Run all unit tests"
26 task :test => [:test_action_pack, :test_active_record_integration]
27
28 Rake::TestTask.new(:test_action_pack) { |t|
29   t.libs << "test"
30 # make sure we include the controller tests (c*) first as on some systems
31 # this will not happen automatically and the tests (as a whole) will error
32   t.test_files=Dir.glob( "test/c*/**/*_test.rb" ) + Dir.glob( "test/[ft]*/*_test.rb" )
33 #  t.pattern = 'test/*/*_test.rb'
34   t.verbose = true
35 }
36
37 desc 'ActiveRecord Integration Tests'
38 Rake::TestTask.new(:test_active_record_integration) do |t|
39   t.libs << "test"
40   t.test_files = Dir.glob("test/activerecord/*_test.rb")
41   t.verbose = true
42 end
43
44
45 # Genereate the RDoc documentation
46
47 Rake::RDocTask.new { |rdoc|
48   rdoc.rdoc_dir = 'doc'
49   rdoc.title    = "Action Pack -- On rails from request to response"
50   rdoc.options << '--line-numbers' << '--inline-source'
51   rdoc.options << '--charset' << 'utf-8'
52   rdoc.template = "#{ENV['template']}.rb" if ENV['template']
53   if ENV['DOC_FILES']
54     rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
55   else
56     rdoc.rdoc_files.include('README', 'RUNNING_UNIT_TESTS', 'CHANGELOG')
57     rdoc.rdoc_files.include('lib/**/*.rb')
58   end
59 }
60
61 # Create compressed packages
62 dist_dirs = [ "lib", "test" ]
63
64 spec = Gem::Specification.new do |s|
65   s.platform = Gem::Platform::RUBY
66   s.name = PKG_NAME
67   s.version = PKG_VERSION
68   s.summary = "Web-flow and rendering framework putting the VC in MVC."
69   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.} #'
70
71   s.author = "David Heinemeier Hansson"
72   s.email = "david@loudthinking.com"
73   s.rubyforge_project = "actionpack"
74   s.homepage = "http://www.rubyonrails.org"
75
76   s.has_rdoc = true
77   s.requirements << 'none'
78
79   s.add_dependency('activesupport', '= 2.0.1' + PKG_BUILD)
80
81   s.require_path = 'lib'
82   s.autorequire = 'action_controller'
83
84   s.files = [ "Rakefile", "install.rb", "README", "RUNNING_UNIT_TESTS", "CHANGELOG", "MIT-LICENSE" ]
85   dist_dirs.each do |dir|
86     s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
87   end
88 end
89  
90 Rake::GemPackageTask.new(spec) do |p|
91   p.gem_spec = spec
92   p.need_tar = true
93   p.need_zip = true
94 end
95
96 task :lines do
97   lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
98
99   for file_name in FileList["lib/**/*.rb"]
100     next if file_name =~ /vendor/
101     f = File.open(file_name)
102
103     while line = f.gets
104       lines += 1
105       next if line =~ /^\s*$/
106       next if line =~ /^\s*#/
107       codelines += 1
108     end
109     puts "L: #{sprintf("%4d", lines)}, LOC #{sprintf("%4d", codelines)} | #{file_name}"
110    
111     total_lines     += lines
112     total_codelines += codelines
113    
114     lines, codelines = 0, 0
115   end
116
117   puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
118 end
119
120 # Publishing ------------------------------------------------------
121
122 task :update_scriptaculous do
123   for js in %w( controls dragdrop effects )
124     system("svn export --force http://dev.rubyonrails.org/svn/rails/spinoffs/scriptaculous/src/#{js}.js #{File.dirname(__FILE__)}/lib/action_view/helpers/javascripts/#{js}.js")
125   end
126 end
127
128 desc "Updates actionpack to the latest version of the javascript spinoffs"
129 task :update_js => [ :update_scriptaculous ]
130
131 # Publishing ------------------------------------------------------
132
133 desc "Publish the API documentation"
134 task :pgem => [:package] do
135   Rake::SshFilePublisher.new("davidhh@wrath.rubyonrails.org", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
136   `ssh davidhh@wrath.rubyonrails.org './gemupdate.sh'`
137 end
138
139 desc "Publish the API documentation"
140 task :pdoc => [:rdoc] do
141   Rake::SshDirPublisher.new("davidhh@wrath.rubyonrails.org", "public_html/ap", "doc").upload
142 end
143
144 desc "Publish the release files to RubyForge."
145 task :release => [ :package ] do
146   require 'rubyforge'
147
148   packages = %w( gem tgz zip ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" }
149
150   rubyforge = RubyForge.new
151   rubyforge.login
152   rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages)
153 end
Note: See TracBrowser for help on using the browser.