rails-markup 1.4.6 → 1.4.7

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: 71cb0dfae1e50403d787bb64d3760a95181fbf2e4fbd7ce6c57629d226fd2dae
4
- data.tar.gz: ba57fa0fde60fd7b8c314ad63d8b2df16c3580076269392991928e81e3a6d53a
3
+ metadata.gz: 66260d5eb5dfb34aee5daa7f51a9a0649a1f241d6dfc3d0bf55fba7435727491
4
+ data.tar.gz: c4461eba4189f4351502bbf2fbcdef57387d6183570ef19c950538edb97c91ee
5
5
  SHA512:
6
- metadata.gz: 7bb524122341ef07f5ea882964f931e4bb766e4c493a7fb0493f0a0c1ca7fb793055ad513219df8f13bafc578b2ea5113bba0fe86f3b51eabaa15b4e12b36cb5
7
- data.tar.gz: 7f2f47ab1f1692dcb9ff5127b7691dd5ca2691a1a2944056d6e65bc9f2cf5dd998c2e58554722f23b80df36e64aa486f94b5f746b60e4a95d01e1a3f93898e16
6
+ metadata.gz: a74b3f974b9124593cd889a78702ebeb466a83f9ca9763102499a4898246b0b0cecca3b53a5af77754d848188cd161f5e90c50a10d6d5b4962b309e343309850
7
+ data.tar.gz: d1f9f8910a108fe314da756afedaf9bd0b46d8d780603adb034d960e17e34cbf4823a2ede9832afb4199ebdf1042d071ef89586051fd5e3731ba878acb1a4457
data/README.md CHANGED
@@ -81,14 +81,14 @@ The generator creates:
81
81
  | `config/initializers/rails_markup.rb` | Configuration |
82
82
  | `app/controllers/rails_markup_auth_controller.rb` | Auth controller |
83
83
  | `bin/markup` | CLI wrapper |
84
- | Route mount | Engine at `/admin/annotations` |
84
+ | Route mount | Engine at `/admin/rails-markup` |
85
85
  | Toolbar injection | Admin-gated `render "rails_markup/shared/toolbar"` in your layout |
86
86
 
87
87
  ### Generator options
88
88
 
89
89
  ```bash
90
90
  rails generate rails_markup:install \
91
- --mount-path=/admin/annotations \
91
+ --mount-path=/admin/rails-markup \
92
92
  --base-controller=Admin::BaseController \
93
93
  --layout=application
94
94
  ```
@@ -169,7 +169,7 @@ end
169
169
 
170
170
  ## Dashboard
171
171
 
172
- Visit `/admin/annotations` for the full dashboard:
172
+ Visit `/admin/rails-markup` for the full dashboard:
173
173
 
174
174
  - **List view** — status filters, search, author filter, load-more pagination
175
175
  - **Board view** — kanban with drag-and-drop status transitions
data/config/routes.rb CHANGED
@@ -30,7 +30,7 @@ RailsMarkup::Engine.routes.draw do
30
30
 
31
31
  # External API (token-authenticated, used by MCP/CLI tools)
32
32
  # Paths: /external/pending, /external/:id, /external/:id/{action}
33
- # Full URL (with mount): /admin/annotations/external/pending
33
+ # Full URL (with mount): /admin/rails-markup/external/pending
34
34
  namespace :external, defaults: { format: :json } do
35
35
  get "pending", to: "annotations#pending"
36
36
  get ":id", to: "annotations#show", constraints: { id: /\d+/ }
@@ -12,8 +12,8 @@ module RailsMarkup
12
12
 
13
13
  desc "Install Rails Markup: create migration, initializer, auth controller, toolbar, and mount engine routes."
14
14
 
15
- class_option :mount_path, type: :string, default: "/admin/annotations",
16
- desc: "Path to mount the Rails Markup engine"
15
+ class_option :mount_path, type: :string, default: nil,
16
+ desc: "Path to mount the Rails Markup engine (leave blank to be prompted)"
17
17
  class_option :base_controller, type: :string, default: "ApplicationController",
18
18
  desc: "Base controller class for authentication"
19
19
  class_option :layout, type: :string, default: "application",
@@ -59,7 +59,7 @@ module RailsMarkup
59
59
  end
60
60
 
61
61
  def mount_engine
62
- mount_path = options[:mount_path]
62
+ mount_path = resolved_mount_path
63
63
  route_line = %{mount RailsMarkup::Engine, at: "#{mount_path}" if defined?(RailsMarkup::Engine)}
