From ea8b56b446f3e55236c25b04eb6c9a10c9a189e6 Mon Sep 17 00:00:00 2001 From: aaronchi Date: Fri, 7 Aug 2009 11:50:30 -0700 Subject: [PATCH] change default to use jQuery.noConflict --- VERSION.yml | 2 +- bin/jrails | 10 ++-------- jrails.gemspec | 4 ++-- lib/jrails.rb | 2 +- rails/init.rb | 8 ++------ tasks/jrails.rake | 29 +++++++++++++---------------- 6 files changed, 21 insertions(+), 34 deletions(-) diff --git a/VERSION.yml b/VERSION.yml index 13f050d..61a5e39 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,4 +1,4 @@ --- -:patch: 0 +:patch: 1 :major: 0 :minor: 5 \ No newline at end of file diff --git a/bin/jrails b/bin/jrails index 6e47f8a..8bfd07b 100755 --- a/bin/jrails +++ b/bin/jrails @@ -14,22 +14,16 @@ task :help do rakeapp.display_tasks_and_comments end -desc "Copies the jQuery and jRails javascripts to public/javascripts" -task :update do - Rake::Task['jrails:update:javascripts'].invoke -end - desc 'Installs the jQuery and jRails javascripts to public/javascripts' task :install do - Rake::Task['jrails:update:javascripts'].invoke + Rake::Task['jrails:js:install'].invoke end desc 'Remove the prototype / script.aculo.us javascript files' task :scrub do - Rake::Task['jrails:update:scrub'].invoke + Rake::Task['jrails:js:scrub'].invoke end - rakeapp.init("jrails") task :default => [:help] diff --git a/jrails.gemspec b/jrails.gemspec index 8dedeea..c68bc7e 100644 --- a/jrails.gemspec +++ b/jrails.gemspec @@ -5,11 +5,11 @@ Gem::Specification.new do |s| s.name = %q{jrails} - s.version = "0.5.0" + s.version = "0.5.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Aaron Eisenberger", "Patrick Hurley"] - s.date = %q{2009-08-05} + s.date = %q{2009-08-07} s.default_executable = %q{jrails} s.description = %q{Using jRails, you can get all of the same default Rails helpers for javascript functionality using the lighter jQuery library.} s.email = %q{aaronchi@gmail.com} diff --git a/lib/jrails.rb b/lib/jrails.rb index 559d65a..9222cfe 100644 --- a/lib/jrails.rb +++ b/lib/jrails.rb @@ -33,7 +33,7 @@ module PrototypeHelper USE_PROTECTION = const_defined?(:DISABLE_JQUERY_FORGERY_PROTECTION) ? !DISABLE_JQUERY_FORGERY_PROTECTION : true unless const_defined? :JQUERY_VAR - JQUERY_VAR = '$' + JQUERY_VAR = 'jQuery' end unless const_defined? :JQCALLBACKS diff --git a/rails/init.rb b/rails/init.rb index 25bb81e..80a90ef 100644 --- a/rails/init.rb +++ b/rails/init.rb @@ -1,18 +1,14 @@ -# ==== # The following options can be changed by creating an initializer in config/initializers/jrails.rb -# ==== -# ActionView::Helpers::PrototypeHelper::JQUERY_VAR + # jRails uses jQuery.noConflict() by default -# to use the regular jQuery syntax, use: +# to use the default jQuery varibale, use: # ActionView::Helpers::PrototypeHelper::JQUERY_VAR = '$' -ActionView::Helpers::PrototypeHelper::JQUERY_VAR = 'jQuery' # ActionView::Helpers::PrototypeHelper:: DISABLE_JQUERY_FORGERY_PROTECTION # Set this to disable forgery protection in ajax calls # This is handy if you want to use caching with ajax by injecting the forgery token via another means # for an example, see http://henrik.nyh.se/2008/05/rails-authenticity-token-with-jquery # ActionView::Helpers::PrototypeHelper::DISABLE_JQUERY_FORGERY_PROTECTION = true -# ==== ActionView::Helpers::AssetTagHelper::JAVASCRIPT_DEFAULT_SOURCES = ['jquery','jquery-ui','jrails'] ActionView::Helpers::AssetTagHelper::reset_javascript_include_default diff --git a/tasks/jrails.rake b/tasks/jrails.rake index 0571426..b91d82b 100644 --- a/tasks/jrails.rake +++ b/tasks/jrails.rake @@ -1,28 +1,25 @@ namespace :jrails do - namespace :update do + + namespace :js do desc "Copies the jQuery and jRails javascripts to public/javascripts" - task :javascripts do + task :install do puts "Copying files..." project_dir = RAILS_ROOT + '/public/javascripts/' scripts = Dir[File.join(File.dirname(__FILE__), '..', '/javascripts/', '*.js')] FileUtils.cp(scripts, project_dir) puts "files copied successfully." end - end - - namespace :install do - desc "Installs the jQuery and jRails javascripts to public/javascripts" - task :javascripts do - Rake::Task['jrails:update:javascripts'].invoke - end - end - desc 'Remove the prototype / script.aculo.us javascript files' - task :scrub do - files = %W[controls.js dragdrop.js effects.js prototype.js] - project_dir = File.join(RAILS_ROOT, 'public', 'javascripts') - files.each do |fname| - FileUtils.rm File.join(project_dir, fname) + desc 'Remove the prototype / script.aculo.us javascript files' + task :scrub do + puts "Removing files..." + files = %W[controls.js dragdrop.js effects.js prototype.js] + project_dir = File.join(RAILS_ROOT, 'public', 'javascripts') + files.each do |fname| + FileUtils.rm(File.join(project_dir, fname)) if File.exists?(File.join(project_dir, fname)) + end + puts "files removed successfully." end end + end