unidom-common 1.8.1 → 1.9
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.
- checksums.yaml +4 -4
- data/README.md +19 -0
- data/app/controllers/unidom/common/application_controller.rb +3 -0
- data/app/jobs/unidom/common/application_job.rb +3 -0
- data/app/mailers/unidom/common/application_mailer.rb +3 -0
- data/app/models/unidom/common/application_record.rb +3 -0
- data/lib/unidom/common.rb +4 -6
- data/lib/unidom/common/engine_extension.rb +1 -1
- data/lib/unidom/common/neglection.rb +7 -0
- data/lib/unidom/common/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad1d0c055e4f13bc289e6240df3dae2a26709b39
|
4
|
+
data.tar.gz: 2a7990041421f9e424064f6c49196c9b363c7348
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e35ed9517822efd61fa2dcfa76ccb92506c03d379dff91843b2d80f173a3622db60c6110ab0c1bf98078478c9b70c04573ff488471f3b7ac02681fa6a9e78f38
|
7
|
+
data.tar.gz: 9a9bfcc2f17fd5bfac5d4a0249a5b8f6a7ebdf33d5841f6a84e60ee495cc902d4253d9493cdfe290d90e27d80195d1b3d8d14f12960256e4ef5d9fd9bc4b5a4e
|
data/README.md
CHANGED
@@ -810,3 +810,22 @@ The numeric code of China is 156.
|
|
810
810
|
* unidom-certificate-china: 2001029156MMSS
|
811
811
|
* unidom-contact-china: 2001039156MMSS
|
812
812
|
* unidom-geo-china: 2001049156MMSS
|
813
|
+
|
814
|
+
|
815
|
+
|
816
|
+
## Configuration
|
817
|
+
|
818
|
+
unidom-common and its relative Ruby gems are configurable. Create your own ``config/initializers/unidom.rb`` file in your project as following:
|
819
|
+
```ruby
|
820
|
+
Unidom::Common.configure do |options|
|
821
|
+
|
822
|
+
# The migrations inside the following namespaces will be ignored. The models inside the following namespaces won't be defined.
|
823
|
+
options[:neglected_namespaces] = %w{
|
824
|
+
Unidom::Party
|
825
|
+
Unidom::Visitor
|
826
|
+
}
|
827
|
+
|
828
|
+
end
|
829
|
+
```
|
830
|
+
The Unidom::Party::Person, the Unidom::Visitor::User, and other models under the listed namespaces won't be defined. Their migrations won't run.
|
831
|
+
But the models under the Unidom::Party::China namespace, if there is any, are defined, and their migrations will run as usual.
|
data/lib/unidom/common.rb
CHANGED
@@ -16,7 +16,6 @@ module Unidom
|
|
16
16
|
#FROM_DATE = '1970-01-01'.freeze
|
17
17
|
#THRU_DATE = '3000-01-01'.freeze
|
18
18
|
|
19
|
-
=begin
|
20
19
|
mattr_accessor :options
|
21
20
|
|
22
21
|
def self.configure
|
@@ -25,18 +24,17 @@ module Unidom
|
|
25
24
|
yield options
|
26
25
|
|
27
26
|
default_options = {
|
28
|
-
|
27
|
+
neglected_namespaces: []
|
29
28
|
}
|
30
29
|
self.options = default_options.merge options
|
31
30
|
|
32
31
|
puts 'Unidom::Common:'
|
33
|
-
if self.options[:
|
34
|
-
puts '--
|
35
|
-
puts " -> #{self.options[:
|
32
|
+
if self.options[:neglected_namespaces].present?
|
33
|
+
puts '-- neglected_namespaces'
|
34
|
+
puts " -> #{self.options[:neglected_namespaces].join ', '}"
|
36
35
|
end
|
37
36
|
|
38
37
|
end
|
39
|
-
=end
|
40
38
|
|
41
39
|
end
|
42
40
|
end
|
@@ -22,7 +22,7 @@ module Unidom::Common::EngineExtension
|
|
22
22
|
|
23
23
|
if migration_enabled
|
24
24
|
initializer :append_migrations do |app|
|
25
|
-
config.paths['db/migrate'].expanded.each { |expanded_path| app.config.paths['db/migrate'] << expanded_path } unless app.root.to_s.match
|
25
|
+
config.paths['db/migrate'].expanded.each { |expanded_path| app.config.paths['db/migrate'] << expanded_path } unless Unidom::Common::Neglection.namespace_neglected?(self.class.name)||app.root.to_s.match(root.to_s)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.9'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- lib/unidom/common/data_helper.rb
|
120
120
|
- lib/unidom/common/engine.rb
|
121
121
|
- lib/unidom/common/engine_extension.rb
|
122
|
+
- lib/unidom/common/neglection.rb
|
122
123
|
- lib/unidom/common/numeration.rb
|
123
124
|
- lib/unidom/common/version.rb
|
124
125
|
- lib/unidom/common/yaml_helper.rb
|