rails_map 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48342f6fbf73d56fd547dfd0565604fc58165a331b4890d2e22c4abc31838498
4
- data.tar.gz: 32163fbc27d52a6615d639008f38dada8f16c64da83e80c8679b899db6003e68
3
+ metadata.gz: a917f534a942aae52659013098e9a87a86092ca89c78c0759698282bc79d4793
4
+ data.tar.gz: be81c66e4763e7684840e2b4231d18123d32949c42a05f22ab7a3f44f082c25b
5
5
  SHA512:
6
- metadata.gz: 9d779878c8463a756d8817102cacb2c8c2f494f41247893aad4e450be8fd3a6800984d76286e7e701c48247e3ec2e12498ef8df2e06c01f88fd7c6c3f64bec47
7
- data.tar.gz: 3d01c86330c56e2fd4d3b620d69ad1e068749ad3c1e1d3105cee1b2f4d5d2478bf765ffdb016aab08f205dbc4f394ea464dcb894962adf2feb1611eb068ffb43
6
+ metadata.gz: a03362eb156c285cd3404ba16a68ede65fe91f923b9887a902bef8745af066bfa98d51b356a3efe43a62c77d0a06e083aeba30bf27e9fa41a97b213df2541209
7
+ data.tar.gz: fcf7e3cb1e9db8bfeee79986324b541eb221a4b1dcaa26681f8bbb47ed4bb927a7038021388780a9c8b2d1cea196e0d4d0e2e89a83162de22a055b5c68b27082
data/CHANGELOG.md CHANGED
@@ -67,7 +67,7 @@ Then visit `http://localhost:3000/rails-map` instead of `/api-doc`.
67
67
  - Automatic configuration file creation
68
68
  - Automatic engine mounting in routes
69
69
  - Automatic user migration creation (unless `--skip-auth`)
70
- - Automatic addition of `/doc/api` to `.gitignore`
70
+ - Automatic addition of `/doc/rails-map` to `.gitignore`
71
71
  - Authentication support with `authenticate_with` configuration option
72
72
  - `RailsMap::Auth` helper module for authentication
73
73
  - Example configuration file with authentication examples
data/QUICKSTART.md CHANGED
@@ -34,7 +34,7 @@ This automatically:
34
34
  - ✅ Creates `config/initializers/rails_map.rb` with auth enabled
35
35
  - ✅ Mounts the engine in `config/routes.rb`
36
36
  - ✅ Creates user migration
37
- - ✅ Adds `/doc/api` to `.gitignore`
37
+ - ✅ Adds `/doc/rails-map` to `.gitignore`
38
38
 
39
39
  2. Create an admin user:
40
40
 
@@ -135,7 +135,7 @@ rails doc:open # Open in browser
135
135
  rails doc:clean # Remove generated files
136
136
  ```
137
137
 
138
- Files are generated in `doc/api/` by default.
138
+ Files are generated in `doc/rails-map/` by default.
139
139
 
140
140
  ## Troubleshooting
141
141
 
data/README.md CHANGED
@@ -54,7 +54,7 @@ This automatically:
54
54
 
55
55
  - ✅ Creates `config/initializers/rails_map.rb` with authentication enabled
56
56
  - ✅ Mounts the engine at `/rails-map`
57
- - ✅ Adds `/doc/api` to `.gitignore`
57
+ - ✅ Adds `/doc/rails-map` to `.gitignore`
58
58
  - ✅ Uses default credentials (admin/password) if ENV variables not set
59
59
 
60
60
  Start your server and visit `http://localhost:3000/rails-map` - you'll be prompted to login!
@@ -71,7 +71,7 @@ This will:
71
71
 
72
72
  - ✅ Create the configuration file (auth disabled)
73
73
  - ✅ Mount the engine at `/rails-map`
74
- - ✅ Add `/doc/api` to `.gitignore`
74
+ - ✅ Add `/doc/rails-map` to `.gitignore`
75
75
 
76
76
  Start your server and visit `/rails-map` - no login required!
77
77
 
@@ -95,7 +95,7 @@ Run the following rake task to generate static HTML documentation:
95
95
  rails doc:generate
96
96
  ```
97
97
 
98
- This will generate HTML documentation in `doc/api/` directory.
98
+ This will generate HTML documentation in `doc/rails-map/` directory.
99
99
 
100
100
  ### Open Documentation in Browser
101
101
 
@@ -116,7 +116,7 @@ Create an initializer `config/initializers/rails_map.rb`:
116
116
  ```ruby
117
117
  RailsMap.configure do |config|
118
118
  # Output directory for generated documentation
