unidom-article_number 2.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db2f5a4a96071c5724910e4433782d9b3f7618a2
4
- data.tar.gz: 7d173519e5808a636ce823ce5d93f760e5cbc321
3
+ metadata.gz: ea52c38327e947ca73cbf0b709beb0d14268c932
4
+ data.tar.gz: 50ff85892ffc04fb92b438586de196e17b954c9b
5
5
  SHA512:
6
- metadata.gz: 3641c5bfdc96359f14267f8e33e74ede45accd42f840c658df4a10d4e17f1935fc4137d269afa1fedff29001c089685753af9c055033ef24a994c6e3222bddbf
7
- data.tar.gz: 3d4839a7b99c5d35926c6ec4975662ac2c4b1ddb82d2f3b2db8bc1b682ceb4e413fcdb74370a6c6d6bfe9879f27a2941a4653181697a660a3bf347d63f75d78d
6
+ metadata.gz: 9070fc3a952b2ab066da880d6737a45c8802a19e69a24366d0fa8c27ae5b4e21277abcfa4e1ccf9a8eb97b8fe5abfaf936570385a040f60f0a0dc7657e1f00c9
7
+ data.tar.gz: 1341a7c5be0861ac4521bdfabe8cdc1598dd58a051f2b2bd4fe0c69e7e0327ae8307749e4e67fa2736b4e8ba7765b45d3912929e08749667950bfbacda95e795
data/README.md CHANGED
@@ -2,28 +2,41 @@
2
2
 
