Class: InstallContactSyncGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- InstallContactSyncGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/install_contact_sync/install_contact_sync_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(path) ⇒ Object
6 7 8 |
# 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 |
Instance Method Details
#generate_encrypted_strings_config ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/generators/install_contact_sync/install_contact_sync_generator.rb', line 19 def generate_encrypted_strings_config inject_into_file 'config/environments/development.rb', before: "end\n" do "\nEncryptedStrings::SymmetricCipher.default_algorithm = 'aes-256-cbc'\nEncryptedStrings::SymmetricCipher.default_password = 'Replace This with some long alphanumeric string'\n\n" end end |
#generate_migration ⇒ Object
12 13 14 15 16 17 |
# File 'lib/generators/install_contact_sync/install_contact_sync_generator.rb', line 12 def generate_migration binding.pry 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 end |
#generate_models ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/generators/install_contact_sync/install_contact_sync_generator.rb', line 29 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 |