Managing Plugin Development on Multiple Rails Projects

Since I work for dawanda and rathershort and maintain an example application I had to split my plugin development, if you need to do the same, here is my current methods, can it be improved !?

  1. maintain all plugins in a seperate folder, because as they grow in numbers they pollute the namespace
  2. add a copy_plugins task to all applications that copies the plugins they need from the local development to vendor(e.g. to test features before releasing them)
#lib/copy_plugins.rake
desc "copies all matching plugins from /apps/plugins to vendor/plugins"
task :copy_plugin, :plugin do |t,args|
  raise "e.g. copy_plugin[rpx_now]" unless args[:plugin]
  vendor = "vendor/plugins/#{args[:plugin]}"
  repo = "/apps/plugins/#{args[:plugin]}"
  raise "#{repo} does not exist" if not File.exist? repo

  `rm -rf #{vendor}` if File.exist? vendor   #remove old
  `mkdir #{vendor}`
  require 'pathname'
  Pathname.new(repo).entries.each do |p|
    next if %w[. .. .git].include? p.basename.to_s
    dir = "#{repo}/#{p}"
    `cp #{File.directory?(dir) ? "-R":""} #{dir} #{vendor}` 
  end
end

task :copy_plugins do
  puts `rake copy_plugin[rpx_now]`
  puts `rake copy_plugin[translation_db_engine]`
  puts `rake copy_plugin[gettext_i18n_rails]`
end
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s