unidom-stapar 0.1
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +130 -0
- data/Rakefile +32 -0
- data/app/assets/config/unidom_stapar_manifest.js +1 -0
- data/app/assets/stylesheets/unidom/stapar/application.css +15 -0
- data/app/controllers/unidom/stapar/application_controller.rb +7 -0
- data/app/helpers/unidom/stapar/application_helper.rb +6 -0
- data/app/jobs/unidom/stapar/application_job.rb +6 -0
- data/app/mailers/unidom/stapar/application_mailer.rb +8 -0
- data/app/models/unidom/stapar/application_record.rb +7 -0
- data/app/types/unidom/stapar/applied_field.rb +7 -0
- data/app/views/layouts/unidom/stapar/application.html.erb +15 -0
- data/config/enum.yml +35 -0
- data/config/locales/enum.zh-CN.yml +20 -0
- data/config/routes.rb +2 -0
- data/lib/rspec/types/unidom/stapar/applied_field_spec.rb +29 -0
- data/lib/tasks/unidom/stapar_tasks.rake +4 -0
- data/lib/unidom/stapar/engine.rb +13 -0
- data/lib/unidom/stapar/types_rspec.rb +1 -0
- data/lib/unidom/stapar/version.rb +5 -0
- data/lib/unidom/stapar.rb +7 -0
- metadata +80 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4b00f98eafa343c20a5017288189ecfc68c4e846f5551842191776c5e957334c
|
|
4
|
+
data.tar.gz: 827fff4cfad04aef8e628f17748bd22e4d6fca2dceec93a0df913e76cf76bc69
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: d0f070d97298ed5b2a478a95db27be7563fe3dbe3bfd0e07507c0c3d808d3ae7ee0dd3fc2048a934099f2e008ab34ca8f133cabec80f9320afa442d1df764872
|
|
7
|
+
data.tar.gz: fbff180d1304dc3e7c9095deb8d921043978bdd5b56418bfa5e22b1bcf503f9d720c54ede68e20cebc5aedd4a28d4ef5b56395dff1c4c9159f8e6fcbf9fd3b07
|
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2020 Topbit Du
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Unidom Stapar 统计模式识别模型引擎
|
|
2
|
+
|
|
3
|
+
[](http://www.rubydoc.info/gems/unidom-stapar/frames)
|
|
4
|
+
[](http://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
[](https://badge.fury.io/rb/unidom-stapar)
|
|
7
|
+
[](https://gemnasium.com/github.com/topbitdu/unidom-stapar)
|
|
8
|
+
|
|
9
|
+
Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Stapar domain model engine includes Sample and Matching models.
|
|
10
|
+
Unidom (统一领域对象模型)是一系列的领域模型引擎。统计模式识别领域模型引擎包括采样和匹配的模型。
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Recent Update
|
|
15
|
+
|
|
16
|
+
Check out the [Road Map](ROADMAP.md) to find out what's the next.
|
|
17
|
+
Check out the [Change Log](CHANGELOG.md) to find out what's new.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Usage in Gemfile
|
|
22
|
+
|
|
23
|
+
```ruby
|
|
24
|
+
gem 'unidom-stapar'
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Run the Database Migration
|
|
30
|
+
|
|
31
|
+
```shell
|
|
32
|
+
rake db:migrate
|
|
33
|
+
```
|
|
34
|
+
The migration versions start with 200601.
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## Call the Model
|
|
39
|
+
|
|
40
|
+
```ruby
|
|
41
|
+
PatternMatching
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## Include the Concerns
|
|
47
|
+
|
|
48
|
+
```ruby
|
|
49
|
+
include Unidom::Stapar::Concerns::AsSample
|
|
50
|
+
include Unidom::Stapar::Concerns::AsFeature
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### As Feature
|
|
54
|
+
|
|
55
|
+
The As Feature concern do the following tasks for the includer automatically:
|
|
56
|
+
|
|
57
|
+
1. Define the has_many :stapar_carts macro as: ``has_many :stapar_carts, class_name: 'Unidom::stapar::staparCart', as: :shopper``
|
|
58
|
+
2. Define the #get_cart! method as: ``get_cart!(from: nil, at: Time.now)``
|
|
59
|
+
3. Define the #get_cart? method as: ``get_cart?(from: nil, at: Time.now)``
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## Disable the Model & Migration
|
|
64
|
+
|
|
65
|
+
If you only need the app components other than models, the migrations should be neglected, and the models should not be loaded.
|
|
66
|
+
|
|
67
|
+
```ruby
|
|
68
|
+
# config/initializers/unidom.rb
|
|
69
|
+
Unidom::Common.configure do |options|
|
|
70
|
+
|
|
71
|
+
options[:neglected_namespaces] = %w{
|
|
72
|
+
Unidom::Stapar
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
end
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
## RSpec examples
|
|
81
|
+
|
|
82
|
+
### RSpec example manifest (run automatically)
|
|
83
|
+
|
|
84
|
+
```ruby
|
|
85
|
+
# spec/models/unidom_spec.rb
|
|
86
|
+
require 'unidom/stapar/models_rspec'
|
|
87
|
+
|
|
88
|
+
# spec/types/unidom_spec.rb
|
|
89
|
+
require 'unidom/stapar/types_rspec'
|
|
90
|
+
|
|
91
|
+
# spec/validators/unidom_spec.rb
|
|
92
|
+
require 'unidom/stapar/validators_rspec'
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### RSpec shared examples (to be integrated)
|
|
96
|
+
|
|
97
|
+
```ruby
|
|
98
|
+
# lib/unidom.rb
|
|
99
|
+
def initialize_unidom
|
|
100
|
+
|
|
101
|
+
Snapshot.class_eval do
|
|
102
|
+
include Unidom::Stapar::Concerns::AsSample
|
|
103
|
+
include Unidom::Stapar::Concerns::AsFeature
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# spec/rails_helper.rb
|
|
109
|
+
require 'unidom'
|
|
110
|
+
initialize_unidom
|
|
111
|
+
|
|
112
|
+
# spec/support/unidom_rspec_shared_examples.rb
|
|
113
|
+
require 'unidom/stapar/rspec_shared_examples'
|
|
114
|
+
|
|
115
|
+
# spec/models/unidom/party/person_spec.rb
|
|
116
|
+
describe Snapshot, type: :model do
|
|
117
|
+
|
|
118
|
+
context do
|
|
119
|
+
|
|
120
|
+
model_attribtues = {
|
|
121
|
+
name: 'Tim'
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
it_behaves_like 'Unidom::Stapar::Concerns::AsSample', model_attribtues
|
|
125
|
+
it_behaves_like 'Unidom::Stapar::Concerns::AsFeature', model_attribtues
|
|
126
|
+
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
end
|
|
130
|
+
```
|
data/Rakefile
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'bundler/setup'
|
|
3
|
+
rescue LoadError
|
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
require 'rdoc/task'
|
|
8
|
+
|
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
11
|
+
rdoc.title = 'Unidom::Stapar'
|
|
12
|
+
rdoc.options << '--line-numbers'
|
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
|
18
|
+
load 'rails/tasks/engine.rake'
|
|
19
|
+
|
|
20
|
+
load 'rails/tasks/statistics.rake'
|
|
21
|
+
|
|
22
|
+
require 'bundler/gem_tasks'
|
|
23
|
+
|
|
24
|
+
require 'rake/testtask'
|
|
25
|
+
|
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
|
27
|
+
t.libs << 'test'
|
|
28
|
+
t.pattern = 'test/**/*_test.rb'
|
|
29
|
+
t.verbose = false
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
task default: :test
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//= link_directory ../stylesheets/unidom/stapar .css
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
|
11
|
+
* It is generally better to create a new file per style scope.
|
|
12
|
+
*
|
|
13
|
+
*= require_tree .
|
|
14
|
+
*= require_self
|
|
15
|
+
*/
|
data/config/enum.yml
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
enum:
|
|
2
|
+
|
|
3
|
+
unidom_applied_field:
|
|
4
|
+
eyeprint:
|
|
5
|
+
code: 'EYEP'
|
|
6
|
+
face:
|
|
7
|
+
code: 'FACE'
|
|
8
|
+
fingerprint:
|
|
9
|
+
code: 'FNGR'
|
|
10
|
+
gait:
|
|
11
|
+
code: 'GAIT'
|
|
12
|
+
gene:
|
|
13
|
+
code: 'GENE'
|
|
14
|
+
hand_shape:
|
|
15
|
+
code: 'HDSP'
|
|
16
|
+
handwriting:
|
|
17
|
+
code: 'HDWR'
|
|
18
|
+
infared_thermogram:
|
|
19
|
+
code: 'IFTG'
|
|
20
|
+
iris:
|
|
21
|
+
code: 'IRIS'
|
|
22
|
+
keyboard_typing_habit:
|
|
23
|
+
code: 'KBDT'
|
|
24
|
+
microchip_implant:
|
|
25
|
+
code: 'MCIP'
|
|
26
|
+
palm:
|
|
27
|
+
code: 'PALM'
|
|
28
|
+
retina:
|
|
29
|
+
code: 'RTNA'
|
|
30
|
+
signature:
|
|
31
|
+
code: 'SGNT'
|
|
32
|
+
vein:
|
|
33
|
+
code: 'VEIN'
|
|
34
|
+
voice:
|
|
35
|
+
code: 'VOIC'
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'zh-CN':
|
|
2
|
+
enum:
|
|
3
|
+
|
|
4
|
+
unidom_applied_field:
|
|
5
|
+
eyeprint: 眼纹
|
|
6
|
+
face: 面部
|
|
7
|
+
fingerprint: 指纹
|
|
8
|
+
gait: 步态
|
|
9
|
+
gene: 基因
|
|
10
|
+
hand_shape: 手形
|
|
11
|
+
handwriting: 笔迹
|
|
12
|
+
infared_thermogram: 红外温谱图
|
|
13
|
+
iris: 虹膜
|
|
14
|
+
keyboard_typing_habit: 键盘敲击习惯
|
|
15
|
+
microchip_implant: 皮肤芯片
|
|
16
|
+
palm: 手掌几何学
|
|
17
|
+
retina: 视网膜
|
|
18
|
+
signature: 签名
|
|
19
|
+
vein: 静脉
|
|
20
|
+
voice: 语音
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require "rails_helper"
|
|
2
|
+
|
|
3
|
+
describe Unidom::Stapar::AppliedField, type: :type do
|
|
4
|
+
|
|
5
|
+
before :each do
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
after :each do
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it_behaves_like 'ProgneTapera::EnumConfig', 16, [
|
|
12
|
+
{ code: 'EYEP', name: 'eyeprint', localized_name: '眼纹' },
|
|
13
|
+
{ code: 'FACE', name: 'face', localized_name: '面部' },
|
|
14
|
+
{ code: 'FNGR', name: 'fingerprint', localized_name: '指纹' },
|
|
15
|
+
{ code: 'GAIT', name: 'gait', localized_name: '步态' },
|
|
16
|
+
{ code: 'GENE', name: 'gene', localized_name: '基因' },
|
|
17
|
+
{ code: 'HDSP', name: 'hand_shape', localized_name: '手形' },
|
|
18
|
+
{ code: 'HDWR', name: 'handwriting', localized_name: '笔迹' },
|
|
19
|
+
{ code: 'IFTG', name: 'infared_thermogram', localized_name: '红外温谱图' },
|
|
20
|
+
{ code: 'IRIS', name: 'iris', localized_name: '虹膜' },
|
|
21
|
+
{ code: 'KBDT', name: 'keyboard_typing_habit', localized_name: '键盘敲击习惯' },
|
|
22
|
+
{ code: 'MCIP', name: 'microchip_implant', localized_name: '皮肤芯片' },
|
|
23
|
+
{ code: 'PALM', name: 'palm', localized_name: '手掌几何学' },
|
|
24
|
+
{ code: 'RTNA', name: 'retina', localized_name: '视网膜' },
|
|
25
|
+
{ code: 'SGNT', name: 'signature', localized_name: '签名' },
|
|
26
|
+
{ code: 'VEIN', name: 'vein', localized_name: '静脉' },
|
|
27
|
+
{ code: 'VOIC', name: 'voice', localized_name: '语音' } ]
|
|
28
|
+
|
|
29
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'rspec/types/unidom/stapar/applied_field_spec'
|
metadata
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: unidom-stapar
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: '0.1'
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Topbit Du
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2020-05-02 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: unidom-common
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '2.0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2.0'
|
|
27
|
+
description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
|
|
28
|
+
The Statistical Approach of Pattern Recognition domain model engine includes Sample
|
|
29
|
+
and Matching models. Unidom (统一领域对象模型)是一系列的领域模型引擎。统计模式识别领域模型引擎包括采样和匹配的模型。
|
|
30
|
+
email:
|
|
31
|
+
- topbit.du@gmail.com
|
|
32
|
+
executables: []
|
|
33
|
+
extensions: []
|
|
34
|
+
extra_rdoc_files: []
|
|
35
|
+
files:
|
|
36
|
+
- MIT-LICENSE
|
|
37
|
+
- README.md
|
|
38
|
+
- Rakefile
|
|
39
|
+
- app/assets/config/unidom_stapar_manifest.js
|
|
40
|
+
- app/assets/stylesheets/unidom/stapar/application.css
|
|
41
|
+
- app/controllers/unidom/stapar/application_controller.rb
|
|
42
|
+
- app/helpers/unidom/stapar/application_helper.rb
|
|
43
|
+
- app/jobs/unidom/stapar/application_job.rb
|
|
44
|
+
- app/mailers/unidom/stapar/application_mailer.rb
|
|
45
|
+
- app/models/unidom/stapar/application_record.rb
|
|
46
|
+
- app/types/unidom/stapar/applied_field.rb
|
|
47
|
+
- app/views/layouts/unidom/stapar/application.html.erb
|
|
48
|
+
- config/enum.yml
|
|
49
|
+
- config/locales/enum.zh-CN.yml
|
|
50
|
+
- config/routes.rb
|
|
51
|
+
- lib/rspec/types/unidom/stapar/applied_field_spec.rb
|
|
52
|
+
- lib/tasks/unidom/stapar_tasks.rake
|
|
53
|
+
- lib/unidom/stapar.rb
|
|
54
|
+
- lib/unidom/stapar/engine.rb
|
|
55
|
+
- lib/unidom/stapar/types_rspec.rb
|
|
56
|
+
- lib/unidom/stapar/version.rb
|
|
57
|
+
homepage: https://github.com/topbitdu/unidom-stapar
|
|
58
|
+
licenses:
|
|
59
|
+
- MIT
|
|
60
|
+
metadata: {}
|
|
61
|
+
post_install_message:
|
|
62
|
+
rdoc_options: []
|
|
63
|
+
require_paths:
|
|
64
|
+
- lib
|
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
|
+
requirements:
|
|
67
|
+
- - ">="
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: '0'
|
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0'
|
|
75
|
+
requirements: []
|
|
76
|
+
rubygems_version: 3.1.2
|
|
77
|
+
signing_key:
|
|
78
|
+
specification_version: 4
|
|
79
|
+
summary: Unidom Statistical Approach of Pattern Recognition Domain Model Engine 统计模式识别领域模型引擎
|
|
80
|
+
test_files: []
|