Sha256: 37455860f4935785c6d6b74cba8ff594f6fa938871c44b725fa5f2bee25340ad

Contents?: true

Size: 1.48 KB

Versions: 19

Compression:

Stored size: 1.48 KB

Contents

module WidgetList
  class Railtie < Rails::Railtie

    config.before_configuration do
      config_file = Rails.root.join("config", "widget-list.yml")
      if config_file.file?
        # WidgetList::List::connect
      else
        puts "\nWidget List config not found.  Creating config/widget-list.yml.  \n\nPlease configure it with the appropriate connections"
        File.open(Rails.root.join("config", "widget-list.yml"), 'w') { |file|
          file.write("#For connection examples see: http://sequel.rubyforge.org/rdoc/files/doc/opening_databases_rdoc.html\n\n")
          file.write("development:\n")
          file.write("  :primary:     sqlite:/\n")
          file.write("  :secondary:   sqlite:/\n")
          file.write("\n")
          file.write("test:\n")
          file.write("  :primary:     sqlite:/\n")
          file.write("  :secondary:   sqlite:/\n")
          file.write("\n")
          file.write("release:\n")
          file.write("  :primary:     sqlite:/\n")
          file.write("  :secondary:   sqlite:/\n")
          file.write("\n")
          file.write("production:\n")
          file.write("  :primary:     sqlite:/\n")
          file.write("  :secondary:   sqlite:/\n")
        }
      end
    end

    initializer "Include widget_list" do
      ActiveSupport.on_load(:action_controller) do
        if WidgetList::List::is_sequel(true) || WidgetList::List::is_sequel(false)
          require 'sequel'
        end
        require 'widget_list/sequel'
      end
    end


  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
widget_list-1.3.7 lib/widget_list/railtie.rb
widget_list-1.3.6 lib/widget_list/railtie.rb
widget_list-1.3.5 lib/widget_list/railtie.rb
widget_list-1.2.0 lib/widget_list/railtie.rb
widget_list-1.1.9 lib/widget_list/railtie.rb
widget_list-1.1.8 lib/widget_list/railtie.rb
widget_list-1.1.7 lib/widget_list/railtie.rb
widget_list-1.1.6 lib/widget_list/railtie.rb
widget_list-1.1.5 lib/widget_list/railtie.rb
widget_list-1.1.4 lib/widget_list/railtie.rb
widget_list-1.1.3 lib/widget_list/railtie.rb
widget_list-1.1.2 lib/widget_list/railtie.rb
widget_list-1.1.1 lib/widget_list/railtie.rb
widget_list-1.1.0 lib/widget_list/railtie.rb
widget_list-1.0.11 lib/widget_list/railtie.rb
widget_list-1.0.10 lib/widget_list/railtie.rb
widget_list-1.0.9 lib/widget_list/railtie.rb
widget_list-1.0.8 lib/widget_list/railtie.rb
widget_list-1.0.7 lib/widget_list/railtie.rb