activerecord-postgresql-extensions 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -15,4 +15,6 @@ debug.log
15
15
  .config
16
16
  .yardoc
17
17
  Gemfile.lock
18
+ Gemfile.local
19
+ Guardfile.local
18
20
  test/local_database.yml
data/Gemfile CHANGED
@@ -1,3 +1,25 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ if RUBY_PLATFORM == "java"
6
+ gem "activerecord-jdbcpostgresql-adapter"
7
+ else
8
+ gem "pg"
9
+ end
10
+
11
+ gem "rdoc", "~> 3.12"
12
+ gem "rake", "~> 10.0"
13
+ gem "minitest"
14
+ gem "minitest-reporters"
15
+ gem "guard-minitest"
16
+
17
+ if RbConfig::CONFIG['host_os'] =~ /^darwin/
18
+ gem "rb-fsevent"
19
+ gem "growl"
20
+ end
21
+
22
+ if File.exists?('Gemfile.local')
23
+ instance_eval File.read('Gemfile.local')
24
+ end
25
+
data/Guardfile ADDED
@@ -0,0 +1,17 @@
1
+
2
+ guard 'minitest', :test_folders => 'test', :test_file_patterns => '*_tests.rb' do
3
+ watch(%r|^test/(.+)_tests\.rb|)
4
+
5
+ watch(%r|^lib/(.*)([^/]+)\.rb|) do |m|
6
+ "test/#{m[1]}#{m[2]}_tests.rb"
7
+ end
8
+
9
+ watch(%r|^test/test_helper\.rb|) do
10
+ "test"
11
+ end
12
+ end
13
+
14
+ if File.exists?('Guardfile.local')
15
+ instance_eval File.read('Guardfile.local')
16
+ end
17
+
data/Rakefile CHANGED
@@ -2,23 +2,12 @@
2
2
  # -*- ruby -*-
3
3
 
4
4
  require 'rubygems'
5
-
6
- gem 'rdoc', '~> 3.12'
7
-
8
5
  require 'rubygems/package_task'
9
6
  require 'rake/testtask'
10
7
  require 'rdoc/task'
11
8
  require 'bundler/gem_tasks'
12
9
 
13
- if RUBY_VERSION >= '1.9'
14
- begin
15
- gem 'psych'
16
- rescue Exception => e
17
- # it's okay, fall back on the bundled psych
18
- end
19
- end
20
-
21
- $:.push 'lib'
10
+ $:.push File.expand_path(File.dirname(__FILE__), 'lib')
22
11
 
23
12
  version = ActiveRecord::PostgreSQLExtensions::VERSION
24
13
 
@@ -21,14 +21,5 @@ Gem::Specification.new do |s|
21
21
  s.require_paths = ["lib"]
22
22
 
23
23
  s.add_dependency("activerecord", [">= 2.3"])
24
- if RUBY_PLATFORM == "java"
25
- s.add_dependency("activerecord-jdbcpostgresql-adapter")
26
- else
27
- s.add_dependency("pg")
28
- end
29
- s.add_dependency("rdoc")
30
- s.add_dependency("rake", ["~> 0.9"])
31
- s.add_dependency("minitest")
32
- s.add_dependency("turn")
33
24
  end
34
25
 
@@ -684,7 +684,7 @@ module ActiveRecord
684
684
  end
685
685
  execute("ALTER TABLE #{quote_table_name(table_name)} ALTER #{quote_column_name(column_name)} #{null ? 'DROP' : 'SET'} NOT NULL")
686
686
  else
687
- change_column_null_without(table_name, column_name, null, default = nil)
687
+ change_column_null_without_expression(table_name, column_name, null, default = nil)
688
688
  end
689
689
  end
690
690
  alias_method_chain :change_column_null, :expression
@@ -1,7 +1,7 @@
1
1
 
2
2
  module ActiveRecord
3
3
  module PostgreSQLExtensions
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.2"
5
5
  end
6
6
  end
7
7
 
@@ -193,4 +193,18 @@ class AdapterExtensionTests < MiniTest::Unit::TestCase
193
193
  %{ALTER TABLE "foo" ALTER "bar" SET NOT NULL},
194
194
  ], statements)
195
195
  end
