class Nib::Crypt::Initializer

Attributes

key[R]

Public Class Methods

new() click to toggle source
# File lib/nib/crypt/initializer.rb, line 7
def initialize
  @key = Key.new
end

Public Instance Methods

call() click to toggle source

rubocop:disable Metrics/MethodLength, Metrics/AbcSize

# File lib/nib/crypt/initializer.rb, line 12
def call
  if key.remote? && !key.local?
    puts 'Pulling existing key from S3'
    key.pull
  elsif !key.local?
    puts 'Key does not yet exist, creating'
    key.create!
    puts 'Pushing new key to to S3'
    key.push
  elsif !key.remote?
    puts 'Pushing existing key to to S3'
    key.push
  else
    puts 'Project already inialized'
  end
end