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

root/tags/rel_0-9-4/activerecord/Rakefile

Revision 439, 4.2 kB (checked in by david, 4 years ago)

Made ready for release of 0.9.4

  • 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
9 PKG_BUILD     = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
10 PKG_NAME      = 'activerecord'
11 PKG_VERSION   = '1.5.0' + PKG_BUILD
12 PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
13
14 PKG_FILES = FileList[
15     "lib/**/*", "test/**/*", "examples/**/*", "doc/**/*", "[A-Z]*", "install.rb", "rakefile"
16 ].exclude(/\bCVS\b|~$/)
17
18
19 desc "Default Task"
20 task :default => [ :test_ruby_mysql, :test_mysql_ruby, :test_sqlite, :test_sqlite3, :test_postgresql ]
21
22 # Run the unit tests
23
24 Rake::TestTask.new("test_ruby_mysql") { |t|
25   t.libs << "test" << "test/connections/native_mysql"
26   t.pattern = 'test/*_test.rb'
27   t.verbose = true
28 }
29
30 Rake::TestTask.new("test_mysql_ruby") { |t|
31   t.libs << "test" << "test/connections/native_mysql"
32   t.pattern = 'test/*_test.rb'
33   t.verbose = true
34 }
35
36 Rake::TestTask.new("test_postgresql") { |t|
37   t.libs << "test" << "test/connections/native_postgresql"
38   t.pattern = 'test/*_test.rb'
39   t.verbose = true
40 }
41
42 Rake::TestTask.new("test_sqlite") { |t|
43   t.libs << "test" << "test/connections/native_sqlite"
44   t.pattern = 'test/*_test.rb'
45   t.verbose = true
46 }
47
48 Rake::TestTask.new("test_sqlite3") { |t|
49   t.libs << "test" << "test/connections/native_sqlite3"
50   t.pattern = 'test/*_test.rb'
51   t.verbose = true
52 }
53
54 Rake::TestTask.new("test_sqlserver") { |t|
55   t.libs << "test" << "test/connections/native_sqlserver"
56   t.pattern = 'test/*_test.rb'
57   t.verbose = true
58 }
59
60 Rake::TestTask.new("test_db2") { |t|
61   t.libs << "test" << "test/connections/native_db2"
62   t.pattern = 'test/*_test.rb'
63   t.verbose = true
64 }
65
66 # Generate the RDoc documentation
67
68 Rake::RDocTask.new { |rdoc|
69   rdoc.rdoc_dir = 'doc'
70   rdoc.title    = "Active Record -- Object-relation mapping put on rails"
71   rdoc.options << '--line-numbers --inline-source --accessor cattr_accessor=object'
72   rdoc.rdoc_files.include('README', 'RUNNING_UNIT_TESTS', 'CHANGELOG')
73   rdoc.rdoc_files.include('lib/**/*.rb')
74   rdoc.rdoc_files.exclude('lib/active_record/vendor/*')
75   rdoc.rdoc_files.include('dev-utils/*.rb')
76 }
77
78
79 # Publish beta gem
80 desc "Publish the beta gem"
81 task :pgem => [:package] do
82   Rake::SshFilePublisher.new("davidhh@comox.textdrive.com", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
83   `ssh davidhh@comox.textdrive.com './gemupdate.sh'`
84 end
85
86 # Publish documentation
87 desc "Publish the API documentation"
88 task :pdoc => [:rdoc] do
89   Rake::SshDirPublisher.new("davidhh@comox.textdrive.com", "public_html/ar", "doc").upload
90 end
91
92
93 # Create compressed packages
94
95 dist_dirs = [ "lib", "test", "examples", "dev-utils" ]
96
97 spec = Gem::Specification.new do |s|
98   s.name = PKG_NAME
99   s.version = PKG_VERSION
100   s.summary = "Implements the ActiveRecord pattern for ORM."
101   s.description = %q{Implements the ActiveRecord pattern (Fowler, PoEAA) for ORM. It ties database tables and classes together for business objects, like Customer or Subscription, that can find, save, and destroy themselves without resorting to manual SQL.}
102
103   s.files = [ "rakefile", "install.rb", "README", "RUNNING_UNIT_TESTS", "CHANGELOG" ]
104   dist_dirs.each do |dir|
105     s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
106   end
107   s.files.delete "test/fixtures/fixture_database.sqlite"
108   s.files.delete "test/fixtures/fixture_database_2.sqlite"
109   s.files.delete "test/fixtures/fixture_database.sqlite3"
110   s.files.delete "test/fixtures/fixture_database_2.sqlite3"
111   s.require_path = 'lib'
112   s.autorequire = 'active_record'
113
114   s.has_rdoc = true
115   s.extra_rdoc_files = %w( README )
116   s.rdoc_options.concat ['--main',  'README']
117  
118   s.author = "David Heinemeier Hansson"
119   s.email = "david@loudthinking.com"
120   s.homepage = "http://www.rubyonrails.com"
121   s.rubyforge_project = "activerecord"
122 end
123  
124 Rake::GemPackageTask.new(spec) do |p|
125   p.gem_spec = spec
126   p.need_tar = true
127   p.need_zip = true
128 end
129
130
131 task :lines do
132   lines = 0
133   codelines = 0
134   Dir.foreach("lib/active_record") { |file_name|
135     next unless file_name =~ /.*rb/
136    
137     f = File.open("lib/active_record/" + file_name)
138
139     while line = f.gets
140       lines += 1
141       next if line =~ /^\s*$/
142       next if line =~ /^\s*#/
143       codelines += 1
144     end
145   }
146   puts "Lines #{lines}, LOC #{codelines}"
147 end
Note: See TracBrowser for help on using the browser.