lib/flextures/flextures.rb in flextures-3.1.3 vs lib/flextures/flextures.rb in flextures-4.0.0

- old
+ new

@@ -1,7 +1,5 @@ -# encoding: utf-8 - require 'ostruct' require 'csv' require "flextures/flextures_base_config" require "flextures/flextures_extension_modules" require "flextures/flextures_factory" @@ -30,23 +28,22 @@ } a.call || b.call || c.call end # load configuration file, if file is exist - def self.init_load + def self.load_configurations if defined?(Rails) and Rails.root [ - File.join( Rails.root.to_path,"/config/flextures.config.rb" ), File.join( Rails.root.to_path,"/config/flextures.factory.rb" ), ].each { |fn| File.exist?(fn) && load(fn) } end end # @return [Array] flextures useable table names def self.deletable_tables tables = ActiveRecord::Base.connection.tables - Flextures::Config.ignore_tables.each { |name| tables.delete( name.to_s ) } + Flextures::Configuration.ignore_tables.each { |name| tables.delete( name.to_s ) } tables end # initialize table data def self.init_tables @@ -131,10 +128,10 @@ table_names end # check exist filename block def self.exist - return->(name){ File.exists?( File.join( Config.fixture_load_directory, "#{name}.csv") ) or - File.exists?( File.join( Config.fixture_load_directory, "#{name}.yml") ) } + return->(name){ File.exists?( File.join(Flextures::Configuration.load_directory, "#{name}.csv") ) or + File.exists?( File.join(Flextures::Configuration.load_directory, "#{name}.yml") ) } end end end