Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 163 lines (129 sloc) 4.681 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'
7 require 'rake/contrib/rubyforgepublisher'
8
9 PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
10 PKG_NAME = 'activerecord'
ac8ebc1 @dhh Prepared for 0.9.5 release
dhh authored
11 PKG_VERSION = '1.6.0' + PKG_BUILD
db045db @dhh Initial
dhh authored
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"
a133f3e @dhh Added SQLite3 compatibility through the sqlite3-ruby adapter by Jamis…
dhh authored
20 task :default => [ :test_ruby_mysql, :test_mysql_ruby, :test_sqlite, :test_sqlite3, :test_postgresql ]
db045db @dhh Initial
dhh authored
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
a133f3e @dhh Added SQLite3 compatibility through the sqlite3-ruby adapter by Jamis…
dhh authored
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
a6fefad @dhh Added the final touches to the Microsoft SQL Server adapter by DeLynn…
dhh authored
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
daf3e92 @dhh Added a db2 adapter that only depends on the Ruby/DB2 bindings (http:…
dhh authored
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
336c2cb @dhh Added an Oracle adapter that works with the Oracle bindings by Yoshid…
dhh authored
66 Rake::TestTask.new("test_oracle") { |t|
67 t.libs << "test" << "test/connections/native_oracle"
68 t.pattern = 'test/*_test.rb'
69 t.verbose = true
70 }
71
10d458b @dhh Added a OCI8-based Oracle adapter that has been verified to work with…
dhh authored
72 Rake::TestTask.new("test_oci") { |t|
73 t.libs << "test" << "test/connections/native_oci"
74 t.pattern = 'test/*_test.rb'
75 t.verbose = true
76 }
77
db045db @dhh Initial
dhh authored
78 # Generate the RDoc documentation
79
80 Rake::RDocTask.new { |rdoc|
81 rdoc.rdoc_dir = 'doc'
82 rdoc.title = "Active Record -- Object-relation mapping put on rails"
83 rdoc.options << '--line-numbers --inline-source --accessor cattr_accessor=object'
84 rdoc.rdoc_files.include('README', 'RUNNING_UNIT_TESTS', 'CHANGELOG')
85 rdoc.rdoc_files.include('lib/**/*.rb')
86 rdoc.rdoc_files.exclude('lib/active_record/vendor/*')
87 rdoc.rdoc_files.include('dev-utils/*.rb')
88 }
89
90
91 # Publish beta gem
92 desc "Publish the beta gem"
93 task :pgem => [:package] do
595a4a5 @dhh Rearranging dependencies
dhh authored
94 Rake::SshFilePublisher.new("davidhh@comox.textdrive.com", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
95 `ssh davidhh@comox.textdrive.com './gemupdate.sh'`
db045db @dhh Initial
dhh authored
96 end
97
98 # Publish documentation
99 desc "Publish the API documentation"
100 task :pdoc => [:rdoc] do
595a4a5 @dhh Rearranging dependencies
dhh authored
101 Rake::SshDirPublisher.new("davidhh@comox.textdrive.com", "public_html/ar", "doc").upload
db045db @dhh Initial
dhh authored
102 end
103
104
105 # Create compressed packages
106
107 dist_dirs = [ "lib", "test", "examples", "dev-utils" ]
108
109 spec = Gem::Specification.new do |s|
110 s.name = PKG_NAME
111 s.version = PKG_VERSION
112 s.summary = "Implements the ActiveRecord pattern for ORM."
113 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.}
114
115 s.files = [ "rakefile", "install.rb", "README", "RUNNING_UNIT_TESTS", "CHANGELOG" ]
116 dist_dirs.each do |dir|
4370466 @dhh Dont include svn directories in packages
dhh authored
117 s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
db045db @dhh Initial
dhh authored
118 end
dc3d6eb @dhh Moved Active Support into its own gem
dhh authored
119
5dabc92 @dhh Call Active Support 0.9 until release
dhh authored
120 s.add_dependency('activesupport', '>= 0.9.0')
dc3d6eb @dhh Moved Active Support into its own gem
dhh authored
121
db045db @dhh Initial
dhh authored
122 s.files.delete "test/fixtures/fixture_database.sqlite"
a133f3e @dhh Added SQLite3 compatibility through the sqlite3-ruby adapter by Jamis…
dhh authored
123 s.files.delete "test/fixtures/fixture_database_2.sqlite"
124 s.files.delete "test/fixtures/fixture_database.sqlite3"
125 s.files.delete "test/fixtures/fixture_database_2.sqlite3"
db045db @dhh Initial
dhh authored
126 s.require_path = 'lib'
127 s.autorequire = 'active_record'
128
129 s.has_rdoc = true
130 s.extra_rdoc_files = %w( README )
131 s.rdoc_options.concat ['--main', 'README']
132
133 s.author = "David Heinemeier Hansson"
134 s.email = "david@loudthinking.com"
595a4a5 @dhh Rearranging dependencies
dhh authored
135 s.homepage = "http://www.rubyonrails.com"
db045db @dhh Initial
dhh authored
136 s.rubyforge_project = "activerecord"
137 end
138
139 Rake::GemPackageTask.new(spec) do |p|
140 p.gem_spec = spec
141 p.need_tar = true
142 p.need_zip = true
143 end
144
145
146 task :lines do
147 lines = 0
148 codelines = 0
149 Dir.foreach("lib/active_record") { |file_name|
150 next unless file_name =~ /.*rb/
151
152 f = File.open("lib/active_record/" + file_name)
153
154 while line = f.gets
155 lines += 1
156 next if line =~ /^\s*$/
157 next if line =~ /^\s*#/
158 codelines += 1
159 end
160 }
161 puts "Lines #{lines}, LOC #{codelines}"
162 end
Something went wrong with that request. Please try again.