class InstallContactSyncGenerator
Public Class Methods
next_migration_number(path)
click to toggle source
# File lib/generators/install_contact_sync/install_contact_sync_generator.rb, line 6 def self.next_migration_number(path) ActiveRecord::Generators::Base.next_migration_number(path) end
Public Instance Methods
generate_encrypted_strings_config()
click to toggle source
# File lib/generators/install_contact_sync/install_contact_sync_generator.rb, line 23 def generate_encrypted_strings_config inject_into_file 'config/environments/development.rb', before: "end\n" do <<-'RUBY' EncryptedStrings::SymmetricCipher.default_algorithm = 'aes-256-cbc' EncryptedStrings::SymmetricCipher.default_password = 'Replace This with some long alphanumeric string' RUBY end end
generate_migration()
click to toggle source
# File lib/generators/install_contact_sync/install_contact_sync_generator.rb, line 12 def generate_migration if !self.class.migration_exists?('db/migrate', 'create_contact_sync_schema') migration_template "create_contact_sync_schema.rb", "db/migrate/create_contact_sync_schema.rb" end if !self.class.migration_exists?('db/migrate', 'remove_device_id_from_contacts') migration_template "remove_device_id_from_contacts.rb", "db/migrate/remove_device_id_from_contacts.rb" end end
generate_models()
click to toggle source
# File lib/generators/install_contact_sync/install_contact_sync_generator.rb, line 33 def generate_models template "address.rb", 'app/models/address.rb' template 'email.rb', 'app/models/email.rb' template 'phone.rb', 'app/models/phone.rb' template 'user.rb', 'app/models/user.rb' template 'contact.rb', 'app/models/contact.rb' end