119
- config.output_dir = Rails.root.join('doc', 'api').to_s
119
+ config.output_dir = Rails.root.join('doc', 'rails-map').to_s
120
120
 
121
121
  # Application name displayed in the documentation
122
122
  config.app_name = 'My Application'
data/SECURITY.md CHANGED
@@ -94,7 +94,7 @@ For production, consider using static HTML generation instead of live documentat
94
94
 
95
95
  ```bash
96
96
  rails doc:generate
97
- # Deploy the doc/api folder to a secure location
97
+ # Deploy the doc/rails-map folder to a secure location
98
98
  ```
99
99
 
100
100
  ### 6. Keep Updated
@@ -11,7 +11,7 @@ RailsMap.configure do |config|
11
11
  config.theme_color = '#3B82F6'
12
12
 
13
13
  # Output directory for static HTML generation
14
- config.output_dir = Rails.root.join('doc', 'api').to_s
14
+ config.output_dir = Rails.root.join('doc', 'rails-map').to_s
15
15
 
16
16
  # Include timestamp columns (created_at, updated_at) in model documentation
17
17
  config.include_timestamps = true
@@ -1,13 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rails/generators'
4
- require 'rails/generators/migration'
5
4
 
6
5
  module RailsMap
7
6
  module Generators
8
7
  class InstallGenerator < Rails::Generators::Base
9
- include Rails::Generators::Migration
10
-
11
8
  source_root File.expand_path('templates', __dir__)
12
9
 
13
10
  desc "Installs RailsMap with environment-based authentication (use --skip-auth to disable)"
@@ -31,13 +28,13 @@ module RailsMap
31
28
  if File.exist?(gitignore_path)
32
29
  gitignore_content = File.read(gitignore_path)
33
30
 
34
- unless gitignore_content.include?('doc/api')
31
+ unless gitignore_content.include?('doc/rails-map')
35
32
  append_to_file gitignore_path do
36
- "\n# Ignore generated documentation\n/doc/api\n"
33
+ "\n# Ignore generated documentation\n/doc/rails-map\n"
37
34
  end
38
35
  end
39
36
  else
40
- create_file gitignore_path, "# Ignore generated documentation\n/doc/api\n"
37
+ create_file gitignore_path, "# Ignore generated documentation\n/doc/rails-map\n"
41
38
  end
42
39
  end
43
40
 
@@ -10,7 +10,7 @@ config/initializers/rails_map.rb
10
10
  mount RailsMap::Engine, at: '/rails-map'
11
11
  <% end %>
12
12
 
13
- ✓ Added /doc/api to .gitignore
13
+ ✓ Added /doc/rails-map to .gitignore
14
14
 
15
15
  <% unless options[:skip_auth] %>
16
16
  Authentication has been ENABLED (default)
@@ -2,13 +2,13 @@
2
2
 
3
3
  RailsMap.configure do |config|
4
4
  # Application name displayed in the documentation
5
- config.app_name = '<%= Rails.application.class.module_parent_name %>'
5
+ config.app_name = '<%= Rails.application.class.respond_to?(:module_parent_name) ? Rails.application.class.module_parent_name : Rails.application.class.parent_name %>'
6
6
 
7
7
  # Theme color (any valid CSS color)
8
8
  config.theme_color = '#3B82F6'
9
9
 
10
10
  # Output directory for static HTML generation
11
- config.output_dir = Rails.root.join('doc', 'api').to_s
11
+ config.output_dir = Rails.root.join('doc', 'rails-map').to_s
12
12
 
13
13
  # Include timestamp columns (created_at, updated_at) in model documentation
14
14
  config.include_timestamps = true
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateRailsMapUsers < ActiveRecord::Migration[7.0]
3
+ class CreateRailsMapUsers < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
4
4
  def change
5
5
  create_table :rails_map_users do |t|
6
6
  t.string :username, null: false
@@ -18,15 +18,20 @@ module RailsMap
18
18
 
19
19
  def default_output_dir
20
20
  if defined?(Rails)
21
- Rails.root.join("doc", "api").to_s
21
+ Rails.root.join("doc", "rails-map").to_s
22
22
  else
23
- File.join(Dir.pwd, "doc", "api")
23
+ File.join(Dir.pwd, "doc", "rails-map")
24
24
  end
25
25
  end
26
26
 
27
27
  def default_app_name
28
28
  if defined?(Rails)
29
- Rails.application.class.module_parent_name
29
+ app_class = Rails.application.class
30
+ if app_class.respond_to?(:module_parent_name)
31
+ app_class.module_parent_name
32
+ else
33
+ app_class.parent_name
34
+ end
30
35
  else
