rails_map 1.1.0 → 1.2.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.
@@ -21,7 +21,7 @@ module RailsMap
21
21
 
22
22
  def add_route_mount
23
23
  unless options[:skip_routes]
24
- route "mount RailsMap::Engine, at: '/api-doc'"
24
+ route "mount RailsMap::Engine, at: '/rails-map'"
25
25
  end
26
26
  end
27
27
 
@@ -3,11 +3,11 @@
3
3
  RailsMap has been installed!
4
4
 
5
5
  ✓ Configuration file created at:
6
- config/initializers/rails_map.rb
6
+ config/initializers/rails_map.rb
7
7
 
8
8
  <% unless options[:skip_routes] %>
9
9
  ✓ Route mounted in config/routes.rb:
10
- mount RailsMap::Engine, at: '/api-doc'
10
+ mount RailsMap::Engine, at: '/rails-map'
11
11
  <% end %>
12
12
 
13
13
  ✓ Added /doc/api to .gitignore
@@ -16,32 +16,34 @@ RailsMap has been installed!
16
16
  Authentication has been ENABLED (default)
17
17
 
18
18
  Next steps:
19
+
19
20
  1. Set environment variables:
20
- export RAILS_MAP_USERNAME=admin
21
- export RAILS_MAP_PASSWORD=your_secure_password
21
+ export RAILS_MAP_USERNAME=admin
22
+ export RAILS_MAP_PASSWORD=your_secure_password
22
23
 
23
24
  Or add to .env file:
24
- RAILS_MAP_USERNAME=admin
25
- RAILS_MAP_PASSWORD=your_secure_password
25
+ RAILS_MAP_USERNAME=admin
26
+ RAILS_MAP_PASSWORD=your_secure_password
26
27
 
27
- 2. Restart your server and visit /api-doc
28
+ 2. Restart your server and visit /rails-map
28
29
  You'll be prompted to login with your credentials
29
30
 
30
31
  To disable authentication, run:
31
- rails destroy rails_map:install
32
- rails g rails_map:install --skip-auth
32
+ rails destroy rails_map:install
33
+ rails g rails_map:install --skip-auth
33
34
  <% else %>
34
35
  Authentication has been DISABLED (--skip-auth flag used)
35
36
 
36
37
  To enable authentication:
38
+
37
39
  1. Set RAILS_MAP_USERNAME and RAILS_MAP_PASSWORD environment variables
38
40
  2. Uncomment authentication in config/initializers/rails_map.rb
39
- <% end %>
41
+ <% end %>
40
42
 
41
43
  Documentation:
42
- Visit http://localhost:3000/api-doc after starting your server
44
+ Visit http://localhost:3000/rails-map after starting your server
43
45
 
44
46
  For more information, see:
45
- https://rails-map.netlify.app
47
+ https://rails-map.netlify.app
46
48
 
47
49
  ===============================================================================
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsMap
4
- VERSION = "1.1.0"
4
+ VERSION = "1.2.0"
5
5
  end
