Sha256: dbdad45b7874ac2af10e12b92f165a28c439834b1fdf3431fcb2016542341998
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
#!/usr/bin/env ruby require 'optparse' options = { :adapter => "mysql", :host => "localhost", :username => "root", :database => "ae_users" } OptionParser.new do |opts| opts.banner = "Usage: export_ae_users [options]" opts.on("-a", "--adapter ADAPTER", "ActiveRecord database adapter") do |a| options[:adapter] = a end opts.on("-u", "--username USERNAME", "Database username") do |u| options[:username] = u end opts.on("-p", "--password PASSWORD", "Database password") do |p| options[:password] = p end opts.on("-d", "--database DATABASE", "Database to connect to") do |d| options[:database] = d end opts.on("-h", "--host HOST", "Database host to connect to") do |h| options[:host] = h end opts.on("-c", "--ssl-ca CA", "CA PEM file to use for database connection") do |c| options[:sslca] = c end end.parse! require 'rubygems' require 'active_record' ActiveRecord::Base.establish_connection(options) require 'ae_users_migrator/export' if AeUsersMigrator::Export::Person.respond_to?(:includes) # ActiveRecord 3 API puts AeUsersMigrator::Export::Person.includes(:email_addresses, :account, :open_id_identities, :roles).all.to_json else # ActiveRecord 2.3 API puts AeUsersMigrator::Export::Person.all(:include => [:email_addresses, :account, :open_id_identities, :roles]).to_json end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ae_users_migrator-1.0.5 | bin/export_ae_users |