Sha256: fc749e0c27d3766f9073e5c006c8b5f32d471cb18094f20dd06689c965181b53

Contents?: true

Size: 956 Bytes

Versions: 4

Compression:

Stored size: 956 Bytes

Contents

require 'fileutils'
require 'pathname'

class AdminAssistant
  def self.init
    gem_root = File.dirname(__FILE__) + "/../.."
    copy_into_public = %w(images)
    unless app_uses_sprockets?
      copy_into_public.concat(%w(stylesheets javascripts))
    end
    copy_into_public.each do |asset_type|
      asset_dir = "#{Rails.root}/public/#{asset_type}/admin_assistant"
      FileUtils.mkdir_p(asset_dir) unless File.exist?(asset_dir)
      FileUtils.cp_r(
        Dir.glob("#{gem_root}/vendor/assets/#{asset_type}/*"), asset_dir
      )
    end
  end
end

# Rails 3.0 doesn't do a very good job of wrapping DB-driver-specific
# exceptions in something more generic, so we catch it in a few places and
# maybe have to define them here in case we're *not* using the exceptions but
# still need to rescue them.
unless Object.const_defined?(:Mysql)
  class Mysql
  end
end

unless Mysql.const_defined?(:Error)
  class Mysql::Error < StandardError
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
admin_assistant-2.2.7 lib/admin_assistant/init.rb
admin_assistant-2.2.6 lib/admin_assistant/init.rb
admin_assistant-2.2.5 lib/admin_assistant/init.rb
admin_assistant-2.2.4 lib/admin_assistant/init.rb