Created
June 12, 2013 19:22
-
-
Save valk/5768297 to your computer and use it in GitHub Desktop.
How to run Rails server and perform other commands from a Ruby script file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Put this file in /script/ directory. | |
require 'rails/commands/server' | |
Rails::Server.new.tap { |server| | |
APP_PATH = File.expand_path('../../config/application', __FILE__) | |
require APP_PATH | |
Dir.chdir(Rails.application.root) | |
server.start | |
} | |
puts "Your code which requires the server in action goes here..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment