ecl 3.0.1 → 3.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d418f427cd07120e2ce1d561201f39577631d88cf2c5f11a8a454f6cb1e5a88e
4
- data.tar.gz: 4ecd65b9f7ea0204918b0d2c54bb07dff681e631fd0b3705f269038dfb2d17bb
3
+ metadata.gz: 9f6a55e474acea1a8a0092e23a7b3533fca93dd185ef334536e9816b142779d6
4
+ data.tar.gz: de85ae66b54a0b8aa577ae742817c67481ef21845706287a3c707731d63608ba
5
5
  SHA512:
6
- metadata.gz: 5cf13d19cd882fc13eef4ece7c08360060aa509135c1d2796f4f93ffd94b756b83d38b9e73d50ff3518eec2b7ee55fa3d8f865715236b2c7b6d47a658d9e2807
7
- data.tar.gz: 21b952fc210aa49b9ded6cf5f58fb9d238f131205d4050aa0cca8f6b09d46e2bb8a0736bca54b9bbd7d70de24c33281cff756e8bd551334eae88cf4b848eb070
6
+ metadata.gz: d414ab9f80aef8f1a92f43ac576240a4717dd7d85558938ac1211beb6f86661af9e46953ca14de73328ca958768d202202667b69dccfc787a41172bd1d7bdbb8
7
+ data.tar.gz: b13b9766f789f2c2b3284b3e5d3645c1c31e0b6541b8df2a67378dde94ea8236a49e1446c7211c427eba0a7f2be27532153b23733b4382bf613f197d7f859226
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ecl (3.0.1)
4
+ ecl (3.0.3)
5
5
  aws-sdk-ec2 (~> 1.18)
6
6
  curses (~> 1.0)
7
7
  json (~> 2.1)
@@ -13,26 +13,26 @@ GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
15
  aws-eventstream (1.0.3)
16
- aws-partitions (1.240.0)
17
- aws-sdk-core (3.78.0)
16
+ aws-partitions (1.294.0)
17
+ aws-sdk-core (3.92.0)
18
18
  aws-eventstream (~> 1.0, >= 1.0.2)
19
19
  aws-partitions (~> 1, >= 1.239.0)
20
20
  aws-sigv4 (~> 1.1)
21
21
  jmespath (~> 1.0)
22
- aws-sdk-ec2 (1.116.0)
22
+ aws-sdk-ec2 (1.151.0)
23
23
  aws-sdk-core (~> 3, >= 3.71.0)
24
24
  aws-sigv4 (~> 1.1)
25
- aws-sigv4 (1.1.0)
25
+ aws-sigv4 (1.1.1)
26
26
  aws-eventstream (~> 1.0, >= 1.0.2)
27
27
  coderay (1.1.2)
28
- curses (1.3.1)
28
+ curses (1.3.2)
29
29
  jmespath (1.4.0)
30
- json (2.2.0)
31
- method_source (0.9.2)
32
- oj (3.9.2)
33
- pry (0.12.2)
34
- coderay (~> 1.1.0)
35
- method_source (~> 0.9.0)
30
+ json (2.3.0)
31
+ method_source (1.0.0)
32
+ oj (3.10.6)
33
+ pry (0.13.0)
34
+ coderay (~> 1.1)
35
+ method_source (~> 1.0)
36
36
  rake (13.0.1)
37
37
  ruby-string-match-scorer (0.1.0)
38
38
 
@@ -45,4 +45,4 @@ DEPENDENCIES
45
45
  rake (~> 13.0)
46
46
 
47
47
  BUNDLED WITH
48
- 2.0.2
48
+ 2.1.4
data/README.md CHANGED
@@ -110,6 +110,19 @@ config.ssh_keys = {
110
110
  }
111
111
  ```
112
112
 
113
+ ### use_vpc_id_env (Experimental)
114
+ _This Feature is experimental and subject to change in future versions_
115
+
116
+ Boolean variable. If true use VPC_ID Environment variable for filtering EC2 instances.
117
+ ```ruby
118
+ config.use_vpc_id_env = true
119
+ ```
120
+
121
+ Example VPC_ID variable:
122
+ ```
123
+ VPC_ID=vpc-12345678901234567
124
+ ```
125
+
113
126
   
114
127
 
115
128
  Install from Source
@@ -124,7 +137,7 @@ sudo yum install libncursesw5-devel # CentOS, etc
124
137
  gem build eclair.gemspec
125
138
 
126
139
  # Install eclair into your system
127
- gem install ecl-3.0.1.gem
140
+ gem install ecl-3.0.4.gem
128
141
  ```
129
142
 
130
143
   
data/lib/eclair/config.rb CHANGED
@@ -40,6 +40,7 @@ module Eclair
40
40
  @exec_format = "{ssh_command} {ssh_options} -p{port} {ssh_key} {username}@{host}"
41
41
  @provider = :ec2
42
42
  @get_pods_option = ""
43
+ @use_vpc_id_env = false
43
44
 
