I want to write standalone script in ruby on rails and want to call it in rake task. I have seen lot of post about standalone scripts but nothing seems to clear for me. I am new to this could anyone suggest me how to write these scripts and call them as rake tasks.
I have something like this to run as a script
for example
empty_list = []
if iterable.is_a?(String)
i = iterable.chars
for k in 0..i.length
if i[k] != i[k + 1]
empty_list << i[k]
end
end
p empty_list
else
i = iterable
for k in 0..i.length
if i[k] != i[k + 1]
empty_list << i[k]
end
end
p empty_list
end
So this should be in my script and run it as a rake task. How to create a script to run this in production environment and where to create this scripts ?