Skip to content

Commit

Permalink
Merge branch 'script_extension' of git://github.com/johnmuhl/radiant …
Browse files Browse the repository at this point in the history
…into script_extension
  • Loading branch information
saturnflyer committed Mar 16, 2010
2 parents 4af2432 + e018fbb commit 8aa2bb7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/radiant/extension/script.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8aa2bb7

Please sign in to comment.