sparrow-entity 0.1.0 → 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/.rubocop.yml +3 -0
- data/Gemfile.lock +1 -1
- data/lib/generators/sparrow/entity/USAGE +11 -0
- data/lib/generators/sparrow/entity/entity_generator.rb +23 -0
- data/lib/generators/sparrow/entity/templates/sparrow_entity.rb.erb +15 -0
- data/lib/sparrow/version.rb +1 -1
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba7f73f798ef8f46951bba6feb55e71b9809c4a4b54e3e1be7840c6b5f4193d4
|
4
|
+
data.tar.gz: 2e7646185c12d2c10b407899f6d0c71d4a8260653821d38c1c4cf3a9849b2af8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc06044da994a650876616956624c65cfb454f632f748212172ddb9c7e5bb6dd6e55e310253315d0693c007128923500193028ec7bf37ea10ded236743f0f186
|
7
|
+
data.tar.gz: 67cd395f4c53fae5d0c28576c2525d087a2e00cdc200272df7fa6167712c347361aa670f4e65d2770a189ad4f8cf59cdce0392711e509cea0756217117236a97
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Sparrow
|
4
|
+
#
|
5
|
+
# 创建一个自定义的创建 Sparrow::Base 的类。
|
6
|
+
#
|
7
|
+
# @author Shiner <shiner527@hotmail.com>
|
8
|
+
#
|
9
|
+
class EntityGenerator < Rails::Generators::NamedBase
|
10
|
+
# 默认的引入应用的相对安装路径
|
11
|
+
TARGET_RELATIVE_PATH = 'app/entities'
|
12
|
+
|
13
|
+
source_root File.expand_path('templates', __dir__)
|
14
|
+
|
15
|
+
#
|
16
|
+
# 复制模板文件到对应 Rails 项目中
|
17
|
+
#
|
18
|
+
def create_sparrow_class_file
|
19
|
+
sparrow_file_path = ::File.join(TARGET_RELATIVE_PATH, class_path, "#{file_name}.rb")
|
20
|
+
template 'sparrow_entity.rb.erb', sparrow_file_path
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SparrowEntity
|
4
|
+
#
|
5
|
+
# Create a sparrow entity class named <%= class_name %> by generator.
|
6
|
+
#
|
7
|
+
class <%= class_name %> < ::Sparrow::Base
|
8
|
+
#
|
9
|
+
# Useage:
|
10
|
+
#
|
11
|
+
# use field DSL to define attribute.
|
12
|
+
# like: <tt>field :name, String</tt> to define an string attribute called +name+.
|
13
|
+
#
|
14
|
+
end
|
15
|
+
end
|
data/lib/sparrow/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sparrow-entity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- shiner
|
@@ -176,6 +176,9 @@ files:
|
|
176
176
|
- bin/setup
|
177
177
|
- lib/config/locales/sparrow/base.en.yml
|
178
178
|
- lib/config/locales/sparrow/base.zh-CN.yml
|
179
|
+
- lib/generators/sparrow/entity/USAGE
|
180
|
+
- lib/generators/sparrow/entity/entity_generator.rb
|
181
|
+
- lib/generators/sparrow/entity/templates/sparrow_entity.rb.erb
|
179
182
|
- lib/sparrow.rb
|
180
183
|
- lib/sparrow/base.rb
|
181
184
|
- lib/sparrow/class_methods.rb
|