Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 215 lines (172 sloc) 7.021 kb
db045db @dhh Initial
dhh authored
1 require 'rubygems'
2 require 'rake'
3 require 'rake/testtask'
4 require 'rake/rdoctask'
5 require 'rake/packagetask'
6 require 'rake/gempackagetask'
df000fc @jamis Move lib/version.rb to lib/action_pack/version.rb
jamis authored
7 require File.join(File.dirname(__FILE__), 'lib', 'action_pack', 'version')
db045db @dhh Initial
dhh authored
8
9 PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
10 PKG_NAME = 'actionpack'
5cb2aa7 Rename Version constant to VERSION. Closes #2802.
Marcel Molina authored
11 PKG_VERSION = ActionPack::VERSION::STRING + PKG_BUILD
db045db @dhh Initial
dhh authored
12 PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
13
065cb2a @dhh Made ready for better release automation
dhh authored
14 RELEASE_NAME = "REL #{PKG_VERSION}"
15
16 RUBY_FORGE_PROJECT = "actionpack"
17 RUBY_FORGE_USER = "webster132"
18
db045db @dhh Initial
dhh authored
19 desc "Default Task"
ddb4600 @wycats Get ActionPack's test running on bundled gems. This should make running ...
wycats authored
20 task :default => [ :bundle, :test ]
21
22 task :bundle do
23 puts "Checking if the bundled testing requirements are up to date..."
24 result = system "gem bundle"
25 unless result
26 puts "The gem bundler is not installed. Installing."
27 system "gem install bundler"
28 system "gem bundle"
29 end
30 end
db045db @dhh Initial
dhh authored
31
32 # Run the unit tests
33
d8fffe7 @lifo Replace ad hoc Rack::Test with ActionController::IntegrationTest
lifo authored
34 desc "Run all unit tests"
5314abe Keep ActionMailer using the old layouts code until it gets refactored.
Yehuda Katz + Carl Lerche authored
35 task :test => [:test_action_pack, :test_active_record_integration, :test_new_base]
070f3fd @jeremy Clean up and run the Active Record integration tests by default.
jeremy authored
36
37be453 Adding "test" to the lib directory when running action pack tests on new...
Yehuda Katz + Carl Lerche authored
37 test_lib_dirs = ENV["NEW"] ? ["test/new_base"] : []
38 test_lib_dirs.push "test", "test/lib"
39 # test_lib_dirs = [ENV["NEW"] ? "test/new_base" : "test", "test/lib"]
c19c0e7 @jeremy Disable warnings in AP tests
jeremy authored
40 Rake::TestTask.new(:test_action_pack) do |t|
ca72078 @jeremy Move fake controllers and models to a common load path
jeremy authored
41 t.libs.concat test_lib_dirs
c19c0e7 @jeremy Disable warnings in AP tests
jeremy authored
42
43 # make sure we include the tests in alphabetical order as on some systems
44 # this will not happen automatically and the tests (as a whole) will error
595107f @lifo Move html-scanner tests one dir up
lifo authored
45 t.test_files = Dir.glob( "test/{controller,dispatch,template,html-scanner}/**/*_test.rb" ).sort
c19c0e7 @jeremy Disable warnings in AP tests
jeremy authored
46
db045db @dhh Initial
dhh authored
47 t.verbose = true
c19c0e7 @jeremy Disable warnings in AP tests
jeremy authored
48 #t.warning = true
49 end
86fc43f ActionPack components should no longer have undeclared dependencies.
Yehuda Katz + Carl Lerche authored
50
fa5da8a @jeremy isolated_test task
jeremy authored
51 task :isolated_test do
52 ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
53 Dir.glob("test/{controller,dispatch,template}/**/*_test.rb").all? do |file|
ca72078 @jeremy Move fake controllers and models to a common load path
jeremy authored
54 system(ruby, "-Ilib:#{test_lib_dirs * ':'}", file)
fa5da8a @jeremy isolated_test task
jeremy authored
55 end or raise "Failures"
56 end
db045db @dhh Initial
dhh authored
57
d49a5fc @NZKoz * Fix pagination problems when using include
NZKoz authored
58 desc 'ActiveRecord Integration Tests'
59 Rake::TestTask.new(:test_active_record_integration) do |t|
ca72078 @jeremy Move fake controllers and models to a common load path
jeremy authored
60 t.libs.concat test_lib_dirs
d49a5fc @NZKoz * Fix pagination problems when using include
NZKoz authored
61 t.test_files = Dir.glob("test/activerecord/*_test.rb")
62 t.verbose = true
63 end
64
8a4e77b OMG, a lot of work
Yehuda Katz + Carl Lerche authored
65 desc 'New Controller Tests'
66 Rake::TestTask.new(:test_new_base) do |t|
ca72078 @jeremy Move fake controllers and models to a common load path
jeremy authored
67 t.libs << "test/new_base" << "test/lib"
8a4e77b OMG, a lot of work
Yehuda Katz + Carl Lerche authored
68 t.test_files = Dir.glob("test/{abstract_controller,new_base}/*_test.rb")
69 t.verbose = true
70 end
71
77d955c Added passing old tests on new base to the main test runner
Yehuda Katz + Carl Lerche authored
72 desc 'Old Controller Tests on New Base'
73 Rake::TestTask.new(:test_new_base_on_old_tests) do |t|
ca72078 @jeremy Move fake controllers and models to a common load path
jeremy authored
74 t.libs << "test/new_base" << "test/lib"
63ed43c Added render_other_test.rb to the new base test runner
Yehuda Katz + Carl Lerche authored
75
a1f280e Got all the dispatch tests running on new base
Carl Lerche authored
76 t.verbose = true
63ed43c Added render_other_test.rb to the new base test runner
Yehuda Katz + Carl Lerche authored
77 # ==== Not ported
78 # * filters
a1f280e Got all the dispatch tests running on new base
Carl Lerche authored
79
7211048 Get all template tests passing on new base
Carl Lerche authored
80 t.test_files = Dir.glob( "test/{dispatch,template}/**/*_test.rb" ).sort + %w(
72a574b Get controller/layout_test.rb running on new base except for ActionContr...
Yehuda Katz + Carl Lerche authored
81 action_pack_assertions addresses_render assert_select
f9dde8f @jeremy Port cookies to new base
jeremy authored
82 base benchmark caching capture content_type cookie dispatcher
72a574b Get controller/layout_test.rb running on new base except for ActionContr...
Yehuda Katz + Carl Lerche authored
83 filter_params flash helper http_basic_authentication
1358f77 Add controller/integration_test.rb to the new base test runner
Carl Lerche authored
84 http_digest_authentication integration layout logging mime_responds
7b3fb1d Got controller/render_js_test.rb to pass on new base
Yehuda Katz + Carl Lerche authored
85 record_identifier redirect render render_js render_json
86 render_other render_xml request_forgery_protection rescue
a3ca563 Get controller/test_test.rb to pass on new base
Carl Lerche authored
87 resources routing selector send_file test url_rewriter
09907d1 Get controller/view_paths_test.rb to pass on new base
Carl Lerche authored
88 verification view_paths webservice
77d955c Added passing old tests on new base to the main test runner
Yehuda Katz + Carl Lerche authored
89 ).map { |name| "test/controller/#{name}_test.rb" }
90 end
91
db045db @dhh Initial
dhh authored
92 # Genereate the RDoc documentation
93
94 Rake::RDocTask.new { |rdoc|
95 rdoc.rdoc_dir = 'doc'
96 rdoc.title = "Action Pack -- On rails from request to response"
dfd953e @dhh Fixed docs
dhh authored
97 rdoc.options << '--line-numbers' << '--inline-source'
d8b67f7 @jeremy Generate rdoc with utf-8 charset. Closes #7188 [manfred, jferris]
jeremy authored
98 rdoc.options << '--charset' << 'utf-8'
a02d672 @jeremy Horo rdoc template
jeremy authored
99 rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : '../doc/template/horo'
dd5397a ActionController::Base Summary documentation rewrite. Closes #4900. [kev...
Marcel Molina authored
100 if ENV['DOC_FILES']
101 rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
102 else
103 rdoc.rdoc_files.include('README', 'RUNNING_UNIT_TESTS', 'CHANGELOG')
a61a2af @jeremy Exclude lib/actionpack.rb from rdoc
jeremy authored
104 rdoc.rdoc_files.include(Dir['lib/**/*.rb'] -
e96d557 @jeremy Use rdoc exclude
jeremy authored
105 Dir['lib/*/vendor/**/*.rb'])
106 rdoc.rdoc_files.exclude('lib/actionpack.rb')
dd5397a ActionController::Base Summary documentation rewrite. Closes #4900. [kev...
Marcel Molina authored
107 end
db045db @dhh Initial
dhh authored
108 }
109
110 # Create compressed packages
955fa61 @dhh The examples are outdated and misleading
dhh authored
111 dist_dirs = [ "lib", "test" ]
db045db @dhh Initial
dhh authored
112
113 spec = Gem::Specification.new do |s|
114 s.platform = Gem::Platform::RUBY
115 s.name = PKG_NAME
116 s.version = PKG_VERSION
117 s.summary = "Web-flow and rendering framework putting the VC in MVC."
dc3d6eb @dhh Moved Active Support into its own gem
dhh authored
118 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.} #'
db045db @dhh Initial
dhh authored
119
120 s.author = "David Heinemeier Hansson"
121 s.email = "david@loudthinking.com"
122 s.rubyforge_project = "actionpack"
f2e6945 @dhh Prepared for release of 0.9.3
dhh authored
123 s.homepage = "http://www.rubyonrails.org"
db045db @dhh Initial
dhh authored
124
125 s.has_rdoc = true
126 s.requirements << 'none'
dc3d6eb @dhh Moved Active Support into its own gem
dhh authored
127
db3de78 Bump up the version to 3.0.pre
Carl Lerche authored
128 s.add_dependency('activesupport', '= 3.0.pre' + PKG_BUILD)
bd53ebd Add required dependencies on activemodel
Carl Lerche authored
129 s.add_dependency('activemodel', '= 3.0.pre' + PKG_BUILD)
b4068c1 @josh Restore rack gem dependency
josh authored
130 s.add_dependency('rack', '~> 1.0.0')
131 s.add_dependency('rack-test', '~> 0.4.2')
dc3d6eb @dhh Moved Active Support into its own gem
dhh authored
132
db045db @dhh Initial
dhh authored
133 s.require_path = 'lib'
134 s.autorequire = 'action_controller'
135
955fa61 @dhh The examples are outdated and misleading
dhh authored
136 s.files = [ "Rakefile", "install.rb", "README", "RUNNING_UNIT_TESTS", "CHANGELOG", "MIT-LICENSE" ]
db045db @dhh Initial
dhh authored
137 dist_dirs.each do |dir|
4370466 @dhh Dont include svn directories in packages
dhh authored
138 s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
db045db @dhh Initial
dhh authored
139 end
140 end
141
142 Rake::GemPackageTask.new(spec) do |p|
143 p.gem_spec = spec
144 p.need_tar = true
145 p.need_zip = true
146 end
147
67f5d61 @wycats Add rake gemspec and gemspecs to the repo
wycats authored
148 task :gemspec do
149 File.open(File.join(File.dirname(__FILE__), "#{spec.name}.gemspec"), "w") do |file|
150 file.puts spec.to_ruby
151 end
152 end
153
e0a2dab @dhh Added KLOC counter for AR and AP. Combined theyre at ~9KLOC
dhh authored
154 task :lines do
155 lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
156
157 for file_name in FileList["lib/**/*.rb"]
158 next if file_name =~ /vendor/
159 f = File.open(file_name)
160
161 while line = f.gets
162 lines += 1
163 next if line =~ /^\s*$/
164 next if line =~ /^\s*#/
165 codelines += 1
166 end
167 puts "L: #{sprintf("%4d", lines)}, LOC #{sprintf("%4d", codelines)} | #{file_name}"
168
169 total_lines += lines
170 total_codelines += codelines
171
172 lines, codelines = 0, 0
173 end
174
175 puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
176 end
177
12ff2f7 @dhh Rake task to update spin off libraries #1514 [Tobias Luetke]
dhh authored
178 # Publishing ------------------------------------------------------
179
180 task :update_scriptaculous do
e3bfd08 @dhh Fixed Effect.Appear in effects.js to work with floats in Safari (closes ...
dhh authored
181 for js in %w( controls dragdrop effects )
08967ea @dhh Allow method chaining in RJS elements [Rick Olson]
dhh authored
182 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")
e3bfd08 @dhh Fixed Effect.Appear in effects.js to work with floats in Safari (closes ...
dhh authored
183 end
12ff2f7 @dhh Rake task to update spin off libraries #1514 [Tobias Luetke]
dhh authored
184 end
185
186 desc "Updates actionpack to the latest version of the javascript spinoffs"
e3bfd08 @dhh Fixed Effect.Appear in effects.js to work with floats in Safari (closes ...
dhh authored
187 task :update_js => [ :update_scriptaculous ]
db045db @dhh Initial
dhh authored
188
065cb2a @dhh Made ready for better release automation
dhh authored
189 # Publishing ------------------------------------------------------
190
db045db @dhh Initial
dhh authored
191 desc "Publish the API documentation"
192 task :pgem => [:package] do
22c5667 @jeremy Defer rake/contrib/sshpublisher require so we can use the stdlib rake in...
jeremy authored
193 require 'rake/contrib/sshpublisher'
eec6e0c @dhh Push to new gem server
dhh authored
194 Rake::SshFilePublisher.new("gems.rubyonrails.org", "/u/sites/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
5366e61 @dhh Proper update call for gem server
dhh authored
195 `ssh gems.rubyonrails.org '/u/sites/gems/gemupdate.sh'`
db045db @dhh Initial
dhh authored
196 end
197
198 desc "Publish the API documentation"
199 task :pdoc => [:rdoc] do
22c5667 @jeremy Defer rake/contrib/sshpublisher require so we can use the stdlib rake in...
jeremy authored
200 require 'rake/contrib/sshpublisher'
231c2c5 @jeremy Update Rakefiles to connect to wrath as current user. Use ssh config to ...
jeremy authored
201 Rake::SshDirPublisher.new("wrath.rubyonrails.org", "public_html/ap", "doc").upload
db045db @dhh Initial
dhh authored
202 end
203
065cb2a @dhh Made ready for better release automation
dhh authored
204 desc "Publish the release files to RubyForge."
98634e7 @dhh Use Aras RubyForge uploader
dhh authored
205 task :release => [ :package ] do
635c7f4 @dhh Run with the latest versions so beta gems will work
dhh authored
206 require 'rubyforge'
699cc15 @jeremy Move rubyforge task require
jeremy authored
207 require 'rake/contrib/rubyforgepublisher'
065cb2a @dhh Made ready for better release automation
dhh authored
208
635c7f4 @dhh Run with the latest versions so beta gems will work
dhh authored
209 packages = %w( gem tgz zip ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" }
210
211 rubyforge = RubyForge.new
212 rubyforge.login
213 rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages)
335c150 @jeremy Bump versions for 1.2.4 release.
jeremy authored
214 end
Something went wrong with that request. Please try again.