Reputation: 8101
In my Rake capistrano script, I am creating shell commands that needs to have dynamic arguments. My rake code is as below
execute "sed -i '/SPARK_HOME=/c\\export SPARK_HOME=<arg1>' #{release_path}/backend_layer/configs/hdfs/cluster.sh"
How can I call this rake and send the argument <arg1>, so that my command is dynamic
Upvotes: 2
Views: 631
Reputation: 773
Write your rake task like below
desc 'Passing argument on rake task'
task :symlink_shared, [:arg1] => :environment do |t, args|
execute "sed -i '/SPARK_HOME=/c\\export SPARK_HOME=#{args.arg1}' #{release_path}/backend_layer/configs/hdfs/cluster.sh"
end
then, run the cap script with argument like below
cap staging postdeploy:symlink_shared[<your_arg1>]
Upvotes: 3