Permalink
Browse files

Merge pull request #32 from grosser/observe-assets

do not add to public if js files are in app/assets
  • Loading branch information...
2 parents 8ce45b8 + 2261f80 commit 9b795ed6234d16a93d56ca5608674d1d32dadf3c @timcharper committed May 25, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/calendar_date_select.rb
@@ -3,32 +3,32 @@
require "calendar_date_select/includes_helper.rb"
require "action_view/helpers"
-if Object.const_defined?(:Rails) && File.directory?(Rails.root.to_s + "/public")
+if Object.const_defined?(:Rails) && File.directory?(Rails.root.to_s + "/public")
ActionView::Helpers::FormHelper.send(:include, CalendarDateSelect::FormHelpers)
ActionView::Base.send(:include, CalendarDateSelect::FormHelpers)
ActionView::Base.send(:include, CalendarDateSelect::IncludesHelper)
-
+
# Filthy backwards compatibility hooks... grumble
if ([Rails::VERSION::MAJOR, Rails::VERSION::MINOR] <=> [2, 2]) == -1
ActionView::Helpers::InstanceTag.class_eval do
def self.new_with_backwards_compatibility(object_name, method_name, template_object, object = nil)
new(object_name, method_name, template_object, nil, object)
end
end
-
+
else
ActionView::Helpers::InstanceTag.class_eval do
class << self; alias new_with_backwards_compatibility new; end
end
end
# install files
- unless File.exists?(RAILS_ROOT + '/public/javascripts/calendar_date_select/calendar_date_select.js')
+ if !File.exists?(RAILS_ROOT + '/public/javascripts/calendar_date_select/calendar_date_select.js') and !File.exists?(RAILS_ROOT + '/app/assets/javascripts/calendar_date_select/calendar_date_select.js')
['/public', '/public/javascripts/calendar_date_select', '/public/stylesheets/calendar_date_select', '/public/images/calendar_date_select', '/public/javascripts/calendar_date_select/locale'].each do |dir|
source = File.dirname(__FILE__) + "/../#{dir}"
dest = RAILS_ROOT + dir
FileUtils.mkdir_p(dest)
FileUtils.cp(Dir.glob(source+'/*.*'), dest)
end
end
-end
+end

0 comments on commit 9b795ed

Please sign in to comment.