Sha256: fe433a3fab70c2f828550935455bdff2b1c329c5d2bdbb71086e094616fd0713

Contents?: true

Size: 839 Bytes

Versions: 9

Compression:

Stored size: 839 Bytes

Contents

require 'ec2ssh/exceptions'
require 'ec2ssh/command'
require 'ec2ssh/ssh_config'
require 'ec2ssh/builder'
require 'ec2ssh/dsl'
require 'ec2ssh/migrator'

module Ec2ssh
  module Command
    class Update < Base
      def initialize(cli)
        super
      end

      def run
        ssh_config = SshConfig.new(ssh_config_path)
        raise MarkNotFound unless ssh_config.mark_exist?

        ssh_config.parse!
        lines = builder.build_host_lines
        ssh_config_str = ssh_config.wrap lines
        ssh_config.replace! ssh_config_str
        cli.yellow ssh_config_str
      end

      def builder
        @builder ||= Builder.new dsl
      end

      def dsl
        @dsl ||= Ec2ssh::Dsl::Parser.parse File.read(dotfile_path)
      end

      def migrator
        @migrator ||= Migrator.new dotfile_path
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ec2ssh-3.1.1 lib/ec2ssh/command/update.rb
ec2ssh-3.1.0 lib/ec2ssh/command/update.rb
ec2ssh-3.1.0.rc2 lib/ec2ssh/command/update.rb
ec2ssh-3.1.0.rc1 lib/ec2ssh/command/update.rb
ec2ssh-3.0.3 lib/ec2ssh/command/update.rb
ec2ssh-3.0.2 lib/ec2ssh/command/update.rb
ec2ssh-3.0.1 lib/ec2ssh/command/update.rb
ec2ssh-3.0.0 lib/ec2ssh/command/update.rb
ec2ssh-3.0.0.beta1 lib/ec2ssh/command/update.rb