Class: Toolchest::Generators::OauthViewsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/toolchest/oauth_views_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_controllersObject



20
21
22
23
24
25
26
27
# File 'lib/generators/toolchest/oauth_views_generator.rb', line 20

def copy_controllers
  controllers_dir = File.join(self.class.source_root, "app/controllers/toolchest/oauth")

  Dir[File.join(controllers_dir, "**", "*.rb")].each do |src|
    relative = src.sub(controllers_dir + "/", "")
    copy_file "app/controllers/toolchest/oauth/#{relative}"
  end
end

#copy_viewsObject



11
12
13
14
15
16
17
18
# File 'lib/generators/toolchest/oauth_views_generator.rb', line 11

def copy_views
  views_dir = File.join(self.class.source_root, "app/views/toolchest/oauth")

  Dir[File.join(views_dir, "**", "*.erb")].each do |src|
    relative = src.sub(views_dir + "/", "")
    copy_file "app/views/toolchest/oauth/#{relative}"
  end
end

#show_instructionsObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/generators/toolchest/oauth_views_generator.rb', line 29

def show_instructions
  say ""
  say "OAuth views and controllers ejected!", :green
  say ""
  say "  Views:       app/views/toolchest/oauth/"
  say "  Controllers: app/controllers/toolchest/oauth/"
  say ""
  say "Controllers:"
  say "  authorizations_controller.rb — consent screen (GET/POST /mcp/oauth/authorize)"
  say "  tokens_controller.rb         — token exchange (POST /mcp/oauth/token)"
  say "  registrations_controller.rb  — DCR (POST /register)"
  say "  metadata_controller.rb       — .well-known endpoints"
  say "  authorized_applications_controller.rb — revocation UI (GET/DELETE /mcp/oauth/authorized_applications)"
  say ""
  say "Views:"
  say "  authorizations/new.html.erb           — consent page"
  say "  authorized_applications/index.html.erb — connected apps list"
  say ""
  say "All controllers inherit from ApplicationController."
  say "Override any file — your app's version takes precedence."
  say ""
end