data/release.sh ADDED
@@ -0,0 +1,338 @@
1
+ #!/bin/bash
2
+
3
+ # RailsMap Release Script
4
+ # This script builds, pushes the gem to RubyGems, and cleans up old gem files
5
+
6
+ set -e # Exit on error
7
+
8
+ # Colors for output
9
+ RED='\033[0;31m'
10
+ GREEN='\033[0;32m'
11
+ YELLOW='\033[1;33m'
12
+ BLUE='\033[0;34m'
13
+ NC='\033[0m' # No Color
14
+
15
+ # Function to print colored output
16
+ print_info() {
17
+ echo -e "${BLUE}ℹ ${NC}$1"
18
+ }
19
+
20
+ print_success() {
21
+ echo -e "${GREEN}✓${NC} $1"
22
+ }
23
+
24
+ print_warning() {
25
+ echo -e "${YELLOW}⚠${NC} $1"
26
+ }
27
+
28
+ print_error() {
29
+ echo -e "${RED}✗${NC} $1"
30
+ }
31
+
32
+ # Get the current version from version.rb
33
+ CURRENT_VERSION=$(ruby -r ./lib/rails_map/version.rb -e "puts RailsMap::VERSION")
34
+ GEM_NAME="rails_map"
35
+
36
+ echo ""
37
+ print_info "═══════════════════════════════════════════════════════"
38
+ print_info " RailsMap Release Script"
39
+ print_info "═══════════════════════════════════════════════════════"
40
+ echo ""
41
+
42
+ # Show current version
43
+ print_info "Current version: ${CURRENT_VERSION}"
44
+ echo ""
45
+
46
+ # Ask for new version
47
+ print_warning "Enter the new version number (e.g., 1.2.0, 1.2.1, 2.0.0):"
48
+ read -p "Version: " NEW_VERSION
49
+
50
+ # Validate version format
51
+ if [[ ! $NEW_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
52
+ print_error "Invalid version format. Please use semantic versioning (e.g., 1.2.0)"
53
+ exit 1
54
+ fi
55
+
56
+ # Check if version is different
57
+ if [ "$NEW_VERSION" == "$CURRENT_VERSION" ]; then
58
+ print_warning "New version is the same as current version"
59
+ read -p "Continue anyway? (y/n) " -n 1 -r
60
+ echo ""
61
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
62
+ print_error "Release cancelled"
63
+ exit 1
64
+ fi
65
+ fi
66
+
67
+ # Confirm version change
68
+ echo ""
69
+ print_info "Version change: ${CURRENT_VERSION} → ${NEW_VERSION}"
70
+ read -p "Is this correct? (y/n) " -n 1 -r
71
+ echo ""
72
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
73
+ print_error "Release cancelled"
74
+ exit 1
75
+ fi
76
+
77
+ # Update version in version.rb
78
+ print_info "Updating version in lib/rails_map/version.rb..."
79
+ sed -i.bak "s/VERSION = \".*\"/VERSION = \"${NEW_VERSION}\"/" lib/rails_map/version.rb
80
+ rm -f lib/rails_map/version.rb.bak
81
+ print_success "Version updated to ${NEW_VERSION}"
82
+
83
+ # Update version in CHANGELOG.md if it has Unreleased section
84
+ if grep -q "\[Unreleased\]" CHANGELOG.md; then
85
+ print_info "Updating CHANGELOG.md..."
86
+ TODAY=$(date +%Y-%m-%d)
87
+ sed -i.bak "s/\[Unreleased\]/[${NEW_VERSION}] - ${TODAY}/" CHANGELOG.md
88
+ rm -f CHANGELOG.md.bak
89
+ print_success "CHANGELOG.md updated"
90
+ fi
91
+
92
+ # Set VERSION and GEM_FILE for the rest of the script
93
+ VERSION=$NEW_VERSION
94
+ GEM_FILE="${GEM_NAME}-${VERSION}.gem"
95
+
96
+ echo ""
97
+ print_info "Preparing to release version ${VERSION}"
98
+ echo ""
99
+
100
+ # Pre-flight checks
101
+ print_info "Running pre-flight checks..."
102
+
103
+ # Check if version.rb exists
104
+ if [ ! -f "lib/rails_map/version.rb" ]; then
105
+ print_error "lib/rails_map/version.rb not found!"
106
+ exit 1
107
+ fi
108
+
109
+ # Check if gemspec exists
110
+ if [ ! -f "${GEM_NAME}.gemspec" ]; then
111
+ print_error "${GEM_NAME}.gemspec not found!"
112
+ exit 1
113
+ fi
114
+
115
+ # Check if CHANGELOG.md has the current version
116
+ if ! grep -q "\[${VERSION}\]" CHANGELOG.md; then
117
+ print_warning "CHANGELOG.md doesn't contain version ${VERSION}"
118
+ read -p "Continue anyway? (y/n) " -n 1 -r
119
+ echo ""
120
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
121
+ print_error "Release cancelled"
122
+ exit 1
123
+ fi
124
+ fi
125
+
126
+ print_success "Pre-flight checks passed"
127
+ echo ""
128
+
129
+ # Step 1: Show current status
130
+ CURRENT_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
131
+ print_info "Current branch: ${CURRENT_BRANCH}"
132
+ print_info "Version to release: ${VERSION}"
133
+ echo ""
134
+
135
+ # Step 2: Check for uncommitted changes
136
+ print_info "Checking git status..."
137
+ if [[ -n $(git status -s 2>/dev/null) ]]; then
138
+ print_warning "You have uncommitted changes:"
139
+ git status -s
140
+ echo ""
141
+
142
+ # Ask if user wants to commit version changes
143
+ print_info "Would you like to commit the version changes?"
144
+ read -p "Commit version changes? (y/n) " -n 1 -r
145
+ echo ""
146
+ if [[ $REPLY =~ ^[Yy]$ ]]; then
147
+ git add lib/rails_map/version.rb
148
+ if grep -q "\[${VERSION}\]" CHANGELOG.md; then
149
+ git add CHANGELOG.md
150
+ fi
151
+ git commit -m "Bump version to ${VERSION}"
152
+ print_success "Version changes committed"
153
+
154
+ read -p "Push to remote? (y/n) " -n 1 -r
155
+ echo ""
156
+ if [[ $REPLY =~ ^[Yy]$ ]]; then
157
+ CURRENT_BRANCH=$(git branch --show-current 2>/dev/null || echo "main")
158
+ if git push origin "$CURRENT_BRANCH" 2>/dev/null; then
159
+ print_success "Changes pushed to remote"
160
+ else
161
+ print_warning "Failed to push (may need to set remote)"
162
+ fi
163
+ fi
164
+ else
165
+ print_warning "Continuing with uncommitted changes"
166
+ fi
167
+ echo ""
168
+ fi
169
+
170
+ # Step 3: Run tests (if available)
171
+ if [ -f "Rakefile" ]; then
172
+ print_info "Running tests..."
173
+ if bundle exec rake spec 2>/dev/null; then
174
+ print_success "Tests passed"
175
+ else
176
+ print_warning "Tests failed or not configured"
177
+ read -p "Continue anyway? (y/n) " -n 1 -r
178
+ echo ""
179
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
180
+ print_error "Release cancelled"
181
+ exit 1
182
+ fi
183
+ fi
184
+ echo ""
185
+ fi
186
+
187
+ # Step 4: Delete old gem files
188
+ print_info "Cleaning up old gem files..."
189
+ OLD_GEMS=$(ls ${GEM_NAME}-*.gem 2>/dev/null || true)
190
+ if [ -n "$OLD_GEMS" ]; then
191
+ for gem_file in $OLD_GEMS; do
192
+ rm -f "$gem_file"
193
+ print_success "Deleted: $gem_file"
194
+ done
195
+ else
196
+ print_info "No old gem files found"
197
+ fi
198
+ echo ""
199
+
200
+ # Step 5: Build the gem
201
+ print_info "Building gem: ${GEM_FILE}..."
202
+ echo ""
203
+ if gem build ${GEM_NAME}.gemspec; then
204
+ echo ""
205
+ print_success "Gem built successfully: ${GEM_FILE}"
206
+ else
207
+ echo ""
208
+ print_error "Failed to build gem"
209
+ exit 1
210
+ fi
211
+ echo ""
212
+
213
+ # Step 6: Verify the gem file exists
214
+ if [ ! -f "$GEM_FILE" ]; then
215
+ print_error "Gem file not found: ${GEM_FILE}"
216
+ exit 1
217
+ fi
218
+
219
+ # Step 7: Show gem size
220
+ GEM_SIZE=$(ls -lh "$GEM_FILE" | awk '{print $5}')
221
+ print_info "Gem size: ${GEM_SIZE}"
222
+ echo ""
223
+
224
+ # Step 8: Final confirmation before pushing
225
+ print_warning "═══════════════════════════════════════════════════════"
226
+ print_warning " READY TO PUSH TO RUBYGEMS"
227
+ print_warning "═══════════════════════════════════════════════════════"
228
+ print_info "Gem: ${GEM_NAME}"
229
+ print_info "Version: ${VERSION}"
230
+ print_info "File: ${GEM_FILE}"
231
+ print_info "Size: ${GEM_SIZE}"
232
+ echo ""
233
+ print_warning "This will publish the gem to RubyGems.org"
234
+ read -p "Are you sure you want to continue? (y/n) " -n 1 -r
235
+ echo ""
236
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
237
+ print_error "Release cancelled"
238
+ print_info "Gem file ${GEM_FILE} has been built but not pushed"
239
+ print_info "You can manually push it later with: gem push ${GEM_FILE}"
240
+ exit 0
241
+ fi
242
+ echo ""
243
+
244
+ # Step 9: Push to RubyGems
245
+ print_info "Pushing gem to RubyGems..."
246
+ if gem push $GEM_FILE; then
247
+ echo ""
248
+ print_success "Gem pushed successfully to RubyGems!"
249
+ else
250
+ echo ""
251
+ print_error "Failed to push gem to RubyGems"
252
+ print_info "Gem file ${GEM_FILE} is still available locally"
253
+ print_info "You can try pushing manually with: gem push ${GEM_FILE}"
254
+ echo ""
255
+
256
+ # Ask if user wants to rollback version changes
257
+ print_warning "Would you like to rollback the version changes?"
258
+ read -p "Rollback to version ${CURRENT_VERSION}? (y/n) " -n 1 -r
259
+ echo ""
260
+ if [[ $REPLY =~ ^[Yy]$ ]]; then
261
+ # Rollback version.rb
262
+ sed -i.bak "s/VERSION = \".*\"/VERSION = \"${CURRENT_VERSION}\"/" lib/rails_map/version.rb
263
+ rm -f lib/rails_map/version.rb.bak
264
+ print_success "Version rolled back to ${CURRENT_VERSION}"
265
+
266
+ # Rollback CHANGELOG.md if it was updated
267
+ if grep -q "\[${VERSION}\]" CHANGELOG.md; then
268
+ sed -i.bak "s/\[${VERSION}\] - [0-9-]*/[Unreleased]/" CHANGELOG.md
269
+ rm -f CHANGELOG.md.bak
270
+ print_success "CHANGELOG.md rolled back"
271
+ fi
272
+
273
+ # Rollback git commit if it was made
274
+ if git log -1 --pretty=%B 2>/dev/null | grep -q "Bump version to ${VERSION}"; then
275
+ git reset --soft HEAD~1
276
+ print_success "Git commit rolled back"
277
+ fi
278
+ fi
279
+
280
+ exit 1
281
+ fi
282
+ echo ""
283
+
284
+ # Step 10: Create git tag
285
+ TAG_NAME="v${VERSION}"
286
+ print_info "Git tag: ${TAG_NAME}"
287
+ read -p "Create and push git tag? (y/n) " -n 1 -r
288
+ echo ""
289
+ if [[ $REPLY =~ ^[Yy]$ ]]; then
290
+ if git tag -a "$TAG_NAME" -m "Release version ${VERSION}" 2>/dev/null; then
291
+ print_success "Tag created: ${TAG_NAME}"
292
+
293
+ read -p "Push tag to remote? (y/n) " -n 1 -r
294
+ echo ""
295
+ if [[ $REPLY =~ ^[Yy]$ ]]; then
296
+ if git push origin "$TAG_NAME" 2>/dev/null; then
297
+ print_success "Tag pushed to remote"
298
+ else
299
+ print_warning "Failed to push tag (may need to set remote)"
300
+ fi
301
+ fi
302
+ else
303
+ print_warning "Tag already exists or failed to create"
304
+ fi
305
+ echo ""
306
+ fi
307
+
308
+ # Step 11: Clean up gem file
309
+ print_info "Local gem file: ${GEM_FILE}"
310
+ read -p "Delete local gem file? (y/n) " -n 1 -r
311
+ echo ""
312
+ if [[ $REPLY =~ ^[Yy]$ ]]; then
313
+ rm -f "$GEM_FILE"
314
+ print_success "Deleted: ${GEM_FILE}"
315
+ else
316
+ print_info "Keeping: ${GEM_FILE}"
317
+ fi
318
+ echo ""
319
+
320
+ # Step 12: Success summary
321
+ print_success "═══════════════════════════════════════════════════════"
322
+ print_success " RELEASE COMPLETED SUCCESSFULLY! 🎉"
323
+ print_success "═══════════════════════════════════════════════════════"
324
+ echo ""
325
+ print_info "Gem: ${GEM_NAME} v${VERSION}"
326
+ print_info "RubyGems: https://rubygems.org/gems/${GEM_NAME}"
327
+ print_info "Install: gem install ${GEM_NAME}"
328
+ echo ""
329
+ print_info "Next steps:"
330
+ echo " 1. ✓ Gem published to RubyGems"
331
+ echo " 2. ✓ Version updated to ${VERSION}"
332
+ echo " 3. → Verify gem installation: gem install ${GEM_NAME}"
333
+ echo " 4. → Create a GitHub release"
334
+ echo " 5. → Announce the release"
335
+ echo " 6. → Update documentation if needed"
336
+ echo ""
337
+ print_success "Great work! 🚀"
338
+ echo ""
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_map
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arshdeep Singh
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '5.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '8.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,6 +27,9 @@ dependencies:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '5.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '8.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: bundler
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -66,8 +72,21 @@ dependencies:
66
72
  - - "~>"
67
73
  - !ruby/object:Gem::Version
68
74
  version: '3.0'
69
- description: Automatically generates interactive API documentation for Rails by mapping
70
- routes, controllers, and models. Zero configuration—just install and go.
75
+ description: |
76
+ RailsMap automatically generates beautiful, interactive API documentation for your Rails application.
77
+
78
+ Features:
79
+ • Live documentation via Rails Engine at /rails-map
80
+ • Static HTML generation for offline use
81
+ • Automatic parameter detection (path, query, body)
82
+ • Route documentation with HTTP methods and paths
83
+ • Controller documentation with actions and parameters
84
+ • Model documentation with columns, associations, validations, and scopes
85
+ • Built-in authentication support
86
+ • Customizable themes and colors
87
+ • Zero configuration - just install and go!
88
+
89
+ Perfect for API development, team collaboration, and maintaining up-to-date documentation.
71
90
  email:
72
91
  - arsh199820@gmail.com
73
92
  executables: []
@@ -76,13 +95,21 @@ extra_rdoc_files: []
76
95
  files:
77
96
  - ".idea/.gitignore"
78
97
  - ".idea/material_theme_project_new.xml"
98
+ - ".vscode/settings.json"
79
99
  - AUTHENTICATION.md
80
100
  - CHANGELOG.md
101
+ - CODE_OF_CONDUCT.md
102
+ - CONTRIBUTING.md
81
103
  - Gemfile
82
104
  - LICENSE.txt
83
105
  - QUICKSTART.md
84
106
  - README.md
107
+ - RELEASE_QUICK_REFERENCE.md
108
+ - RELEASE_SCRIPT_GUIDE.md
109
+ - RUBYGEMS_IMPROVEMENTS.md
85
110
  - Rakefile
111
+ - SECURITY.md
112
+ - URL_CHANGE_SUMMARY.md
86
113
  - app/controllers/rails_map/docs_controller.rb
87
114
  - app/models/rails_map/user.rb
88
115
  - app/views/rails_map/docs/_styles.html.erb
@@ -106,6 +133,7 @@ files:
106
133
  - lib/rails_map/parsers/route_parser.rb
107
134
  - lib/rails_map/railtie.rb
108
135
  - lib/rails_map/version.rb
136
+ - release.sh
109
137
  - templates/controller.html.erb
110
138
  - templates/index.html.erb
111
139
  - templates/layout.html.erb
@@ -117,11 +145,23 @@ licenses:
117
145
  metadata:
118
146
  homepage_uri: https://rails-map.netlify.app
119
147
  source_code_uri: https://github.com/ArshdeepGrover/rails-map
120
- changelog_uri: https://github.com/ArshdeepGrover/rails-map/blob/main/CHANGELOG.md
148
+ changelog_uri: https://github.com/ArshdeepGrover/rails-map/blob/release/deploy/CHANGELOG.md
121
149
  bug_tracker_uri: https://github.com/ArshdeepGrover/rails-map/issues
122
- documentation_uri: https://rails-map.netlify.app
150
+ documentation_uri: https://github.com/ArshdeepGrover/rails-map#readme
151
+ wiki_uri: https://github.com/ArshdeepGrover/rails-map/wiki
152
+ funding_uri: https://github.com/sponsors/ArshdeepGrover
123
153
  rubygems_mfa_required: 'true'
124
- post_install_message:
154
+ allowed_push_host: https://rubygems.org
155
+ github_repo: ssh://github.com/ArshdeepGrover/rails-map
156
+ post_install_message: "\n╔═══════════════════════════════════════════════════════════════╗\n║
157
+ \ ║\n║ Thanks for
158
+ installing RailsMap! \U0001F389 ║\n║ ║\n║
159
+ \ Get started: ║\n║ $ rails g
160
+ rails_map:install ║\n║ ║\n║
161
+ \ Then visit: http://localhost:3000/rails-map ║\n║ ║\n║
162
+ \ Documentation: https://rails-map.netlify.app ║\n║ GitHub: https://github.com/ArshdeepGrover/rails-map
163
+ \ ║\n║ ║\n║
164
+ \ New in v1.2.0: Automatic API parameter detection! \U0001F680 ║\n║ ║\n╚═══════════════════════════════════════════════════════════════╝\n\n"
125
165
  rdoc_options: []
126
166
  require_paths:
127
167
  - lib