This won’t work:
cvs_username = gets
to get it working you have to ask input from STDIN:
cvs_username = STDIN.gets
def ask message
print message
STDIN.gets.chomp
end
# ...
cvs_username = ask('Please insert your CVS username')
This won’t work:
cvs_username = gets
to get it working you have to ask input from STDIN:
cvs_username = STDIN.gets
def ask message
print message
STDIN.gets.chomp
end
# ...
cvs_username = ask('Please insert your CVS username')
Here’s the problem
task :mytask do
# ...
end
namespace :myscope do
task :mytask => :mytask
end
This will end up with loop dependency error, so how we can call a top level task with the same name of one from our current scope?
The solution is not documented, i found it directly in the rake’s library code.
task :mytask do
# ...
end
namespace :myscope do
task :mytask => "rake:mytask"
end
Well, you know what ./script/runner is?
If so, you’ll know you can’t use it to build script without using an absolute path in the shebang line in your custom scripts:
> ./script/runner -h
Usage: ./script/runner [options] ('Some.ruby(code)' or a filename)
You can also use runner as a shebang line for your scripts like this:
#!/usr/bin/env /path/to/your/app/script/runner
...
So here’s the solution! (here the script is saved in the script dir)
#!/usr/bin/env ruby
unless $0 =~ /runner/
exec("#{File.dirname(__FILE__)}/runner #{__FILE__}")
# "exec" exits the current processing, so this comment won't reached (thanks to Arthaey Angosii)
end
# Your great script goes here!
Alternative:
#!/usr/bin/env ruby $: << File.dirname(__FILE__) ARGV[0] = __FILE__ load 'runner' #your code here
Here’s the magic option:
sudo gem install mysql --include-dependencies -- --with-mysql-config=/usr/bin/mysql_config
UPDATE on other systems the following should work:
sudo gem install mysql --include-dependencies -- --with-mysql-config=`which mysql_config`