sbf-dm-validations 1.3.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +38 -0
- data/.rspec +1 -0
- data/.rubocop.yml +468 -0
- data/.travis.yml +51 -0
- data/Gemfile +60 -0
- data/LICENSE +21 -0
- data/README.rdoc +122 -0
- data/Rakefile +4 -0
- data/dm-validations.gemspec +20 -0
- data/lib/data_mapper/core.rb +1 -0
- data/lib/data_mapper/support/assertions.rb +1 -0
- data/lib/data_mapper/support/equalizer.rb +1 -0
- data/lib/data_mapper/support/ordered_set.rb +2 -0
- data/lib/data_mapper/validation/backward.rb +205 -0
- data/lib/data_mapper/validation/context.rb +57 -0
- data/lib/data_mapper/validation/contextual_rule_set.rb +210 -0
- data/lib/data_mapper/validation/exceptions.rb +7 -0
- data/lib/data_mapper/validation/inferred.rb +264 -0
- data/lib/data_mapper/validation/macros.rb +449 -0
- data/lib/data_mapper/validation/message_transformer.rb +111 -0
- data/lib/data_mapper/validation/model_extensions.rb +17 -0
- data/lib/data_mapper/validation/resource_extensions.rb +131 -0
- data/lib/data_mapper/validation/rule/absence.rb +31 -0
- data/lib/data_mapper/validation/rule/acceptance.rb +49 -0
- data/lib/data_mapper/validation/rule/block.rb +37 -0
- data/lib/data_mapper/validation/rule/confirmation.rb +47 -0
- data/lib/data_mapper/validation/rule/format/proc.rb +34 -0
- data/lib/data_mapper/validation/rule/format/regexp.rb +51 -0
- data/lib/data_mapper/validation/rule/format.rb +86 -0
- data/lib/data_mapper/validation/rule/formats/email.rb +54 -0
- data/lib/data_mapper/validation/rule/formats/url.rb +13 -0
- data/lib/data_mapper/validation/rule/length/equal.rb +48 -0
- data/lib/data_mapper/validation/rule/length/maximum.rb +50 -0
- data/lib/data_mapper/validation/rule/length/minimum.rb +50 -0
- data/lib/data_mapper/validation/rule/length/range.rb +50 -0
- data/lib/data_mapper/validation/rule/length.rb +96 -0
- data/lib/data_mapper/validation/rule/method.rb +42 -0
- data/lib/data_mapper/validation/rule/numericalness/equal.rb +34 -0
- data/lib/data_mapper/validation/rule/numericalness/greater_than.rb +34 -0
- data/lib/data_mapper/validation/rule/numericalness/greater_than_or_equal.rb +34 -0
- data/lib/data_mapper/validation/rule/numericalness/integer.rb +41 -0
- data/lib/data_mapper/validation/rule/numericalness/less_than.rb +34 -0
- data/lib/data_mapper/validation/rule/numericalness/less_than_or_equal.rb +34 -0
- data/lib/data_mapper/validation/rule/numericalness/not_equal.rb +34 -0
- data/lib/data_mapper/validation/rule/numericalness/numeric.rb +68 -0
- data/lib/data_mapper/validation/rule/numericalness.rb +91 -0
- data/lib/data_mapper/validation/rule/presence.rb +52 -0
- data/lib/data_mapper/validation/rule/primitive_type.rb +32 -0
- data/lib/data_mapper/validation/rule/uniqueness.rb +64 -0
- data/lib/data_mapper/validation/rule/within/range/bounded.rb +29 -0
- data/lib/data_mapper/validation/rule/within/range/unbounded_begin.rb +29 -0
- data/lib/data_mapper/validation/rule/within/range/unbounded_end.rb +29 -0
- data/lib/data_mapper/validation/rule/within/range.rb +55 -0
- data/lib/data_mapper/validation/rule/within/set.rb +45 -0
- data/lib/data_mapper/validation/rule/within.rb +32 -0
- data/lib/data_mapper/validation/rule.rb +232 -0
- data/lib/data_mapper/validation/rule_set.rb +157 -0
- data/lib/data_mapper/validation/support/object.rb +19 -0
- data/lib/data_mapper/validation/support/ordered_hash.rb +434 -0
- data/lib/data_mapper/validation/version.rb +5 -0
- data/lib/data_mapper/validation/violation.rb +136 -0
- data/lib/data_mapper/validation/violation_set.rb +115 -0
- data/lib/data_mapper/validation.rb +105 -0
- data/lib/dm-validations.rb +24 -0
- data/spec/data_mapper/validation/resource_extensions/save_spec.rb +56 -0
- data/spec/data_mapper/validation/resource_extensions/validate_spec.rb +103 -0
- data/spec/fixtures/barcode.rb +40 -0
- data/spec/fixtures/basketball_court.rb +58 -0
- data/spec/fixtures/basketball_player.rb +34 -0
- data/spec/fixtures/beta_tester_account.rb +33 -0
- data/spec/fixtures/bill_of_landing.rb +47 -0
- data/spec/fixtures/boat_dock.rb +26 -0
- data/spec/fixtures/city.rb +24 -0
- data/spec/fixtures/company.rb +93 -0
- data/spec/fixtures/corporate_world.rb +39 -0
- data/spec/fixtures/country.rb +24 -0
- data/spec/fixtures/ethernet_frame.rb +56 -0
- data/spec/fixtures/event.rb +44 -0
- data/spec/fixtures/g3_concert.rb +57 -0
- data/spec/fixtures/integer_dumped_as_string_property.rb +24 -0
- data/spec/fixtures/jabberwock.rb +27 -0
- data/spec/fixtures/kayak.rb +28 -0
- data/spec/fixtures/lernean_hydra.rb +39 -0
- data/spec/fixtures/llama_spaceship.rb +15 -0
- data/spec/fixtures/mathematical_function.rb +34 -0
- data/spec/fixtures/memory_object.rb +35 -0
- data/spec/fixtures/mittelschnauzer.rb +39 -0
- data/spec/fixtures/motor_launch.rb +21 -0
- data/spec/fixtures/multibyte.rb +16 -0
- data/spec/fixtures/page.rb +32 -0
- data/spec/fixtures/phone_number.rb +28 -0
- data/spec/fixtures/pirogue.rb +28 -0
- data/spec/fixtures/programming_language.rb +83 -0
- data/spec/fixtures/reservation.rb +38 -0
- data/spec/fixtures/scm_operation.rb +56 -0
- data/spec/fixtures/sms_message.rb +22 -0
- data/spec/fixtures/udp_packet.rb +49 -0
- data/spec/integration/absent_field_validator/absent_field_validator_spec.rb +90 -0
- data/spec/integration/absent_field_validator/spec_helper.rb +7 -0
- data/spec/integration/acceptance_validator/acceptance_validator_spec.rb +196 -0
- data/spec/integration/acceptance_validator/spec_helper.rb +7 -0
- data/spec/integration/automatic_validation/custom_messages_for_inferred_validation_spec.rb +57 -0
- data/spec/integration/automatic_validation/disabling_inferred_validation_spec.rb +49 -0
- data/spec/integration/automatic_validation/inferred_boolean_properties_validation_spec.rb +100 -0
- data/spec/integration/automatic_validation/inferred_float_property_validation_spec.rb +45 -0
- data/spec/integration/automatic_validation/inferred_format_validation_spec.rb +35 -0
- data/spec/integration/automatic_validation/inferred_integer_properties_validation_spec.rb +70 -0
- data/spec/integration/automatic_validation/inferred_length_validation_spec.rb +142 -0
- data/spec/integration/automatic_validation/inferred_presence_validation_spec.rb +45 -0
- data/spec/integration/automatic_validation/inferred_primitive_validation_spec.rb +22 -0
- data/spec/integration/automatic_validation/inferred_uniqueness_validation_spec.rb +48 -0
- data/spec/integration/automatic_validation/inferred_within_validation_spec.rb +35 -0
- data/spec/integration/automatic_validation/spec_helper.rb +57 -0
- data/spec/integration/block_validator/spec_helper.rb +5 -0
- data/spec/integration/conditional_validation/if_condition_spec.rb +63 -0
- data/spec/integration/conditional_validation/spec_helper.rb +5 -0
- data/spec/integration/confirmation_validator/confirmation_validator_spec.rb +76 -0
- data/spec/integration/confirmation_validator/spec_helper.rb +5 -0
- data/spec/integration/datamapper_models/association_validation_spec.rb +29 -0
- data/spec/integration/datamapper_models/inheritance_spec.rb +82 -0
- data/spec/integration/dirty_attributes/dirty_attributes_spec.rb +13 -0
- data/spec/integration/duplicated_validations/duplicated_validations_spec.rb +24 -0
- data/spec/integration/duplicated_validations/spec_helper.rb +5 -0
- data/spec/integration/format_validator/email_format_validator_spec.rb +139 -0
- data/spec/integration/format_validator/format_validator_spec.rb +64 -0
- data/spec/integration/format_validator/regexp_validator_spec.rb +33 -0
- data/spec/integration/format_validator/spec_helper.rb +5 -0
- data/spec/integration/format_validator/url_format_validator_spec.rb +91 -0
- data/spec/integration/length_validator/default_value_spec.rb +14 -0
- data/spec/integration/length_validator/equality_spec.rb +83 -0
- data/spec/integration/length_validator/error_message_spec.rb +22 -0
- data/spec/integration/length_validator/maximum_spec.rb +47 -0
- data/spec/integration/length_validator/minimum_spec.rb +54 -0
- data/spec/integration/length_validator/range_spec.rb +87 -0
- data/spec/integration/length_validator/spec_helper.rb +7 -0
- data/spec/integration/method_validator/method_validator_spec.rb +243 -0
- data/spec/integration/method_validator/spec_helper.rb +5 -0
- data/spec/integration/numeric_validator/equality_with_float_type_spec.rb +65 -0
- data/spec/integration/numeric_validator/equality_with_integer_type_spec.rb +41 -0
- data/spec/integration/numeric_validator/float_type_spec.rb +90 -0
- data/spec/integration/numeric_validator/gt_with_float_type_spec.rb +37 -0
- data/spec/integration/numeric_validator/gte_with_float_type_spec.rb +36 -0
- data/spec/integration/numeric_validator/integer_only_true_spec.rb +91 -0
- data/spec/integration/numeric_validator/integer_type_spec.rb +86 -0
- data/spec/integration/numeric_validator/lt_with_float_type_spec.rb +37 -0
- data/spec/integration/numeric_validator/lte_with_float_type_spec.rb +37 -0
- data/spec/integration/numeric_validator/spec_helper.rb +5 -0
- data/spec/integration/primitive_validator/primitive_validator_spec.rb +112 -0
- data/spec/integration/primitive_validator/spec_helper.rb +5 -0
- data/spec/integration/pure_ruby_objects/plain_old_ruby_object_validation_spec.rb +118 -0
- data/spec/integration/required_field_validator/association_spec.rb +69 -0
- data/spec/integration/required_field_validator/boolean_type_value_spec.rb +164 -0
- data/spec/integration/required_field_validator/date_type_value_spec.rb +127 -0
- data/spec/integration/required_field_validator/datetime_type_value_spec.rb +127 -0
- data/spec/integration/required_field_validator/float_type_value_spec.rb +131 -0
- data/spec/integration/required_field_validator/integer_type_value_spec.rb +99 -0
- data/spec/integration/required_field_validator/plain_old_ruby_object_spec.rb +35 -0
- data/spec/integration/required_field_validator/shared_examples.rb +27 -0
- data/spec/integration/required_field_validator/spec_helper.rb +7 -0
- data/spec/integration/required_field_validator/string_type_value_spec.rb +167 -0
- data/spec/integration/required_field_validator/text_type_value_spec.rb +49 -0
- data/spec/integration/shared/default_validation_context.rb +13 -0
- data/spec/integration/shared/valid_and_invalid_model.rb +35 -0
- data/spec/integration/uniqueness_validator/spec_helper.rb +5 -0
- data/spec/integration/uniqueness_validator/uniqueness_validator_spec.rb +116 -0
- data/spec/integration/within_validator/spec_helper.rb +5 -0
- data/spec/integration/within_validator/within_validator_spec.rb +168 -0
- data/spec/public/resource_spec.rb +113 -0
- data/spec/spec_helper.rb +28 -0
- data/spec/unit/contextual_validators/emptiness_spec.rb +50 -0
- data/spec/unit/contextual_validators/execution_spec.rb +48 -0
- data/spec/unit/contextual_validators/spec_helper.rb +37 -0
- data/spec/unit/generic_validator/equality_operator_spec.rb +26 -0
- data/spec/unit/generic_validator/optional_spec.rb +54 -0
- data/spec/unit/validators/within_validator_spec.rb +23 -0
- data/spec/unit/violation_set/adding_spec.rb +54 -0
- data/spec/unit/violation_set/emptiness_spec.rb +38 -0
- data/spec/unit/violation_set/enumerable_spec.rb +32 -0
- data/spec/unit/violation_set/reading_spec.rb +35 -0
- data/spec/unit/violation_set/respond_to_spec.rb +15 -0
- data/tasks/spec.rake +21 -0
- data/tasks/yard.rake +9 -0
- data/tasks/yardstick.rake +19 -0
- metadata +245 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2fd26483f7775584b88fcfe525bdf0e7b4996f8abeb463b82fe789bd81ba8afc
|
4
|
+
data.tar.gz: c723429e08a5b33cc4462da7144a25cad5c9b96493f76a0af9f971552038d66a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d82d14eae7408bfa860153b84862b401e496feb7a666d6eb15c4c2505e410f715ac327dc37b63e31016be5d795a8131d4a3d8a46ca81a3c14107144f0709af3a
|
7
|
+
data.tar.gz: daeaee6c17ac1352c8eb2ecf2f7d1bdab6017dee6cf229edf73294624fc3f01138bc8db59c1c661901531bfeb971116b4d7c8fa11b3309af1492c6e3e267ad40
|
data/.gitignore
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
## MAC OS
|
2
|
+
.DS_Store
|
3
|
+
|
4
|
+
## TEXTMATE
|
5
|
+
*.tmproj
|
6
|
+
tmtags
|
7
|
+
|
8
|
+
## EMACS
|
9
|
+
*~
|
10
|
+
\#*
|
11
|
+
.\#*
|
12
|
+
|
13
|
+
## VIM
|
14
|
+
*.swp
|
15
|
+
|
16
|
+
## Rubinius
|
17
|
+
*.rbc
|
18
|
+
|
19
|
+
## RubyMine
|
20
|
+
.idea
|
21
|
+
|
22
|
+
## PROJECT::GENERAL
|
23
|
+
*.gem
|
24
|
+
coverage
|
25
|
+
rdoc
|
26
|
+
pkg
|
27
|
+
tmp
|
28
|
+
doc
|
29
|
+
log
|
30
|
+
.yardoc
|
31
|
+
measurements
|
32
|
+
|
33
|
+
## BUNDLER
|
34
|
+
.bundle
|
35
|
+
Gemfile.*
|
36
|
+
|
37
|
+
## PROJECT::SPECIFIC
|
38
|
+
spec/db/
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--order rand
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,468 @@
|
|
1
|
+
#require: rubocop-performance
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.7
|
5
|
+
|
6
|
+
Gemspec/DeprecatedAttributeAssignment:
|
7
|
+
Enabled: true
|
8
|
+
|
9
|
+
Gemspec/DevelopmentDependencies: # new in 1.44
|
10
|
+
Enabled: true
|
11
|
+
|
12
|
+
Gemspec/RequireMFA:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Layout/LineContinuationLeadingSpace: # new in 1.31
|
16
|
+
Enabled: true
|
17
|
+
|
18
|
+
Layout/LineContinuationSpacing: # new in 1.31
|
19
|
+
Enabled: true
|
20
|
+
|
21
|
+
Layout/LineEndStringConcatenationIndentation:
|
22
|
+
Enabled: true
|
23
|
+
|
24
|
+
Layout/LineLength:
|
25
|
+
Max: 150
|
26
|
+
|
27
|
+
Layout/MultilineOperationIndentation:
|
28
|
+
EnforcedStyle: aligned
|
29
|
+
|
30
|
+
Layout/SpaceAfterSemicolon:
|
31
|
+
Enabled: true
|
32
|
+
|
33
|
+
Layout/SpaceBeforeBrackets: # new in 1.7
|
34
|
+
Enabled: true
|
35
|
+
|
36
|
+
Layout/SpaceInsideHashLiteralBraces:
|
37
|
+
EnforcedStyle: no_space
|
38
|
+
|
39
|
+
Lint/AmbiguousAssignment: # new in 1.7
|
40
|
+
Enabled: true
|
41
|
+
|
42
|
+
Lint/AmbiguousBlockAssociation:
|
43
|
+
Enabled: true
|
44
|
+
Exclude:
|
45
|
+
- 'spec/**/*'
|
46
|
+
|
47
|
+
Lint/AmbiguousOperatorPrecedence: # new in 1.21
|
48
|
+
Enabled: true
|
49
|
+
|
50
|
+
Lint/AmbiguousRange: # new in 1.19
|
51
|
+
Enabled: true
|
52
|
+
|
53
|
+
Lint/ConstantDefinitionInBlock:
|
54
|
+
Enabled: true
|
55
|
+
|
56
|
+
Lint/ConstantOverwrittenInRescue: # new in 1.31
|
57
|
+
Enabled: true
|
58
|
+
|
59
|
+
Lint/DeprecatedConstants: # new in 1.8
|
60
|
+
Enabled: true
|
61
|
+
|
62
|
+
Lint/DuplicateBranch: # new in 1.3
|
63
|
+
Enabled: true
|
64
|
+
|
65
|
+
Lint/DuplicateMagicComment: # new in 1.37
|
66
|
+
Enabled: true
|
67
|
+
|
68
|
+
Lint/DuplicateMatchPattern: # new in 1.50
|
69
|
+
Enabled: true
|
70
|
+
|
71
|
+
Lint/DuplicateMethods:
|
72
|
+
Enabled: false
|
73
|
+
|
74
|
+
Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
|
75
|
+
Enabled: true
|
76
|
+
|
77
|
+
Lint/EmptyBlock:
|
78
|
+
Enabled: true
|
79
|
+
|
80
|
+
Lint/EmptyClass: # new in 1.3
|
81
|
+
Enabled: true
|
82
|
+
|
83
|
+
Lint/EmptyFile:
|
84
|
+
Enabled: true
|
85
|
+
|
86
|
+
Lint/EmptyInPattern: # new in 1.16
|
87
|
+
Enabled: true
|
88
|
+
|
89
|
+
Lint/FloatComparison:
|
90
|
+
Enabled: true
|
91
|
+
|
92
|
+
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
|
93
|
+
Enabled: true
|
94
|
+
|
95
|
+
Lint/ItWithoutArgumentsInBlock: # new in 1.59
|
96
|
+
Enabled: true
|
97
|
+
|
98
|
+
Lint/LambdaWithoutLiteralBlock: # new in 1.8
|
99
|
+
Enabled: true
|
100
|
+
|
101
|
+
Lint/LiteralAssignmentInCondition: # new in 1.58
|
102
|
+
Enabled: true
|
103
|
+
|
104
|
+
Lint/MissingSuper:
|
105
|
+
Enabled: true
|
106
|
+
|
107
|
+
Lint/MixedCaseRange: # new in 1.53
|
108
|
+
Enabled: true
|
109
|
+
|
110
|
+
Lint/NoReturnInBeginEndBlocks: # new in 1.2
|
111
|
+
Enabled: true
|
112
|
+
|
113
|
+
Lint/NonAtomicFileOperation: # new in 1.31
|
114
|
+
Enabled: true
|
115
|
+
|
116
|
+
Lint/NumberedParameterAssignment: # new in 1.9
|
117
|
+
Enabled: true
|
118
|
+
|
119
|
+
Lint/OrAssignmentToConstant: # new in 1.9
|
120
|
+
Enabled: true
|
121
|
+
|
122
|
+
Lint/RaiseException:
|
123
|
+
Enabled: false
|
124
|
+
|
125
|
+
Lint/RedundantDirGlobSort: # new in 1.8
|
126
|
+
Enabled: true
|
127
|
+
|
128
|
+
Lint/RedundantRegexpQuantifiers: # new in 1.53
|
129
|
+
Enabled: true
|
130
|
+
|
131
|
+
Lint/RefinementImportMethods: # new in 1.27
|
132
|
+
Enabled: true
|
133
|
+
|
134
|
+
Lint/RequireRangeParentheses: # new in 1.32
|
135
|
+
Enabled: true
|
136
|
+
|
137
|
+
Lint/RequireRelativeSelfPath: # new in 1.22
|
138
|
+
Enabled: true
|
139
|
+
|
140
|
+
Lint/SafeNavigationChain:
|
141
|
+
Enabled: true
|
142
|
+
AllowedMethods:
|
143
|
+
- present?
|
144
|
+
- blank?
|
145
|
+
- presence
|
146
|
+
- try
|
147
|
+
- try!
|
148
|
+
- empty?
|
149
|
+
- nil?
|
150
|
+
- blank?
|
151
|
+
|
152
|
+
Lint/SymbolConversion:
|
153
|
+
Enabled: false
|
154
|
+
|
155
|
+
Lint/ToEnumArguments: # new in 1.1
|
156
|
+
Enabled: true
|
157
|
+
|
158
|
+
Lint/TripleQuotes: # new in 1.9
|
159
|
+
Enabled: true
|
160
|
+
|
161
|
+
Lint/UnexpectedBlockArity: # new in 1.5
|
162
|
+
Enabled: true
|
163
|
+
|
164
|
+
Lint/UnmodifiedReduceAccumulator: # new in 1.1
|
165
|
+
Enabled: true
|
166
|
+
|
167
|
+
Lint/UnreachableLoop:
|
168
|
+
Enabled: true
|
169
|
+
|
170
|
+
Lint/UselessRescue: # new in 1.43
|
171
|
+
Enabled: true
|
172
|
+
|
173
|
+
Lint/UselessRuby2Keywords: # new in 1.23
|
174
|
+
Enabled: true
|
175
|
+
|
176
|
+
Metrics/AbcSize:
|
177
|
+
Enabled: false
|
178
|
+
|
179
|
+
Metrics/BlockLength:
|
180
|
+
Enabled: false
|
181
|
+
|
182
|
+
Metrics/BlockNesting:
|
183
|
+
Max: 4
|
184
|
+
|
185
|
+
Metrics/ClassLength:
|
186
|
+
Enabled: false
|
187
|
+
|
188
|
+
Metrics/CollectionLiteralLength: # new in 1.47
|
189
|
+
Enabled: true
|
190
|
+
|
191
|
+
Metrics/CyclomaticComplexity:
|
192
|
+
Max: 15
|
193
|
+
|
194
|
+
Metrics/MethodLength:
|
195
|
+
Max: 30
|
196
|
+
|
197
|
+
Metrics/ModuleLength:
|
198
|
+
Enabled: false
|
199
|
+
|
200
|
+
Metrics/ParameterLists:
|
201
|
+
Max: 5
|
202
|
+
CountKeywordArgs: false
|
203
|
+
|
204
|
+
Metrics/PerceivedComplexity:
|
205
|
+
Max: 20
|
206
|
+
|
207
|
+
Naming/BlockForwarding: # new in 1.24
|
208
|
+
Enabled: true
|
209
|
+
|
210
|
+
Naming/HeredocDelimiterNaming:
|
211
|
+
Enabled: false
|
212
|
+
|
213
|
+
Naming/MethodParameterName:
|
214
|
+
AllowedNames: [a, _, id]
|
215
|
+
|
216
|
+
Naming/VariableNumber:
|
217
|
+
Enabled: true
|
218
|
+
# EnforcedStyle: snake_case
|
219
|
+
|
220
|
+
#Performance/CollectionLiteralInLoop:
|
221
|
+
# Enabled: true
|
222
|
+
#
|
223
|
+
#Performance/RangeInclude:
|
224
|
+
# Enabled: false
|
225
|
+
#
|
226
|
+
#Performance/RedundantEqualityComparisonBlock:
|
227
|
+
# Enabled: true
|
228
|
+
|
229
|
+
Security/CompoundHash: # new in 1.28
|
230
|
+
Enabled: true
|
231
|
+
|
232
|
+
Security/IoMethods: # new in 1.22
|
233
|
+
Enabled: true
|
234
|
+
|
235
|
+
Style/AccessModifierDeclarations:
|
236
|
+
EnforcedStyle: inline
|
237
|
+
|
238
|
+
Style/Alias:
|
239
|
+
Enabled: false
|
240
|
+
EnforcedStyle: prefer_alias_method
|
241
|
+
|
242
|
+
Style/ArgumentsForwarding: # new in 1.1
|
243
|
+
Enabled: true
|
244
|
+
|
245
|
+
Style/ArrayIntersect: # new in 1.40
|
246
|
+
Enabled: true
|
247
|
+
|
248
|
+
Style/CaseLikeIf:
|
249
|
+
Enabled: true
|
250
|
+
|
251
|
+
Style/CollectionCompact: # new in 1.2
|
252
|
+
Enabled: true
|
253
|
+
|
254
|
+
Style/CombinableLoops:
|
255
|
+
Enabled: true
|
256
|
+
|
257
|
+
Style/ComparableClamp: # new in 1.44
|
258
|
+
Enabled: true
|
259
|
+
|
260
|
+
Style/ConcatArrayLiterals: # new in 1.41
|
261
|
+
Enabled: true
|
262
|
+
|
263
|
+
Style/DataInheritance: # new in 1.49
|
264
|
+
Enabled: true
|
265
|
+
|
266
|
+
Style/DirEmpty: # new in 1.48
|
267
|
+
Enabled: true
|
268
|
+
|
269
|
+
Style/Documentation:
|
270
|
+
Enabled: false
|
271
|
+
|
272
|
+
Style/DocumentDynamicEvalDefinition: # new in 1.1
|
273
|
+
Enabled: true
|
274
|
+
|
275
|
+
Style/EmptyHeredoc: # new in 1.32
|
276
|
+
Enabled: true
|
277
|
+
|
278
|
+
Style/EndlessMethod: # new in 1.8
|
279
|
+
Enabled: true
|
280
|
+
|
281
|
+
Style/EnvHome: # new in 1.29
|
282
|
+
Enabled: true
|
283
|
+
|
284
|
+
Style/ExactRegexpMatch: # new in 1.51
|
285
|
+
Enabled: true
|
286
|
+
|
287
|
+
Style/FetchEnvVar:
|
288
|
+
Enabled: true
|
289
|
+
|
290
|
+
Style/FileEmpty: # new in 1.48
|
291
|
+
Enabled: true
|
292
|
+
|
293
|
+
Style/FileRead: # new in 1.24
|
294
|
+
Enabled: true
|
295
|
+
|
296
|
+
Style/FileWrite: # new in 1.24
|
297
|
+
Enabled: true
|
298
|
+
|
299
|
+
Style/FormatStringToken:
|
300
|
+
Enabled: false
|
301
|
+
|
302
|
+
Style/FrozenStringLiteralComment:
|
303
|
+
Enabled: false
|
304
|
+
|
305
|
+
Style/HashConversion: # new in 1.10
|
306
|
+
Enabled: true
|
307
|
+
|
308
|
+
Style/HashExcept: # new in 1.7
|
309
|
+
Enabled: true
|
310
|
+
|
311
|
+
Style/HashLikeCase:
|
312
|
+
Enabled: true
|
313
|
+
|
314
|
+
Style/HashSyntax:
|
315
|
+
Enabled: true
|
316
|
+
EnforcedShorthandSyntax: consistent
|
317
|
+
|
318
|
+
Style/IfWithBooleanLiteralBranches: # new in 1.9
|
319
|
+
Enabled: true
|
320
|
+
|
321
|
+
Style/InPatternThen: # new in 1.16
|
322
|
+
Enabled: true
|
323
|
+
|
324
|
+
Style/MagicCommentFormat: # new in 1.35
|
325
|
+
Enabled: true
|
326
|
+
|
327
|
+
Style/MapCompactWithConditionalBlock: # new in 1.30
|
328
|
+
Enabled: true
|
329
|
+
|
330
|
+
Style/MapToHash: # new in 1.24
|
331
|
+
Enabled: true
|
332
|
+
|
333
|
+
Style/MapToSet: # new in 1.42
|
334
|
+
Enabled: true
|
335
|
+
|
336
|
+
Style/MinMaxComparison: # new in 1.42
|
337
|
+
Enabled: true
|
338
|
+
|
339
|
+
Style/MixinGrouping:
|
340
|
+
Enabled: true
|
341
|
+
EnforcedStyle: grouped
|
342
|
+
|
343
|
+
Style/MultilineInPatternThen: # new in 1.16
|
344
|
+
Enabled: true
|
345
|
+
|
346
|
+
Style/NegatedIfElseCondition: # new in 1.2
|
347
|
+
Enabled: true
|
348
|
+
|
349
|
+
Style/NestedFileDirname: # new in 1.26
|
350
|
+
Enabled: true
|
351
|
+
|
352
|
+
Style/NilLambda: # new in 1.3
|
353
|
+
Enabled: true
|
354
|
+
|
355
|
+
Style/NumberedParameters: # new in 1.22
|
356
|
+
Enabled: true
|
357
|
+
|
358
|
+
Style/NumberedParametersLimit: # new in 1.22
|
359
|
+
Enabled: true
|
360
|
+
|
361
|
+
Style/NumericPredicate:
|
362
|
+
Enabled: false
|
363
|
+
|
364
|
+
Style/ObjectThen: # new in 1.28
|
365
|
+
Enabled: true
|
366
|
+
|
367
|
+
Style/OpenStructUse:
|
368
|
+
Enabled: false
|
369
|
+
|
370
|
+
Style/OperatorMethodCall: # new in 1.37
|
371
|
+
Enabled: true
|
372
|
+
|
373
|
+
Style/OptionalBooleanParameter:
|
374
|
+
Enabled: true
|
375
|
+
|
376
|
+
Style/PercentLiteralDelimiters:
|
377
|
+
PreferredDelimiters:
|
378
|
+
default: ()
|
379
|
+
'%i': '()'
|
380
|
+
'%I': '()'
|
381
|
+
'%r': '{}'
|
382
|
+
'%w': '()'
|
383
|
+
'%W': '()'
|
384
|
+
|
385
|
+
Style/QuotedSymbols: # new in 1.16
|
386
|
+
Enabled: true
|
387
|
+
|
388
|
+
Style/RedundantArgument: # new in 1.4
|
389
|
+
Enabled: true
|
390
|
+
|
391
|
+
Style/RedundantArrayConstructor: # new in 1.52
|
392
|
+
Enabled: true
|
393
|
+
|
394
|
+
Style/RedundantConstantBase: # new in 1.40
|
395
|
+
Enabled: true
|
396
|
+
|
397
|
+
Style/RedundantCurrentDirectoryInPath: # new in 1.53
|
398
|
+
Enabled: true
|
399
|
+
|
400
|
+
Style/RedundantDoubleSplatHashBraces: # new in 1.41
|
401
|
+
Enabled: true
|
402
|
+
|
403
|
+
Style/RedundantEach: # new in 1.38
|
404
|
+
Enabled: true
|
405
|
+
|
406
|
+
Style/RedundantFilterChain: # new in 1.52
|
407
|
+
Enabled: true
|
408
|
+
|
409
|
+
Style/RedundantHeredocDelimiterQuotes: # new in 1.45
|
410
|
+
Enabled: true
|
411
|
+
|
412
|
+
Style/RedundantInitialize: # new in 1.27
|
413
|
+
Enabled: true
|
414
|
+
|
415
|
+
Style/RedundantLineContinuation: # new in 1.49
|
416
|
+
Enabled: true
|
417
|
+
|
418
|
+
Style/RedundantParentheses:
|
419
|
+
Enabled: true
|
420
|
+
|
421
|
+
Style/RedundantRegexpArgument: # new in 1.53
|
422
|
+
Enabled: true
|
423
|
+
|
424
|
+
Style/RedundantRegexpConstructor: # new in 1.52
|
425
|
+
Enabled: true
|
426
|
+
|
427
|
+
Style/RedundantSelfAssignmentBranch: # new in 1.19
|
428
|
+
Enabled: true
|
429
|
+
|
430
|
+
Style/RedundantStringEscape: # new in 1.37
|
431
|
+
Enabled: true
|
432
|
+
|
433
|
+
Style/RegexpLiteral:
|
434
|
+
Enabled: true
|
435
|
+
EnforcedStyle: mixed
|
436
|
+
|
437
|
+
Style/RescueStandardError:
|
438
|
+
EnforcedStyle: implicit
|
439
|
+
|
440
|
+
Style/ReturnNilInPredicateMethodDefinition: # new in 1.53
|
441
|
+
Enabled: true
|
442
|
+
|
443
|
+
Style/SelectByRegexp: # new in 1.22
|
444
|
+
Enabled: true
|
445
|
+
|
446
|
+
Style/SingleArgumentDig:
|
447
|
+
Enabled: true
|
448
|
+
|
449
|
+
Style/SignalException:
|
450
|
+
EnforcedStyle: only_raise
|
451
|
+
|
452
|
+
Style/SingleLineDoEndBlock: # new in 1.57
|
453
|
+
Enabled: true
|
454
|
+
|
455
|
+
Style/StringChars: # new in 1.12
|
456
|
+
Enabled: true
|
457
|
+
|
458
|
+
Style/SuperWithArgsParentheses: # new in 1.58
|
459
|
+
Enabled: true
|
460
|
+
|
461
|
+
Style/SwapValues: # new in 1.1
|
462
|
+
Enabled: true
|
463
|
+
|
464
|
+
Style/TernaryParentheses:
|
465
|
+
EnforcedStyle: require_parentheses_when_complex
|
466
|
+
|
467
|
+
Style/YAMLFileRead: # new in 1.53
|
468
|
+
Enabled: true
|
data/.travis.yml
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
rvm:
|
4
|
+
- 2.0
|
5
|
+
- 2.1
|
6
|
+
- 2.2
|
7
|
+
- ruby-head
|
8
|
+
- jruby-19mode
|
9
|
+
- jruby-head
|
10
|
+
- rbx-19mode
|
11
|
+
|
12
|
+
env:
|
13
|
+
global:
|
14
|
+
- JRUBY_OPTS="$JRUBY_OPTS -J-Xmx1g --debug"
|
15
|
+
matrix:
|
16
|
+
- "ADAPTER=in_memory"
|
17
|
+
- "ADAPTER=yaml"
|
18
|
+
- "ADAPTER=sqlite"
|
19
|
+
- "ADAPTER=mysql DM_DB_USER=root DM_DB_PASSWORD=''"
|
20
|
+
- "ADAPTER=postgres DM_DB_USER=postgres DM_DB_PASSWORD=''"
|
21
|
+
|
22
|
+
cache: bundler
|
23
|
+
|
24
|
+
sudo: true
|
25
|
+
|
26
|
+
services:
|
27
|
+
- mysql
|
28
|
+
- postgresql
|
29
|
+
|
30
|
+
before_install:
|
31
|
+
- travis_retry sudo apt-get update -qq
|
32
|
+
- sudo apt-get install -qq postgresql-server-dev-all
|
33
|
+
|
34
|
+
bundler_args: --without yard guard metrics benchmarks --retry 3
|
35
|
+
|
36
|
+
before_script:
|
37
|
+
- mysql -e "create database datamapper_alternate_tests;"
|
38
|
+
- mysql -e "create database datamapper_default_tests;"
|
39
|
+
- psql -c "create database datamapper_default_tests;" -U postgres
|
40
|
+
- psql -c "create database datamapper_alternate_tests;" -U postgres
|
41
|
+
|
42
|
+
script: "bundle exec rake spec"
|
43
|
+
|
44
|
+
matrix:
|
45
|
+
allow_failures:
|
46
|
+
- rvm: ruby-head
|
47
|
+
- rvm: jruby-19mode
|
48
|
+
- rvm: jruby-head
|
49
|
+
|
50
|
+
notifications:
|
51
|
+
irc: "irc.freenode.org#datamapper"
|
data/Gemfile
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
SOURCE = ENV.fetch('SOURCE', :git).to_sym
|
6
|
+
REPO_POSTFIX = (SOURCE == :path) ? '' : '.git'
|
7
|
+
DATAMAPPER = (SOURCE == :path) ? Pathname(__FILE__).dirname.parent : 'https://github.com/firespring'
|
8
|
+
DM_VERSION = '~> 1.3.0.beta'.freeze
|
9
|
+
DO_VERSION = '~> 0.10.17'.freeze
|
10
|
+
DM_DO_ADAPTERS = %w(sqlite postgres mysql oracle sqlserver).freeze
|
11
|
+
CURRENT_BRANCH = ENV.fetch('GIT_BRANCH', 'master')
|
12
|
+
|
13
|
+
options = {}
|
14
|
+
options[SOURCE] = "#{DATAMAPPER}/dm-core#{REPO_POSTFIX}"
|
15
|
+
options[:branch] = CURRENT_BRANCH unless SOURCE == :path
|
16
|
+
gem 'sbf-dm-core', DM_VERSION, options.dup
|
17
|
+
|
18
|
+
group :datamapper do
|
19
|
+
adapters = ENV['ADAPTER'] || ENV.fetch('ADAPTERS', nil)
|
20
|
+
adapters = adapters.to_s.tr(',', ' ').split.uniq - %w(in_memory)
|
21
|
+
|
22
|
+
if (do_adapters = DM_DO_ADAPTERS & adapters).any?
|
23
|
+
do_options = {}
|
24
|
+
if ENV['DO_GIT'] == 'true'
|
25
|
+
do_options = options.dup
|
26
|
+
do_options[SOURCE] = "#{DATAMAPPER}/datamapper-do#{REPO_POSTFIX}"
|
27
|
+
end
|
28
|
+
gem 'sbf-data_objects', DO_VERSION, do_options.dup
|
29
|
+
|
30
|
+
do_adapters.each do |adapter|
|
31
|
+
adapter = 'sqlite3' if adapter == 'sqlite'
|
32
|
+
|
33
|
+
gem "sbf-do_#{adapter}", DO_VERSION, do_options.dup
|
34
|
+
end
|
35
|
+
|
36
|
+
options[SOURCE] = "#{DATAMAPPER}/dm-do-adapter#{REPO_POSTFIX}"
|
37
|
+
gem 'sbf-dm-do-adapter', DM_VERSION, options.dup
|
38
|
+
end
|
39
|
+
|
40
|
+
adapters.each do |adapter|
|
41
|
+
options[SOURCE] = "#{DATAMAPPER}/dm-#{adapter}-adapter#{REPO_POSTFIX}"
|
42
|
+
gem "sbf-dm-#{adapter}-adapter", DM_VERSION, options.dup
|
43
|
+
end
|
44
|
+
|
45
|
+
plugins = ENV['PLUGINS'] || ENV.fetch('PLUGIN', nil)
|
46
|
+
plugins = plugins.to_s.tr(',', ' ').split.uniq << 'dm-types' << 'dm-migrations'
|
47
|
+
|
48
|
+
plugins.each do |plugin|
|
49
|
+
options[SOURCE] = "#{DATAMAPPER}/#{plugin}#{REPO_POSTFIX}"
|
50
|
+
gem "sbf-#{plugin}", DM_VERSION, options.dup
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
group :development do
|
55
|
+
gem 'pry'
|
56
|
+
gem 'pry-byebug'
|
57
|
+
gem 'rake'
|
58
|
+
gem 'rspec'
|
59
|
+
gem 'simplecov'
|
60
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2007 Guy van den Berg
|
2
|
+
Copyright (c) 2011 DataMapper development team
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|