unidom-inventory 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: 8f5e96fcfc7b41846527bd595a78e243fa39cf4c
4
+ data.tar.gz: 279f467231b3b984e6687990c887dcd8358d22a7
5
+ SHA512:
6
+ metadata.gz: b621d882e9d4d9efd4ccbdbc2fb220e09083cdff7c0e47a289d64bfad8f1cd6fadca34fcc8c9720c7cd9297fe6648f817f54322ae71f06b4d6ca67f537165b56
7
+ data.tar.gz: cffce1cddbb64531485eed9c6e4e1dac8b5ce2dbe3dec13626f364337d90cb691a530f0e7314375980ccdaeaf2f555977ccfe425ab49e73122937d12a27dda20
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,28 @@
1
+ # Unidom Inventory 库存领域模型引擎
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-inventory.svg)](https://badge.fury.io/rb/unidom-inventory)
5
+
6
+ Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Inventory domain model engine includes the Serialized Inventory Item, the Grouped Inventory Item, the Lot, and the Inventory Item Variance 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-inventory'
16
+ ```
17
+
18
+ ## Run the Database Migration
19
+ ```shell
20
+ rake db:migrate
21
+ ```
22
+ The migration versions start with 200209.
23
+
24
+ ## Call the Model
25
+ ```ruby
26
+ Unidom::Inventory::SerializedInventoryItem.valid_at.alive.first
27
+ Unidom::Inventory::GroupedInventoryItem.valid_at.alive.first
28
+ ```
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 Inventory'
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::Inventory::ApplicationController < ActionController::Base
2
+ end
@@ -0,0 +1,2 @@
1
+ module Unidom::Inventory::ApplicationHelper
2
+ end
@@ -0,0 +1,13 @@
1
+ # Grouped Inventory Item 是分组库存项。
2
+ class Unidom::Inventory::GroupedInventoryItem < ActiveRecord::Base
3
+
4
+ self.table_name = 'unidom_grouped_inventory_items'
5
+
6
+ include Unidom::Common::Concerns::ModelExtension
7
+
8
+ belongs_to :stored, polymorphic: true
9
+ belongs_to :store, polymorphic: true
10
+
11
+ validates :quantity, presence: true, numericality: true
12
+
13
+ end
@@ -0,0 +1,13 @@
1
+ # Serialized Inventory Item 是序列化库存项。
2
+ class Unidom::Inventory::SerializedInventoryItem < ActiveRecord::Base
3
+
4
+ self.table_name = 'unidom_serialized_inventory_items'
5
+
6
+ include Unidom::Common::Concerns::ModelExtension
7
+
8
+ belongs_to :stored, polymorphic: true
9
+ belongs_to :store, polymorphic: true
10
+
11
+ validates :serial_number, presence: true, length: { in: 2..columns_hash['serial_number'].limit }
12
+
13
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Unidom Inventory</title>
5
+ <%= stylesheet_link_tag 'unidom/inventory/application', media: 'all' %>
6
+ <%= csrf_meta_tags %>
7
+ </head>
8
+ <body>
9
+
10
+ <%= yield %>
11
+
12
+ <%= javascript_include_tag 'unidom/inventory/application' %>
13
+
14
+ </body>
15
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Unidom::Inventory::Engine.routes.draw do
2
+ end
@@ -0,0 +1,30 @@
1
+ class CreateUnidomSerializedInventoryItems < ActiveRecord::Migration
2
+
3
+ def change
4
+
5
+ create_table :unidom_serialized_inventory_items, id: :uuid do |t|
6
+
7
+ t.references :stored, type: :uuid, null: false,
8
+ polymorphic: { null: false, default: '', limit: 200 }
9
+ t.references :store, type: :uuid, null: false,
10
+ polymorphic: { null: false, default: '', limit: 200 }
11
+
12
+ t.string :serial_number, null: false, default: nil, limit: 200
13
+
14
+ t.column :state, 'char(1)', null: false, default: 'C'
15
+ t.datetime :opened_at, null: false, default: ::Time.utc(1970)
16
+ t.datetime :closed_at, null: false, default: ::Time.utc(3000)
17
+ t.boolean :defunct, null: false, default: false
18
+ t.jsonb :notation, null: false, default: {}
19
+
20
+ t.timestamps null: false
21
+
22
+ end
23
+
24
+ add_index :unidom_serialized_inventory_items, :stored_id
25
+ add_index :unidom_serialized_inventory_items, :store_id
26
+ add_index :unidom_serialized_inventory_items, :serial_number
27
+
28
+ end
29
+
30
+ end
@@ -0,0 +1,29 @@
1
+ class CreateUnidomGroupedInventoryItems < ActiveRecord::Migration
2
+
3
+ def change
4
+
5
+ create_table :unidom_grouped_inventory_items, id: :uuid do |t|
6
+
7
+ t.references :stored, type: :uuid, null: false,
8
+ polymorphic: { null: false, default: '', limit: 200 }
9
+ t.references :store, type: :uuid, null: false,
10
+ polymorphic: { null: false, default: '', limit: 200 }
11
+
12
+ t.decimal :quantity, null: false, default: 0.0, precision: 10, scale: 6
13
+
14
+ t.column :state, 'char(1)', null: false, default: 'C'
15
+ t.datetime :opened_at, null: false, default: ::Time.utc(1970)
16
+ t.datetime :closed_at, null: false, default: ::Time.utc(3000)
17
+ t.boolean :defunct, null: false, default: false
18
+ t.jsonb :notation, null: false, default: {}
19
+
20
+ t.timestamps null: false
21
+
22
+ end
23
+
24
+ add_index :unidom_grouped_inventory_items, :stored_id
25
+ add_index :unidom_grouped_inventory_items, :store_id
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :inventory do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,6 @@
1
+ require 'unidom/inventory/engine'
2
+
3
+ module Unidom
4
+ module Inventory
5
+ end
6
+ end
@@ -0,0 +1,15 @@
1
+ module Unidom
2
+ module Inventory
3
+
4
+ class Engine < ::Rails::Engine
5
+
6
+ isolate_namespace ::Unidom::Inventory
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 Inventory
3
+ VERSION = '0.1'.freeze
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: unidom-inventory
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-09-11 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: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
28
+ The Inventory domain model engine includes the Serialized Inventory Item, the Grouped
29
+ Inventory Item, the Lot, and the Inventory Item Variance 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/inventory/application.js
40
+ - app/assets/stylesheets/unidom/inventory/application.css
41
+ - app/controllers/unidom/inventory/application_controller.rb
42
+ - app/helpers/unidom/inventory/application_helper.rb
43
+ - app/models/unidom/inventory/grouped_inventory_item.rb
44
+ - app/models/unidom/inventory/serialized_inventory_item.rb
45
+ - app/views/layouts/unidom/inventory/application.html.erb
46
+ - config/routes.rb
47
+ - db/migrate/20020901000000_create_unidom_serialized_inventory_items.rb
48
+ - db/migrate/20020902000000_create_unidom_grouped_inventory_items.rb
49
+ - lib/tasks/inventory_tasks.rake
50
+ - lib/unidom/inventory.rb
51
+ - lib/unidom/inventory/engine.rb
52
+ - lib/unidom/inventory/version.rb
53
+ homepage: https://github.com/topbitdu/unidom-inventory
54
+ licenses:
55
+ - MIT
56
+ metadata: {}
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubyforge_project:
73
+ rubygems_version: 2.6.4
74
+ signing_key:
75
+ specification_version: 4
76
+ summary: Unidom Inventory Domain Model Engine 库存领域模型引擎
77
+ test_files: []