progne_tapera 0.1 → 0.1.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: fd661dd328a0cca1b2cbe396620e0fdcf890cced
4
- data.tar.gz: 392c0a5cdd3b5dce2eaf38c0eac3a01c747de6e5
3
+ metadata.gz: c347517d3cc7131f1969253a474a29966720f1e1
4
+ data.tar.gz: da0e6d466b75fcc15823623de76a97e00e0335b5
5
5
  SHA512:
6
- metadata.gz: 22d0667f8df930b057ac45c28af5a0b27eb0c0835e70e2e30a108bbcfce347591a03a6e8e153d7e3f0e6d41f5e5d8da67a01d2f6d10a461a8460a52fc284a35f
7
- data.tar.gz: 8d0f4d43dac0fe24fe10b50362a8de3ff1956dfa0af233b8ffa79ba9ec59bf643b7209ef8e7b08ce21963776762b913566adb801372d2bc4517249a0fc7b6865
6
+ metadata.gz: 77d5dad91214242e8bca4fe35c0f33278648fd98c940da3c9e2a4b5898cf9439ba0fce86288835440d4ad192b594992ee4a7a0093da74ca2d4180d563fa6cd4f
7
+ data.tar.gz: 04d98c24b1377dfdd90524aaed64c3c53ff031fd121860297efb9e9d8e71ba76586857903c9fb1a2fb6fb31e5cfd4fb0687f39abddaa0b9975ecb0eba2b21365
data/.gitignore CHANGED
@@ -1,6 +1,5 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
4
3
  /_yardoc/
5
4
  /coverage/
6
5
  /doc/
@@ -11,5 +10,6 @@
11
10
  *.so
12
11
  *.o
13
12
  *.a
13
+ *.gem
14
14
  mkmf.log
15
15
  .DS_Store
