class DockerRailsProxy::Rails
Attributes
args[R]
Public Instance Methods
process()
click to toggle source
# File lib/docker_rails_proxy/commands/rails.rb, line 15 def process command, *@args = arguments case command when 'c', 'console' then console when 'db', 'dbconsole' then db when 'logs' then logs when 'restart', 'touch' then restart when 'secrets' then secrets else execute "bin/rails #{command} #{args.join(' ')}", tty: true end end
Private Instance Methods
console()
click to toggle source
# File lib/docker_rails_proxy/commands/rails.rb, line 31 def console execute "bin/rails c #{args.join(' ')}", tty: true, replace_process: true end
credentials()
click to toggle source
# File lib/docker_rails_proxy/commands/rails.rb, line 63 def credentials # Temporary solution to use credentials in Rails 5.2 # Future version will use the --environment argument instead command = "RAILS_ENV=#{args.first} EDITOR=vim bin/rails credentials:edit" execute "bash -c '#{command}'", tty: true end
db()
click to toggle source
# File lib/docker_rails_proxy/commands/rails.rb, line 35 def db container_id = get_docker_container_id(:mysql) if container_id.empty? logger.error "Couldn't connect to mysql container, make sure it's running" exit 1 end execute( "mysql #{args.first || "#{APP_NAME}_development"}", container_id: container_id, tty: true, replace_process: true ) end
logs()
click to toggle source
# File lib/docker_rails_proxy/commands/rails.rb, line 51 def logs execute "tail -f log/#{args.first || 'development'}.log", replace_process: true end
restart()
click to toggle source
# File lib/docker_rails_proxy/commands/rails.rb, line 55 def restart execute "touch tmp/restart.txt", replace_process: true end
secrets()
click to toggle source
# File lib/docker_rails_proxy/commands/rails.rb, line 59 def secrets execute "bash -c 'EDITOR=vim bin/rails secrets:edit'", tty: true end