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 +4 -4
- data/.gitignore +1 -1
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +135 -0
- data/README.md +118 -3
- data/ROADMAP.md +10 -0
- data/Rakefile +4 -0
- data/lib/progne_tapera/version.rb +1 -1
- data/progne_tapera.gemspec +13 -12
- data/spec/progne_tapera/enum_item_spec.rb +0 -1
- data/spec/progne_tapera/enum_list_spec.rb +0 -1
- data/spec/spec_helper.rb +2 -0
- metadata +15 -12
- data/CHANGELOG +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c347517d3cc7131f1969253a474a29966720f1e1
|
4
|
+
data.tar.gz: da0e6d466b75fcc15823623de76a97e00e0335b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77d5dad91214242e8bca4fe35c0f33278648fd98c940da3c9e2a4b5898cf9439ba0fce86288835440d4ad192b594992ee4a7a0093da74ca2d4180d563fa6cd4f
|
7
|
+
data.tar.gz: 04d98c24b1377dfdd90524aaed64c3c53ff031fd121860297efb9e9d8e71ba76586857903c9fb1a2fb6fb31e5cfd4fb0687f39abddaa0b9975ecb0eba2b21365
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
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
|
-
#
|
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
|
-
|
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/
|
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
data/Rakefile
CHANGED
data/progne_tapera.gemspec
CHANGED
@@ -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 =
|
7
|
+
spec.name = 'progne_tapera'
|
8
8
|
spec.version = ProgneTapera::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
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 = [
|
19
|
+
spec.require_paths = [ 'lib' ]
|
20
20
|
|
21
|
-
spec.add_dependency
|
22
|
-
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
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
|
data/spec/spec_helper.rb
CHANGED
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:
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Du
|
7
|
+
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10
|
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: '
|
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: '
|
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
|
70
|
-
|
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:
|
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.
|