The Rails cli has a runner
feature that allows you to run a file (or a string of code) from the command line.
E.g. rails runner my-script.rb
(where my-script.rb
will run in the context of a fully bootstrapped Rails application). It's a fantastic way to write scripts/backfills/etc without needing to alter your application.
I know that craft includesyiic
but it seems to be focused on migrations or code generation and not necessarily providing the same bootstrapped playground.
Is there an easy way to give an arbitrary script access to a bootstrapped craft application? My specific use case is that I want access to models and plugins to be able to migrate fields from one event plugin to another (this is actual content, not just a schema migration).