ec2ssh 3.1.1 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +31 -0
- data/ChangeLog.md +23 -0
- data/Gemfile +7 -5
- data/README.md +27 -24
- data/bash/ec2ssh.bash +4 -11
- data/ec2ssh.gemspec +6 -5
- data/example/example.ec2ssh +2 -2
- data/lib/ec2ssh/builder.rb +13 -5
- data/lib/ec2ssh/cli.rb +2 -22
- data/lib/ec2ssh/command/init.rb +3 -9
- data/lib/ec2ssh/command/update.rb +0 -5
- data/lib/ec2ssh/dsl.rb +15 -0
- data/lib/ec2ssh/ec2_instances.rb +70 -16
- data/lib/ec2ssh/version.rb +1 -1
- data/spec/aws_sdk_compatibility_spec.rb +45 -44
- data/spec/lib/ec2ssh/builder_spec.rb +16 -14
- data/spec/lib/ec2ssh/command/remove_spec.rb +3 -4
- data/spec/lib/ec2ssh/command/update_spec.rb +12 -10
- data/spec/lib/ec2ssh/dsl_spec.rb +44 -11
- data/spec/lib/ec2ssh/ec2_instances_spec.rb +26 -8
- data/zsh/_ec2ssh +8 -19
- metadata +43 -23
- data/.travis.yml +0 -11
- data/lib/ec2ssh/command/migrate.rb +0 -34
- data/lib/ec2ssh/migrator.rb +0 -77
- data/spec/lib/ec2ssh/command/migrate_spec.rb +0 -113
- data/spec/lib/ec2ssh/migrator_spec.rb +0 -64
@@ -8,8 +8,8 @@ describe 'aws-sdk compatibility' do
|
|
8
8
|
let!(:ec2_instances) do
|
9
9
|
VCR.use_cassette('ec2-instances') do
|
10
10
|
Ec2ssh::Ec2Instances.new(
|
11
|
-
{'foo' => {
|
12
|
-
['
|
11
|
+
{'foo' => {'us-west-1' => Aws::Credentials.new('access_key_id', 'secret_access_key')}},
|
12
|
+
[{ name: 'instance-state-name', values: ['running'] }]
|
13
13
|
).instances('foo')
|
14
14
|
end
|
15
15
|
end
|
@@ -18,54 +18,51 @@ describe 'aws-sdk compatibility' do
|
|
18
18
|
|
19
19
|
it { expect(ec2_instances.count).to be == 1 }
|
20
20
|
|
21
|
-
it { expect(ins.
|
22
|
-
it { expect(ins.
|
21
|
+
it { expect(ins.tag('Name')).to match /.+/ }
|
22
|
+
it { expect(ins.tag('Role')).to match /.+/ }
|
23
|
+
it { expect(ins.tags).to match_array([have_attributes(key: 'Name', value: /.+/), have_attributes(key: 'Role', value: /.+/)]) }
|
23
24
|
it { expect(ins.ami_launch_index).to be == 0 }
|
24
|
-
it { expect(ins.architecture).to be ==
|
25
|
-
it { expect(ins.attachments.to_h).to match( root_device => an_instance_of(AWS::EC2::Attachment) ) }
|
26
|
-
it { expect(ins.availability_zone).to match /\A#{region}[a-c]\z/ }
|
27
|
-
it { expect(ins.block_device_mappings.to_h).to match( root_device => an_instance_of(AWS::EC2::Attachment) ) }
|
25
|
+
it { expect(ins.architecture).to be == 'x86_64' }
|
28
26
|
it do
|
29
|
-
expect(ins.
|
27
|
+
expect(ins.block_device_mappings).to match [
|
28
|
+
have_attributes(
|
30
29
|
device_name: root_device,
|
31
|
-
ebs:
|
30
|
+
ebs: have_attributes(
|
32
31
|
volume_id: /\Avol-\w+\z/,
|
33
32
|
status: 'attached',
|
34
33
|
attach_time: an_instance_of(Time),
|
35
34
|
delete_on_termination: true
|
36
|
-
|
37
|
-
|
35
|
+
)
|
36
|
+
)]
|
38
37
|
end
|
38
|
+
# it { expect(ins.capacity_reservation_id).to be_nil}
|
39
|
+
# it { expect(ins.capacity_reservation_specification).to be_nil }
|
40
|
+
it { expect(ins.classic_address).to be_a(Aws::EC2::ClassicAddress) }
|
41
|
+
it { expect(ins.client).to be_a(Aws::EC2::Client) }
|
39
42
|
it { expect(ins.client_token).to match /\A\w{18}\z/ }
|
40
|
-
it { expect(ins.
|
41
|
-
it { expect(ins.dns_name).to match /\Aec2-[\d\.\-]+\.#{region}\.compute\.amazonaws\.com\z/ }
|
43
|
+
# it { expect(ins.cpu_options).to be_nil }
|
42
44
|
it { expect(ins.ebs_optimized).to be_falsy }
|
43
|
-
it
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
it { expect(ins.groups.to_a).to all match(AWS::EC2::SecurityGroup) }
|
50
|
-
it { expect(ins.hypervisor).to be == :xen }
|
51
|
-
it { expect(ins.iam_instance_profile_arn).to match /\Aarn:aws:iam::\d+:instance-profile\/[\w\-]+\z/ }
|
52
|
-
it { expect(ins.iam_instance_profile_id).to match /\A\w{21}\z/ }
|
45
|
+
it { expect(ins.elastic_gpu_associations).to be_nil }
|
46
|
+
# it { expect(ins.elastic_inference_accelerator_associations).to be_nil }
|
47
|
+
it { expect(ins.ena_support).to be_falsy }
|
48
|
+
# it { expect(ins.hibernation_options).to be_nil}
|
49
|
+
it { expect(ins.hypervisor).to be == 'xen' }
|
50
|
+
it { expect(ins.iam_instance_profile).to have_attributes(arn: /\Aarn:aws:iam::\d+:instance-profile\/[\w\-]+\z/, id: /\A\w{21}\z/) }
|
53
51
|
it { expect(ins.id).to match /\Ai-\w+\z/ }
|
54
|
-
it { expect(ins.image).to be_a(
|
52
|
+
it { expect(ins.image).to be_a(Aws::EC2::Image) }
|
55
53
|
it { expect(ins.image_id).to match /\Aami-\w+\z/ }
|
56
54
|
it { expect(ins.instance_id).to match /\Ai-\w+\z/ }
|
57
55
|
it { expect(ins.instance_lifecycle).to be_nil }
|
58
56
|
it { expect(ins.instance_type).to match /\A[trmci][1248]\.\w+\z/ }
|
59
|
-
it { expect(ins.ip_address).to match /\A[\d\.]+\z/ }
|
60
57
|
it { expect(ins.kernel_id).to be_nil }
|
61
58
|
it { expect(ins.key_name).to match /\A.+\.pem\z/ }
|
62
|
-
it { expect(ins.key_pair).to be_a(
|
59
|
+
it { expect(ins.key_pair).to be_a(Aws::EC2::KeyPairInfo) }
|
63
60
|
it { expect(ins.launch_time).to be_a(Time) }
|
64
|
-
it { expect(ins.
|
65
|
-
it { expect(ins.
|
66
|
-
it { expect(ins.network_interfaces
|
67
|
-
|
68
|
-
it { expect(ins.
|
61
|
+
# it { expect(ins.licenses).to all have_attributes(license_configuration_arn: '') }
|
62
|
+
it { expect(ins.monitoring).to have_attributes(state: 'disabled') }
|
63
|
+
it { expect(ins.network_interfaces).to all match(an_instance_of(Aws::EC2::NetworkInterface)) }
|
64
|
+
it { expect(ins.placement).to have_attributes(availability_zone: /\A#{region}[a-c]\z/, group_name: '', tenancy: 'default') }
|
65
|
+
it { expect(ins.placement_group).to be_a(Aws::EC2::PlacementGroup) }
|
69
66
|
it { expect(ins.platform).to be_nil }
|
70
67
|
it { expect(ins.private_dns_name).to match /\Aip-[\w\-]+\.#{region}\.compute\.internal\z/ }
|
71
68
|
it { expect(ins.private_ip_address).to match /\A[\d\.]+\z/ }
|
@@ -73,19 +70,23 @@ describe 'aws-sdk compatibility' do
|
|
73
70
|
it { expect(ins.public_dns_name).to match /\Aec2-[\w\-]+\.#{region}\.compute\.amazonaws\.com\z/ }
|
74
71
|
it { expect(ins.public_ip_address).to match /\A[\d\.]+\z/ }
|
75
72
|
it { expect(ins.ramdisk_id).to be_nil }
|
76
|
-
it { expect(ins.requester_id).to be_nil }
|
77
|
-
# it { expect(ins.reservation_id).to match /\Ar-\w+\z/ }
|
78
73
|
it { expect(ins.root_device_name).to eq root_device }
|
79
|
-
it { expect(ins.root_device_type).to be ==
|
80
|
-
it
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
74
|
+
it { expect(ins.root_device_type).to be == 'ebs' }
|
75
|
+
it do
|
76
|
+
expect(ins.security_groups).to all have_attributes(
|
77
|
+
group_id: /\Asg-\w+\z/,
|
78
|
+
group_name: /\A.+\z/
|
79
|
+
)
|
80
|
+
end
|
81
|
+
it { expect(ins.source_dest_check).to be true }
|
82
|
+
it { expect(ins.spot_instance_request_id).to be_nil }
|
83
|
+
it { expect(ins.sriov_net_support).to be_nil }
|
84
|
+
it { expect(ins.state).to have_attributes(code: 16, name: 'running') }
|
85
|
+
it { expect(ins.state_reason).to be_nil }
|
86
|
+
it { expect(ins.state_transition_reason).to be == '' }
|
87
|
+
it { expect(ins.subnet).to be_a(Aws::EC2::Subnet) }
|
86
88
|
it { expect(ins.subnet_id).to match /\Asubnet-\w+\z/ }
|
87
|
-
it { expect(ins.virtualization_type).to be ==
|
88
|
-
it { expect(ins.vpc).to be_a(
|
89
|
-
it { expect(ins.vpc?).to be_truthy }
|
89
|
+
it { expect(ins.virtualization_type).to be == 'hvm' }
|
90
|
+
it { expect(ins.vpc).to be_a(Aws::EC2::Vpc) }
|
90
91
|
it { expect(ins.vpc_id).to match /\Avpc-\w+\z/ }
|
91
92
|
end
|
@@ -7,10 +7,10 @@ describe Ec2ssh::Builder do
|
|
7
7
|
let(:container) do
|
8
8
|
Ec2ssh::Dsl::Container.new.tap do |c|
|
9
9
|
c.aws_keys = {
|
10
|
-
key1
|
11
|
-
key2
|
10
|
+
'key1' => { 'us-west-1' => Aws::Credentials.new('KEY1', 'SEC1') },
|
11
|
+
'key2' => { 'us-west-1' => Aws::Credentials.new('KEY2', 'SEC2') }
|
12
12
|
}
|
13
|
-
c.host_line = "Host <%=
|
13
|
+
c.host_line = "Host <%= tag('Name') %>"
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -28,12 +28,14 @@ describe Ec2ssh::Builder do
|
|
28
28
|
|
29
29
|
let(:instances) do
|
30
30
|
{
|
31
|
-
key1
|
32
|
-
double('instance'
|
33
|
-
double('instance'
|
34
|
-
|
35
|
-
|
36
|
-
double('instance'
|
31
|
+
'key1' => [
|
32
|
+
double('instance').tap {|m| allow(m).to receive(:tag).with('Name').and_return('srv1') },
|
33
|
+
double('instance').tap {|m| allow(m).to receive(:tag).with('Name').and_return('srv2') }
|
34
|
+
],
|
35
|
+
'key2' => [
|
36
|
+
double('instance').tap {|m| allow(m).to receive(:tag).with('Name').and_return('srv3') },
|
37
|
+
double('instance').tap {|m| allow(m).to receive(:tag).with('Name').and_return('srv4') }
|
38
|
+
]
|
37
39
|
}
|
38
40
|
end
|
39
41
|
|
@@ -50,7 +52,7 @@ Host srv4
|
|
50
52
|
|
51
53
|
context 'with #reject' do
|
52
54
|
before do
|
53
|
-
container.reject = lambda {|ins| ins.
|
55
|
+
container.reject = lambda {|ins| ins.tag('Name') == 'srv1' }
|
54
56
|
end
|
55
57
|
|
56
58
|
it do
|
@@ -67,10 +69,10 @@ Host srv4
|
|
67
69
|
context 'checking erb trim_mode' do
|
68
70
|
before do
|
69
71
|
container.host_line = <<-END
|
70
|
-
% if
|
71
|
-
<%- if
|
72
|
-
Host <%=
|
73
|
-
HostName <%=
|
72
|
+
% if tag('Name')
|
73
|
+
<%- if tag('Name') == 'srv3' -%>
|
74
|
+
Host <%= tag('Name') %>
|
75
|
+
HostName <%= tag('Name') %>
|
74
76
|
<%- end -%>
|
75
77
|
% end
|
76
78
|
END
|
@@ -19,11 +19,10 @@ describe Ec2ssh::Command::Remove do
|
|
19
19
|
|
20
20
|
let(:dotfile_str) { <<-END }
|
21
21
|
path '/dotfile'
|
22
|
-
|
23
|
-
|
24
|
-
)
|
22
|
+
profiles 'default'
|
23
|
+
regions 'us-west-1'
|
25
24
|
host_line <<EOS
|
26
|
-
Host <%=
|
25
|
+
Host <%= tag('Name') %>
|
27
26
|
HostName <%= private_ip_address %>
|
28
27
|
EOS
|
29
28
|
END
|
@@ -9,6 +9,7 @@ describe Ec2ssh::Command::Update do
|
|
9
9
|
let(:command) do
|
10
10
|
described_class.new(cli).tap do |cmd|
|
11
11
|
allow(cmd).to receive(:options).and_return(options)
|
12
|
+
allow(cmd.builder).to receive(:aws_keys) { aws_keys }
|
12
13
|
allow(cmd.builder.ec2s).to receive(:instances) { instances }
|
13
14
|
end
|
14
15
|
end
|
@@ -18,10 +19,13 @@ describe Ec2ssh::Command::Update do
|
|
18
19
|
let(:cli) do
|
19
20
|
double(:cli, options: options, red: nil, yellow: nil, green: nil)
|
20
21
|
end
|
22
|
+
let(:aws_keys) do
|
23
|
+
{'default' => {'us-west-1' => Aws::Credentials.new('access_key_id', 'secret_access_key')}}
|
24
|
+
end
|
21
25
|
let(:instances) do
|
22
26
|
[
|
23
|
-
double('instance',
|
24
|
-
double('instance',
|
27
|
+
double('instance', private_ip_address: '10.0.0.1').tap {|m| allow(m).to receive(:tag).with('Name').and_return('srv1') },
|
28
|
+
double('instance', private_ip_address: '10.0.0.2').tap {|m| allow(m).to receive(:tag).with('Name').and_return('srv2') }
|
25
29
|
]
|
26
30
|
end
|
27
31
|
|
@@ -34,11 +38,10 @@ describe Ec2ssh::Command::Update do
|
|
34
38
|
let(:ssh_config_str) { '' }
|
35
39
|
let(:dotfile_str) { <<-END }
|
36
40
|
path '/dotfile'
|
37
|
-
|
38
|
-
|
39
|
-
)
|
41
|
+
profiles 'default'
|
42
|
+
regions 'us-west-1'
|
40
43
|
host_line <<EOS
|
41
|
-
Host <%=
|
44
|
+
Host <%= tag('Name') %>
|
42
45
|
HostName <%= private_ip_address %>
|
43
46
|
EOS
|
44
47
|
END
|
@@ -60,11 +63,10 @@ EOS
|
|
60
63
|
|
61
64
|
let(:dotfile_str) { <<-END }
|
62
65
|
path '/dotfile'
|
63
|
-
|
64
|
-
|
65
|
-
)
|
66
|
+
profiles 'default'
|
67
|
+
regions 'us-west-1'
|
66
68
|
host_line <<EOS
|
67
|
-
Host <%=
|
69
|
+
Host <%= tag('Name') %>
|
68
70
|
HostName <%= private_ip_address %>
|
69
71
|
EOS
|
70
72
|
END
|
data/spec/lib/ec2ssh/dsl_spec.rb
CHANGED
@@ -27,10 +27,9 @@ END
|
|
27
27
|
let(:dsl_str) do
|
28
28
|
<<-END
|
29
29
|
aws_keys(
|
30
|
-
key1
|
31
|
-
key2
|
30
|
+
'key1' => { 'ap-northeast-1' => Aws::Credentials.new('ACCESS_KEY1', 'SECRET1') },
|
31
|
+
'key2' => { 'us-east-1' => Aws::Credentials.new('ACCESS_KEY2', 'SECRET2') }
|
32
32
|
)
|
33
|
-
regions 'ap-northeast-1', 'us-east-1'
|
34
33
|
host_line 'host lines'
|
35
34
|
reject {|instance| instance }
|
36
35
|
path 'path'
|
@@ -40,13 +39,12 @@ END
|
|
40
39
|
subject(:result) { Ec2ssh::Dsl::Parser.parse dsl_str }
|
41
40
|
|
42
41
|
its(:profiles) { should be_nil }
|
43
|
-
|
44
|
-
|
45
|
-
key1
|
46
|
-
key2
|
47
|
-
|
42
|
+
it do
|
43
|
+
expect(result.aws_keys).to match(
|
44
|
+
'key1' => { 'ap-northeast-1' => be_a(Aws::Credentials).and(have_attributes(access_key_id: 'ACCESS_KEY1', secret_access_key: 'SECRET1')) } ,
|
45
|
+
'key2' => { 'us-east-1' => be_a(Aws::Credentials).and(have_attributes(access_key_id: 'ACCESS_KEY2', secret_access_key: 'SECRET2')) }
|
46
|
+
)
|
48
47
|
end
|
49
|
-
its(:regions) { should == ['ap-northeast-1', 'us-east-1'] }
|
50
48
|
its(:host_line) { should == 'host lines' }
|
51
49
|
it { expect(result.reject.call(123)).to eq(123) }
|
52
50
|
its(:path) { should == 'path' }
|
@@ -56,8 +54,8 @@ END
|
|
56
54
|
let(:dsl_str) do
|
57
55
|
<<-END
|
58
56
|
aws_keys(
|
59
|
-
key1
|
60
|
-
key2
|
57
|
+
'key1' => { 'ap-northeast-1' => Aws::Credentials.new('ACCESS_KEY1', 'SECRET1') },
|
58
|
+
'key2' => { 'us-east-1' => Aws::Credentials.new('ACCESS_KEY2', 'SECRET2') }
|
61
59
|
)
|
62
60
|
profiles 'default', 'myprofile'
|
63
61
|
regions 'ap-northeast-1', 'us-east-1'
|
@@ -71,4 +69,39 @@ END
|
|
71
69
|
expect { Ec2ssh::Dsl::Parser.parse dsl_str }.to raise_error Ec2ssh::DotfileValidationError
|
72
70
|
end
|
73
71
|
end
|
72
|
+
|
73
|
+
context 'with old structure aws_keys' do
|
74
|
+
let(:dsl_str) do
|
75
|
+
<<-END
|
76
|
+
aws_keys(
|
77
|
+
key1: { access_key_id: 'ACCESS_KEY1', secret_access_key: 'SECRET1' },
|
78
|
+
key2: { access_key_id: 'ACCESS_KEY2', secret_access_key: 'SECRET2' }
|
79
|
+
)
|
80
|
+
regions 'ap-northeast-1', 'us-east-1'
|
81
|
+
host_line 'host lines'
|
82
|
+
reject {|instance| instance }
|
83
|
+
path 'path'
|
84
|
+
END
|
85
|
+
end
|
86
|
+
|
87
|
+
it { expect { Ec2ssh::Dsl::Parser.parse dsl_str }.to raise_error Ec2ssh::DotfileValidationError }
|
88
|
+
end
|
89
|
+
|
90
|
+
context 'with filters' do
|
91
|
+
let(:dsl_str) do
|
92
|
+
<<-END
|
93
|
+
regions 'ap-northeast-1', 'us-east-1'
|
94
|
+
filters [{
|
95
|
+
name: 'instance-state-name',
|
96
|
+
values: ['running', 'stopped']
|
97
|
+
}]
|
98
|
+
END
|
99
|
+
end
|
100
|
+
|
101
|
+
subject(:result) { Ec2ssh::Dsl::Parser.parse dsl_str }
|
102
|
+
|
103
|
+
it do
|
104
|
+
expect(result.filters).to eq([{name:'instance-state-name', values:['running', 'stopped']}])
|
105
|
+
end
|
106
|
+
end
|
74
107
|
end
|
@@ -12,9 +12,11 @@ describe Ec2ssh::Ec2Instances do
|
|
12
12
|
}
|
13
13
|
|
14
14
|
let(:mock) do
|
15
|
-
described_class.new(
|
15
|
+
described_class.new(
|
16
|
+
{key_name => {region => ''}},
|
17
|
+
[{ name: 'instance-state-name', values: ['running'] }]
|
18
|
+
).tap do |e|
|
16
19
|
allow(e).to receive(:ec2s) { ec2s }
|
17
|
-
allow(e).to receive(:regions) { [region] }
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
@@ -37,9 +39,9 @@ describe Ec2ssh::Ec2Instances do
|
|
37
39
|
context 'with non-empty names' do
|
38
40
|
let(:mock_instances) {
|
39
41
|
[
|
40
|
-
double('instance', n: 1, tags:
|
41
|
-
double('instance', n: 2, tags:
|
42
|
-
double('instance', n: 3, tags:
|
42
|
+
double('instance', n: 1, tags: [double('tag', key: 'Name', value: 'srvB')]),
|
43
|
+
double('instance', n: 2, tags: [double('tag', key: 'Name', value: 'srvA')]),
|
44
|
+
double('instance', n: 3, tags: [double('tag', key: 'Name', value: 'srvC')])
|
43
45
|
]
|
44
46
|
}
|
45
47
|
|
@@ -52,9 +54,9 @@ describe Ec2ssh::Ec2Instances do
|
|
52
54
|
context 'with names including empty one' do
|
53
55
|
let(:mock_instances) {
|
54
56
|
[
|
55
|
-
double('instance', n: 1, tags:
|
56
|
-
double('instance', n: 2, tags:
|
57
|
-
double('instance', n: 3, tags:
|
57
|
+
double('instance', n: 1, tags: [double('tag', key: 'Name', value: 'srvA')]),
|
58
|
+
double('instance', n: 2, tags: []),
|
59
|
+
double('instance', n: 3, tags: [double('tag', key: 'Name', value: 'srvC')])
|
58
60
|
]
|
59
61
|
}
|
60
62
|
|
@@ -63,6 +65,22 @@ describe Ec2ssh::Ec2Instances do
|
|
63
65
|
expect(result.map {|ins| ins.n}).to match_array([2, 1, 3])
|
64
66
|
end
|
65
67
|
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe Ec2ssh::Ec2Instances::InstanceWrapper do
|
71
|
+
let(:mock_instance) {
|
72
|
+
double('instance', n: 1, tags: [double('tag', key: 'Name', value: 'srvA')])
|
73
|
+
}
|
74
|
+
let(:instance) { described_class.new(mock_instance) }
|
66
75
|
|
76
|
+
describe '#tag' do
|
77
|
+
it { expect(instance.tag('Name')).to eq 'srvA' }
|
78
|
+
end
|
79
|
+
|
80
|
+
describe '#tags' do
|
81
|
+
it { expect(instance.tags).to match_array(have_attributes(key: 'Name', value: 'srvA')) }
|
82
|
+
it { expect(instance.tags[0]).to have_attributes(key: 'Name', value: 'srvA') }
|
83
|
+
it { expect { instance.tags['Name'] }.to raise_error Ec2ssh::DotfileValidationError }
|
84
|
+
end
|
67
85
|
end
|
68
86
|
end
|
data/zsh/_ec2ssh
CHANGED
@@ -3,46 +3,35 @@
|
|
3
3
|
# main completion function
|
4
4
|
_ec2ssh-init() {
|
5
5
|
local ret
|
6
|
-
_call_function ret
|
7
|
-
return $ret
|
8
|
-
}
|
9
|
-
|
10
|
-
_ec2ssh-migrate() {
|
11
|
-
local ret
|
12
|
-
_call_function ret __ec2ssh_noarg_cmd
|
6
|
+
_call_function ret __ec2ssh_common_cmd
|
13
7
|
return $ret
|
14
8
|
}
|
15
9
|
|
16
10
|
_ec2ssh-remove() {
|
17
11
|
local ret
|
18
|
-
_call_function ret
|
12
|
+
_call_function ret __ec2ssh_common_cmd
|
19
13
|
return $ret
|
20
14
|
}
|
21
15
|
|
22
16
|
_ec2ssh-update() {
|
23
|
-
local
|
24
|
-
|
25
|
-
|
26
|
-
integer ret=1
|
27
|
-
_arguments -C -S \
|
28
|
-
'--aws-key:aws key name' \
|
29
|
-
'--dotfile:ec2ssh dotfile:_files' \
|
30
|
-
'--verbose' && return
|
17
|
+
local ret
|
18
|
+
_call_function ret __ec2ssh_common_cmd
|
31
19
|
return $ret
|
32
20
|
}
|
33
21
|
|
34
22
|
_ec2ssh-version() {
|
35
23
|
local ret
|
36
|
-
_call_function ret
|
24
|
+
_call_function ret __ec2ssh_common_cmd
|
37
25
|
return $ret
|
38
26
|
}
|
39
27
|
|
40
|
-
|
28
|
+
__ec2ssh_common_cmd() {
|
41
29
|
local curcontext context state line
|
42
30
|
declare -A opt_args
|
43
31
|
|
44
32
|
integer ret=1
|
45
33
|
_arguments -C -S \
|
34
|
+
'--path:ssh_config file:_files' \
|
46
35
|
'--dotfile:ec2ssh dotfile:_files' \
|
47
36
|
'--verbose' && return
|
48
37
|
return $ret
|
@@ -55,6 +44,7 @@ _ec2ssh() {
|
|
55
44
|
integer ret=1
|
56
45
|
|
57
46
|
_arguments -C -S \
|
47
|
+
'--path:ssh_config file:_files' \
|
58
48
|
'--dotfile:ec2ssh dotfile:_files' \
|
59
49
|
'--verbose' \
|
60
50
|
'(-): :->commands' \
|
@@ -80,7 +70,6 @@ _ec2ssh_commands() {
|
|
80
70
|
_values 'command' \
|
81
71
|
'help[Describe available commands or one specific command]' \
|
82
72
|
'init[Add ec2ssh mark to ssh_config]' \
|
83
|
-
'migrate[Migrate dotfile from old versions]' \
|
84
73
|
'remove[Remove ec2ssh mark from ssh_config]' \
|
85
74
|
'update[Update ec2 hosts list in ssh_config]' \
|
86
75
|
'version[Show version]'
|
metadata
CHANGED
@@ -1,57 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ec2ssh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Issei Naruta
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0.14'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '0.14'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: highline
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- - "
|
37
|
+
- - ">="
|
32
38
|
- !ruby/object:Gem::Version
|
33
39
|
version: '1.6'
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '3.0'
|
34
43
|
type: :runtime
|
35
44
|
prerelease: false
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
37
46
|
requirements:
|
38
|
-
- - "
|
47
|
+
- - ">="
|
39
48
|
- !ruby/object:Gem::Version
|
40
49
|
version: '1.6'
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '3.0'
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: aws-sdk-core
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '3'
|
60
|
+
type: :runtime
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '3'
|
41
67
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: aws-sdk
|
68
|
+
name: aws-sdk-ec2
|
43
69
|
requirement: !ruby/object:Gem::Requirement
|
44
70
|
requirements:
|
45
71
|
- - "~>"
|
46
72
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1
|
73
|
+
version: '1'
|
48
74
|
type: :runtime
|
49
75
|
prerelease: false
|
50
76
|
version_requirements: !ruby/object:Gem::Requirement
|
51
77
|
requirements:
|
52
78
|
- - "~>"
|
53
79
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1
|
80
|
+
version: '1'
|
55
81
|
description: ec2ssh is a ssh_config manager for AWS EC2
|
56
82
|
email:
|
57
83
|
- mimitako@gmail.com
|
@@ -60,9 +86,9 @@ executables:
|
|
60
86
|
extensions: []
|
61
87
|
extra_rdoc_files: []
|
62
88
|
files:
|
89
|
+
- ".github/workflows/main.yml"
|
63
90
|
- ".gitignore"
|
64
91
|
- ".rspec"
|
65
|
-
- ".travis.yml"
|
66
92
|
- ChangeLog.md
|
67
93
|
- Gemfile
|
68
94
|
- Guardfile
|
@@ -79,31 +105,28 @@ files:
|
|
79
105
|
- lib/ec2ssh/cli.rb
|
80
106
|
- lib/ec2ssh/command.rb
|
81
107
|
- lib/ec2ssh/command/init.rb
|
82
|
-
- lib/ec2ssh/command/migrate.rb
|
83
108
|
- lib/ec2ssh/command/remove.rb
|
84
109
|
- lib/ec2ssh/command/update.rb
|
85
110
|
- lib/ec2ssh/dsl.rb
|
86
111
|
- lib/ec2ssh/ec2_instances.rb
|
87
112
|
- lib/ec2ssh/exceptions.rb
|
88
|
-
- lib/ec2ssh/migrator.rb
|
89
113
|
- lib/ec2ssh/ssh_config.rb
|
90
114
|
- lib/ec2ssh/version.rb
|
91
115
|
- spec/aws_sdk_compatibility_spec.rb
|
92
116
|
- spec/lib/ec2ssh/builder_spec.rb
|
93
117
|
- spec/lib/ec2ssh/command/init_spec.rb
|
94
|
-
- spec/lib/ec2ssh/command/migrate_spec.rb
|
95
118
|
- spec/lib/ec2ssh/command/remove_spec.rb
|
96
119
|
- spec/lib/ec2ssh/command/update_spec.rb
|
97
120
|
- spec/lib/ec2ssh/dsl_spec.rb
|
98
121
|
- spec/lib/ec2ssh/ec2_instances_spec.rb
|
99
|
-
- spec/lib/ec2ssh/migrator_spec.rb
|
100
122
|
- spec/lib/ec2ssh/ssh_config_spec.rb
|
101
123
|
- spec/spec_helper.rb
|
102
124
|
- zsh/_ec2ssh
|
103
125
|
homepage: http://github.com/mirakui/ec2ssh
|
104
|
-
licenses:
|
126
|
+
licenses:
|
127
|
+
- MIT
|
105
128
|
metadata: {}
|
106
|
-
post_install_message:
|
129
|
+
post_install_message:
|
107
130
|
rdoc_options: []
|
108
131
|
require_paths:
|
109
132
|
- lib
|
@@ -111,27 +134,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
134
|
requirements:
|
112
135
|
- - ">="
|
113
136
|
- !ruby/object:Gem::Version
|
114
|
-
version: 2.
|
137
|
+
version: 2.6.0
|
115
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
139
|
requirements:
|
117
140
|
- - ">="
|
118
141
|
- !ruby/object:Gem::Version
|
119
142
|
version: '0'
|
120
143
|
requirements: []
|
121
|
-
|
122
|
-
|
123
|
-
signing_key:
|
144
|
+
rubygems_version: 3.3.7
|
145
|
+
signing_key:
|
124
146
|
specification_version: 4
|
125
147
|
summary: A ssh_config manager for AWS EC2
|
126
148
|
test_files:
|
127
149
|
- spec/aws_sdk_compatibility_spec.rb
|
128
150
|
- spec/lib/ec2ssh/builder_spec.rb
|
129
151
|
- spec/lib/ec2ssh/command/init_spec.rb
|
130
|
-
- spec/lib/ec2ssh/command/migrate_spec.rb
|
131
152
|
- spec/lib/ec2ssh/command/remove_spec.rb
|
132
153
|
- spec/lib/ec2ssh/command/update_spec.rb
|
133
154
|
- spec/lib/ec2ssh/dsl_spec.rb
|
134
155
|
- spec/lib/ec2ssh/ec2_instances_spec.rb
|
135
|
-
- spec/lib/ec2ssh/migrator_spec.rb
|
136
156
|
- spec/lib/ec2ssh/ssh_config_spec.rb
|
137
157
|
- spec/spec_helper.rb
|
data/.travis.yml
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.2
|
4
|
-
- 2.3
|
5
|
-
- 2.4.0
|
6
|
-
- ruby-head
|
7
|
-
script: 'bundle exec rspec spec'
|
8
|
-
before_install: gem install bundler -v 1.14.3
|
9
|
-
notifications:
|
10
|
-
slack:
|
11
|
-
secure: CYxJDs0jJkrgXfbOyHuF+gJtxgK5JjS0GAFRNOlkWlDUmpEErtcnPuBOrlzkIBJS4eXaDOuSvpyRJSuJZJjEhmp94GEI98GEcyvByHuaehUWhzhUrhXstX/gg/Ntt6jiFR5dC6NrRWAnmKb7cDsfvagGAVNAuNzAtX0Z9iXWQDo=
|