Empact-sexy_pg_constraints 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,79 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{Empact-sexy_pg_constraints}
8
+ s.version = "0.2.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Maxim Chernyak", "Ben Woosley"]
12
+ s.date = %q{2011-04-21}
13
+ s.description = %q{Use migrations and simple syntax to manage constraints in PostgreSQL DB.}
14
+ s.email = %q{ben.woosley@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ "CHANGELOG.rdoc",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "init.rb",
28
+ "lib/sexy_pg_constraints.rb",
29
+ "lib/sexy_pg_constraints/constrainer.rb",
30
+ "lib/sexy_pg_constraints/constraints.rb",
31
+ "lib/sexy_pg_constraints/deconstrainer.rb",
32
+ "lib/sexy_pg_constraints/helpers.rb",
33
+ "lib/sexy_pg_constraints/initializer.rb",
34
+ "sexy_pg_constraints.gemspec",
35
+ "test/sexy_pg_constraints_test.rb",
36
+ "test/support/assert_prohibits_allows.rb",
37
+ "test/support/database.yml.example",
38
+ "test/support/models.rb",
39
+ "test/test_helper.rb"
40
+ ]
41
+ s.homepage = %q{http://github.com/maxim/sexy_pg_constraints}
42
+ s.require_paths = ["lib"]
43
+ s.rubygems_version = %q{1.7.2}
44
+ s.summary = nil
45
+ s.test_files = [
46
+ "test/sexy_pg_constraints_test.rb",
47
+ "test/support/assert_prohibits_allows.rb",
48
+ "test/support/models.rb",
49
+ "test/test_helper.rb"
50
+ ]
51
+
52
+ if s.respond_to? :specification_version then
53
+ s.specification_version = 3
54
+
55
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
56
+ s.add_runtime_dependency(%q<activerecord>, [">= 3.0.0"])
57
+ s.add_runtime_dependency(%q<pg>, [">= 0"])
58
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
59
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
60
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
61
+ s.add_development_dependency(%q<rcov>, [">= 0"])
62
+ else
63
+ s.add_dependency(%q<activerecord>, [">= 3.0.0"])
64
+ s.add_dependency(%q<pg>, [">= 0"])
65
+ s.add_dependency(%q<shoulda>, [">= 0"])
66
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
67
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
68
+ s.add_dependency(%q<rcov>, [">= 0"])
69
+ end
70
+ else
71
+ s.add_dependency(%q<activerecord>, [">= 3.0.0"])
72
+ s.add_dependency(%q<pg>, [">= 0"])
73
+ s.add_dependency(%q<shoulda>, [">= 0"])
74
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
75
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
76
+ s.add_dependency(%q<rcov>, [">= 0"])
77
+ end
78
+ end
79
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -1,23 +1,10 @@
1
- require 'sexy_pg_constraints/initializer'
2
- require "sexy_pg_constraints/helpers"
3
- require "sexy_pg_constraints/constrainer"
4
- require "sexy_pg_constraints/deconstrainer"
5
- require "sexy_pg_constraints/constraints"
6
-
7
1
  module SexyPgConstraints
8
- def constrain(*args)
9
- if block_given?
10
- yield SexyPgConstraints::Constrainer.new(args[0].to_s)
11
- else
12
- SexyPgConstraints::Constrainer::add_constraints(*args)
13
- end
14
- end
15
-
16
- def deconstrain(*args)
17
- if block_given?
18
- yield SexyPgConstraints::DeConstrainer.new(args[0])
19
- else
20
- SexyPgConstraints::DeConstrainer::drop_constraints(*args)
21
- end
22
- end
2
+ extend ActiveSupport::Autoload
3
+ autoload :SchemaDefinitions
4
+ autoload :Constrainer
5
+ autoload :Deconstrainer
6
+ autoload :Constraints
7
+ autoload :Helpers
23
8
  end
9
+
10
+ require 'sexy_pg_constraints/railtie' if defined?(Rails)
@@ -1,5 +1,5 @@
1
1
  module SexyPgConstraints
2
- class DeConstrainer
2
+ class Deconstrainer
3
3
  include SexyPgConstraints::Helpers
4
4
 
5
5
  def initialize(table, columns = [])
@@ -0,0 +1,9 @@
1
+ module SexyPgConstraints
2
+ class Railtie < Rails::Railtie
3
+ initializer 'sexy_pg_constraints.load_adapter' do
4
+ ActiveSupport.on_load :active_record do
5
+ ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send(:include, SexyPgConstraints::SchemaDefinitions)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,19 @@
1
+ module SexyPgConstraints
2
+ module SchemaDefinitions
3
+ def constrain(*args)
4
+ if block_given?
5
+ yield SexyPgConstraints::Constrainer.new(args[0].to_s)
6
+ else
7
+ SexyPgConstraints::Constrainer::add_constraints(*args)
8
+ end
9
+ end
10
+
11
+ def deconstrain(*args)
12
+ if block_given?
13
+ yield SexyPgConstraints::Deconstrainer.new(args[0])
14
+ else
15
+ SexyPgConstraints::Deconstrainer::drop_constraints(*args)
16
+ end
17
+ end
18
+ end
19
+ end
data/test/test_helper.rb CHANGED
@@ -10,6 +10,10 @@ end
10
10
  require 'active_support/core_ext/class/attribute_accessors'
11
11
  require 'active_support/core_ext/module/delegation'
12
12
  require 'active_record'
13
+
14
+ db_config_path = File.join(File.dirname(__FILE__), 'support', 'database.yml')
15
+ ActiveRecord::Base.establish_connection(YAML::load(open(db_config_path)))
16
+
13
17
  require 'test/unit'
14
18
  require 'shoulda'
15
19
 
@@ -19,9 +23,7 @@ require "sexy_pg_constraints"
19
23
  require 'support/models'
20
24
  require 'support/assert_prohibits_allows'
21
25
 
22
- db_config_path = File.join(File.dirname(__FILE__), 'support', 'database.yml')
23
- ActiveRecord::Base.establish_connection(YAML::load(open(db_config_path)))
24
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send(:include, SexyPgConstraints)
26
+ ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send(:include, SexyPgConstraints::SchemaDefinitions)
25
27
 
26
28
  class Test::Unit::TestCase
27
29
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: Empact-sexy_pg_constraints
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.0
5
+ version: 0.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Maxim Chernyak
@@ -90,6 +90,7 @@ extra_rdoc_files:
90
90
  - README.rdoc
91
91
  files:
92
92
  - CHANGELOG.rdoc
93
+ - Empact-sexy_pg_constraints.gemspec
93
94
  - Gemfile
94
95
  - Gemfile.lock
95
96
  - LICENSE.txt
@@ -102,8 +103,8 @@ files:
102
103
  - lib/sexy_pg_constraints/constraints.rb
103
104
  - lib/sexy_pg_constraints/deconstrainer.rb
104
105
  - lib/sexy_pg_constraints/helpers.rb
105
- - lib/sexy_pg_constraints/initializer.rb
106
- - sexy_pg_constraints.gemspec
106
+ - lib/sexy_pg_constraints/railtie.rb
107
+ - lib/sexy_pg_constraints/schema_definitions.rb
107
108
  - test/sexy_pg_constraints_test.rb
108
109
  - test/support/assert_prohibits_allows.rb
109
110
  - test/support/database.yml.example
@@ -122,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
123
  requirements:
123
124
  - - ">="
124
125
  - !ruby/object:Gem::Version
125
- hash: -665410626784681910
126
+ hash: 1726302836925487223
126
127
  segments:
127
128
  - 0
128
129
  version: "0"
@@ -1,7 +0,0 @@
1
- if defined?(Rails)
2
- class SexyPgConstraintsRailtie < Rails::Railtie
3
- config.after_initialize do
4
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.send(:include, SexyPgConstraints)
5
- end
6
- end
7
- end
@@ -1,32 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- Gem::Specification.new do |s|
4
- s.name = %q{sexy_pg_constraints}
5
- s.version = "0.1.3"
6
-
7
- s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Maxim Chernyak"]
9
- s.date = %q{2009-01-19}
10
- s.description = %q{Use migrations and simple syntax to manage constraints in PostgreSQL DB.}
11
- s.email = %q{max@bitsonnet.com}
12
- s.extra_rdoc_files = ["CHANGELOG.rdoc", "lib/constrainer.rb", "lib/constraints.rb", "lib/deconstrainer.rb", "lib/helpers.rb", "lib/sexy_pg_constraints.rb", "README.rdoc"]
13
- s.files = ["CHANGELOG.rdoc", "init.rb", "lib/constrainer.rb", "lib/constraints.rb", "lib/deconstrainer.rb", "lib/helpers.rb", "lib/sexy_pg_constraints.rb", "Manifest", "Rakefile", "README.rdoc", "sexy_pg_constraints.gemspec", "test/postgresql_adapter.rb", "test/sexy_pg_constraints_test.rb", "test/test_helper.rb"]
14
- s.has_rdoc = true
15
- s.homepage = %q{http://github.com/maxim/sexy_pg_constraints}
16
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Sexy_pg_constraints", "--main", "README.rdoc"]
17
- s.require_paths = ["lib"]
18
- s.rubyforge_project = %q{sexy_pg_constraints}
19
- s.rubygems_version = %q{1.3.1}
20
- s.summary = %q{Use migrations and simple syntax to manage constraints in PostgreSQL DB.}
21
- s.test_files = ["test/sexy_pg_constraints_test.rb", "test/test_helper.rb"]
22
-
23
- if s.respond_to? :specification_version then
24
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
25
- s.specification_version = 2
26
-
27
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
- else
29
- end
30
- else
31
- end
32
- end