lib/radiant/extension/script.rb in radiant-0.9.1 vs lib/radiant/extension/script.rb in radiant-1.0.0.rc1

- old
+ new

@@ -29,26 +29,26 @@ end end class Action def rake(command) - `rake #{command} RAILS_ENV=#{RAILS_ENV}` if tasks_include? command + puts "rake #{command}" + puts `rake #{command} RAILS_ENV=#{RAILS_ENV}` if tasks_include? command end def tasks_include?(command) - extension = command.split('radiant:extensions:') - if extension.length > 1 - extension = extension.reject{|e| e.blank? }[0] + command = command.split(':') + if command.length > 1 && command[0..1] == ['radiant','extensions'] + extension = command[2] + task = "radiant:extensions:#{extension}:#{command[3].split[0]}" else - extension = extension.to_s + extension = task = command.to_s end rake_file = File.join(RAILS_ROOT, 'vendor', 'extensions', extension) + '/lib/tasks/' + extension + '_extension_tasks.rake' - if File.exist? rake_file - load rake_file - end + load rake_file if File.exist? rake_file tasks = Rake.application.tasks.map(&:name) - tasks.include? "#{command}" + tasks.include? task end def file_utils FileUtils end @@ -303,16 +303,16 @@ self.extension_name = to_extension_name(args.shift) if installed? puts "#{extension_name} is already installed." else find_extension + if registered? + extension.install + else + raise ArgumentError, "#{extension_name} is not available in the registry." + end end - if registered? - extension.install - else - raise ArgumentError, "#{extension_name} is not available in the registry." - end - end + end end class Uninstall include Util