Class: Chamber::Commands::Initialize
- Defined in:
- lib/chamber/commands/initialize.rb
Class Method Summary collapse
-
.call(options = {}) ⇒ Object
rubocop:enable Metrics/LineLength, Metrics/MethodLength, Metrics/AbcSize.
Instance Method Summary collapse
-
#call ⇒ Object
rubocop:disable Metrics/LineLength, Metrics/MethodLength, Metrics/AbcSize.
-
#initialize(options = {}) ⇒ Initialize
constructor
A new instance of Initialize.
Constructor Details
#initialize(options = {}) ⇒ Initialize
Returns a new instance of Initialize.
10 11 12 13 14 |
# File 'lib/chamber/commands/initialize.rb', line 10 def initialize( = {}) super self.basepath = Chamber.configuration.basepath end |
Class Method Details
.call(options = {}) ⇒ Object
rubocop:enable Metrics/LineLength, Metrics/MethodLength, Metrics/AbcSize
61 62 63 |
# File 'lib/chamber/commands/initialize.rb', line 61 def self.call( = {}) new().call end |
Instance Method Details
#call ⇒ Object
rubocop:disable Metrics/LineLength, Metrics/MethodLength, Metrics/AbcSize
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/chamber/commands/initialize.rb', line 17 def call shell.create_file private_key_filepath, rsa_private_key.to_pem shell.create_file protected_key_filepath, rsa_protected_key shell.create_file public_key_filepath, rsa_public_key.to_pem `chmod 600 #{private_key_filepath}` `chmod 600 #{protected_key_filepath}` `chmod 644 #{public_key_filepath}` ::FileUtils.touch gitignore_filepath unless ::File.read(gitignore_filepath).match(/^.chamber.pem$/) shell.append_to_file gitignore_filepath, "\n# Private and protected key files for Chamber\n" shell.append_to_file gitignore_filepath, "#{private_key_filename}\n" shell.append_to_file gitignore_filepath, "#{protected_key_filename}\n" end shell.copy_file settings_template_filepath, settings_filepath shell.say '' shell.say 'The passphrase for your encrypted private key is:', :green shell.say '' shell.say rsa_key_passphrase, :green shell.say '' shell.say 'Store this securely somewhere.', :green shell.say '' shell.say 'You can send them the file located at:', :green shell.say '' shell.say protected_key_filepath, :green shell.say '' shell.say 'and not have to worry about sending it via a secure medium (such as', :green shell.say 'email), however do not send the passphrase along with it. Give it to', :green shell.say 'your team members in person.', :green shell.say '' shell.say 'In order for them to decrypt it (for use with Chamber), they can run:', :green shell.say '' shell.say "$ cp /path/to/{#{protected_key_filename},#{private_key_filename}}", :green shell.say "$ ssh-keygen -p -f /path/to/#{private_key_filename}", :green shell.say '' shell.say 'Enter the passphrase when prompted and leave the new passphrase blank.', :green shell.say '' end |