31
36
  "Rails Application"
32
37
  end
@@ -42,7 +42,7 @@ module RailsMap
42
42
  if defined?(Rails.root)
43
43
  Dir[Rails.root.join('app/models/**/*.rb')].each do |file|
44
44
  begin
45
- require_dependency file
45
+ require file
46
46
  rescue => e
47
47
  # Ignore errors, file might already be loaded
48
48
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsMap
4
- VERSION = "1.2.0"
4
+ VERSION = "1.3.0"
5
5
  end
data/rails-map-gem.png ADDED
Binary file
@@ -33,8 +33,7 @@
33
33
  <th>Method</th>
34
34
  <th>Path</th>
35
35
  <th>Action</th>
36
- <th>Route Name</th>
37
- <th>Constraints</th>
36
+ <th>Parameters</th>
38
37
  </tr>
39
38
  </thead>
40
39
  <tbody>
@@ -48,19 +47,41 @@
48
47
  <td><code><%= route.path %></code></td>
49
48
  <td><code><%= route.action %></code></td>
50
49
  <td>
51
- <% if route.name %>
52
- <code><%= route.name %></code>
53
- <% else %>
54
- <span style="color: var(--text-muted);">—</span>
50
+ <% all_params = [] %>
51
+ <% all_params += route.path_params if route.path_params&.any? %>
52
+ <% verb = route.verb.to_s.upcase %>
53
+ <% if %w[GET DELETE].include?(verb) %>
54
+ <% all_params += route.query_params if route.query_params&.any? %>
55
+ <% elsif %w[POST PUT PATCH].include?(verb) %>
56
+ <% all_params += route.request_body_params if route.request_body_params&.any? %>
55
57
  <% end %>
56
- </td>
57
- <td>
58
- <% if route.constraints.any? %>
59
- <% route.constraints.each do |key, value| %>
60
- <code><%= key %>: <%= value %></code><br>
61
- <% end %>
58
+
59
+ <% if all_params.any? %>
60
+ <details style="cursor: pointer;">
61
+ <summary style="color: var(--primary-color); font-weight: 500;">
62
+ <%= all_params.size %> parameter<%= all_params.size > 1 ? 's' : '' %>
63
+ </summary>
64
+ <div style="margin-top: 0.5rem; padding: 0.75rem; background: var(--bg-color); border-radius: 6px; font-size: 0.875rem;">
65
+ <% all_params.each do |param| %>
66
+ <div style="margin-bottom: 0.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border-color);">
67
+ <div style="display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem;">
68
+ <code style="font-weight: 600; color: var(--primary-color);"><%= param[:name] %></code>
69
+ <span class="badge" style="font-size: 0.75rem; padding: 0.125rem 0.375rem;"><%= param[:type] %></span>
70
+ <% if param[:required] %>
71
+ <span style="color: #dc2626; font-size: 0.75rem; font-weight: 600;">required</span>
72
+ <% else %>
73
+ <span style="color: #6b7280; font-size: 0.75rem;">optional</span>
74
+ <% end %>
75
+ </div>
76
+ <div style="color: #6b7280; font-size: 0.75rem;">
77
+ Location: <%= param[:location] %>
78
+ </div>
79
+ </div>
80
+ <% end %>
81
+ </div>
82
+ </details>
62
83
  <% else %>
63
- <span style="color: var(--text-muted);">—</span>
84
+ <span style="color: var(--text-muted);">No parameters</span>
64
85
  <% end %>
65
86
  </td>
66
87
  </tr>
@@ -283,7 +283,7 @@
283
283
  </main>
284
284
 
285
285
  <footer style="text-align: center; padding: 2rem; color: var(--text-muted); font-size: 0.875rem;">
286
- Generated by RailsDocGenerator on <%= Time.now.strftime('%Y-%m-%d %H:%M:%S') %>
286
+ Generated by <a href="https://github.com/ArshdeepGrover/rails-map" target="_blank">RailsMap</a> on <%= Time.now.strftime('%Y-%m-%d %H:%M:%S') %>
287
287
  </footer>
288
288
  </body>
289
289
  </html>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_map
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arshdeep Singh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-02-12 00:00:00.000000000 Z
11
+ date: 2026-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -133,6 +133,7 @@ files:
133
133
  - lib/rails_map/parsers/route_parser.rb
134
134
  - lib/rails_map/railtie.rb
135
135
  - lib/rails_map/version.rb
136
+ - rails-map-gem.png
136
137
  - release.sh
137
138
  - templates/controller.html.erb
138
139
  - templates/index.html.erb