Created
January 18, 2009 22:14
-
-
Save ohammersmith/48788 to your computer and use it in GitHub Desktop.
Ruby script in a Windows batch script
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
@echo off | |
goto endofruby | |
#!/bin/ruby | |
git_repo = "git://github.com/rails/rails.git" | |
help = %Q{ | |
Rails Info: | |
-v, --version Show the Rails version number and quit. | |
-h, --help Show this help message and quit. | |
General Options: | |
-p, --pretend Run but do not make any changes. | |
--force Overwrite files that already exist. | |
-s, --skip Skip files that already exist. | |
-q, --quiet Suppress normal output. | |
-t, --backtrace Debugging: show backtrace on errors. | |
Description: | |
The 'edge_rails' command creates a new Rails application with a default | |
directory structure and configuration at the path you specify, using the | |
very latest version of Rails. | |
Example: | |
edge_rails ~/Code/Ruby/weblog | |
This generates a skeletal Rails installation in ~/Code/Ruby/weblog. | |
See the README in the newly created application to get going. | |
} | |
require 'fileutils' | |
if ARGV.empty? | |
puts help | |
exit | |
end | |
dir = ARGV.shift | |
args = ARGV.join (" ") | |
FileUtils::mkdir(dir) | |
FileUtils::mkdir("#{dir}/vendor") | |
puts "Exporting EdgeRails from #{git_repo}" | |
# system "svn export http://svn.rubyonrails.org/rails/trunk #{dir}/vendor/rails" | |
system "git clone --depth=1 #{git_repo} #{dir}/vendor/rails" | |
system "rm -rf #{dir}/vendor/rails/.git*" | |
system "ruby #{dir}/vendor/rails/railties/bin/rails #{dir} #{args}" | |
__END__ | |
:endofruby | |
"%~d0%~p0ruby" -x "%~f0" %* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment