composite_primary_keys 8.1.8 → 9.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +5 -5
  2. data/History.rdoc +3 -25
  3. data/README.rdoc +1 -0
  4. data/README_DB2.rdoc +33 -33
  5. data/Rakefile +34 -34
  6. data/lib/composite_primary_keys.rb +4 -11
  7. data/lib/composite_primary_keys/associations/association.rb +14 -12
  8. data/lib/composite_primary_keys/associations/association_scope.rb +27 -54
  9. data/lib/composite_primary_keys/associations/collection_association.rb +22 -8
  10. data/lib/composite_primary_keys/associations/has_many_association.rb +16 -54
  11. data/lib/composite_primary_keys/associations/has_many_through_association.rb +58 -58
  12. data/lib/composite_primary_keys/associations/join_dependency.rb +74 -56
  13. data/lib/composite_primary_keys/associations/join_dependency/join_association.rb +13 -11
  14. data/lib/composite_primary_keys/associations/preloader/association.rb +75 -72
  15. data/lib/composite_primary_keys/associations/singular_association.rb +8 -12
  16. data/lib/composite_primary_keys/attribute_methods.rb +6 -4
  17. data/lib/composite_primary_keys/attribute_methods/primary_key.rb +13 -11
  18. data/lib/composite_primary_keys/attribute_methods/read.rb +16 -15
  19. data/lib/composite_primary_keys/attribute_methods/write.rb +21 -19
  20. data/lib/composite_primary_keys/attribute_set/builder.rb +13 -11
  21. data/lib/composite_primary_keys/base.rb +5 -69
  22. data/lib/composite_primary_keys/composite_arrays.rb +8 -51
  23. data/lib/composite_primary_keys/composite_predicates.rb +7 -16
  24. data/lib/composite_primary_keys/connection_adapters/abstract_adapter.rb +10 -10
  25. data/lib/composite_primary_keys/connection_adapters/postgresql_adapter.rb +42 -11
  26. data/lib/composite_primary_keys/core.rb +46 -45
  27. data/lib/composite_primary_keys/dirty.rb +19 -19
  28. data/lib/composite_primary_keys/fixtures.rb +19 -17
  29. data/lib/composite_primary_keys/locking/optimistic.rb +48 -44
  30. data/lib/composite_primary_keys/nested_attributes.rb +64 -53
  31. data/lib/composite_primary_keys/persistence.rb +49 -41
  32. data/lib/composite_primary_keys/relation.rb +22 -47
  33. data/lib/composite_primary_keys/relation/batches.rb +33 -30
  34. data/lib/composite_primary_keys/relation/calculations.rb +3 -7
  35. data/lib/composite_primary_keys/relation/finder_methods.rb +123 -56
  36. data/lib/composite_primary_keys/relation/predicate_builder.rb +18 -29
  37. data/lib/composite_primary_keys/relation/where_clause.rb +33 -0
  38. data/lib/composite_primary_keys/sanitization.rb +45 -38
  39. data/lib/composite_primary_keys/validations/uniqueness.rb +37 -37
  40. data/lib/composite_primary_keys/version.rb +4 -4
  41. data/scripts/console.rb +48 -48
  42. data/scripts/txt2html +76 -76
  43. data/scripts/txt2js +65 -65
  44. data/tasks/databases/mysql.rake +42 -42
  45. data/tasks/databases/postgresql.rake +47 -47
  46. data/tasks/databases/sqlite3.rake +27 -27
  47. data/tasks/website.rake +18 -18
  48. data/test/README_tests.rdoc +56 -56
  49. data/test/abstract_unit.rb +10 -9
  50. data/test/connections/connection_spec.rb +18 -18
  51. data/test/connections/databases.yml +9 -39
  52. data/test/connections/native_ibm_db/connection.rb +18 -18
  53. data/test/connections/native_mysql/connection.rb +17 -17
  54. data/test/connections/native_postgresql/connection.rb +12 -12
  55. data/test/connections/native_sqlite3/connection.rb +9 -9
  56. data/test/db_test.rb +52 -52
  57. data/test/fixtures/article.rb +5 -5
  58. data/test/fixtures/articles.yml +6 -6
  59. data/test/fixtures/capitol.rb +3 -3
  60. data/test/fixtures/capitols.yml +16 -16
  61. data/test/fixtures/comments.yml +15 -15
  62. data/test/fixtures/db_definitions/mysql.sql +2 -12
  63. data/test/fixtures/db_definitions/oracle.sql +1 -2
  64. data/test/fixtures/db_definitions/postgresql.sql +0 -10
  65. data/test/fixtures/db_definitions/sqlite.sql +0 -9
  66. data/test/fixtures/db_definitions/sqlserver.sql +1 -2
  67. data/test/fixtures/department.rb +5 -5
  68. data/test/fixtures/departments.yml +15 -15
  69. data/test/fixtures/dorms.yml +4 -4
  70. data/test/fixtures/employee.rb +1 -2
  71. data/test/fixtures/employees.yml +19 -23
  72. data/test/fixtures/group.rb +2 -2
  73. data/test/fixtures/groups.yml +6 -6
  74. data/test/fixtures/hack.rb +4 -4
  75. data/test/fixtures/hacks.yml +2 -2
  76. data/test/fixtures/membership_status.rb +2 -2
  77. data/test/fixtures/product.rb +9 -9
  78. data/test/fixtures/product_tariff.rb +5 -5
  79. data/test/fixtures/products.yml +11 -11
  80. data/test/fixtures/reading.rb +4 -4
  81. data/test/fixtures/readings.yml +10 -10
  82. data/test/fixtures/reference_code_using_composite_key_alias.rb +8 -8
  83. data/test/fixtures/reference_code_using_simple_key_alias.rb +8 -8
  84. data/test/fixtures/reference_codes.yml +28 -28
  85. data/test/fixtures/reference_type.rb +1 -1
  86. data/test/fixtures/reference_types.yml +9 -9
  87. data/test/fixtures/restaurant.rb +9 -9
  88. data/test/fixtures/restaurants.yml +14 -14
  89. data/test/fixtures/restaurants_suburbs.yml +10 -10
  90. data/test/fixtures/room.rb +11 -11
  91. data/test/fixtures/room_assignment.rb +13 -13
  92. data/test/fixtures/room_assignments.yml +24 -24
  93. data/test/fixtures/room_attribute.rb +2 -2
  94. data/test/fixtures/room_attribute_assignment.rb +4 -4
  95. data/test/fixtures/room_attribute_assignments.yml +4 -4
  96. data/test/fixtures/room_attributes.yml +2 -2
  97. data/test/fixtures/rooms.yml +12 -12
  98. data/test/fixtures/seat.rb +5 -5
  99. data/test/fixtures/seats.yml +8 -8
  100. data/test/fixtures/street.rb +2 -2
  101. data/test/fixtures/streets.yml +16 -16
  102. data/test/fixtures/student.rb +3 -3
  103. data/test/fixtures/students.yml +15 -15
  104. data/test/fixtures/suburbs.yml +14 -14
  105. data/test/fixtures/tariff.rb +5 -5
  106. data/test/fixtures/tariffs.yml +14 -14
  107. data/test/fixtures/user.rb +0 -1
  108. data/test/plugins/pagination.rb +405 -405
  109. data/test/plugins/pagination_helper.rb +135 -135
  110. data/test/setup.rb +50 -50
  111. data/test/test_aliases.rb +18 -18
  112. data/test/test_associations.rb +7 -18
  113. data/test/test_composite_arrays.rb +24 -38
  114. data/test/test_counter_cache.rb +30 -30
  115. data/test/test_create.rb +5 -5
  116. data/test/test_delete_all.rb +7 -13
  117. data/test/test_dup.rb +37 -37
  118. data/test/test_exists.rb +39 -39
  119. data/test/test_find.rb +16 -12
  120. data/test/test_habtm.rb +26 -2
  121. data/test/test_ids.rb +109 -116
  122. data/test/test_miscellaneous.rb +32 -32
  123. data/test/test_pagination.rb +35 -35
  124. data/test/test_polymorphic.rb +0 -7
  125. data/test/test_predicates.rb +9 -28
  126. data/test/test_update.rb +3 -5
  127. data/test/test_validations.rb +13 -13
  128. metadata +24 -32
  129. data/lib/composite_primary_keys/arel/visitors/to_sql.rb +0 -36
  130. data/lib/composite_primary_keys/attribute_methods/dirty.rb +0 -29
  131. data/lib/composite_primary_keys/autosave_association.rb +0 -67
  132. data/lib/composite_primary_keys/connection_adapters/abstract_mysql_adapter.rb +0 -23
  133. data/test/fixtures/pk_called_id.rb +0 -5
  134. data/test/fixtures/pk_called_ids.yml +0 -11
  135. data/test/test_find_in_batches.rb +0 -30
  136. data/test/test_update_all.rb +0 -17
@@ -1,65 +1,65 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require 'redcloth'
5
- require 'syntax/convertors/html'
6
- require 'erb'
7
- require 'active_support'
8
-
9
- version_path = File.join(File.dirname(__FILE__), '..', 'lib', 'composite_primary_keys', 'version.rb')
10
- require File.expand_path(version_path)
11
-
12
- version = CompositePrimaryKeys::VERSION::STRING
13
- download = 'http://rubygems.org/gems/composite_primary_keys'
14
-
15
- class Fixnum
16
- def ordinal
17
- # teens
18
- return 'th' if (10..19).include?(self % 100)
19
- # others
20
- case self % 10
21
- when 1
22
- return 'st'
23
- when 2
24
- return 'nd'
25
- when 3
26
- return 'rd'
27
- else
28
- return 'th'
29
- end
30
- end
31
- end
32
-
33
- class Time
34
- def pretty
35
- return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
36
- end
37
- end
38
-
39
- def convert_syntax(syntax, source)
40
- return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
41
- end
42
-
43
- if ARGV.length >= 1
44
- src, template = ARGV
45
- template ||= File.dirname(__FILE__) + '/../website/template.js'
46
- else
47
- puts("Usage: #{File.split($0).last} source.txt [template.js] > output.html")
48
- exit!
49
- end
50
-
51
- template = ERB.new(File.open(template).read)
52
-
53
- title = nil
54
- body = nil
55
- File.open(src) do |fsrc|
56
- title_text = fsrc.readline
57
- body_text = fsrc.read
58
- title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
59
- body = RedCloth.new(body_text)
60
- end
61
- stat = File.stat(src)
62
- created = stat.ctime
63
- modified = stat.mtime
64
-
65
- $stdout << template.result(binding)
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'redcloth'
5
+ require 'syntax/convertors/html'
6
+ require 'erb'
7
+ require 'active_support'
8
+
9
+ version_path = File.join(File.dirname(__FILE__), '..', 'lib', 'composite_primary_keys', 'version.rb')
10
+ require File.expand_path(version_path)
11
+
12
+ version = CompositePrimaryKeys::VERSION::STRING
13
+ download = 'http://rubygems.org/gems/composite_primary_keys'
14
+
15
+ class Fixnum
16
+ def ordinal
17
+ # teens
18
+ return 'th' if (10..19).include?(self % 100)
19
+ # others
20
+ case self % 10
21
+ when 1
22
+ return 'st'
23
+ when 2
24
+ return 'nd'
25
+ when 3
26
+ return 'rd'
27
+ else
28
+ return 'th'
29
+ end
30
+ end
31
+ end
32
+
33
+ class Time
34
+ def pretty
35
+ return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
36
+ end
37
+ end
38
+
39
+ def convert_syntax(syntax, source)
40
+ return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
41
+ end
42
+
43
+ if ARGV.length >= 1
44
+ src, template = ARGV
45
+ template ||= File.dirname(__FILE__) + '/../website/template.js'
46
+ else
47
+ puts("Usage: #{File.split($0).last} source.txt [template.js] > output.html")
48
+ exit!
49
+ end
50
+
51
+ template = ERB.new(File.open(template).read)
52
+
53
+ title = nil
54
+ body = nil
55
+ File.open(src) do |fsrc|
56
+ title_text = fsrc.readline
57
+ body_text = fsrc.read
58
+ title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
59
+ body = RedCloth.new(body_text)
60
+ end
61
+ stat = File.stat(src)
62
+ created = stat.ctime
63
+ modified = stat.mtime
64
+
65
+ $stdout << template.result(binding)
@@ -1,42 +1,42 @@
1
- require File.join(PROJECT_ROOT, 'lib', 'composite_primary_keys')
2
- require File.join(PROJECT_ROOT, 'test', 'connections', 'connection_spec')
3
-
4
- namespace :mysql do
5
- desc 'Create the MySQL test database'
6
- task :create_database do
7
- ActiveRecord::Base.clear_all_connections!
8
- spec = CompositePrimaryKeys::ConnectionSpec['mysql'].dup
9
- database_name = spec.delete('database')
10
- connection = ActiveRecord::Base.establish_connection(spec)
11
- ActiveRecord::Base.connection.create_database(database_name)
12
- ActiveRecord::Base.clear_all_connections!
13
- end
14
-
15
- desc 'Build the MySQL test database'
16
- task :build_database => [:create_database] do
17
- path = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'mysql.sql')
18
- sql = File.open(path, 'rb') do |file|
19
- file.read
20
- end
21
-
22
- Rake::Task['mysql:load_connection'].reenable
23
- Rake::Task['mysql:load_connection'].invoke
24
- #puts %(ActiveRecord::Base.connection.instance_variable_get(:@config)=#{(ActiveRecord::Base.connection.instance_variable_get(:@config)).inspect})
25
- sql.split(";").each do |statement|
26
- ActiveRecord::Base.connection.execute(statement) unless statement.strip.length == 0
27
- end
28
- end
29
-
30
- desc 'Drop the MySQL test database'
31
- task :drop_database => :load_connection do
32
- ActiveRecord::Base.connection.drop_database(SPEC['database'])
33
- end
34
-
35
- desc 'Rebuild the MySQL test database'
36
- task :rebuild_database => [:drop_database, :build_database]
37
-
38
- task :load_connection do
39
- require File.join(PROJECT_ROOT, "test", "connections", "native_mysql", "connection")
40
- establish_connection
41
- end
42
- end
1
+ require File.join(PROJECT_ROOT, 'lib', 'composite_primary_keys')
2
+ require File.join(PROJECT_ROOT, 'test', 'connections', 'connection_spec')
3
+
4
+ namespace :mysql do
5
+ desc 'Create the MySQL test database'
6
+ task :create_database do
7
+ ActiveRecord::Base.clear_all_connections!
8
+ spec = CompositePrimaryKeys::ConnectionSpec['mysql'].dup
9
+ database_name = spec.delete('database')
10
+ connection = ActiveRecord::Base.establish_connection(spec)
11
+ ActiveRecord::Base.connection.create_database(database_name)
12
+ ActiveRecord::Base.clear_all_connections!
13
+ end
14
+
15
+ desc 'Build the MySQL test database'
16
+ task :build_database => [:create_database] do
17
+ path = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'mysql.sql')
18
+ sql = File.open(path, 'rb') do |file|
19
+ file.read
20
+ end
21
+
22
+ Rake::Task['mysql:load_connection'].reenable
23
+ Rake::Task['mysql:load_connection'].invoke
24
+ #puts %(ActiveRecord::Base.connection.instance_variable_get(:@config)=#{(ActiveRecord::Base.connection.instance_variable_get(:@config)).inspect})
25
+ sql.split(";").each do |statement|
26
+ ActiveRecord::Base.connection.execute(statement) unless statement.strip.length == 0
27
+ end
28
+ end
29
+
30
+ desc 'Drop the MySQL test database'
31
+ task :drop_database => :load_connection do
32
+ ActiveRecord::Base.connection.drop_database(SPEC['database'])
33
+ end
34
+
35
+ desc 'Rebuild the MySQL test database'
36
+ task :rebuild_database => [:drop_database, :build_database]
37
+
38
+ task :load_connection do
39
+ require File.join(PROJECT_ROOT, "test", "connections", "native_mysql", "connection")
40
+ establish_connection
41
+ end
42
+ end
@@ -1,48 +1,48 @@
1
- require File.join(PROJECT_ROOT, 'lib', 'composite_primary_keys')
2
- require File.join(PROJECT_ROOT, 'test', 'connections', 'connection_spec')
3
-
4
- namespace :postgresql do
5
- desc 'Create the PostgreSQL test database'
6
- task :create_database do
7
- ActiveRecord::Base.clear_all_connections!
8
- spec = CompositePrimaryKeys::ConnectionSpec['postgresql'].dup
9
- database_name = spec.delete('database')
10
- spec['database'] = 'postgres'
11
- connection = ActiveRecord::Base.establish_connection(spec)
12
- ActiveRecord::Base.connection.create_database(database_name)
13
- ActiveRecord::Base.clear_all_connections!
14
- end
15
-
16
- desc 'Build the PostgreSQL test database'
17
- task :build_database => [:create_database] do
18
- ActiveRecord::Base.clear_all_connections!
19
- spec = CompositePrimaryKeys::ConnectionSpec['postgresql'].dup
20
- connection = ActiveRecord::Base.establish_connection(spec)
21
-
22
- path = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'postgresql.sql')
23
- sql = File.open(path, 'rb') do |file|
24
- file.read
25
- end
26
-
27
- Rake::Task['postgresql:load_connection'].invoke
28
- ActiveRecord::Base.connection.execute(sql)
29
- end
30
-
31
- desc 'Drop the PostgreSQL test database'
32
- task :drop_database => :load_connection do
33
- ActiveRecord::Base.clear_all_connections!
34
- spec = CompositePrimaryKeys::ConnectionSpec['postgresql'].dup
35
- database_name = spec.delete('database')
36
- spec['database'] = 'postgres'
37
- connection = ActiveRecord::Base.establish_connection(spec)
38
- ActiveRecord::Base.connection.drop_database(SPEC['database'])
39
- ActiveRecord::Base.clear_all_connections!
40
- end
41
-
42
- desc 'Rebuild the PostgreSQL test database'
43
- task :rebuild_database => [:drop_database, :build_database]
44
-
45
- task :load_connection do
46
- require File.join(PROJECT_ROOT, "test", "connections", "native_postgresql", "connection")
47
- end
1
+ require File.join(PROJECT_ROOT, 'lib', 'composite_primary_keys')
2
+ require File.join(PROJECT_ROOT, 'test', 'connections', 'connection_spec')
3
+
4
+ namespace :postgresql do
5
+ desc 'Create the PostgreSQL test database'
6
+ task :create_database do
7
+ ActiveRecord::Base.clear_all_connections!
8
+ spec = CompositePrimaryKeys::ConnectionSpec['postgresql'].dup
9
+ database_name = spec.delete('database')
10
+ spec['database'] = 'postgres'
11
+ connection = ActiveRecord::Base.establish_connection(spec)
12
+ ActiveRecord::Base.connection.create_database(database_name)
13
+ ActiveRecord::Base.clear_all_connections!
14
+ end
15
+
16
+ desc 'Build the PostgreSQL test database'
17
+ task :build_database => [:create_database] do
18
+ ActiveRecord::Base.clear_all_connections!
19
+ spec = CompositePrimaryKeys::ConnectionSpec['postgresql'].dup
20
+ connection = ActiveRecord::Base.establish_connection(spec)
21
+
22
+ path = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'postgresql.sql')
23
+ sql = File.open(path, 'rb') do |file|
24
+ file.read
25
+ end
26
+
27
+ Rake::Task['postgresql:load_connection'].invoke
28
+ ActiveRecord::Base.connection.execute(sql)
29
+ end
30
+
31
+ desc 'Drop the PostgreSQL test database'
32
+ task :drop_database => :load_connection do
33
+ ActiveRecord::Base.clear_all_connections!
34
+ spec = CompositePrimaryKeys::ConnectionSpec['postgresql'].dup
35
+ database_name = spec.delete('database')
36
+ spec['database'] = 'postgres'
37
+ connection = ActiveRecord::Base.establish_connection(spec)
38
+ ActiveRecord::Base.connection.drop_database(SPEC['database'])
39
+ ActiveRecord::Base.clear_all_connections!
40
+ end
41
+
42
+ desc 'Rebuild the PostgreSQL test database'
43
+ task :rebuild_database => [:drop_database, :build_database]
44
+
45
+ task :load_connection do
46
+ require File.join(PROJECT_ROOT, "test", "connections", "native_postgresql", "connection")
47
+ end
48
48
  end