196
+
197
+ def test_change_column_without_expression
198
+ Mig.change_column(:foo, :bar, :integer, :null => false, :default => 100)
199
+ Mig.change_column(:foo, :bar, :integer, :null => true, :default => 100)
200
+
201
+ assert_equal([
202
+ %{ALTER TABLE "foo" ALTER COLUMN "bar" TYPE integer},
203
+ %{ALTER TABLE "foo" ALTER COLUMN "bar" SET DEFAULT 100},
204
+ %{ALTER TABLE "foo" ALTER "bar" SET NOT NULL},
205
+ %{ALTER TABLE "foo" ALTER COLUMN "bar" TYPE integer},
206
+ %{ALTER TABLE "foo" ALTER COLUMN "bar" SET DEFAULT 100},
207
+ %{ALTER TABLE "foo" ALTER "bar" DROP NOT NULL},
208
+ ], statements)
209
+ end
196
210
  end
data/test/test_helper.rb CHANGED
@@ -5,9 +5,13 @@ require 'rubygems'
5
5
  gem 'activerecord', ACTIVERECORD_GEM_VERSION
6
6
 
7
7
  require 'active_record'
8
- require 'minitest/autorun'
9
- require 'turn'
10
8
  require 'logger'
9
+ require 'minitest/autorun'
10
+
11
+ if RUBY_VERSION >= '1.9'
12
+ require 'minitest/reporters'
13
+ end
14
+
11
15
  require File.join(File.dirname(__FILE__), *%w{ .. lib activerecord-postgresql-extensions })
12
16
 
13
17
  ActiveRecord::Base.logger = Logger.new("debug.log") if ENV['ENABLE_LOGGER']
@@ -49,10 +53,6 @@ else
49
53
  end
50
54
 
51
55
  class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
52
- def statements
53
- @statements ||= []
54
- end
55
-
56
56
  def execute_with_statement_capture(*args)
57
57
  PostgreSQLExtensionsTestHelper.add_statement(args.first)
58
58
 
@@ -123,10 +123,7 @@ end
123
123
  class Foo < ActiveRecord::Base
124
124
  end
125
125
 
126
- if ENV['autotest']
127
- module Turn::Colorize
128
- def self.color_supported?
129
- true
130
- end
131
- end
126
+ if RUBY_VERSION >= '1.9'
127
+ MiniTest::Reporters.use!(MiniTest::Reporters::SpecReporter.new)
132
128
  end
129
+
metadata CHANGED
@@ -1,112 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-postgresql-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
5
4
  prerelease:
5
+ version: 0.2.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - J Smith
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-01 00:00:00.000000000 Z
12
+ date: 2012-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: activerecord
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '2.3'
22
- type: :runtime
23
- prerelease: false
24
15
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
16
  requirements:
27
17
  - - ! '>='
28
18
  - !ruby/object:Gem::Version
29
19
  version: '2.3'
30
- - !ruby/object:Gem::Dependency
31
- name: pg
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :runtime
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: rdoc
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
20
  none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: rake
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ~>
68
- - !ruby/object:Gem::Version
69
- version: '0.9'
21
+ name: activerecord
70
22
  type: :runtime
71
23
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- version: '0.9'
78
- - !ruby/object:Gem::Dependency
79
- name: minitest
80
24
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '0'
86
- type: :runtime
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
25
  requirements:
91
26
  - - ! '>='
92
27
  - !ruby/object:Gem::Version
93
- version: '0'
94
- - !ruby/object:Gem::Dependency
95
- name: turn
96
- requirement: !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '0'
102
- type: :runtime
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
28
+ version: '2.3'
105
29
  none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
30
  description: A whole bunch of extensions the ActiveRecord PostgreSQL adapter.
111
31
  email: code@zoocasa.com
112
32
  executables: []
@@ -116,6 +36,7 @@ extra_rdoc_files:
116
36
  files:
117
37
  - .gitignore
118
38
  - Gemfile
39
+ - Guardfile
119
40
  - MIT-LICENSE
120
41
  - README.rdoc
121
42
  - Rakefile
@@ -171,20 +92,20 @@ rdoc_options: []
171
92
  require_paths:
172
93
  - lib
173
94
  required_ruby_version: !ruby/object:Gem::Requirement
174
- none: false
175
95
  requirements:
176
96
  - - ! '>='
177
97
  - !ruby/object:Gem::Version
178
98
  version: '0'
179
- required_rubygems_version: !ruby/object:Gem::Requirement
180
99
  none: false
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
181
101
  requirements:
182
102
  - - ! '>='
183
103
  - !ruby/object:Gem::Version
184
104
  version: '0'
105
+ none: false
185
106
  requirements: []
186
107
  rubyforge_project:
187
- rubygems_version: 1.8.24
108
+ rubygems_version: 1.8.23
188
109
  signing_key:
189
110
  specification_version: 3
190
111
  summary: A whole bunch of extensions the ActiveRecord PostgreSQL adapter.