3
3
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
4
4
  [![Gem Version](https://badge.fury.io/rb/unidom-article_number.svg)](https://badge.fury.io/rb/unidom-article_number)
5
+ [![Dependency Status](https://gemnasium.com/badges/github.com/topbitdu/unidom-accession.svg)](https://gemnasium.com/github.com/topbitdu/unidom-accession)
5
6
  [![Build Status](https://travis-ci.org/topbitdu/unidom-article_number.svg?branch=master)](https://travis-ci.org/topbitdu/unidom-article_number)
6
7
  [![Build status](https://ci.appveyor.com/api/projects/status/fayn35r72oy5na3u?svg=true)](https://ci.appveyor.com/project/topbitdu/unidom-article-number)
7
8
 
8
9
  Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Article Number domain model engine includes EAN-13, EAN-8, and IMEI models.
9
10
  Unidom (统一领域对象模型)是一系列的领域模型引擎。物品编码领域模型引擎包括EAN-13、EAN-8和IMEI的模型。
10
11
 
12
+
13
+
11
14
  ## Recent Update
15
+
12
16
  Check out the [Road Map](ROADMAP.md) to find out what's the next.
13
17
  Check out the [Change Log](CHANGELOG.md) to find out what's new.
14
18
 
19
+
20
+
15
21
  ## Usage in Gemfile
22
+
16
23
  ```ruby
17
24
  gem 'unidom-article_number'
18
25
  ```
19
26
 
27
+
28
+
20
29
  ## Run the Database Migration
30
+
21
31
  ```shell
22
32
  rake db:migrate
23
33
  ```
24
34
  The migration versions start with 200201.
25
35
 
36
+
37
+
26
38
  ## Call the Model
39
+
27
40
  ```ruby
28
41
  ean_13_barcode = Unidom::ArticleNumber::Ean13Barcode.create code: '1234567890123'
29
42
  ean_8_barcode = Unidom::ArticleNumber::Ean8Barcode.create code: '12345678'
@@ -33,7 +46,10 @@ ean_13_marking = Unidom::ArticleNumber::Marking.mark! barcode: ean_13_barcode, m
33
46
  ean_8_marking = Unidom::ArticleNumber::Marking.mark! barcode: ean_8_barcode, marked: marked, marker: marker, opened_at: Time.now
34
47
  ```
35
48
 
49
+
50
+
36
51
  ## Include the Concern
52
+
37
53
  ```ruby
38
54
  include Unidom::ArticleNumber::Concerns::AsBarcode
39
55
  include Unidom::ArticleNumber::Concerns::AsMarked
@@ -42,23 +58,27 @@ include Unidom::ArticleNumber::Concerns::AsEan8Marked
42
58
  ```
43
59
 
44
60
  ### As Barcode concern
61
+
45
62
  The As Barcode concern do the following tasks for the includer automatically:
46
- 1. Define the has_many :markings macro as: ``has_many :markings, class_name: 'Unidom::ArticleNumber::Marking', as: :barcode``
47
- 2. Define the #mark! method as: ``mark!(marked, by: nil, at: Time.now)``
63
+ 1. Define the has_many :markings macro as: ``has_many :markings, class_name: 'Unidom::ArticleNumber::Marking', as: :barcode``
64
+ 2. Define the #mark! method as: ``mark!(marked, by: nil, at: Time.now)``
48
65
  3. Define the #mark? mathod as: ``mark?(marked, at: Time.now)``
49
66
 
50
67
  ### As Marked concern
68
+
51
69
  The As Marked concern do the following tasks for the includer automatically:
52
- 1. Define the has_many :markings macro as: ``has_many :markings, class_name: 'Unidom::ArticleNumber::Marking', as: :marked``
53
- 2. Define the #is_marked! method as: ``is_marked!(as: nil, by: nil, at: Time.now)``
70
+ 1. Define the has_many :markings macro as: ``has_many :markings, class_name: 'Unidom::ArticleNumber::Marking', as: :marked``
71
+ 2. Define the #is_marked! method as: ``is_marked!(as: nil, by: nil, at: Time.now)``
54
72
  3. Define the #is_marked? method as: ``is_marked?(as: nil, at: Time.now)``
55
73
 
56
74
  ### As EAN-13 Marked concern
75
+
57
76
  The As EAN-13 Marked concern do the following tasks for the includer automatically:
58
- 1. Include the As Marked concern
77
+ 1. Include the As Marked concern
59
78
  2. Define the has_many :ean13_barcodes macro as: ``has_many :ean13_barcodes, through: :markings, source: :barcode, source_type: 'Unidom::ArticleNumber::Ean13Barcode'``
60
79
 
61
80
  ### As EAN-8 Marked concern
81
+
62
82
  The As EAN-8 Marked concern do the following tasks for the includer automatically:
63
- 1. Include the As Marked concern
83
+ 1. Include the As Marked concern
64
84
  2. Define the has_many :ean8_barcodes macro as: ``has_many :ean8_barcodes, through: :markings, source: :barcode, source_type: 'Unidom::ArticleNumber::Ean8Barcode'``
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
10
10
  rdoc.rdoc_dir = 'rdoc'
11
11
  rdoc.title = 'Unidom Article Number'
12
12
  rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.rdoc')
13
+ rdoc.rdoc_files.include('README.md')
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
@@ -20,5 +20,5 @@ load 'rails/tasks/statistics.rake'
20
20
 
21
21
 
22
22
 
23
- Bundler::GemHelper.install_tasks
23
+ require 'bundler/gem_tasks'
24
24
 
@@ -0,0 +1,2 @@
1
+ //= link_directory ../javascripts/unidom/article_number .js
2
+ //= link_directory ../stylesheets/unidom/article_number .css
@@ -5,7 +5,7 @@
5
5
  // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
6
  //
7
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.
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
9
  //
10
10
  // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
@@ -6,9 +6,9 @@
6
6
  * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
7
  *
8
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.
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
12
  *
13
13
  *= require_self
14
14
  */
@@ -1,2 +1,3 @@
1
1
  class Unidom::ArticleNumber::ApplicationController < ActionController::Base
2
+ protect_from_forgery with: :exception
2
3
  end
@@ -0,0 +1,2 @@
1
+ class Unidom::ArticleNumber::ApplicationJob < ActiveJob::Base
2
+ end
@@ -0,0 +1,4 @@
1
+ class Unidom::ArticleNumber::ApplicationMailer < ActionMailer::Base
2
+ default from: 'from@example.com'
3
+ layout 'mailer'
4
+ end
@@ -0,0 +1,3 @@
1
+ class Unidom::ArticleNumber::ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -8,7 +8,7 @@ module Unidom::ArticleNumber::Concerns::Code128Barcode
8
8
 
9
9
  extend ActiveSupport::Concern
10
10
 
11
- self.included do |includer|
11
+ included do |includer|
12
12
 
13
13
  validates :code, uniqueness: true
14
14
  validates :code, numericality: { only_integer: true }, if: Proc.new { |barcode| 'C'==barcode.code_set_code }
@@ -2,7 +2,7 @@
2
2
  # https://en.wikipedia.org/wiki/EAN-13
3
3
  # https://en.wikipedia.org/wiki/International_Article_Number_(EAN)
4
4
 
5
- class Unidom::ArticleNumber::Ean13Barcode < ActiveRecord::Base
5
+ class Unidom::ArticleNumber::Ean13Barcode < Unidom::ArticleNumber::ApplicationRecord
6
6
 
7
7
  RESTRICTED_DISTRIBUTION_GS1_PREFIXES = (('020'..'029').to_a + ('040'..'049').to_a + ('200'..'299').to_a).freeze
8
8
 
@@ -1,7 +1,7 @@
1
1
  # EAN-8 Barcode 是8位条形码。
2
2
  # https://en.wikipedia.org/wiki/EAN-8
3
3
 
4
- class Unidom::ArticleNumber::Ean8Barcode < ActiveRecord::Base
4
+ class Unidom::ArticleNumber::Ean8Barcode < Unidom::ArticleNumber::ApplicationRecord
5
5
 
6
6
  RESTRICTED_DISTRIBUTION_GS1_PREFIXES = (('020'..'029').to_a + ('040'..'049').to_a + ('200'..'299').to_a).freeze
7
7
 
@@ -1,6 +1,6 @@
1
1
  # Marking 是条码和物品的标记关系。
2
2
 
3
- class Unidom::ArticleNumber::Marking < ActiveRecord::Base
3
+ class Unidom::ArticleNumber::Marking < Unidom::ArticleNumber::ApplicationRecord
4
4
 
5
5
  self.table_name = 'unidom_markings'
6
6
 
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module ArticleNumber
3
- VERSION = '2.0'.freeze
3
+ VERSION = '2.0.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-article_number
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.0'
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-25 00:00:00.000000000 Z
11
+ date: 2016-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '1.6'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '1.6'
27
27
  description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
28
28
  The Article Number domain model engine includes EAN-13, EAN-8, and IMEI models.
29
29
  Unidom (统一领域对象模型)是一系列的领域模型引擎。物品编码领域模型引擎包括EAN-13、EAN-8和IMEI的模型。
@@ -36,10 +36,14 @@ files:
36
36
  - MIT-LICENSE
37
37
  - README.md
38
38
  - Rakefile
39
+ - app/assets/config/unidom-article_number_manifest.js
39
40
  - app/assets/javascripts/unidom/article_number/application.js
40
41
  - app/assets/stylesheets/unidom/article_number/application.css
41
42
  - app/controllers/unidom/article_number/application_controller.rb
42
43
  - app/helpers/unidom/article_number/application_helper.rb
44
+ - app/jobs/unidom/article_number/application_job.rb
45
+ - app/mailers/unidom/article_number/application_mailer.rb
46
+ - app/models/unidom/article_number/application_record.rb
43
47
  - app/models/unidom/article_number/concerns/as_barcode.rb
44
48
  - app/models/unidom/article_number/concerns/as_ean13_marked.rb
45
49
  - app/models/unidom/article_number/concerns/as_ean8_marked.rb