How to deploy Rails project on live server using Rake task?

For other projects I used Capistrano deployment.But for this project I wish to use rake...if anybody guide me please ... What gem I will need to install or what is the procedure I should follow?

有帮助吗?

解决方案

You already answered your question yourself:

Either you use capistrano (the recommended way) - or you write your own custom rake Tasks that do what you want.

Writing Rake tasks is nothing complicated, you simply define tasks that depend on each other for each step of your deployment and then run them. Remember: Rake tasks are just plain Ruby and you therefore can use any Gem that suits your needs.

Only if you get a bit more detailed on what tasks you want to do during your deployment I can start recommending Gems or what Tasks you may need to write.

Article by Martin Fowler on Rake: http://martinfowler.com/articles/rake.html

Generally a Rake file looks pretty much like this:

task :default => [:test]

task :test do
  # You can write regular ruby here and do anything you want
  puts "Foo"
end

task :dependant => [:test] do
  # This task will automatically make sure task test is run before running.
  puts "Hello World"
end

其他提示

Linux or windows? which is the os you are using?

you can follow this refeerence

http://guides.rubyonrails.org/command_line.html

http://www.tutorialspoint.com/ruby-on-rails/rails-and-rake.htm

Just guessing a bit.

You probably would need:

  1. A command line options parser
  2. A way to interact through ssh
  3. Some linux command execution
  4. Optionally a way to interact with git
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top