diff --git a/lib/asset_sync/config.rb b/lib/asset_sync/config.rb index 2ea3a51e..88d88510 100644 --- a/lib/asset_sync/config.rb +++ b/lib/asset_sync/config.rb @@ -110,7 +110,7 @@ def google? end def yml_exists? - defined?(Rails.root) ? File.exists?(self.yml_path) : false + defined?(Rails.root) ? File.exist?(self.yml_path) : false end def yml diff --git a/lib/asset_sync/engine.rb b/lib/asset_sync/engine.rb index 4e7fd887..0f6aa534 100644 --- a/lib/asset_sync/engine.rb +++ b/lib/asset_sync/engine.rb @@ -7,10 +7,10 @@ class Engine < Rails::Engine app_initializer = Rails.root.join('config', 'initializers', 'asset_sync.rb').to_s app_yaml = Rails.root.join('config', 'asset_sync.yml').to_s - if File.exists?( app_initializer ) + if File.exist?( app_initializer ) AssetSync.log "AssetSync: using #{app_initializer}" load app_initializer - elsif !File.exists?( app_initializer ) && !File.exists?( app_yaml ) + elsif !File.exist?( app_initializer ) && !File.exist?( app_yaml ) AssetSync.log "AssetSync: using default configuration from built-in initializer" AssetSync.configure do |config| config.fog_provider = ENV['FOG_PROVIDER'] if ENV.has_key?('FOG_PROVIDER') @@ -44,7 +44,7 @@ class Engine < Rails::Engine end - if File.exists?( app_yaml ) + if File.exist?( app_yaml ) AssetSync.log "AssetSync: YAML file found #{app_yaml} settings will be merged into the configuration" end end diff --git a/lib/asset_sync/storage.rb b/lib/asset_sync/storage.rb index 822b11a7..3e369d4f 100644 --- a/lib/asset_sync/storage.rb +++ b/lib/asset_sync/storage.rb @@ -73,7 +73,7 @@ def get_local_files log "Using: Rails 4.0 manifest access" manifest = Sprockets::Manifest.new(ActionView::Base.assets_manifest.environment, ActionView::Base.assets_manifest.dir) return manifest.assets.values.map { |f| File.join(self.config.assets_prefix, f) } - elsif File.exists?(self.config.manifest_path) + elsif File.exist?(self.config.manifest_path) log "Using: Manifest #{self.config.manifest_path}" yml = YAML.load(IO.read(self.config.manifest_path)) @@ -150,8 +150,8 @@ def upload_file(f) log "Overwriting #{f} with custom headers #{files_with_custom_headers[f].to_s}" elsif key = self.config.custom_headers.keys.detect {|k| f.match(Regexp.new(k))} headers = {} - self.config.custom_headers[key].each do |key, value| - headers[key.to_sym] = value + self.config.custom_headers[key].each do |k, value| + headers[k.to_sym] = value end file.merge! headers log "Overwriting matching file #{f} with custom headers #{headers.to_s}" @@ -166,7 +166,7 @@ def upload_file(f) # as we will overwrite file.css with file.css.gz if it exists. log "Ignoring: #{f}" ignore = true - elsif config.gzip? && File.exists?(gzipped) + elsif config.gzip? && File.exist?(gzipped) original_size = File.size("#{path}/#{f}") gzipped_size = File.size(gzipped) diff --git a/spec/dummy_app/Rakefile b/spec/dummy_app/Rakefile index 55568624..8d768cfc 100644 --- a/spec/dummy_app/Rakefile +++ b/spec/dummy_app/Rakefile @@ -3,7 +3,7 @@ require 'rubygems' ENV['RAILS_ROOT'] = File.dirname(__FILE__) # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) # require 'rails/all' require "action_controller/railtie" require "sprockets/railtie"