feature_pack 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/feature_pack/add_feature/USAGE +8 -0
- data/lib/generators/feature_pack/add_feature/add_feature_generator.rb +29 -0
- data/lib/generators/feature_pack/add_feature/templates/controller.rb.tt +3 -0
- data/lib/generators/feature_pack/add_feature/templates/doc/readme.md.tt +1 -0
- data/lib/generators/feature_pack/add_feature/templates/manifest.yaml.tt +14 -0
- data/lib/generators/feature_pack/add_feature/templates/routes.rb.tt +1 -0
- data/lib/generators/feature_pack/add_feature/templates/views/home.html.slim.tt +2 -0
- data/lib/generators/feature_pack/add_feature/templates/views/partials/_footer.html.slim.tt +2 -0
- data/lib/generators/feature_pack/add_feature/templates/views/partials/_header.html.slim.tt +2 -0
- data/lib/generators/feature_pack/add_group/add_group_generator.rb +1 -1
- metadata +10 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e2946dd4dbd9336908bb8044877f745a97d44ee11fa125eb3a8a77f0102c3c2
|
4
|
+
data.tar.gz: 5e29ad8bcf002715386a2c93fa9a2ef4e9cb5922a49f198dbcdcd9e43caac354
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad1e716ab8b251c4c6677074e338ad84ecaf127e3f6c2acd6a1b52a9ddcb27c7ad6346812645499e269ca6bd929bf14888585026ef0adebfd7a2275be73ff883
|
7
|
+
data.tar.gz: 8ed15f2382e2c3cc301e55e649e916cb1925ba4c4987e871e9a26156eb0ecb347315cee8b2a25d1a55d162fa367c21ea1dfe73132a211d482f61707630b1236a
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class FeaturePack::AddFeatureGenerator < Rails::Generators::NamedBase
|
2
|
+
desc 'Adds a new Feature'
|
3
|
+
source_root File.expand_path('templates', __dir__)
|
4
|
+
|
5
|
+
argument :name, type: :string, required: true, desc: 'The name (sneak case) of the group to add'
|
6
|
+
|
7
|
+
def add_feature
|
8
|
+
@group_name, @feature_name = name.split('/')
|
9
|
+
@group = FeaturePack.group(@group_name.to_sym)
|
10
|
+
@group_class_name = @group_name.camelcase
|
11
|
+
@feature_class_name = @feature_name.camelcase
|
12
|
+
|
13
|
+
raise "Group '#{@group_name}' doesn't exist. First, create it." if @group.nil?
|
14
|
+
|
15
|
+
raise "Feature '#{@group_class_name}::#{@feature_class_name}' already Exist." if FeaturePack.feature(@group_name.to_sym, @feature_name.to_sym).present?
|
16
|
+
|
17
|
+
@feature_id = @feature_name.gsub('_', '-') + '-' + '999'
|
18
|
+
@feature_dir = @group.relative_path.join("feature_#{@feature_id}_#{@feature_name}")
|
19
|
+
|
20
|
+
template './controller.rb.tt', @feature_dir.join('controller.rb')
|
21
|
+
template './manifest.yaml.tt', @feature_dir.join('manifest.yaml')
|
22
|
+
template './routes.rb.tt', @feature_dir.join('routes.rb')
|
23
|
+
template './views/home.html.slim.tt', @feature_dir.join('views/home.html.slim')
|
24
|
+
template './views/partials/_header.html.slim.tt', @feature_dir.join('views/partials/_header.html.slim')
|
25
|
+
template './views/partials/_footer.html.slim.tt', @feature_dir.join('views/partials/_footer.html.slim')
|
26
|
+
template './doc/readme.md.tt', @feature_dir.join('doc/readme.md')
|
27
|
+
create_file @feature_dir.join('queries', '.gitkeep')
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
# <%= @feature_name%>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
:name: Feature Friendly Name
|
2
|
+
:description:
|
3
|
+
:type: :alert
|
4
|
+
:url: <%= @feature_name.gsub('_', '-') %>
|
5
|
+
:version: 1.0.0
|
6
|
+
:policy:
|
7
|
+
:admin: '*'
|
8
|
+
:coordenacao_aps: '*'
|
9
|
+
:coordenacao_atividade_fisica: '*'
|
10
|
+
:coordenacao_saude_bucal:
|
11
|
+
- :lista_equipes_saude_bucal
|
12
|
+
:professional:
|
13
|
+
- :whatsapp_text_alert
|
14
|
+
- :whatsapp_protected_pdf
|
@@ -0,0 +1 @@
|
|
1
|
+
get '/', to: '<%= @feature_name %>#home'
|
@@ -11,7 +11,7 @@ class FeaturePack::AddGroupGenerator < Rails::Generators::NamedBase
|
|
11
11
|
@class_name = name.camelcase
|
12
12
|
|
13
13
|
# id can't contain underline '_'
|
14
|
-
group_id = name.gsub('_', '-') + '-' + '
|
14
|
+
group_id = name.gsub('_', '-') + '-' + '999'
|
15
15
|
group_dir = FeaturePack.features_path.join("group_#{group_id}_#{name}")
|
16
16
|
|
17
17
|
template './_group_metadata/controller.rb.tt', group_dir.join('_group_metadata', 'controller.rb')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feature_pack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gedean Dias
|
@@ -40,6 +40,15 @@ files:
|
|
40
40
|
- lib/feature_pack/error.rb
|
41
41
|
- lib/feature_pack/feature_pack_routes.rb
|
42
42
|
- lib/feature_pack/group_controller.rb
|
43
|
+
- lib/generators/feature_pack/add_feature/USAGE
|
44
|
+
- lib/generators/feature_pack/add_feature/add_feature_generator.rb
|
45
|
+
- lib/generators/feature_pack/add_feature/templates/controller.rb.tt
|
46
|
+
- lib/generators/feature_pack/add_feature/templates/doc/readme.md.tt
|
47
|
+
- lib/generators/feature_pack/add_feature/templates/manifest.yaml.tt
|
48
|
+
- lib/generators/feature_pack/add_feature/templates/routes.rb.tt
|
49
|
+
- lib/generators/feature_pack/add_feature/templates/views/home.html.slim.tt
|
50
|
+
- lib/generators/feature_pack/add_feature/templates/views/partials/_footer.html.slim.tt
|
51
|
+
- lib/generators/feature_pack/add_feature/templates/views/partials/_header.html.slim.tt
|
43
52
|
- lib/generators/feature_pack/add_group/USAGE
|
44
53
|
- lib/generators/feature_pack/add_group/add_group_generator.rb
|
45
54
|
- lib/generators/feature_pack/add_group/templates/_group_metadata/controller.rb.tt
|