What happens to a running rake task if I change its source? - rake

If I am running rake foo:bar, if I edit the bar method before the task completes, will it change the task midway through?

If you change the code of that rake task then No, if you change anything on which it depends then it will. Like changing the database schema on which task is dependent then it will change mid way

Related

How to execute a file after compilation?

I need to execute the file that is a result of a successful compilation, but I have no idea how to do so.
What I know is the full path of the file, so I need to run a command like double click on the file after compilation.. any idea?
If I understood your problem correctly then you should be able to do that with appropriate tasks
Of course, the concrete implementation depends on the kind of task runner you will use but e.g. with gulp you could use gulp-shell to execute your compilation / build result after the build (gulp) task is done

PowerShell - psake run clean up script after all tasks?

Is there a hook in psake to run a clean up block after ALL talks (not just per task)?
Thanks
There is not such an option, as far as I know. There are a few related issues:
BeforeAll & AfterAll instructions
Cleanup / always run task
If this feature is important, you may take a look at the similar tool
Invoke-Build. It supports such
features as two functions defined in a build script: Enter-Build (invoked
before the first task, a place for initialization) and Exit-Build (invoked
when a build is finished or failed, i.e. always, a place for clean up).

Talend: Task Execution Fails when re-built sub-job is deployed

We have a perfectly working Talend Workflow which has 4 sub-jobs. One of the jobs needed a change, so we modified it and re-built the job within Talend Open Studio. Copied the jar to our production machine. However, when the Task executed, it failed with a "No Class Def Found" error message.
So, is this not how its supposed to be done? Do we have to re-build and re-deploy the main task and all the sub-jobs even for a minor change in a sub-job? Any ideas?
TIA,
Bee
You need to rebuild and deploy the main job.
I don't know why, mays be have you increased the version of your subjob ?

Grouping rake tasks from other gems

To avoid having to trigger many rake tasks when I want to reinitialize my project I created the following task in lib/task/twiddle.rake:
task :twiddle => %w(db:drop db:create railties:install:migrations db:migrate db:seed spree_sample:load)
Triggering each of these command from the command line works.
However running rake twiddle hangs when it reaches spree_sample:load with the following error:
NoMethodError: undefined method `slug' for #<Spree::Product:0x0000000ec9b9f0>
Could someone explain why running a set of specific tasks would works on the CLI and not through the rake task? Should I require some libraries?
The answer's relatively simple actually - Rails loads schema information from the database only when it boots. (You can do something like reset_schema_information to force it to reload)
You generally don't ever do db:migrate followed by db:seed right after because Rails won't reload the app between the migration and the seeding. Therefore, when db:seed runs, it will have no table information. This is why you see different results if you run them individually -- the act of running them individually makes Rails reload itself and fixes the catch-22 of trying work with a schema that is only made available by the previous command.
Also railties:install:migrations makes no sense in your task-- you only run that yourself as the developer 1 time, it creates several migration files (which you check-in to git), and then those files live in your app forever. You don't re-run railties:install:migrations on regular basis, since you've already created those migration files. (You do re-run it when you upgrade spree, but that's a different matter)

Having sbt to re-run on file changes - The `~ compile` equivalent for `run`

I know it's possible to re-compile or re-run tests on file changes. I want know to if it's possible to perform something similar for the run command. ~ run does not work. (That makes sense since the run never finishes).
Is there a way to create a task that watches for file changes, quit the running server and relaunch it ?
If not what other tool, would you suggest to get the same behaviour ?
You will have to bring in an external project like sbt-revolver
https://github.com/spray/sbt-revolver