unidom-position 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: 624064954bb041f9e6cd1034b89795d0205914bb
4
+ data.tar.gz: 1a8da8761035b857133de825053905d0aaefa01f
5
+ SHA512:
6
+ metadata.gz: 79a930c8765be0723addd422a3ae646d4d3ba081210fe49576bb62f671f642cbac428eb5e63146689ab50bbdce680ee15dd640a740bc51be673f825fa82272b7
7
+ data.tar.gz: cfae527328749c8a26816e179ba56b79fae799c94968d7bcfbca23b693e8df5f1da621cc5c6758b78fe42d160a3dd2410b8d4311304866bfd649e0d53df2c838
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2016 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,31 @@
1
+ # Unidom Position 职位领域模型引擎
2
+
3
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
4
+ [![Gem Version](https://badge.fury.io/rb/unidom-position.svg)](https://badge.fury.io/rb/unidom-position)
5
+
6
+ Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Position domain model engine includes the Occupation, Position, Post, and Position Reporting Structure models.
7
+ Unidom (统一领域对象模型)是一系列的领域模型引擎。职位领域模型引擎包括职业、职位、岗位及职位报告关系模型。
8
+
9
+ ## Recent Update
10
+ Check out the [Road Map](ROADMAP.md) to find out what's the next.
11
+ Check out the [Change Log](CHANGELOG.md) to find out what's new.
12
+
13
+ ## Usage in Gemfile
14
+ ```ruby
15
+ gem 'unidom-position'
16
+ ```
17
+
18
+ ## Run the Database Migration
19
+ ```shell
20
+ rake db:migrate
21
+ ```
22
+ The migration versions start with 200101.
23
+
24
+ ## Call the Model
25
+ ```ruby
26
+ position = Unidom::Position::Position.valid_at.alive.first
27
+
28
+ occupation = Unidom::Position::Occupation.valid_at.alive.first
29
+
30
+ post = Unidom::Position::Post.valid_at.alive.first
31
+ ```
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 Position'
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_self
@@ -0,0 +1,14 @@
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_self
14
+ */
@@ -0,0 +1,2 @@
1
+ class Unidom::Position::ApplicationController < ActionController::Base
2
+ end
@@ -0,0 +1,2 @@
1
+ module Unidom::Position::ApplicationHelper
2
+ end
@@ -0,0 +1,16 @@
1
+ # Occupation 是职业。
2
+
3
+ class Unidom::Position::Occupation < ActiveRecord::Base
4
+
5
+ self.table_name = 'unidom_occupations'
6
+
7
+ include Unidom::Common::Concerns::ModelExtension
8
+
9
+ validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
10
+
11
+ belongs_to :scheme, polymorphic: true
12
+
13
+ has_many :positions, class_name: 'Unidom::Position::Position'
14
+ has_many :posts, through: :positions, source: :posts
15
+
16
+ end
@@ -0,0 +1,16 @@
1
+ # Position 是职位。
2
+
3
+ class Unidom::Position::Position < ActiveRecord::Base
4
+
5
+ self.table_name = 'unidom_positions'
6
+
7
+ include Unidom::Common::Concerns::ModelExtension
8
+
9
+ validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
10
+
11
+ belongs_to :organization, polymorphic: true
12
+ belongs_to :occupation, class_name: 'Unidom::Position::Occupation'
13
+
14
+ has_many :posts, class_name: 'Unidom::Position::Post'
15
+
16
+ end
@@ -0,0 +1,14 @@
1
+ # Post 是岗位。
2
+
3
+ class Unidom::Position::Post < ActiveRecord::Base
4
+
5
+ self.table_name = 'unidom_posts'
6
+
7
+ include Unidom::Common::Concerns::ModelExtension
8
+
9
+ validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
10
+
11
+ belongs_to :organization, polymorphic: true
12
+ belongs_to :position, class_name: 'Unidom::Position::Position'
13
+
14
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Unidom Position</title>
5
+ <%= stylesheet_link_tag 'unidom/position/application', media: 'all' %>
6
+ <%= csrf_meta_tags %>
7
+ </head>
8
+ <body>
9
+
10
+ <%= yield %>
11
+
12
+ <%= javascript_include_tag 'unidom/position/application' %>
13
+
14
+ </body>
15
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Unidom::Position::Engine.routes.draw do
2
+ end
@@ -0,0 +1,31 @@
1
+ class CreateUnidomOccupations < ActiveRecord::Migration
2
+
3
+ def change
4
+
5
+ create_table :unidom_occupations, id: :uuid do |t|
6
+
7
+ t.references :scheme, type: :uuid, null: false,
8
+ polymorphic: { null: false, default: '', limit: 200 }
9
+
10
+ t.string :code, null: true, default: nil, limit: 64
11
+ t.string :name, null: false, default: '', limit: 200
12
+
13
+ t.text :description
14
+ t.text :instruction
15
+
16
+ t.column :state, 'char(1)', null: false, default: 'C'
17
+ t.datetime :opened_at, null: false, default: ::Time.utc(1970)
18
+ t.datetime :closed_at, null: false, default: ::Time.utc(3000)
19
+ t.boolean :defunct, null: false, default: false
20
+ t.jsonb :notation, null: false, default: {}
21
+
22
+ t.timestamps null: false
23
+
24
+ end
25
+
26
+ add_index :unidom_occupations, :scheme_id
27
+ add_index :unidom_occupations, [ :code, :scheme_id ], unique: true
28
+
29
+ end
30
+
31
+ end
@@ -0,0 +1,31 @@
1
+ class CreateUnidomPositions < ActiveRecord::Migration
2
+
3
+ def change
4
+
5
+ create_table :unidom_positions, id: :uuid do |t|
6
+
7
+ t.references :organization, type: :uuid, null: false,
8
+ polymorphic: { null: false, default: '', limit: 200 }
9
+ t.references :occupation, type: :uuid, null: false
10
+
11
+ t.string :name, null: false, default: '', limit: 200
12
+
13
+ t.text :description
14
+ t.text :instruction
15
+
16
+ t.column :state, 'char(1)', null: false, default: 'C'
17
+ t.datetime :opened_at, null: false, default: ::Time.utc(1970)
18
+ t.datetime :closed_at, null: false, default: ::Time.utc(3000)
19
+ t.boolean :defunct, null: false, default: false
20
+ t.jsonb :notation, null: false, default: {}
21
+
22
+ t.timestamps null: false
23
+
24
+ end
25
+
26
+ add_index :unidom_positions, :organization_id
27
+ add_index :unidom_positions, :occupation_id
28
+
29
+ end
30
+
31
+ end
@@ -0,0 +1,41 @@
1
+ class CreateUnidomPosts < ActiveRecord::Migration
2
+
3
+ def change
4
+
5
+ create_table :unidom_posts, id: :uuid do |t|
6
+
7
+ t.references :organization, type: :uuid, null: false,
8
+ polymorphic: { null: false, default: '', limit: 200 }
9
+ t.references :position, type: :uuid, null: false
10
+
11
+ t.string :name, null: false, default: '', limit: 200
12
+
13
+ t.boolean :part_time, null: false, default: false
14
+ t.boolean :temporary, null: false, default: false
15
+
16
+ # t.date :expected_from_date, null: false, default: '1970-01-01'
17
+ # t.date :expected_thru_date, null: false, default: '3000-01-01'
18
+ # t.date :actual_from_date, null: false, default: '1970-01-01'
19
+ # t.date :actual_thru_date, null: false, default: '3000-01-01'
20
+ t.datetime :expection_opened_at, null: false, default: Time.utc(1970)
21
+ t.datetime :expection_closed_at, null: false, default: Time.utc(3000)
22
+
23
+ t.text :description
24
+ t.text :instruction
25
+
26
+ t.column :state, 'char(1)', null: false, default: 'C'
27
+ t.datetime :opened_at, null: false, default: ::Time.utc(1970)
28
+ t.datetime :closed_at, null: false, default: ::Time.utc(3000)
29
+ t.boolean :defunct, null: false, default: false
30
+ t.jsonb :notation, null: false, default: {}
31
+
32
+ t.timestamps null: false
33
+
34
+ end
35
+
36
+ add_index :unidom_posts, :organization_id
37
+ add_index :unidom_posts, :position_id
38
+
39
+ end
40
+
41
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :position do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,15 @@
1
+ module Unidom
2
+ module Position
3
+
4
+ class Engine < ::Rails::Engine
5
+
6
+ isolate_namespace ::Unidom::Position
7
+
8
+ initializer :append_migrations do |app|
9
+ config.paths['db/migrate'].expanded.each { |expanded_path| app.config.paths['db/migrate'] << expanded_path } unless app.root.to_s.match root.to_s
10
+ end
11
+
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ module Unidom
2
+ module Position
3
+ VERSION = '0.1'.freeze
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ require 'unidom/position/engine'
2
+
3
+ module Unidom
4
+ module Position
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: unidom-position
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-06-19 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.9'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.9'
27
+ description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
28
+ The Position domain model engine includes the Occupation, Position, Post, and Position
29
+ Reporting Structure 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/javascripts/unidom/position/application.js
40
+ - app/assets/stylesheets/unidom/position/application.css
41
+ - app/controllers/unidom/position/application_controller.rb
42
+ - app/helpers/unidom/position/application_helper.rb
43
+ - app/models/unidom/position/occupation.rb
44
+ - app/models/unidom/position/position.rb
45
+ - app/models/unidom/position/post.rb
46
+ - app/views/layouts/unidom/position/application.html.erb
47
+ - config/routes.rb
48
+ - db/migrate/20040201000000_create_unidom_occupations.rb
49
+ - db/migrate/20040211000000_create_unidom_positions.rb
50
+ - db/migrate/20040212000000_create_unidom_posts.rb
51
+ - lib/tasks/position_tasks.rake
52
+ - lib/unidom/position.rb
53
+ - lib/unidom/position/engine.rb
54
+ - lib/unidom/position/version.rb
55
+ homepage: https://github.com/topbitdu/unidom-position
56
+ licenses:
57
+ - MIT
58
+ metadata: {}
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubyforge_project:
75
+ rubygems_version: 2.4.5.1
76
+ signing_key:
77
+ specification_version: 4
78
+ summary: Unidom Position Domain Model Engine 职位领域模型引擎
79
+ test_files: []