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
-
#generate_encrypted_strings_config ⇒ Object
def generate_global_phone_db copy_file “global_phone.json”, “db/global_phone.json” end.
- #generate_migration ⇒ Object
- #generate_models ⇒ Object
- #generate_routes ⇒ Object
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
def generate_global_phone_db
copy_file "global_phone.json", "db/global_phone.json"
end
24 25 26 27 28 29 30 31 32 |
# File 'lib/generators/install_contact_sync/install_contact_sync_generator.rb', line 24 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 ⇒ Object
12 13 14 |
# File 'lib/generators/install_contact_sync/install_contact_sync_generator.rb', line 12 def generate_migration migration_template "create_contact_sync_schema.rb", "db/migrate/create_contact_sync_schema.rb" end |
#generate_models ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/generators/install_contact_sync/install_contact_sync_generator.rb', line 34 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 |
#generate_routes ⇒ Object
16 17 18 |
# File 'lib/generators/install_contact_sync/install_contact_sync_generator.rb', line 16 def generate_routes route(File.read(File.join(File.dirname(__FILE__), 'templates/routes.rb') )) end |