mongoid_snappy 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.ruby-version +1 -1
- data/.travis.yml +4 -2
- data/README.md +2 -0
- data/gemfiles/mongoid-3.1.gemfile +4 -3
- data/gemfiles/mongoid-4.0.gemfile +3 -3
- data/lib/mongoid_snappy.rb +1 -44
- data/lib/mongoid_snappy/rails_admin.rb +51 -0
- data/lib/mongoid_snappy/version.rb +2 -1
- data/mongoid_snappy.gemspec +9 -8
- data/spec/support/mongoid.yml +0 -2
- metadata +44 -44
- data/gemfiles/mongoid-3.0.gemfile +0 -5
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MjExMGEwYmRlOWQ3MzQ1ODEyNzE1OTk4ZGUzMWYzZTQzY2RiZWZiNjE5NDQ3
|
10
|
-
MWQxMjQ3NTAzNzg3NTllODdiMjY5MWFmNmE1ZTZlOGZmNjA2ZTNmZDYyYjBm
|
11
|
-
YjU3NjQ4NGVlNGU1YWI0ZWE0MjhhNDQ1NTgzMjY1ZjM5NmY3ZmQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NmQzZWUwY2M1M2JlOTJlM2I2ZmQ3NWM3OTExMTc4YTUwZGZmMGRlZDA5ZjI0
|
14
|
-
OGY5ZmE2ODFkM2ExY2NjMTg1Y2U5YWExYzY2YTkzZGUxZGRmMjc4OTVmZWU3
|
15
|
-
MDZlMDA1MDZmZmVkMTVhMGQyYzA5MGFjOGY5YzlmNjgzMmEyNmU=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 35002b66a23a55abdc49b9e75dd665d276acd600
|
4
|
+
data.tar.gz: 0c80f280f7c73457f9845d2c5d18a09ab5edc4c3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7b28fb05a3ee3b906e8b5eed8de5b39e171128a73bd0da14885c0545ac294588c4b96c94d41999c0072c58e36178bb30568189b05d7aa26a98afa2fb37ab9479
|
7
|
+
data.tar.gz: 0082b0a343e328c92832865bc3be500874fb818b22725c0525368fa0be65af1dc1f941d8ed27f9ca8087710ef416e4fa3b5c30124134fca3ba6d4616881861d3
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.1.1
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
data/lib/mongoid_snappy.rb
CHANGED
@@ -87,48 +87,5 @@ module Mongoid
|
|
87
87
|
end
|
88
88
|
|
89
89
|
if Object.const_defined?("RailsAdmin")
|
90
|
-
require
|
91
|
-
require 'rails_admin/config/fields/types/text'
|
92
|
-
module RailsAdmin
|
93
|
-
module Adapters
|
94
|
-
module Mongoid
|
95
|
-
alias_method :type_lookup_without_mongoid_snappy, :type_lookup
|
96
|
-
def type_lookup(name, field)
|
97
|
-
if field.type.to_s == 'Mongoid::Snappy'
|
98
|
-
{ :type => :mongoid_snappy }
|
99
|
-
else
|
100
|
-
type_lookup_without_mongoid_snappy(name, field)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
module Config
|
107
|
-
module Fields
|
108
|
-
module Types
|
109
|
-
class MongoidSnappy < RailsAdmin::Config::Fields::Types::Text
|
110
|
-
# Register field type for the type loader
|
111
|
-
RailsAdmin::Config::Fields::Types::register(self)
|
112
|
-
|
113
|
-
register_instance_option :pretty_value do
|
114
|
-
if value.respond_to?(:data)
|
115
|
-
::Snappy.inflate(value.data).force_encoding('UTF-8')
|
116
|
-
else
|
117
|
-
value
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
register_instance_option :formatted_value do
|
122
|
-
if value.respond_to?(:data)
|
123
|
-
::Snappy.inflate(value.data).force_encoding('UTF-8')
|
124
|
-
else
|
125
|
-
value
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
90
|
+
require "mongoid_snappy/rails_admin"
|
134
91
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'rails_admin/adapters/mongoid'
|
2
|
+
begin
|
3
|
+
require 'rails_admin/adapters/mongoid/property'
|
4
|
+
rescue Exception => e
|
5
|
+
end
|
6
|
+
|
7
|
+
module RailsAdmin
|
8
|
+
module Adapters
|
9
|
+
module Mongoid
|
10
|
+
class Property
|
11
|
+
alias_method :type_without_mongoid_snappy, :type
|
12
|
+
def type(name, field)
|
13
|
+
if field.type.to_s == 'Mongoid::Snappy'
|
14
|
+
{ :type => :mongoid_snappy }
|
15
|
+
else
|
16
|
+
type_without_mongoid_snappy(name, field)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module RailsAdmin
|
25
|
+
module Config
|
26
|
+
module Fields
|
27
|
+
module Types
|
28
|
+
class MongoidSnappy < RailsAdmin::Config::Fields::Types::Text
|
29
|
+
# Register field type for the type loader
|
30
|
+
RailsAdmin::Config::Fields::Types::register(self)
|
31
|
+
|
32
|
+
register_instance_option :pretty_value do
|
33
|
+
if value.respond_to?(:data)
|
34
|
+
::Snappy.inflate(value.data).force_encoding('UTF-8')
|
35
|
+
else
|
36
|
+
value
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
register_instance_option :formatted_value do
|
41
|
+
if value.respond_to?(:data)
|
42
|
+
::Snappy.inflate(value.data).force_encoding('UTF-8')
|
43
|
+
else
|
44
|
+
value
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
data/mongoid_snappy.gemspec
CHANGED
@@ -18,15 +18,16 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_runtime_dependency 'snappy', '~> 0.0.
|
21
|
+
spec.add_runtime_dependency 'snappy', '~> 0.0.10'
|
22
22
|
spec.add_runtime_dependency 'mongoid', '>= 3.0'
|
23
23
|
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
24
|
+
spec.add_development_dependency 'bundler'
|
25
|
+
spec.add_development_dependency 'rake'
|
26
26
|
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
29
|
-
spec.add_development_dependency
|
30
|
-
spec.add_development_dependency
|
31
|
-
spec.add_development_dependency
|
27
|
+
spec.add_development_dependency 'rspec'
|
28
|
+
spec.add_development_dependency 'simplecov'
|
29
|
+
spec.add_development_dependency 'database_cleaner'
|
30
|
+
spec.add_development_dependency 'glebtv-mongoid-rspec'
|
31
|
+
spec.add_development_dependency 'faker'
|
32
32
|
end
|
33
|
+
|
data/spec/support/mongoid.yml
CHANGED
metadata
CHANGED
@@ -1,141 +1,141 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_snappy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GlebTV
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: snappy
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.0.
|
19
|
+
version: 0.0.10
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.0.
|
26
|
+
version: 0.0.10
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mongoid
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: simplecov
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0
|
89
|
+
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: database_cleaner
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0
|
103
|
+
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0
|
110
|
+
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name: mongoid-rspec
|
112
|
+
name: glebtv-mongoid-rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: faker
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: '0'
|
139
139
|
description: Mongoid Snappy
|
140
140
|
email:
|
141
141
|
- glebtv@gmail.com
|
@@ -143,19 +143,19 @@ executables: []
|
|
143
143
|
extensions: []
|
144
144
|
extra_rdoc_files: []
|
145
145
|
files:
|
146
|
-
- .gitignore
|
147
|
-
- .rspec
|
148
|
-
- .ruby-gemset
|
149
|
-
- .ruby-version
|
150
|
-
- .travis.yml
|
146
|
+
- ".gitignore"
|
147
|
+
- ".rspec"
|
148
|
+
- ".ruby-gemset"
|
149
|
+
- ".ruby-version"
|
150
|
+
- ".travis.yml"
|
151
151
|
- Gemfile
|
152
152
|
- LICENSE.txt
|
153
153
|
- README.md
|
154
154
|
- Rakefile
|
155
|
-
- gemfiles/mongoid-3.0.gemfile
|
156
155
|
- gemfiles/mongoid-3.1.gemfile
|
157
156
|
- gemfiles/mongoid-4.0.gemfile
|
158
157
|
- lib/mongoid_snappy.rb
|
158
|
+
- lib/mongoid_snappy/rails_admin.rb
|
159
159
|
- lib/mongoid_snappy/version.rb
|
160
160
|
- mongoid_snappy.gemspec
|
161
161
|
- spec/mongoid_snappy_spec.rb
|
@@ -172,17 +172,17 @@ require_paths:
|
|
172
172
|
- lib
|
173
173
|
required_ruby_version: !ruby/object:Gem::Requirement
|
174
174
|
requirements:
|
175
|
-
- -
|
175
|
+
- - ">="
|
176
176
|
- !ruby/object:Gem::Version
|
177
177
|
version: '0'
|
178
178
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
179
|
requirements:
|
180
|
-
- -
|
180
|
+
- - ">="
|
181
181
|
- !ruby/object:Gem::Version
|
182
182
|
version: '0'
|
183
183
|
requirements: []
|
184
184
|
rubyforge_project:
|
185
|
-
rubygems_version: 2.
|
185
|
+
rubygems_version: 2.2.2
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: Allow string attributes in Mongoid to be compressed with Snappy
|