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