unidom-product 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +21 -0
- data/Rakefile +24 -0
- data/app/assets/javascripts/unidom/product/application.js +13 -0
- data/app/assets/stylesheets/unidom/product/application.css +15 -0
- data/app/controllers/unidom/product/application_controller.rb +2 -0
- data/app/helpers/unidom/product/application_helper.rb +2 -0
- data/app/models/unidom/product/product.rb +12 -0
- data/app/views/layouts/unidom/product/application.html.erb +14 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20020201000000_create_unidom_products.rb +34 -0
- data/lib/tasks/product_tasks.rake +4 -0
- data/lib/unidom/product/engine.rb +15 -0
- data/lib/unidom/product/version.rb +5 -0
- data/lib/unidom/product.rb +6 -0
- metadata +75 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 60c5ab3ae92279af3a31bc2a9f7692f26e29c342
|
4
|
+
data.tar.gz: 30fd81784691836738aa30837068ca8f173ee952
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d59af05a1eb09c18752acdfdf81f0d9c3de37675797b90e2d819a275d506909f2d3bec9730982161445c2000be74f8e0de8177631e5e3f2230b26003ea1db0fa
|
7
|
+
data.tar.gz: 53ff54d832e1253fb6447271ce5953b1de27423f6ab6a616d3228809fe2db0bd82558c8d6c639d9eb891d5e88ef54d495311b372f29b62f69a16ceb6e4c0a911
|
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,21 @@
|
|
1
|
+
# Unidom Product
|
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 Product domain model engine includes Product and its relative models.
|
6
|
+
Unidom (统一领域对象模型)是一系列的领域模型引擎。产品领域模型引擎包括产品及其相关的模型。
|
7
|
+
|
8
|
+
## Usage in Gemfile:
|
9
|
+
```ruby
|
10
|
+
gem 'unidom-product'
|
11
|
+
```
|
12
|
+
|
13
|
+
## Run the Database Migration:
|
14
|
+
```shell
|
15
|
+
rake db:migrate
|
16
|
+
```
|
17
|
+
|
18
|
+
## Call the Model:
|
19
|
+
```ruby
|
20
|
+
Unidom::Product::Product.valid_at.alive.first
|
21
|
+
```
|
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 Product'
|
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,12 @@
|
|
1
|
+
# Product 是产品。
|
2
|
+
|
3
|
+
class Unidom::Product::Product < ActiveRecord::Base
|
4
|
+
|
5
|
+
self.table_name = 'unidom_products'
|
6
|
+
|
7
|
+
validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
|
8
|
+
validates :abbreviation, presence: true, length: { in: 1..self.columns_hash['abbreviation'].limit }
|
9
|
+
validates :measurement_unit, presence: true, length: { in: 1..self.columns_hash['measurement_unit'].limit }
|
10
|
+
validates :packing_norm, presence: true, length: { in: 1..self.columns_hash['packing_norm'].limit }
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Product</title>
|
5
|
+
<%= stylesheet_link_tag "product/application", media: "all" %>
|
6
|
+
<%= javascript_include_tag "product/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,34 @@
|
|
1
|
+
class CreateUnidomProducts < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def change
|
4
|
+
|
5
|
+
create_table :unidom_products, id: :uuid do |t|
|
6
|
+
|
7
|
+
t.string :name, null: false, default: '', limit: 200
|
8
|
+
t.string :abbreviation, null: false, default: '', limit: 8
|
9
|
+
t.string :measurement_unit, null: false, default: '', limit: 200
|
10
|
+
t.string :packing_norm, null: false, default: '', limit: 200
|
11
|
+
|
12
|
+
t.text :instruction
|
13
|
+
t.text :description
|
14
|
+
|
15
|
+
t.column :formset_code, 'char(4)', null: false, default: 'WARE'
|
16
|
+
|
17
|
+
t.string :slug, null: false, default: nil, limit: 200
|
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_products, :slug, unique: true
|
29
|
+
add_index :unidom_products, :name
|
30
|
+
add_index :unidom_products, :abbreviation
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Unidom
|
2
|
+
module Product
|
3
|
+
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
|
6
|
+
isolate_namespace ::Unidom::Product
|
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
|
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unidom-product
|
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 Product domain model engine includes Product and its relative models. Unidom
|
29
|
+
(统一领域对象模型)是一系列的领域模型引擎。产品领域模型引擎包括产品及其相关的模型。
|
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/product/application.js
|
40
|
+
- app/assets/stylesheets/unidom/product/application.css
|
41
|
+
- app/controllers/unidom/product/application_controller.rb
|
42
|
+
- app/helpers/unidom/product/application_helper.rb
|
43
|
+
- app/models/unidom/product/product.rb
|
44
|
+
- app/views/layouts/unidom/product/application.html.erb
|
45
|
+
- config/routes.rb
|
46
|
+
- db/migrate/20020201000000_create_unidom_products.rb
|
47
|
+
- lib/tasks/product_tasks.rake
|
48
|
+
- lib/unidom/product.rb
|
49
|
+
- lib/unidom/product/engine.rb
|
50
|
+
- lib/unidom/product/version.rb
|
51
|
+
homepage: https://github.com/topbitdu/unidom-product
|
52
|
+
licenses:
|
53
|
+
- MIT
|
54
|
+
metadata: {}
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
requirements: []
|
70
|
+
rubyforge_project:
|
71
|
+
rubygems_version: 2.4.5.1
|
72
|
+
signing_key:
|
73
|
+
specification_version: 4
|
74
|
+
summary: The Product domain model engine includes Product and its relative models.
|
75
|
+
test_files: []
|