activerecord-postgres-hstore-core 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/Gemfile +7 -0
- data/README.rdoc +2 -2
- data/activerecord-postgres-hstore-core.gemspec +1 -2
- data/lib/activerecord-postgres-hstore-core.rb +0 -1
- data/lib/activerecord-postgres-hstore-core/version.rb +1 -1
- data/lib/activerecord_postgres_hstore_core/activerecord.rb +2 -2
- data/lib/activerecord_postgres_hstore_core/string.rb +2 -2
- data/spec/activerecord_postgres_hstore_core/{activerecord_posgres_hstore_database_spec.rb → activerecord_postgres_hstore_database_spec.rb} +0 -0
- data/spec/activerecord_postgres_hstore_core/activerecord_postgres_hstore_datatype_spec.rb +8 -1
- metadata +9 -23
data/Gemfile
CHANGED
@@ -1,3 +1,10 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
gemspec
|
3
3
|
|
4
|
+
# putting these here because if they're in the gemspec it tries to load both of them.
|
5
|
+
# Bundler lets you choose per-platform.
|
6
|
+
group :development do
|
7
|
+
gem 'pg', :platforms => :ruby
|
8
|
+
gem 'activerecord-jdbc-adapter', :platforms => :jruby
|
9
|
+
gem 'activerecord-jdbcpostgresql-adapter', :platforms => :jruby
|
10
|
+
end
|
data/README.rdoc
CHANGED
@@ -22,8 +22,8 @@ I have made it "more better" by removing the spurious rails install, removing th
|
|
22
22
|
|
23
23
|
== Help
|
24
24
|
|
25
|
-
You can contact me at @entropyfails if you need help or email me at
|
25
|
+
You can contact me at @entropyfails if you need help or email me at jt@justin.tv
|
26
26
|
|
27
27
|
== Copyright
|
28
28
|
|
29
|
-
Copyright @ 2012 Jt Gleason, Juan Miaz, MIT License
|
29
|
+
Copyright @ 2012 Jt Gleason, Juan Miaz, MIT License
|
@@ -8,12 +8,11 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.description = %q{Allows you to use active record with databases that already have an hstore type}
|
9
9
|
gem.summary = "Hstore AR for Hstore DB"
|
10
10
|
gem.email = %q{jt@twitch.tv}
|
11
|
-
gem.homepage = ''
|
11
|
+
gem.homepage = 'https://github.com/jtvjt/activerecord-postgres-hstore-core'
|
12
12
|
|
13
13
|
gem.add_dependency 'rails', '~> 3.0'
|
14
14
|
gem.add_development_dependency 'rspec', '~> 2.6'
|
15
15
|
gem.add_development_dependency 'ammeter', '~> 0.1.3'
|
16
|
-
gem.add_development_dependency 'pg'
|
17
16
|
gem.add_development_dependency 'guard'
|
18
17
|
gem.add_development_dependency 'guard-rspec'
|
19
18
|
|
@@ -114,7 +114,7 @@ module ActiveRecord
|
|
114
114
|
|
115
115
|
end
|
116
116
|
|
117
|
-
|
117
|
+
PostgreSQLColumn.class_eval do
|
118
118
|
# Does the type casting from hstore columns using String#from_hstore or Hash#from_hstore.
|
119
119
|
def type_cast_code_with_hstore(var_name)
|
120
120
|
type == :hstore ? "#{var_name}.from_hstore" : type_cast_code_without_hstore(var_name)
|
@@ -128,7 +128,7 @@ module ActiveRecord
|
|
128
128
|
alias_method_chain :simplified_type, :hstore
|
129
129
|
end
|
130
130
|
|
131
|
-
|
131
|
+
PostgreSQLAdapter.class_eval do
|
132
132
|
|
133
133
|
def native_database_types_with_hstore
|
134
134
|
native_database_types_without_hstore.merge({:hstore => { :name => "hstore" }})
|
@@ -24,7 +24,7 @@ class String
|
|
24
24
|
[k,v].map { |t|
|
25
25
|
case t
|
26
26
|
when nil then t
|
27
|
-
when
|
27
|
+
when /\A"(.*)"\Z/m then $1.gsub(/\\(.)/, '\1')
|
28
28
|
else t.gsub(/\\(.)/, '\1')
|
29
29
|
end
|
30
30
|
}
|
@@ -40,4 +40,4 @@ class String
|
|
40
40
|
string = /(#{quoted_string}|#{unquoted_string})/
|
41
41
|
/#{string}\s*=>\s*#{string}/
|
42
42
|
end
|
43
|
-
end
|
43
|
+
end
|
File without changes
|
@@ -93,4 +93,11 @@ describe "Datatypes Changes for Hstore" do
|
|
93
93
|
''.from_hstore.should eq({})
|
94
94
|
' '.from_hstore.should eq({})
|
95
95
|
end
|
96
|
-
|
96
|
+
|
97
|
+
it "should not change values with line breaks" do
|
98
|
+
input = { "a" => "foo\n\nbar" }
|
99
|
+
output = input.to_hstore
|
100
|
+
output.from_hstore.should eq(input)
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-postgres-hstore-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jt Gleason
|
@@ -64,7 +64,7 @@ dependencies:
|
|
64
64
|
type: :development
|
65
65
|
version_requirements: *id003
|
66
66
|
- !ruby/object:Gem::Dependency
|
67
|
-
name:
|
67
|
+
name: guard
|
68
68
|
prerelease: false
|
69
69
|
requirement: &id004 !ruby/object:Gem::Requirement
|
70
70
|
none: false
|
@@ -78,7 +78,7 @@ dependencies:
|
|
78
78
|
type: :development
|
79
79
|
version_requirements: *id004
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
|
-
name: guard
|
81
|
+
name: guard-rspec
|
82
82
|
prerelease: false
|
83
83
|
requirement: &id005 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
@@ -91,20 +91,6 @@ dependencies:
|
|
91
91
|
version: "0"
|
92
92
|
type: :development
|
93
93
|
version_requirements: *id005
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: guard-rspec
|
96
|
-
prerelease: false
|
97
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
|
-
requirements:
|
100
|
-
- - ">="
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
hash: 3
|
103
|
-
segments:
|
104
|
-
- 0
|
105
|
-
version: "0"
|
106
|
-
type: :development
|
107
|
-
version_requirements: *id006
|
108
94
|
description: Allows you to use active record with databases that already have an hstore type
|
109
95
|
email: jt@twitch.tv
|
110
96
|
executables: []
|
@@ -126,13 +112,13 @@ files:
|
|
126
112
|
- lib/activerecord_postgres_hstore_core/hash.rb
|
127
113
|
- lib/activerecord_postgres_hstore_core/string.rb
|
128
114
|
- rails/init.rb
|
129
|
-
- spec/activerecord_postgres_hstore_core/
|
115
|
+
- spec/activerecord_postgres_hstore_core/activerecord_postgres_hstore_database_spec.rb
|
130
116
|
- spec/activerecord_postgres_hstore_core/activerecord_postgres_hstore_datatype_spec.rb
|
131
117
|
- spec/database.yml.sample
|
132
118
|
- spec/models.rb
|
133
119
|
- spec/schema.rb
|
134
120
|
- spec/spec_helper.rb
|
135
|
-
homepage:
|
121
|
+
homepage: https://github.com/jtvjt/activerecord-postgres-hstore-core
|
136
122
|
licenses: []
|
137
123
|
|
138
124
|
post_install_message:
|
@@ -161,12 +147,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
147
|
requirements: []
|
162
148
|
|
163
149
|
rubyforge_project:
|
164
|
-
rubygems_version: 1.8.
|
150
|
+
rubygems_version: 1.8.17
|
165
151
|
signing_key:
|
166
152
|
specification_version: 3
|
167
153
|
summary: Hstore AR for Hstore DB
|
168
154
|
test_files:
|
169
|
-
- spec/activerecord_postgres_hstore_core/
|
155
|
+
- spec/activerecord_postgres_hstore_core/activerecord_postgres_hstore_database_spec.rb
|
170
156
|
- spec/activerecord_postgres_hstore_core/activerecord_postgres_hstore_datatype_spec.rb
|
171
157
|
- spec/database.yml.sample
|
172
158
|
- spec/models.rb
|