44
45
  instance_variables.each do |var|
45
46
  Config.class_eval do
@@ -52,7 +53,7 @@ module Eclair
52
53
  new_dir = "#{ENV['HOME']}/.ecl"
53
54
  new_conf = "#{ENV['HOME']}/.ecl/config.rb"
54
55
 
55
- if !File.exists?(new_conf) && File.exists?(old_conf)
56
+ if !File.exist?(new_conf) && File.exist?(old_conf)
56
57
  FileUtils.mkdir_p new_dir
57
58
  FileUtils.mv old_conf, new_conf
58
59
  puts "#{old_conf} migrated to #{new_conf}"
@@ -60,7 +61,7 @@ module Eclair
60
61
  exit
61
62
  end
62
63
 
63
- unless File.exists? @config_file
64
+ unless File.exist? @config_file
64
65
  template_path = File.join(File.dirname(__FILE__), "..", "..", "templates", "eclrc.template")
65
66
  FileUtils.mkdir_p(File.dirname(@config_file))
66
67
  FileUtils.cp(template_path, @config_file)
@@ -69,8 +70,8 @@ module Eclair
69
70
  end
70
71
 
71
72
  key_path = "#{new_dir}/keys"
72
- FileUtils.mkdir_p key_path unless Dir.exists? key_path
73
- # FileUtils.mkdir_p CACHE_DIR unless Dir.exists? CACHE_DIR
73
+ FileUtils.mkdir_p key_path unless Dir.exist? key_path
74
+ # FileUtils.mkdir_p CACHE_DIR unless Dir.exist? CACHE_DIR
74
75
  end
75
76
 
76
77
  def after_load
data/lib/eclair/grid.rb CHANGED
@@ -172,7 +172,7 @@ module Eclair
172
172
  def append_search key
173
173
  return unless key
174
174
 
175
- if @search_buffer.length > 0 && key == 127 # backspace
175
+ if @search_buffer.length > 0 && (key == 127 || key == Curses::KEY_BACKSPACE || key == 8) #backspace
176
176
  @search_buffer = @search_buffer.chop
177
177
  elsif key.to_s.length == 1
178
178
  begin
@@ -1,6 +1,10 @@
1
1
  # frozen_string_literal: true
2
+ require "eclair/config"
3
+
2
4
  module Eclair
3
5
  module Provider
6
+ include ConfigHelper
7
+
4
8
  extend self
5
9
  attr_accessor :items
6
10
 
@@ -53,13 +53,6 @@ module Eclair
53
53
  "echo Attaching to #{Shellwords.escape(name)} \\[#{@instance.instance_id}\\] && #{joined_cmd}"
54
54
  end
55
55
 
56
- def header
57
- <<-EOS
58
- #{name} (#{instance_id}) [#{state[:name]}]
59
- launched at #{launch_time.to_time}
60
- EOS
61
- end
62
-
63
56
  def image
64
57
  @image ||= provider.find_image_by_id(@instance.image_id)
65
58
  end
@@ -70,7 +63,7 @@ module Eclair
70
63
 
71
64
  def header
72
65
  <<-EOS
73
- #{name} (#{@instance.instance_id}) [#{@instance.state[:name]}]
66
+ #{name} (#{@instance.instance_id}) [#{@instance.state[:name]}] #{@instance.private_ip_address}
74
67
  launched at #{@instance.launch_time.to_time}
75
68
  EOS
76
69
  end
@@ -93,6 +93,13 @@ module Eclair
93
93
 
94
94
  def fetch_instances keyword
95
95
  filter = if keyword.empty? then {} else { filters: [{name: "tag:Name", values: ["*#{keyword}*"]}] } end
96
+ if config.use_vpc_id_env then
97
+ if filter.empty? then
98
+ filter = { filters: [{name: "vpc-id", values: [ENV['VPC_ID']]}] }
99
+ else
100
+ filter[:filters].push({name: "vpc-id", values: [ENV['VPC_ID']]})
101
+ end
102
+ end
96
103
 
97
104
  ec2_client.describe_instances(filter).map{ |resp|
98
105
  resp.data.reservations.map do |rsv|
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Eclair
3
- VERSION = "3.0.1"
3
+ VERSION = "3.0.4"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecl
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Devsisters
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-19 00:00:00.000000000 Z
11
+ date: 2023-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -166,7 +166,7 @@ homepage: https://github.com/devsisters/eclair
166
166
  licenses:
167
167
  - MIT
168
168
  metadata: {}
169
- post_install_message:
169
+ post_install_message:
170
170
  rdoc_options: []
171
171
  require_paths:
172
172
  - lib
@@ -181,8 +181,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  - !ruby/object:Gem::Version
182
182
  version: '0'
183
183
  requirements: []
184
- rubygems_version: 3.0.6
185
- signing_key:
184
+ rubygems_version: 3.4.12
185
+ signing_key:
186
186
  specification_version: 4
187
187
  summary: EC2 ssh helper
188
188
  test_files: []