feature_pack 0.3.0 → 0.3.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
  SHA256:
3
- metadata.gz: c4d4c06a3ac9cc919e20a0616c0ec7b0d1da2553f43a4c5b140ef7a8bc29147a
4
- data.tar.gz: 21ae0804c870c884ee4270168327fa81eade33b261bb4adb915f87f49764ca41
3
+ metadata.gz: a358d066012fe6059153050e3887849afec64faf789a3668c696c8606347044c
4
+ data.tar.gz: 27141fe3653ff391a85301d9fcc5ea8676084403d0ad259b06528c22b6fab0ed
5
5
  SHA512:
6
- metadata.gz: a66fab958817fe7391449fe39d04043b9729e3bfc4a40b18e8ad6458e4a2f2c6a7ff863dfb0c8acf5841024bfdb34bb48e79c631c58949d655d1d0ca809fb8ec
7
- data.tar.gz: bcc1750715d4f4a88587b557bd75e5ed0e3c698fec80a1691942b5ff895ecd3b6041636dd4b325de811d3008551a1244aa10635b5a28e7180a41642a86420b54
6
+ metadata.gz: 22d7b9a11292d34b1fc5920741ac4e4033dbc1417cb59dd534ff4acd564b34ed46440b9f163aba77b077b70977852b6ad136f3c28363e927e394034b6a3b9f1a
7
+ data.tar.gz: c3b4d00e9a16dd5767a8ce1c79bfc689ddc3b07d2890c52c88d5046c7261a432c318a1d5950600d3bc5ffcc674175f3d54b5a3a919ebe94930777bc8ea53f308
@@ -0,0 +1,122 @@
1
+ # FeaturePack Library Documentation
2
+
3
+ ## Overview
4
+
5
+ The `FeaturePack` library is a Ruby module designed to manage and organize feature groups and individual features within a Rails application. It provides a structured way to handle feature-specific routes, controllers, views, and JavaScript files.
6
+
7
+ ## Key Components
8
+
9
+ ### Constants
10
+
11
+ - `GROUP_ID_PATTERN`: Regex pattern for group IDs
12
+ - `FEATURE_ID_PATTERN`: Regex pattern for feature IDs
13
+ - `GROUP_METADATA_DIRECTORY`: Name of the directory containing group metadata
14
+ - `MANIFEST_FILE_NAME`: Name of the manifest file for groups and features
15
+ - `CONTROLLER_FILE_NAME`: Name of the controller file
16
+
17
+ ### Attributes
18
+
19
+ The module defines several read-only attributes:
20
+
21
+ - `path`: Path to the FeaturePack library
22
+ - `features_path`: Path to the features directory
23
+ - `ignored_paths`: Paths to be ignored
24
+ - `groups`: Array of group objects
25
+ - `groups_controllers_paths`: Paths to group controllers
26
+ - `features_controllers_paths`: Paths to feature controllers
27
+ - `javascript_files_paths`: Paths to JavaScript files
28
+
29
+ ## Setup
30
+
31
+ The `setup` method initializes the FeaturePack library:
32
+
33
+ 1. Validates the provided `features_path`
34
+ 2. Sets up ignored paths
35
+ 3. Discovers and initializes groups and features
36
+ 4. Sets up routes and controllers for groups and features
37
+
38
+ ### Usage
39
+
40
+ ```ruby
41
+ FeaturePack.setup(features_path: '/path/to/features')
42
+ ```
43
+
44
+ ## Groups
45
+
46
+ Groups are represented as `OpenStruct` objects with the following properties:
47
+
48
+ - `id`: Unique identifier for the group
49
+ - `name`: Human-readable name of the group
50
+ - `metadata_path`: Path to the group's metadata directory
51
+ - `relative_path`: Relative path to the group directory
52
+ - `base_dir`: Base directory name
53
+ - `routes_file`: Path to the group's routes file (if exists)
54
+ - `features`: Array of feature objects belonging to this group
55
+ - `manifest`: Parsed content of the group's manifest file
56
+
57
+ Groups also have methods for accessing views and JavaScript modules.
58
+
59
+ ## Features
60
+
61
+ Features are represented as `OpenStruct` objects with the following properties:
62
+
63
+ - `id`: Unique identifier for the feature
64
+ - `name`: Human-readable name of the feature
65
+ - `group`: Reference to the parent group object
66
+ - `absolute_path`: Absolute path to the feature directory
67
+ - `relative_path`: Relative path to the feature directory
68
+ - `sub_path`: Sub-path of the feature directory
69
+ - `routes_file_path`: Path to the feature's routes file
70
+ - `routes_file`: Route name for the feature
71
+ - `views_absolute_path`: Absolute path to the feature's views
72
+ - `views_relative_path`: Relative path to the feature's views
73
+ - `javascript_relative_path`: Relative path to the feature's JavaScript files
74
+ - `manifest`: Parsed content of the feature's manifest file
75
+
76
+ Features also have methods for accessing their class name, namespace, views, and JavaScript modules.
77
+
78
+ ## Utility Methods
79
+
80
+ - `FeaturePack.group(group_name)`: Finds a group by name
81
+ - `FeaturePack.feature(group_name, feature_name)`: Finds a feature within a group
82
+
83
+ ## File Structure
84
+
85
+ The library expects the following file structure:
86
+
87
+ ```
88
+ features_path/
89
+ ├── group_name_1/
90
+ │ ├── _group_metadata/
91
+ │ │ ├── manifest.yaml
92
+ │ │ ├── controller.rb
93
+ │ │ └── routes.rb (optional)
94
+ │ ├── feature_name_1/
95
+ │ │ ├── manifest.yaml
96
+ │ │ ├── controller.rb
97
+ │ │ └── routes.rb
98
+ │ └── feature_name_2/
99
+ │ └── ...
100
+ └── group_name_2/
101
+ └── ...
102
+ ```
103
+
104
+ ## Manifest Files
105
+
106
+ Both groups and features use manifest files (`manifest.yaml`) to store metadata. These files can include `const_aliases` for defining method aliases to constants.
107
+
108
+ ## JavaScript Integration
109
+
110
+ The library automatically discovers and tracks JavaScript files within feature directories, making them accessible through the `javascript_files_paths` attribute.
111
+
112
+ ## Error Handling
113
+
114
+ The library includes basic error handling for invalid or non-existent paths and missing group/feature IDs.
115
+
116
+ ## Limitations and Notes
117
+
118
+ - The library assumes a specific directory structure and naming conventions.
119
+ - It relies on Rails' autoloading capabilities for controllers.
120
+ - Custom routes files for features are ignored to prevent conflicts with Rails' default routing.
121
+
122
+ This documentation provides an overview of the `FeaturePack` library's structure and functionality. For specific implementation details, refer to the inline comments and method definitions in the source code.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feature_pack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gedean Dias
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-30 00:00:00.000000000 Z
11
+ date: 2024-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '7.1'
19
+ version: '7.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: '7.1'
26
+ version: '7.2'
27
27
  description: Organizes and sets up the architecture of micro-applications within a
28
28
  Rails application, enabling the segregation of code, management, and isolation of
29
29
  functionalities, which can be developed, tested, and maintained independently of
@@ -34,6 +34,7 @@ extensions: []
34
34
  extra_rdoc_files: []
35
35
  files:
36
36
  - README.md
37
+ - doc/feature_pack.md
37
38
  - lib/feature_pack.rb
38
39
  - lib/feature_pack/api/controller.rb
39
40
  - lib/feature_pack/controller.rb
@@ -46,7 +47,7 @@ files:
46
47
  - lib/generators/feature_pack/add_feature/templates/doc/readme.md.tt
47
48
  - lib/generators/feature_pack/add_feature/templates/manifest.yaml.tt
48
49
  - 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/index.html.slim.tt
50
51
  - lib/generators/feature_pack/add_feature/templates/views/partials/_footer.html.slim.tt
51
52
  - lib/generators/feature_pack/add_feature/templates/views/partials/_header.html.slim.tt
52
53
  - lib/generators/feature_pack/add_group/USAGE