Class: ForestAdminRpcAgent::Thor::Install

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/forest_admin_rpc_agent/thor/install.rb

Constant Summary collapse

RAILS_CONFIG_PATH =
'config/initializers/forest_admin_rpc_agent.rb'.freeze
RAILS_AGENT_PATH =
'lib/forest_admin_rpc_agent/create_rpc_agent.rb'.freeze
SINATRA_CONFIG_PATH =
'config/forest_admin_rpc_agent.rb'.freeze
SINATRA_AGENT_PATH =
'config/create_rpc_agent.rb'.freeze

Instance Method Summary collapse

Instance Method Details

#install(auth_secret) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/forest_admin_rpc_agent/thor/install.rb', line 22

def install(auth_secret)
  if rails_app?
    say_status('info', 'Rails framework detected ✅', :green)
    setup_rails(auth_secret)
  elsif sinatra_app?
    if options[:app_file].nil?
      say_status('error', 'You must specify the main file of the Sinatra application with --app_file', :red)
      raise ::Thor::Error, 'You must specify the main file of the Sinatra application with --app_file'
    end
    say_status('info', 'Sinatra framework detected ✅', :green)
    setup_sinatra(auth_secret)
  else
    say_status('error', 'Unsupported framework', :red)
    raise ::Thor::Error, 'Unsupported framework, only Rails and Sinatra are supported with ForestAdmin RPC Agent'
  end
end