Navigation Menu

Skip to content

Commit

Permalink
make the running of tasks with script/extension install conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmuhl committed Mar 9, 2010
1 parent 8f33b03 commit e018fbb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/radiant/extension/script.rb
@@ -1,6 +1,7 @@
require 'active_resource'
require 'tmpdir'
require 'fileutils'
require 'rake'

module Registry
class Extension < ActiveResource::Base
Expand Down Expand Up @@ -29,7 +30,17 @@ def inspect

class Action
def rake(command)
`rake #{command} RAILS_ENV=#{RAILS_ENV}`
`rake #{command} RAILS_ENV=#{RAILS_ENV}` if tasks_include? command
end

def tasks_include?(command)
extension = command.split(':')[2]
rake_file = File.join(RAILS_ROOT, 'vendor', 'extensions', extension) + '/lib/tasks/' + extension + '_extension_tasks.rake'
if File.exist? rake_file
load rake_file
tasks = Rake.application.tasks.map(&:name)
end
tasks.include? "#{command}"
end

def file_utils
Expand Down

1 comment on commit e018fbb

@joshfrench
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one has been bugging me for ages. Thanks!

Please sign in to comment.