Standard Rake Install/Uninstall Tasks for Extensions

I considered adding a recommendation to the Creating Extensions
Tutorial, but not wanting to offend, I thought I might run the idea past
people first.

I’m wondering if developers think it’s useful to have standard rake
tasks for installing/uninstalling extensions. For example:

:radiant:extensions:my_fancy_ext:install
:radiant:extensions:my_fancy_ext:uninstall

I thought it might be nice if we always have these two tasks and those
tasks perform all of the necessary subtasks. Might even have the
generate Extension task set these up by default and reports “Not
implemented” until implemented.

Granted, people can continue to do it their own way, but I thought why
not at least offer a recommendation.

Silly idea?

I’m wondering if developers think it’s useful to have standard rake
tasks for installing/uninstalling extensions. For example:

:radiant:extensions:my_fancy_ext:install
:radiant:extensions:my_fancy_ext:uninstall

I thought it might be nice if we always have these two tasks and those
tasks perform all of the necessary subtasks. Might even have the
generate Extension task set these up by default and reports “Not
implemented” until implemented.

Granted, people can continue to do it their own way, but I thought why
not at least offer a recommendation.

Silly idea?

It’s a good idea for me! I usually use install task for my extensions.
It
should be easier if everybody use the same task names.


Andrea F.
http://gravityblast.com - http://nimboo.net

Added a tiny section called “Standard Rake Tasks” to:
http://wiki.radiantcms.org/Creating_Radiant_Extensions

On 1/10/08, Mario T. Lanza [email protected] wrote:

Added a tiny section called “Standard Rake Tasks” to:
http://wiki.radiantcms.org/Creating_Radiant_Extensions

Perhaps that should be put at the bottom in an Additional Notes
section? Or even better truly work it into the tutorial by adding an
code examples and screenshots.


John L.
http://wiseheartdesign.com

On Jan 10, 2008 8:01 PM, John L. [email protected] wrote:

On 1/10/08, Mario T. Lanza [email protected] wrote:

Added a tiny section called “Standard Rake Tasks” to:
http://wiki.radiantcms.org/Creating_Radiant_Extensions

Why not put those tasks in the generated Rakefile and just have them
do nothing by default?

We could also make assets/{javascripts,stylesheets,images} directories
and have the install task copy files from those directories to their
counterparts in public by default (but should not overwrite something
already there, probably).

-todd[1]

I’ve kind of kept out of this discussion so far, but there does exist an
‘update’ task that is generated for new extensions since 0.6.3 (I
believe). It copies files from the extension’s public folder to the
project/instance public folder. However, there is no reverse operation
for it currently. I imagine the tasks might look something like this
(cleanup would be the reverse of update):

task :install => [:migrate, :update]

task :uninstall => :cleanup do
ENV[‘VERSION’] = 0
migrate
end

Sean

Sean C. wrote:

ENV[‘VERSION’] = 0
migrate
end

I’ve used the built-in rake ‘update’ task and was wondering how it was
different from the ‘install’ being proposed here. You’re right Sean,
they’re really asking for both:
rake production radiant:extensions:my_extension_name:update and,
rake production radiant:extensions:lmy_extension_name:migrate

However, what is also being asked here but can get sticky is an
‘un-update’ task which, at this point, doesn’t exist. IMHO, it should
do the following:

* Take an inventory of all the files in the extension's public
  folders that would be copied by the 'update' task.
* Look for those files in the application's public folders and:
      o If they exist and are an exact (binary) match, delete them
      o If they are exist but are different (same name, different
        file), leave them alone
      o If they don't exist, do nothing.
* Spit out a report showing which files were deleted, which weren't
  and why, and which were expected but missing.

That way people could update a css file or change a jpeg that came with
their extension and not have to worry that uninstalling would erase
their work. But I’m not sure what ruby offers to aid in performing a
diff-check against two files, though. Ideas anyone?

-Chris

If you (anyone in this thread) want this, please implement it, test it
and submit a patch.

Sean

Maybe we can use a standard way to organize files for each
extension.Something
like:

public/images/extensions/newsletter/ (here all images added by the
newsletter extension)
public/stylesheets/extensions/newsletter/ (here all css added by the
newsletter extension)
public/javascripts/extensions/newsletter/ (here all js added by the
newsletter extension)

It could be easier to remove files. What do you think about it?

On Jan 11, 2008 6:46 PM, Chris P. <
[email protected]> wrote:

task :uninstall => :cleanup do
However, what is also being asked here but can get sticky is an


Andrea F.
http://gravityblast.com - http://nimboo.net

Why not put those tasks in the generated Rakefile and just have them
do nothing by default?

My sentiment exactly.

task :install => [:migrate, :update]

task :uninstall => :cleanup do
ENV[‘VERSION’] = 0
migrate
end

Additionally, the cleanup should handle removing the files copied to
public. If the files are indeed copied and not moved, then
programmatically reversing this should be a cinch. Use the original
files in the extension directory to locate their public counterpart and
delete them if the size and timestamp match.