Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed 'install' task to compile the scripts anew.

  • Loading branch information...
commit 1336b5833e04f215e82378ca76825b3663897952 1 parent 765539c
Dmitry Ratnikov authored
Showing with 14 additions and 11 deletions.
  1. +14 −11 tasks/ajax_resource.rb
25 tasks/ajax_resource.rb
View
@@ -1,19 +1,22 @@
namespace :ajax_resource do
namespace :rails do
- desc "Re-builds the library"
- task :build do
+ desc "Installs ajax_resource javascript in the public/javascripts directory. Set COMPRESS=true to install the compressed version."
+ task :install do
require 'jake'
- Jake.build File.join(File.dirname(__FILE__), '..'), true
- end
- desc "Installs ajax_resource javascript in the public/javascripts directory. Set COMPRESS=true to install the compressed version."
- task :install => [ :build ] do
- extension = ENV["COMPRESS"] == "true" ? "min" : "src"
- from = File.join File.dirname(__FILE__), '..', 'build', "ajax_resource-#{extension}.js"
- to = File.join Rails.root, 'public', 'javascripts', 'ajax_resource.js'
- FileUtils.cp(from, to, :verbose => true);
- puts "Done installing."
+ build = Jake::Build.new File.join(File.dirname(__FILE__), '..')
+
+ class << build
+ def build_directory
+ File.join Rails.root, 'public', 'javascripts'
+ end
+ end
+
+ build.force!
+ build.run!
+
+ puts "Installed to #{build.build_directory}"
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.