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

root/tags/rel_1-1-4/actionpack/Rakefile

Revision 4204, 4.5 kB (checked in by david, 3 years ago)

Use Aras RubyForge uploader

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