module Flextures::Rake::Command

Public Class Methods

dump() click to toggle source
# File lib/flextures/flextures_command.rb, line 11
def self.dump
  Flextures::load_configurations
  table_names = Flextures::ARGS.parse(ENV)
  puts "dumping..."
  case ENV["FORMAT"].to_s.to_sym
  when :yml,:yaml
    table_names.each { |fmt| Flextures::Dumper::yml(fmt) }
  when :csv
    table_names.each { |fmt| Flextures::Dumper::csv(fmt) }
  else
    table_names.each { |fmt| Flextures::Dumper::csv(fmt) }
  end
end
generate() click to toggle source

load and dump data

# File lib/flextures/flextures_command.rb, line 42
def self.generate
  Flextures::load_configurations
  table_names = Flextures::ARGS.parse(ENV)
  Flextures::init_tables unless ENV["T"] or ENV["TABLE"] or ENV["M"] or ENV["MODEL"] or ENV["F"] or ENV["FIXTUES"]
  file_format = ENV["FORMAT"]
  puts "generating..."
  case file_format.to_s.to_sym
  when :yml
    table_names.each do |fmt|
      Flextures::Loader::load(fmt, %i[yml])
      Flextures::Dumper::yml(fmt)
    end
  when :csv
    table_names.each do |fmt|
      Flextures::Loader::load(fmt, %i[csv])
      Flextures::Dumper::csv(fmt)
    end
  else
    table_names.each do |fmt|
      Flextures::Loader::load(fmt)
      Flextures::Dumper::csv(fmt)
    end
  end
end
load() click to toggle source
# File lib/flextures/flextures_command.rb, line 25
def self.load
  Flextures::load_configurations
  table_names = Flextures::ARGS.parse(ENV)
  Flextures::init_tables unless ENV["T"] or ENV["TABLE"] or ENV["M"] or ENV["MODEL"] or ENV["F"] or ENV["FIXTUES"]
  file_format = ENV["FORMAT"]
  puts "loading..."
  case file_format.to_s.to_sym
  when :csv
    table_names.each { |fmt| Flextures::Loader::load(fmt, %i[csv]) }
  when :yml
    table_names.each { |fmt| Flextures::Loader::load(fmt, %i[yml]) }
  else
    table_names.each { |fmt| Flextures::Loader::load(fmt) }
  end
end