@@ -1,27 +1,27 @@
1
- require File.join(PROJECT_ROOT, 'lib', 'composite_primary_keys')
2
- require File.join(PROJECT_ROOT, 'test', 'connections', 'connection_spec')
3
-
4
- namespace :sqlite3 do
5
- desc 'Build the sqlite test database'
6
- task :build_database => :load_connection do
7
- schema = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'sqlite.sql')
8
- dbfile = File.join(PROJECT_ROOT, connection_string)
9
- FileUtils.mkdir_p(File.dirname(dbfile))
10
- cmd = "sqlite3 #{dbfile} < #{schema}"
11
- puts cmd
12
- sh %{ #{cmd} }
13
- end
14
-
15
- desc 'Drop the sqlite test database'
16
- task :drop_database => :load_connection do
17
- dbfile = connection_string
18
- sh %{ rm -f #{dbfile} }
19
- end
20
-
21
- desc 'Rebuild the sqlite test database'
22
- task :rebuild_database => [:drop_database, :build_database]
23
-
24
- task :load_connection do
25
- require File.join(PROJECT_ROOT, "test", "connections", "native_sqlite3", "connection")
26
- end
27
- end
1
+ require File.join(PROJECT_ROOT, 'lib', 'composite_primary_keys')
2
+ require File.join(PROJECT_ROOT, 'test', 'connections', 'connection_spec')
3
+
4
+ namespace :sqlite3 do
5
+ desc 'Build the sqlite test database'
6
+ task :build_database => :load_connection do
7
+ schema = File.join(PROJECT_ROOT, 'test', 'fixtures', 'db_definitions', 'sqlite.sql')
8
+ dbfile = File.join(PROJECT_ROOT, connection_string)
9
+ FileUtils.mkdir_p(File.dirname(dbfile))
10
+ cmd = "sqlite3 #{dbfile} < #{schema}"
11
+ puts cmd
12
+ sh %{ #{cmd} }
13
+ end
14
+
15
+ desc 'Drop the sqlite test database'
16
+ task :drop_database => :load_connection do
17
+ dbfile = connection_string
18
+ sh %{ rm -f #{dbfile} }
19
+ end
20
+
21
+ desc 'Rebuild the sqlite test database'
22
+ task :rebuild_database => [:drop_database, :build_database]
23
+
24
+ task :load_connection do
25
+ require File.join(PROJECT_ROOT, "test", "connections", "native_sqlite3", "connection")
26
+ end
27
+ end
@@ -1,18 +1,18 @@
1
- desc 'Generate website files'
2
- task :website_generate do
3
- sh %{ ruby scripts/txt2html website/index.txt > website/index.html }
4
- sh %{ ruby scripts/txt2js website/version.txt > website/version.js }
5
- sh %{ ruby scripts/txt2js website/version-raw.txt > website/version-raw.js }
6
- end
7
-
8
- desc 'Upload website files to rubyforge'
9
- task :website_upload do
10
- config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
11
- host = "#{config["username"]}@rubyforge.org"
12
- remote_dir = "/var/www/gforge-projects/compositekeys/"
13
- local_dir = 'website'
14
- sh %{scp -r #{local_dir}/* #{host}:#{remote_dir}}
15
- end
16
-
17
- desc 'Generate and upload website files'
18
- task :website => [:website_generate, :website_upload]
1
+ desc 'Generate website files'
2
+ task :website_generate do
3
+ sh %{ ruby scripts/txt2html website/index.txt > website/index.html }
4
+ sh %{ ruby scripts/txt2js website/version.txt > website/version.js }
5
+ sh %{ ruby scripts/txt2js website/version-raw.txt > website/version-raw.js }
6
+ end
7
+
8
+ desc 'Upload website files to rubyforge'
9
+ task :website_upload do
10
+ config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
11
+ host = "#{config["username"]}@rubyforge.org"
12
+ remote_dir = "/var/www/gforge-projects/compositekeys/"
13
+ local_dir = 'website'
14
+ sh %{scp -r #{local_dir}/* #{host}:#{remote_dir}}
15
+ end
16
+
17
+ desc 'Generate and upload website files'
18
+ task :website => [:website_generate, :website_upload]
@@ -1,56 +1,56 @@
1
- = Composite Primary Keys - Testing Readme
2
-
3
- == Testing an adapter
4
-
5
- There are tests available for the following adapters:
6
-
7
- * ibmdb
8
- * mysql
9
- * oracle
10
- * oracle_enhanced
11
- * postgresql
12
- * sqlite3
13
-
14
- To run the tests for one of the adapters follow these steps (using mysql in the example):
15
-
16
- * You will need the following gems:
17
- - rake
18
- - activerecord (3.1.0.rc5 or later)
19
- - mysql (or the adapter of your choice)
20
-
21
- * Put your database connection settings in test/connections/databases.yml.
22
- Look at databases.example.yml for examples.
23
-
24
- mysql:
25
- adapter: mysql
26
- username: root
27
- database: composite_primary_keys_unittest
28
-
29
- * rake -T mysql
30
-
31
- rake mysql:build_database # Build the MySQL test databases
32
- rake mysql:drop_database # Drop the MySQL test databases
33
- rake mysql:rebuild_database # Rebuild the MySQL test databases
34
- rake mysql:test # Run tests using the mysql adapter
35
-
36
- * rake mysql:build_database
37
- * rake mysql:test
38
-
39
- == Running tests individually
40
-
41
- You can specify which test you'd like to run on the command line:
42
-
43
- * rake mysql:test TEST=test/test_equal.rb
44
-
45
- If you want to run closer to the metal you can cd into the test/
46
- directory and run the tests like so:
47
-
48
- * ADAPTER=mysql ruby test_equal.rb
49
-
50
- == Logging
51
-
52
- By default, ActiveRecord's log messages are sent to standard out when
53
- running the tests. If you would prefer to send them to a file, specify
54
- it as the environment variable CPK_LOGFILE:
55
-
56
- * CPK_LOGFILE=cpk_test.log rake mysql:test
1
+ = Composite Primary Keys - Testing Readme
2
+
3
+ == Testing an adapter
4
+
5
+ There are tests available for the following adapters:
6
+
7
+ * ibmdb
8
+ * mysql
9
+ * oracle
10
+ * oracle_enhanced
11
+ * postgresql
12
+ * sqlite3
13
+
14
+ To run the tests for one of the adapters follow these steps (using mysql in the example):
15
+
16
+ * You will need the following gems:
17
+ - rake
18
+ - activerecord (3.1.0.rc5 or later)
19
+ - mysql (or the adapter of your choice)
20
+
21
+ * Put your database connection settings in test/connections/databases.yml.
22
+ Look at databases.example.yml for examples.
23
+
24
+ mysql:
25
+ adapter: mysql
26
+ username: root
27
+ database: composite_primary_keys_unittest
28
+
29
+ * rake -T mysql
30
+
31
+ rake mysql:build_database # Build the MySQL test databases
32
+ rake mysql:drop_database # Drop the MySQL test databases
33
+ rake mysql:rebuild_database # Rebuild the MySQL test databases
34
+ rake mysql:test # Run tests using the mysql adapter
35
+
36
+ * rake mysql:build_database
37
+ * rake mysql:test
38
+
39
+ == Running tests individually
40
+
41
+ You can specify which test you'd like to run on the command line:
42
+
43
+ * rake mysql:test TEST=test/test_equal.rb
44
+
45
+ If you want to run closer to the metal you can cd into the test/
46
+ directory and run the tests like so:
47
+
48
+ * ADAPTER=mysql ruby test_equal.rb
49
+
50
+ == Logging
51
+
52
+ By default, ActiveRecord's log messages are sent to standard out when
53
+ running the tests. If you would prefer to send them to a file, specify
54
+ it as the environment variable CPK_LOGFILE:
55
+
56
+ * CPK_LOGFILE=cpk_test.log rake mysql:test