unidom-party 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6be7d4c4a29f34fb617509f4ffd1699cb8bcbbf6
4
+ data.tar.gz: 3c69e8ce62fb0f6ea3a7b46077ba1b589503c4b7
5
+ SHA512:
6
+ metadata.gz: ee23775c46aff03239496d42aa6cd00ef717c49429749dfef68df239b6ebcd411717d3711160c3d412ea716a83d8299c48d1f4dc18e5259bff8bc1cfb1831e77
7
+ data.tar.gz: d8dde01cdab1feca3998e330b83cc36490e52b5ff6f609026c0b55515224012cfd0c712df1e77bbd3be42acdc485107abb8bfbd1622d146004dec6e4bb2ebf31
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Topbit Du
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2015 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,23 @@
1
+ # Unidom Party 参与者领域模型引擎
2
+
3
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
4
+
5
+ Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Party domain model engine includes Person, Shop, and Company models.
6
+ Unidom (统一领域对象模型)是一系列的领域模型引擎。参与者领域模型引擎包括个人、店铺、公司的模型。
7
+
8
+ ## Usage in Gemfile:
9
+ ```ruby
10
+ gem 'unidom-party'
11
+ ```
12
+
13
+ ## Run the Database Migration:
14
+ ```shell
15
+ rake db:migrate
16
+ ```
17
+
18
+ ## Call the Model:
19
+ ```ruby
20
+ Unidom::Party::Company.valid_at.alive.first
21
+ Unidom::Party::Shop.valid_at.alive.first
22
+ Unidom::Party::People.valid_at.alive.first
23
+ ```
data/Rakefile ADDED
@@ -0,0 +1,24 @@
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::Party'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+ load 'rails/tasks/statistics.rake'
20
+
21
+
22
+
23
+ Bundler::GemHelper.install_tasks
24
+
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -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 styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,6 @@
1
+ module Unidom
2
+ module Party
3
+ class ApplicationController < ActionController::Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Unidom
2
+ module Party
3
+ module ApplicationHelper
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,36 @@
1
+ # Person 是个人。
2
+
3
+ class Unidom::Party::Person < ActiveRecord::Base
4
+
5
+ self.table_name = 'unidom_people'
6
+
7
+ validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
8
+
9
+ #has_many :source_party_linkings, class_name: 'Party::PartyLinking', as: :source_party
10
+ #has_many :linked_shops_as_source, through: :source_party_linkings, source: :target_party, source_type: 'Party::Shop'
11
+ #has_many :linked_people_as_source, through: :source_party_linkings, source: :target_party, source_type: 'Party::Person'
12
+
13
+ #has_many :target_party_linkings, class_name: 'Party::PartyLinking', as: :target_party
14
+ #has_many :linked_shops_as_target, through: :source_party_linkings, source: :source_party, source_type: 'Party::Shop'
15
+ #has_many :linked_people_as_target, through: :source_party_linkings, source: :source_party, source_type: 'Party::Person'
16
+
17
+ #has_many :allocatings, class_name: 'Property::Allocating', as: :allocatee
18
+ #has_many :allocated_tables, through: :allocatings, source: :allocated, source_type: 'Property::Table'
19
+
20
+ #has_many :receptions, class_name: 'Visitor::Reception', as: :party
21
+ #has_many :recepted_users, through: :receptions, source: :visitor, source_type: 'Visitor::User'
22
+
23
+ #has_many :contact_subscriptions, class_name: 'Contact::ContactSubscription', as: :subscriber
24
+ #has_many :china_mobile_phone_numbers, through: :contact_subscriptions, source: :contact, source_type: 'Contact::ChinaMobilePhoneNumber'
25
+
26
+ has_many :target_linkings, class_name: 'Party::PartyLinking', as: :source_party
27
+ #has_many :target_people, through: :target_linkings, source: :target_party, source_type: 'Party::Person'
28
+ #has_many :target_shops, through: :target_linkings, source: :target_party, source_type: 'Party::Shop'
29
+
30
+ has_many :source_linkings, class_name: 'Party::PartyLinking', as: :target_party
31
+ #has_many :source_people, through: :source_linkings, source: :source_party, source_type: 'Party::Person'
32
+ #has_many :source_shops, through: :source_linkings, source: :source_party, source_type: 'Party::Shop'
33
+
34
+ include ::Unidom::Common::ModelExtension
35
+
36
+ end
@@ -0,0 +1,36 @@
1
+ # Person 是个人。
2
+
3
+ class Unidom::Party::Person < ActiveRecord::Base
4
+
5
+ self.table_name = 'unidom_people'
6
+
7
+ validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
8
+
9
+ #has_many :source_party_linkings, class_name: 'Party::PartyLinking', as: :source_party
10
+ #has_many :linked_shops_as_source, through: :source_party_linkings, source: :target_party, source_type: 'Party::Shop'
11
+ #has_many :linked_people_as_source, through: :source_party_linkings, source: :target_party, source_type: 'Party::Person'
12
+
13
+ #has_many :target_party_linkings, class_name: 'Party::PartyLinking', as: :target_party
14
+ #has_many :linked_shops_as_target, through: :source_party_linkings, source: :source_party, source_type: 'Party::Shop'
15
+ #has_many :linked_people_as_target, through: :source_party_linkings, source: :source_party, source_type: 'Party::Person'
16
+
17
+ #has_many :allocatings, class_name: 'Property::Allocating', as: :allocatee
18
+ #has_many :allocated_tables, through: :allocatings, source: :allocated, source_type: 'Property::Table'
19
+
20
+ #has_many :receptions, class_name: 'Visitor::Reception', as: :party
21
+ #has_many :recepted_users, through: :receptions, source: :visitor, source_type: 'Visitor::User'
22
+
23
+ #has_many :contact_subscriptions, class_name: 'Contact::ContactSubscription', as: :subscriber
24
+ #has_many :china_mobile_phone_numbers, through: :contact_subscriptions, source: :contact, source_type: 'Contact::ChinaMobilePhoneNumber'
25
+
26
+ has_many :target_linkings, class_name: 'Party::PartyLinking', as: :source_party
27
+ #has_many :target_people, through: :target_linkings, source: :target_party, source_type: 'Party::Person'
28
+ #has_many :target_shops, through: :target_linkings, source: :target_party, source_type: 'Party::Shop'
29
+
30
+ has_many :source_linkings, class_name: 'Party::PartyLinking', as: :target_party
31
+ #has_many :source_people, through: :source_linkings, source: :source_party, source_type: 'Party::Person'
32
+ #has_many :source_shops, through: :source_linkings, source: :source_party, source_type: 'Party::Shop'
33
+
34
+ include ::Unidom::Common::ModelExtension
35
+
36
+ end
@@ -0,0 +1,11 @@
1
+ # Shop 是店铺。
2
+
3
+ class Unidom::Party::Shop < ActiveRecord::Base
4
+
5
+ self.table_name = 'unidom_shops'
6
+
7
+ validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
8
+
9
+ include ::Unidom::Common::ModelExtension
10
+
11
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Party</title>
5
+ <%= stylesheet_link_tag "party/application", media: "all" %>
6
+ <%= javascript_include_tag "party/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Unidom::Party::Engine.routes.draw do
2
+ end
@@ -0,0 +1,33 @@
1
+ class CreateUnidomPartyRelations < ActiveRecord::Migration
2
+
3
+ def change
4
+
5
+ create_table :unidom_party_relations, id: :uuid do |t|
6
+
7
+ t.references :source_party, type: :uuid, null: false,
8
+ polymorphic: { null: false, default: '', limit: 200 }
9
+ t.references :target_party, type: :uuid, null: false,
10
+ polymorphic: { null: false, default: '', limit: 200 }
11
+
12
+ t.column :linkage_code, 'char(4)', null: false, default: 'FRND'
13
+
14
+ t.integer :priority, null: false, default: 0
15
+ t.integer :grade, null: false, default: 0
16
+ t.text :description
17
+
18
+ t.column :state, 'char(1)', null: false, default: 'C'
19
+ t.datetime :opened_at, null: false, default: ::Time.utc(1970)
20
+ t.datetime :closed_at, null: false, default: ::Time.utc(3000)
21
+ t.boolean :defunct, null: false, default: false
22
+ t.jsonb :notation, null: false, default: {}
23
+
24
+ t.timestamps null: false
25
+
26
+ end
27
+
28
+ add_index :unidom_party_relations, :source_party_id
29
+ add_index :unidom_party_relations, :target_party_id
30
+
31
+ end
32
+
33
+ end
@@ -0,0 +1,27 @@
1
+ class CreateUnidomPeople < ActiveRecord::Migration
2
+
3
+ def change
4
+
5
+ create_table :unidom_people, id: :uuid do |t|
6
+
7
+ t.string :name, null: false, default: '', limit: 200
8
+ t.text :description
9
+
10
+ t.string :slug, null: false, default: nil, limit: 200
11
+ t.column :state, 'char(1)', null: false, default: 'C'
12
+ t.datetime :opened_at, null: false, default: ::Time.utc(1970)
13
+ t.datetime :closed_at, null: false, default: ::Time.utc(3000)
14
+ t.boolean :defunct, null: false, default: false
15
+ t.jsonb :notation, null: false, default: {}
16
+
17
+ t.timestamps null: false
18
+
19
+ end
20
+
21
+ add_index :unidom_people, :name
22
+ add_index :unidom_people, :slug, unique: true
23
+ # add_index :unidom_people, :notation, using: 'gin ((notation -> 'tags'))'
24
+
25
+ end
26
+
27
+ end
@@ -0,0 +1,26 @@
1
+ class CreateUnidomShops < ActiveRecord::Migration
2
+
3
+ def change
4
+
5
+ create_table :unidom_shops, id: :uuid do |t|
6
+
7
+ t.string :name, null: false, default: '', limit: 200
8
+ t.text :description
9
+
10
+ t.string :slug, null: false, default: nil, limit: 200
11
+ t.column :state, 'char(1)', null: false, default: 'C'
12
+ t.datetime :opened_at, null: false, default: ::Time.utc(1970)
13
+ t.datetime :closed_at, null: false, default: ::Time.utc(3000)
14
+ t.boolean :defunct, null: false, default: false
15
+ t.jsonb :notation, null: false, default: {}
16
+
17
+ t.timestamps null: false
18
+
19
+ end
20
+
21
+ add_index :unidom_shops, :name
22
+ add_index :unidom_shops, :slug, unique: true
23
+
24
+ end
25
+
26
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :party do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,6 @@
1
+ require 'unidom/party/engine'
2
+
3
+ module Unidom
4
+ module Party
5
+ end
6
+ end
@@ -0,0 +1,13 @@
1
+ module Unidom
2
+ module Party
3
+ class Engine < ::Rails::Engine
4
+
5
+ isolate_namespace ::Unidom::Party
6
+
7
+ initializer :append_migrations do |app|
8
+ config.paths['db/migrate'].expanded.each { |expanded_path| app.config.paths['db/migrate'] << expanded_path } unless app.root.to_s.match root.to_s
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module Unidom
2
+ module Party
3
+ VERSION = '0.1'.freeze
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: unidom-party
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: 2016-02-10 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: '0.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.2'
27
+ description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
28
+ The Party domain model engine includes Person, Shop, and Company models. Unidom
29
+ (统一领域对象模型)是一系列的领域模型引擎。参与者领域模型引擎包括个人、店铺、公司的模型。
30
+ email:
31
+ - topbit.du@gmail.com
32
+ executables: []
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - LICENSE
37
+ - MIT-LICENSE
38
+ - README.md
39
+ - Rakefile
40
+ - app/assets/javascripts/unidom/party/application.js
41
+ - app/assets/stylesheets/unidom/party/application.css
42
+ - app/controllers/unidom/party/application_controller.rb
43
+ - app/helpers/unidom/party/application_helper.rb
44
+ - app/models/unidom/party/party_relation.rb
45
+ - app/models/unidom/party/person.rb
46
+ - app/models/unidom/party/shop.rb
47
+ - app/views/layouts/unidom/party/application.html.erb
48
+ - config/routes.rb
49
+ - db/migrate/20010101000000_create_unidom_party_relations.rb
50
+ - db/migrate/20010102000000_create_unidom_people.rb
51
+ - db/migrate/20010103000000_create_unidom_shops.rb
52
+ - lib/tasks/party_tasks.rake
53
+ - lib/unidom/party.rb
54
+ - lib/unidom/party/engine.rb
55
+ - lib/unidom/party/version.rb
56
+ homepage: http://github.com/topbitdu/unidom-party
57
+ licenses:
58
+ - MIT
59
+ metadata: {}
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 2.4.5.1
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: The Party domain model engine includes Person, Shop, and Company models.
80
+ test_files: []