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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9474d2917faba0c23fdf4c37722442a16e4e2c74ffb3c1feee6d5fd5e29b16f3
4
- data.tar.gz: 7dc49809014676cb100aebb05b44af97486ed3254c81677b9bf96d058f10689d
3
+ metadata.gz: 3e2946dd4dbd9336908bb8044877f745a97d44ee11fa125eb3a8a77f0102c3c2
4
+ data.tar.gz: 5e29ad8bcf002715386a2c93fa9a2ef4e9cb5922a49f198dbcdcd9e43caac354
5
5
  SHA512:
6
- metadata.gz: c9791858b73654bd34566d6015435920b04c5a1933d019cbf21f69f54e4d8491d57adf8e155b4bbce1972caa54e4b6305096ccec8d724ef6220d186ad12f25ac
7
- data.tar.gz: a6b0cc7430ad8db23543f45e1c78b7dd1a4c980b7f2fc8f5d3f3eec174e0e882ded063473a63463386036a50b83e178484cf3dc20d1d8d95cca2d2f1e3087619
6
+ metadata.gz: ad1e716ab8b251c4c6677074e338ad84ecaf127e3f6c2acd6a1b52a9ddcb27c7ad6346812645499e269ca6bd929bf14888585026ef0adebfd7a2275be73ff883
7
+ data.tar.gz: 8ed15f2382e2c3cc301e55e649e916cb1925ba4c4987e871e9a26156eb0ecb347315cee8b2a25d1a55d162fa367c21ea1dfe73132a211d482f61707630b1236a
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ bin/rails generate add_feature Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -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,3 @@
1
+ class FeaturePack::<%= @group_class_name %>::<%= @feature_class_name %>Controller < FeaturePack::Controller
2
+ # home defined in parent controller
3
+ 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'
@@ -0,0 +1,2 @@
1
+ h1 Feature <%= @group_class_name%>::<%=@feature_class_name %> Home
2
+ p = "Find-me at #{__FILE__}"
@@ -0,0 +1,2 @@
1
+ h1 Feature <%= @group_class_name %>::<%= @feature_class_name %> Footer
2
+ p = "Edit-me OR delete-me at #{__FILE__}"
@@ -0,0 +1,2 @@
1
+ h1 Feature <%= @group_class_name %>::<%= @feature_class_name %> Header
2
+ p = "Edit-me OR delete-me at #{__FILE__}"
@@ -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('_', '-') + '-' + 'GIVE-ME-AN-ID'
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.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