activerecord-postgres-hstore-core 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  *.log
2
+ *.gem
2
3
  *.sqlite3
3
4
  /pkg/*
4
5
  .bundle
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
@@ -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
 
@@ -1,5 +1,4 @@
1
1
  require 'rails'
2
- require 'pg'
3
2
  require "active_record"
4
3
 
5
4
  require "activerecord_postgres_hstore_core/string"
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordPostgresHstore
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -114,7 +114,7 @@ module ActiveRecord
114
114
 
115
115
  end
116
116
 
117
- class PostgreSQLColumn < Column
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
- class PostgreSQLAdapter < AbstractAdapter
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 /^"(.*)"$/ then $1.gsub(/\\(.)/, '\1')
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
@@ -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
- end
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: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
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: pg
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/activerecord_posgres_hstore_database_spec.rb
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.6
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/activerecord_posgres_hstore_database_spec.rb
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