data/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Progne Tapera Change Log 枚举库变更日志
2
+
3
+ ## v0.1
4
+ 1. Enum Item class
5
+ 2. Enum List concern
6
+ 3. Enum Config concern
7
+ 4. Enum Code concern
8
+
9
+ ## v0.1.1
10
+ 1. Improve the Ruby Gem Specification to depend on Rails v4.2
data/Gemfile.lock ADDED
@@ -0,0 +1,135 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ progne_tapera (0.1)
5
+ rails (>= 4.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (5.0.0.1)
11
+ actionpack (= 5.0.0.1)
12
+ nio4r (~> 1.2)
13
+ websocket-driver (~> 0.6.1)
14
+ actionmailer (5.0.0.1)
15
+ actionpack (= 5.0.0.1)
16
+ actionview (= 5.0.0.1)
17
+ activejob (= 5.0.0.1)
18
+ mail (~> 2.5, >= 2.5.4)
19
+ rails-dom-testing (~> 2.0)
20
+ actionpack (5.0.0.1)
21
+ actionview (= 5.0.0.1)
22
+ activesupport (= 5.0.0.1)
23
+ rack (~> 2.0)
24
+ rack-test (~> 0.6.3)
25
+ rails-dom-testing (~> 2.0)
26
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
27
+ actionview (5.0.0.1)
28
+ activesupport (= 5.0.0.1)
29
+ builder (~> 3.1)
30
+ erubis (~> 2.7.0)
31
+ rails-dom-testing (~> 2.0)
32
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
33
+ activejob (5.0.0.1)
34
+ activesupport (= 5.0.0.1)
35
+ globalid (>= 0.3.6)
36
+ activemodel (5.0.0.1)
37
+ activesupport (= 5.0.0.1)
38
+ activerecord (5.0.0.1)
39
+ activemodel (= 5.0.0.1)
40
+ activesupport (= 5.0.0.1)
41
+ arel (~> 7.0)
42
+ activesupport (5.0.0.1)
43
+ concurrent-ruby (~> 1.0, >= 1.0.2)
44
+ i18n (~> 0.7)
45
+ minitest (~> 5.1)
46
+ tzinfo (~> 1.1)
47
+ arel (7.1.4)
48
+ builder (3.2.2)
49
+ concurrent-ruby (1.0.2)
50
+ diff-lcs (1.2.5)
51
+ erubis (2.7.0)
52
+ globalid (0.3.7)
53
+ activesupport (>= 4.1.0)
54
+ i18n (0.7.0)
55
+ loofah (2.0.3)
56
+ nokogiri (>= 1.5.9)
57
+ mail (2.6.4)
58
+ mime-types (>= 1.16, < 4)
59
+ method_source (0.8.2)
60
+ mime-types (3.1)
61
+ mime-types-data (~> 3.2015)
62
+ mime-types-data (3.2016.0521)
63
+ mini_portile2 (2.1.0)
64
+ minitest (5.9.1)
65
+ nio4r (1.2.1)
66
+ nokogiri (1.6.8)
67
+ mini_portile2 (~> 2.1.0)
68
+ pkg-config (~> 1.1.7)
69
+ pkg-config (1.1.7)
70
+ rack (2.0.1)
71
+ rack-test (0.6.3)
72
+ rack (>= 1.0)
73
+ rails (5.0.0.1)
74
+ actioncable (= 5.0.0.1)
75
+ actionmailer (= 5.0.0.1)
76
+ actionpack (= 5.0.0.1)
77
+ actionview (= 5.0.0.1)
78
+ activejob (= 5.0.0.1)
79
+ activemodel (= 5.0.0.1)
80
+ activerecord (= 5.0.0.1)
81
+ activesupport (= 5.0.0.1)
82
+ bundler (>= 1.3.0, < 2.0)
83
+ railties (= 5.0.0.1)
84
+ sprockets-rails (>= 2.0.0)
85
+ rails-dom-testing (2.0.1)
86
+ activesupport (>= 4.2.0, < 6.0)
87
+ nokogiri (~> 1.6.0)
88
+ rails-html-sanitizer (1.0.3)
89
+ loofah (~> 2.0)
90
+ railties (5.0.0.1)
91
+ actionpack (= 5.0.0.1)
92
+ activesupport (= 5.0.0.1)
93
+ method_source
94
+ rake (>= 0.8.7)
95
+ thor (>= 0.18.1, < 2.0)
96
+ rake (11.3.0)
97
+ rspec (3.5.0)
98
+ rspec-core (~> 3.5.0)
99
+ rspec-expectations (~> 3.5.0)
100
+ rspec-mocks (~> 3.5.0)
101
+ rspec-core (3.5.2)
102
+ rspec-support (~> 3.5.0)
103
+ rspec-expectations (3.5.0)
104
+ diff-lcs (>= 1.2.0, < 2.0)
105
+ rspec-support (~> 3.5.0)
106
+ rspec-mocks (3.5.0)
107
+ diff-lcs (>= 1.2.0, < 2.0)
108
+ rspec-support (~> 3.5.0)
109
+ rspec-support (3.5.0)
110
+ sprockets (3.7.0)
111
+ concurrent-ruby (~> 1.0)
112
+ rack (> 1, < 3)
113
+ sprockets-rails (3.2.0)
114
+ actionpack (>= 4.0)
115
+ activesupport (>= 4.0)
116
+ sprockets (>= 3.0.0)
117
+ thor (0.19.1)
118
+ thread_safe (0.3.5)
119
+ tzinfo (1.2.2)
120
+ thread_safe (~> 0.1)
121
+ websocket-driver (0.6.4)
122
+ websocket-extensions (>= 0.1.0)
123
+ websocket-extensions (0.1.2)
124
+
125
+ PLATFORMS
126
+ ruby
127
+
128
+ DEPENDENCIES
129
+ bundler (~> 1.12)
130
+ progne_tapera!
131
+ rake (~> 11.3)
132
+ rspec (~> 3.5)
133
+
134
+ BUNDLED WITH
135
+ 1.12.5
data/README.md CHANGED
@@ -1,8 +1,21 @@
1
- # ProgneTapera
1
+ # Progne Tapera
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/progne_tapera.svg)](https://badge.fury.io/rb/progne_tapera)
5
+ [![Dependency Status](https://gemnasium.com/badges/github.com/topbitdu/progne_tapera.svg)](https://gemnasium.com/github.com/topbitdu/progne_tapera)
2
6
 
3
7
  Progne Tapera is a Rails-based configurable enumeration implementation. Progne Tapera is the Brown-chested Martin in Latin.
4
8
  Progne Tapera 是基于 Rails 的可配置的枚举实现。Progne Tapera 是棕胸崖燕的拉丁学名。
5
9
 
10
+
11
+
12
+ ## Recent Update
13
+
14
+ Check out the [Road Map](ROADMAP.md) to find out what's the next.
15
+ Check out the [Change Log](CHANGELOG.md) to find out what's new.
16
+
17
+
18
+
6
19
  ## Installation
7
20
 
8
21
  Add this line to your application's Gemfile:
@@ -19,13 +32,115 @@ Or install it yourself as:
19
32
 
20
33
  $ gem install progne_tapera
21
34
 
35
+
36
+
22
37
  ## Usage
23
38
 
24
- TODO: Write usage instructions here
39
+ config/initializers/enum.rb
40
+ ```ruby
41
+ Unidom::Common::YamlHelper.load_enum config: Rails.configuration, root: Rails.root
42
+ ```
43
+
44
+ config/enum.yml
45
+ ```yaml
46
+ enum:
47
+
48
+ gender:
49
+ male:
50
+ code: '1'
51
+ female:
52
+ code: '2'
53
+ not_specified:
54
+ code: '9'
55
+
56
+ china_ethnicity:
57
+ han:
58
+ code: HA
59
+ numeric_code: '01'
60
+ mongel:
61
+ code: 'MG'
62
+ numeric_code: '02'
63
+ ```
64
+
65
+ config/locales/enum.zh-CN.yml
66
+ ```yaml
67
+ 'zh-CN':
68
+ enum:
69
+
70
+ gender:
71
+ male: 男
72
+ female: 女
73
+ not_specified: 未指定
74
+
75
+ china_ethnicity:
76
+ han: 汉
77
+ mongel: 蒙古
78
+ ```
79
+
80
+ app/types/gender.rb
81
+ ```ruby
82
+ class Gender < ActiveRecord::Type::Value
83
+
84
+ include ProgneTapera::EnumConfig
85
+
86
+ enum
87
+
88
+ end
89
+ ```
90
+
91
+ app/types/ethnicity.rb
92
+ ```ruby
93
+ class Ethnicity < ActiveRecord::Type::Value
94
+
95
+ include ProgneTapera::EnumConfig
96
+
97
+ enum :china_ethnicity
98
+
99
+ end
100
+ ```
101
+
102
+
103
+
104
+ ## Include the Concerns
105
+
106
+ ```ruby
107
+ include ProgneTapera::EnumList
108
+ include ProgneTapera::EnumConfig
109
+ include ProgneTapera::EnumCode
110
+ ```
111
+
112
+ ### Enum List concern
113
+
114
+ The Enum List concern do the following tasks for the includer automatically:
115
+ 1. Include the Enumerable module
116
+ 2. Define the .enum_name method as: ``enum_name(name = nil)``
117
+ 3. Define the .item_defined? method as: ``item_defined?(item)``
118
+ 4. Define the .add_item method as: ``add_item(item)``
119
+ 5. Define the .safe_add_item method as: ``safe_add_item(item)``
120
+ 6. Define the .enum_constants method as: ``enum_constants``
121
+ 7. Define the .all method as: ``all``
122
+ 8. Define the .selected method as: ``selected(&block)``
123
+ 9. Define the .each method as: ``each(&block)``
124
+ 10. Define the .form_options method as: ``form_options(&block)``
125
+ 11. Define the .deserialize method as: ``deserialize(value)``
126
+ 12. Define the .serialize method as: ``serialize(value)``
127
+
128
+ ### Enum Config concern
129
+
130
+ The Enum Config concern do the following tasks for the includer automatically:
131
+ 1. Include the Enum List concern
132
+ 2. Define the .enum method as: ``enum(name = nil)``
133
+
134
+ ### Enum Code concern
135
+
136
+ The Enum Code concern do the following tasks for the includer automatically:
137
+ 1. Define the .code method as: ``code(field, enum)``
138
+
139
+
25
140
 
26
141
  ## Contributing
27
142
 
28
- 1. Fork it ( https://github.com/[my-github-username]/progne_tapera/fork )
143
+ 1. Fork it ( https://github.com/topbitdu/progne_tapera/fork )
29
144
  2. Create your feature branch (`git checkout -b my-new-feature`)
30
145
  3. Commit your changes (`git commit -am 'Add some feature'`)
31
146
  4. Push to the branch (`git push origin my-new-feature`)
data/ROADMAP.md ADDED
@@ -0,0 +1,10 @@
1
+ # Progne Tapera Road Map 枚举库线路图
2
+
3
+ ## v0.1
4
+ 1. Enum Item class
5
+ 2. Enum List concern
6
+ 3. Enum Config concern
7
+ 4. Enum Code concern
8
+
9
+ ## v0.1.1
10
+ 1. Improve the Ruby Gem Specification to depend on Rails v4.2
data/Rakefile CHANGED
@@ -1,2 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
2
3
 
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -1,3 +1,3 @@
1
1
  module ProgneTapera
2
- VERSION = "0.1"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -4,23 +4,24 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'progne_tapera/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "progne_tapera"
7
+ spec.name = 'progne_tapera'
8
8
  spec.version = ProgneTapera::VERSION
9
- spec.authors = ["Du Hengfeng"]
10
- spec.email = ["topbit.du@gmail.com"]
11
- spec.summary = %q{A configurable enumeration for Ruby.}
12
- spec.description = %q{Progne Tapera is another enum implementation for Ruby. It focuses on configurable enumeration.}
13
- spec.homepage = ""
14
- spec.license = "MIT"
9
+ spec.authors = [ 'Topbit Du' ]
10
+ spec.email = [ 'topbit.du@gmail.com' ]
11
+ spec.summary = 'Rails-based configurable enumeration 基于 Rails 的可配置的枚举'
12
+ spec.description = 'Progne Tapera is a Rails-based configurable enumeration implementation. Progne Tapera is the Brown-chested Martin in Latin. Progne Tapera 是基于 Rails 的可配置的枚举实现。Progne Tapera 是棕胸崖燕的拉丁学名。'
13
+ spec.homepage = 'https://github.com/topbitdu/progne_tapera'
14
+ spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
19
+ spec.require_paths = [ 'lib' ]
20
20
 
21
- spec.add_dependency "rails", "~> 5.0"
22
- spec.add_development_dependency "bundler", "~> 1.12"
23
- spec.add_development_dependency "rake", "~> 11.3"
24
- spec.add_development_dependency "rspec", "~> 3.5"
21
+ spec.add_dependency 'rails', '>= 4.2'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.12'
24
+ spec.add_development_dependency 'rake', '~> 11.3'
25
+ spec.add_development_dependency 'rspec', '~> 3.5'
25
26
 
26
27
  end
@@ -1,5 +1,4 @@
1
1
  require 'spec_helper'
2
- require 'progne_tapera'
3
2
 
4
3
  describe ProgneTapera::EnumItem do
5
4
 
@@ -1,5 +1,4 @@
1
1
  require 'spec_helper'
2
- require 'progne_tapera'
3
2
 
4
3
  describe ProgneTapera::EnumList do
5
4
 
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'progne_tapera'
2
+
1
3
  # This file was generated by the `rspec --init` command. Conventionally, all
2
4
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
5
  # The generated `.rspec` file contains `--require spec_helper` which will cause
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: progne_tapera
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
- - Du Hengfeng
7
+ - Topbit Du
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-25 00:00:00.000000000 Z
11
+ date: 2016-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.0'
19
+ version: '4.2'
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: '5.0'
26
+ version: '4.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -66,8 +66,9 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.5'
69
- description: Progne Tapera is another enum implementation for Ruby. It focuses on
70
- configurable enumeration.
69
+ description: Progne Tapera is a Rails-based configurable enumeration implementation.
70
+ Progne Tapera is the Brown-chested Martin in Latin. Progne Tapera 是基于 Rails 的可配置的枚举实现。Progne
71
+ Tapera 是棕胸崖燕的拉丁学名。
71
72
  email:
72
73
  - topbit.du@gmail.com
73
74
  executables: []
@@ -76,10 +77,12 @@ extra_rdoc_files: []
76
77
  files:
77
78
  - ".gitignore"
78
79
  - ".rspec"
79
- - CHANGELOG
80
+ - CHANGELOG.md
80
81
  - Gemfile
82
+ - Gemfile.lock
81
83
  - LICENSE.txt
82
84
  - README.md
85
+ - ROADMAP.md
83
86
  - Rakefile
84
87
  - lib/progne_tapera.rb
85
88
  - lib/progne_tapera/enum_code.rb
@@ -91,7 +94,7 @@ files:
91
94
  - spec/progne_tapera/enum_item_spec.rb
92
95
  - spec/progne_tapera/enum_list_spec.rb
93
96
  - spec/spec_helper.rb
94
- homepage: ''
97
+ homepage: https://github.com/topbitdu/progne_tapera
95
98
  licenses:
96
99
  - MIT
97
100
  metadata: {}
@@ -114,7 +117,7 @@ rubyforge_project:
114
117
  rubygems_version: 2.6.4
115
118
  signing_key:
116
119
  specification_version: 4
117
- summary: A configurable enumeration for Ruby.
120
+ summary: Rails-based configurable enumeration 基于 Rails 的可配置的枚举
118
121
  test_files:
119
122
  - spec/progne_tapera/enum_item_spec.rb
120
123
  - spec/progne_tapera/enum_list_spec.rb
data/CHANGELOG DELETED
@@ -1 +0,0 @@
1
- Version 0.0.1: The initial EnumListing module and EnumItem class is released.