64
64
  route route_line
65
65
  end
@@ -140,7 +140,7 @@ module RailsMarkup
140
140
  dev_url = detect_dev_url
141
141
  env_updates = {
142
142
  "RAILS_MARKUP_DEV_URL" => dev_url,
143
- "RAILS_MARKUP_MOUNT_PATH" => options[:mount_path]
143
+ "RAILS_MARKUP_MOUNT_PATH" => resolved_mount_path
144
144
  }
145
145
  config.update_env(env_updates)
146
146
  say_status :create, ".mcp.json (dev URL: #{dev_url})", :green
@@ -159,7 +159,7 @@ module RailsMarkup
159
159
  say ""
160
160
  say "Next steps:"
161
161
  say " 1. Run migrations: rails db:migrate"
162
- say " 2. Visit dashboard: #{options[:mount_path]}"
162
+ say " 2. Visit dashboard: #{resolved_mount_path}"
163
163
  say " 3. Configure auth in config/initializers/rails_markup.rb"
164
164
  say ""
165
165
  dev_url = detect_dev_url
@@ -180,6 +180,40 @@ module RailsMarkup
180
180
 
181
181
  private
182
182
 
183
+ def resolved_mount_path
184
+ @resolved_mount_path ||= begin
185
+ explicit = options[:mount_path]
186
+ return normalize_mount_path(explicit) if explicit && !explicit.strip.empty?
187
+
188
+ prompt_mount_path
189
+ end
190
+ end
191
+
192
+ def prompt_mount_path
193
+ return "/rails-markup" unless interactive_prompt_available?
194
+
195
+ if yes?("Choose a nested prefix before /rails-markup? (for example /admin/rails-markup or /dashboard/rails-markup)")
196
+ prefix = ask("Prefix segment (leave blank for admin)")
197
+ prefix = "admin" if prefix.to_s.strip.empty?
198
+ normalize_mount_path("#{prefix}/rails-markup")
199
+ else
200
+ "/rails-markup"
201
+ end
202
+ end
203
+
204
+ def interactive_prompt_available?
205
+ $stdin.tty? && $stdout.tty?
206
+ end
207
+
208
+ def normalize_mount_path(path)
209
+ value = path.to_s.strip
210
+ value = value.sub(%r{\A/+}, "")
211
+ value = value.sub(%r{/+\z}, "")
212
+ value = "/#{value}"
213
+ value = value.gsub(%r{/+}, "/")
214
+ value == "/" ? "/rails-markup" : value
215
+ end
216
+
183
217
  def migration_version
184
218
  "[#{ActiveRecord::Migration.current_version}]"
185
219
  end
@@ -110,7 +110,7 @@ module RailsMarkup
110
110
  method_option :prod_url, type: :string, desc: "Production URL (RAILS_MARKUP_PROD_URL)"
111
111
  method_option :prod_token, type: :string, desc: "Production API token (RAILS_MARKUP_PROD_TOKEN)"
112
112
  method_option :dev_url, type: :string, desc: "Dev URL (RAILS_MARKUP_DEV_URL)"
113
- method_option :mount_path, type: :string, desc: "Engine mount path (RAILS_MARKUP_MOUNT_PATH)"
113
+ method_option :mount_path, type: :string, desc: "Engine mount path (RAILS_MARKUP_MOUNT_PATH; e.g. /admin/rails-markup)"
114
114
  method_option :global, type: :boolean, default: false, desc: "Write to ~/.claude/settings.json"
115
115
  method_option :codex, type: :boolean, default: false, desc: "Write to ~/.codex/config.toml"
116
116
  def configure
@@ -209,7 +209,7 @@ module RailsMarkup
209
209
  method_option :production, type: :boolean, default: false, desc: "Watch production"
210
210
  method_option :url, type: :string, desc: "Override base URL"
211
211
  method_option :token, type: :string, desc: "Override API token"
212
- method_option :mount_path, type: :string, desc: "Engine mount path"
212
+ method_option :mount_path, type: :string, desc: "Engine mount path (e.g. /admin/rails-markup)"
213
213
  method_option :interval, type: :numeric, default: 5, desc: "Poll interval in seconds"
214
214
  def watch
215
215
  env = resolve_env(options[:production])
@@ -259,7 +259,7 @@ module RailsMarkup
259
259
  method_option :production, type: :boolean, default: false, desc: "Fetch from production"
260
260
  method_option :url, type: :string, desc: "Override base URL"
261
261
  method_option :token, type: :string, desc: "Override API token"
