Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't require escape unless it's needed and show an error if it's not…

… available
  • Loading branch information...
commit f36f735603347310fc38aa3de036454430756602 1 parent 0f849f5
@kjvarga authored
Showing with 12 additions and 10 deletions.
  1. +12 −10 lib/juggernaut/rails/tasks.rb
View
22 lib/juggernaut/rails/tasks.rb
@@ -1,10 +1,8 @@
-require 'escape'
-
namespace :juggernaut do
desc "Install the Juggernaut js and swf files into your Rails application."
- task :install => :environment do
+ task :install => :environment do
require 'fileutils'
-
+
here = File.join(File.dirname(__FILE__), '../../../')
there = ::Rails.root
@@ -21,28 +19,28 @@
FileUtils.cp("#{here}/media/juggernaut_hosts.yml", "#{there}/config/") unless File.exist?("#{there}/config/juggernaut_hosts.yml")
puts "Juggernaut has been successfully installed."
puts
- puts "Please refer to the readme file #{File.expand_path(here)}/README"
+ puts "Please refer to the readme file #{File.expand_path(here)}/README"
end
namespace :install do
desc "Install the Juggernaut jQuery JavaScript files into your Rails application."
task :jquery => :environment do
require 'fileutils'
-
+
here = File.join(File.dirname(__FILE__), '../../../')
there = ::Rails.root
-
+
FileUtils.cp("#{here}/media/jquerynaut.js", "#{there}/public/javascripts/juggernaut/")
FileUtils.cp("#{here}/media/json.js", "#{there}/public/javascripts/juggernaut/")
puts "Installed the Juggernaut jQuery JavaScript files to public/javascripts/juggernaut/"
end
end
-
+
desc 'Compile the juggernaut flash file'
task :compile_flash do
`mtasc -version 8 -header 1:1:1 -main -swf media/juggernaut.swf media/juggernaut.as`
end
-
+
desc "Start the Juggernaut server"
task 'start' => :environment do
run_juggernaut('-d')
@@ -52,8 +50,10 @@
task 'stop' => :environment do
run_juggernaut('-k')
end
-
+
def run_juggernaut(extra_options=[])
+ require 'escape'
+
defaults = Juggernaut::Rails.default_options
extra_options = [extra_options] unless extra_options.is_a?(Array)
extra_options << '-e' if Rails.env.development?
@@ -62,5 +62,7 @@ def run_juggernaut(extra_options=[])
ENV['RAILS_ENV'] = Rails.env.to_s
system(Escape.shell_command(command))
end
+ rescue LoadError
+ puts "Escape not evailable! Please `gem install escape`"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.