Sha256: 0838610b3f203f20d0f43450dcfb3d8673ef3547824c813674721bdd21a42214

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

module SocialFramework
  class Engine < ::Rails::Engine
    isolate_namespace SocialFramework

    config.autoload_paths += %W(#{config.root}/lib/social_framework/graphs/)
    config.autoload_paths += %W(#{config.root}/lib/social_framework/fabrics/)

    unless /[\w]+$/.match(Dir.pwd).to_s == "social_framework"
      initializer :append_migrations do |app|
        path = config.paths["db"].expanded.first

        FileUtils.rm_rf("#{path}/tmp")
        FileUtils.mkdir_p("#{path}/tmp/migrate")

        migrations_app = Dir.glob(app.config.paths["db/migrate"].first + "/*")
        migrations_framework = Dir.glob(config.paths["db/migrate"].first + "/*")

        migrations_framework.each do |m|
          migrate = m.to_s.scan(/([a-zA-Z_]+[^rb])/).last.first
          unless migrations_app.any? { |m_app| m_app.include?(migrate) }
            result = m.split("/").last
            FileUtils.cp(m, "#{path}/tmp/migrate/#{result}")
          end
        end
        
        app.config.paths["db/migrate"] << "#{path}/tmp/migrate"
      end
    end

    config.generators do |g|
      g.test_framework      :rspec,        :fixture => false
      g.fixture_replacement :factory_girl, :dir => 'spec/factories'
      g.assets false
      g.helper false
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
social_framework-1.0.1 lib/social_framework/engine.rb
social_framework-0.0.3 lib/social_framework/engine.rb