Sha256: f2a293ff907d07a5db5a71497293f996b266e0bc65e7c95d9dc0212f3d8e654e

Contents?: true

Size: 735 Bytes

Versions: 3

Compression:

Stored size: 735 Bytes

Contents

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

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
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ec2ssh-5.1.0 lib/ec2ssh/command/update.rb
ec2ssh-5.0.0 lib/ec2ssh/command/update.rb
ec2ssh-4.0.0 lib/ec2ssh/command/update.rb