262
- method_option :mount_path, type: :string, desc: "Engine mount path"
262
+ method_option :mount_path, type: :string, desc: "Engine mount path (e.g. /admin/rails-markup)"
263
263
  def pending
264
264
  env = resolve_env(options[:production])
265
265
  return unless env
@@ -433,7 +433,7 @@ module RailsMarkup
433
433
  desc: "Environment to fetch from"
434
434
  method_option :url, type: :string, desc: "Override base URL"
435
435
  method_option :token, type: :string, desc: "Override API token"
436
- method_option :mount_path, type: :string, desc: "Engine mount path (default: /admin/annotations)"
436
+ method_option :mount_path, type: :string, desc: "Engine mount path (default: /admin/rails-markup; e.g. /admin/rails-markup)"
437
437
  def fetch(env_arg = nil)
438
438
  production = env_arg == "production" || options[:production] || options[:environment] == "production"
439
439
  env = resolve_env(production)
@@ -571,7 +571,7 @@ module RailsMarkup
571
571
  sections << " --prod-url URL Production URL"
572
572
  sections << " --prod-token TOKEN Production API token"
573
573
  sections << " --dev-url URL Development URL"
574
- sections << " --mount-path PATH Engine mount path"
574
+ sections << " --mount-path PATH Engine mount path (e.g. /admin/rails-markup)"
575
575
  sections << " --global Write to ~/.claude/settings.json"
576
576
  sections << " --codex Write to ~/.codex/config.toml"
577
577
  sections << " setup-production --url URL Generate token + configure production"
@@ -671,7 +671,7 @@ module RailsMarkup
671
671
  if production
672
672
  base_url = options[:url] || mcp_env["RAILS_MARKUP_PROD_URL"]
673
673
  token = options[:token] || mcp_env["RAILS_MARKUP_PROD_TOKEN"]
674
- mount = options[:mount_path] || mcp_env["RAILS_MARKUP_MOUNT_PATH"] || "/admin/annotations"
674
+ mount = options[:mount_path] || mcp_env["RAILS_MARKUP_MOUNT_PATH"] || "/admin/rails-markup"
675
675
 
676
676
  unless base_url
677
677
  say "No production URL. Set it via:", :red
@@ -695,7 +695,7 @@ module RailsMarkup
695
695
  else
696
696
  base_url = options[:url] || mcp_env["RAILS_MARKUP_DEV_URL"]
697
697
  token = options[:token] || mcp_env["RAILS_MARKUP_DEV_TOKEN"]
698
- mount = options[:mount_path] || mcp_env["RAILS_MARKUP_MOUNT_PATH"] || "/admin/annotations"
698
+ mount = options[:mount_path] || mcp_env["RAILS_MARKUP_MOUNT_PATH"] || "/admin/rails-markup"
699
699
 
700
700
  unless base_url
701
701
  say "No dev URL. Set it via:", :red
@@ -17,7 +17,7 @@ module RailsMarkup
17
17
  # RAILS_MARKUP_DEV_URL — local Rails server URL (auto-detected on install)
18
18
  # RAILS_MARKUP_PROD_URL — production URL
19
19
  # RAILS_MARKUP_PROD_TOKEN — production API token
20
- # RAILS_MARKUP_MOUNT_PATH — engine mount path (default: /admin/annotations)
20
+ # RAILS_MARKUP_MOUNT_PATH — engine mount path (default: /admin/rails-markup)
21
21
  class McpServer
22
22
  class ToolError < StandardError; end
23
23
  class TargetError < ToolError; end
@@ -184,7 +184,7 @@ module RailsMarkup
184
184
  end
185
185
 
186
186
  def mount_path
187
- config_value("RAILS_MARKUP_MOUNT_PATH") || "/admin/annotations"
187
+ config_value("RAILS_MARKUP_MOUNT_PATH") || "/admin/rails-markup"
188
188
  end
189
189
 
190
190
  def prod_url
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsMarkup
4
- VERSION = "1.4.6"
4
+ VERSION = "1.4.7"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-markup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.6
4
+ version: 1.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - InventList
@@ -184,7 +184,7 @@ post_install_message: |
184
184
  rails db:migrate
185
185
 
186
186
  Options:
187
- --mount-path=/admin/annotations (engine route)
187
+ --mount-path=/admin/rails-markup (engine route)
188
188
  --base-controller=AdminController (auth parent class)
189
189
  --layout=application (toolbar injection)
190
190
  rdoc_options: []