lib/symmetric/railties/symmetric_encryption.rake in symmetric-encryption-0.1.0 vs lib/symmetric/railties/symmetric_encryption.rake in symmetric-encryption-0.1.1
- old
+ new
@@ -1,15 +1,15 @@
-namespace 'symmetric-encryption' do
+namespace :symmetric_encryption do
- desc 'Decrypt the supplied string. Example: VALUE="Hello World" rake symmetric-encryption:decrypt'
- task :decrypt do
+ desc 'Decrypt the supplied string. Example: VALUE="_encrypted_string_" rake symmetric_encryption:decrypt'
+ task :decrypt => :environment do
puts "\nEncrypted: #{ENV['VALUE']}"
puts "Decrypted: #{Symmetric::Encryption.decrypt(ENV['VALUE'])}\n\n"
end
- desc 'Encrypt a value, such as a password. Example: rake symmetric-encryption:encrypt'
- task :encrypt do
+ desc 'Encrypt a value, such as a password. Example: rake symmetric_encryption:encrypt'
+ task :encrypt => :environment do
require 'highline'
password1 = nil
password2 = 0
while password1 != password2
@@ -21,11 +21,16 @@
end
end
puts "\nEncrypted: #{Symmetric::Encryption.encrypt(password1)}\n\n"
end
- desc 'Generate a random password and display its encrypted form'
- task :random_password do
+ desc 'Generate new Symmetric key and initialization vector. Example: RAILS_ENV=production rake symmetric_encryption:generate_symmetric_keys'
+ task :generate_symmetric_keys do
+ Symmetric::Encryption.generate_symmetric_key_files
+ end
+
+ desc 'Generate a random password and display its encrypted form. Example: rake symmetric_encryption:random_password'
+ task :random_password => :environment do
p = Symmetric::Encryption.random_password
puts "\nGenerated Password: #{p}"
puts "Encrypted: #{Symmetric::Encryption.encrypt(p)}\n\n"
end