awssh 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7813fbd643c47e30330aa13e8df8c830694833a2
4
- data.tar.gz: fa612f8c10bfc39b2b111ff8c89e702594c61071
3
+ metadata.gz: bf4f811b2deee46c61931cb776834d68384ae7d6
4
+ data.tar.gz: 79bc526ecf91a64b45a690b1914902be7f84547d
5
5
  SHA512:
6
- metadata.gz: bc4a46a8e7e69672c8165af90b92ea1c5f9b7dcfc3c76bbeac97737318ca60424dc27fd1a4ee12011bae3b63aaa8e394d1411e4453ce5fb45893638a6bc8cd80
7
- data.tar.gz: 77f3cd627766fe012459567f412ee9f6030ecb01501cd1ded42fa1c121435b92a80b5fc088522609040beb4062c45305b690bc1f2160bcc5a422d21fba466b35
6
+ metadata.gz: d4601030e632b861310b8a8874b866f4a395cd17e16f86fbd7c7299472389f9144ac0deaafac09c3d4ac0eee1320b2029d3a070935a9986ff3cb62e4565b6d83
7
+ data.tar.gz: c3a5e9d1abfc33514afcdf9a940fe16ecb4dffd4fa33e049dcf2dd6ba4f1e711bf0293afacb43f050cc2c46cd9fc144cc48608bedf7419284d66e0b266e55a9e
data/README.md CHANGED
@@ -4,10 +4,15 @@ Hacky way to handle ssh to AWS servers
4
4
 
5
5
  - Searches for servers based on AWS tag Name.
6
6
  - Provides the ability to use single ssh and multiple ssh access.
7
- - Multiple can use cssh or csshX (configurable)
7
+ - Use cssh or csshX (configurable) for mulit-server access
8
+ - caches list of servers, to minimize calls to AWS (primarily for speed).
8
9
 
9
10
  ## Installation
10
11
 
12
+ Generally, you will install this directly:
13
+
14
+ $ gem install awssh
15
+
11
16
  Add this line to your application's Gemfile:
12
17
 
13
18
  gem 'awssh'
@@ -16,10 +21,6 @@ And then execute:
16
21
 
17
22
  $ bundle
18
23
 
19
- Or install it yourself as:
20
-
21
- $ gem install awssh
22
-
23
24
  ## Usage
24
25
 
25
26
  ```
@@ -30,17 +31,45 @@ Search Terms:
30
31
  positive check for each entry
31
32
  name =~ /term/
32
33
  negative check if the term starts with ^
33
- name !~ /term/ if term[0] == "^"
34
+ name !~ /term/
34
35
 
35
36
  Options:
37
+ -V, --version print version
38
+ -i, --init initialize config
39
+
40
+ -l, --list just list servers
36
41
  -n, --test just output ssh command
37
42
  -v, --[no-]verbose Run verbosely
38
- -V, --version print version
39
- -c, --config config file (default: ~/.awssh)
43
+
44
+ -U, --update just update the cache
45
+ --no-cache disable cache for this run
46
+
40
47
  -m, --[no-]multi connect to multiple servers
41
- -i, --init initialize config
48
+ -c, --config override config file (default: ~/.awssh)
49
+ -u, --user override user setting
50
+
42
51
  ```
43
52
 
53
+ ## Config
54
+ ```
55
+ ---
56
+ multi: csshX # multi ssh program: csshX or cssh
57
+ single: ssh # ssh program, allows for common configs
58
+ region: us-east-1 # ec2 region
59
+ user: # username to ssh as
60
+ key: AWS ACCESS KEY ID # AWS key
61
+ secret: AWS SECRET ACCESS KEY # AWS secret
62
+ domain: example.com # append domain to server names
63
+ cache: "~/.awssh.cache" # cache file location
64
+ expires: 86400 # cache expiration time (in seconds)
65
+ ```
66
+
67
+ ## Caching
68
+
69
+ Maintains a simple cache with expiration (default: 1 day)
70
+ The cache just contains the list of servers' names.
71
+ You can disable the cache by setting the cache value to false in the config file.
72
+
44
73
  ## Shell Alias
45
74
 
46
75
  To get around using multiple RVM's and still have access to awssh command
@@ -48,7 +77,7 @@ To get around using multiple RVM's and still have access to awssh command
48
77
  alias awssh='rvm <rvm version> do awssh'
49
78
 
50
79
  When you install awssh into your default ruby, then change to a project ruby,
51
- the awssh gem is not longer available. This allows you to use the awssh gem
80
+ the awssh gem is no longer available. This allows you to use the awssh gem
52
81
  from ruby. Just specify the default rvm version in <rvm verison> above.
53
82
 
54
83
  alias awssh='rvm 2.1.2 do awssh'
@@ -21,7 +21,7 @@ module Awssh
21
21
  }.stringify_keys
22
22
 
23
23
  @config_file = File.expand_path(@options[:config])
24
- @config.merge!(YAML.load_file(@config_file)) if File.exists?(@config_file)
24
+ @config.merge!(YAML.load_file(@config_file)||{}) if File.exists?(@config_file)
25
25
 
26
26
  OptionParser.new do |opts|
27
27
  opts.banner = "Usage: awssh [options] [search terms]"
@@ -32,43 +32,49 @@ module Awssh
32
32
  opts.separator ' positive check for each entry'
33
33
  opts.separator ' name =~ /term/'
34
34
  opts.separator ' negative check if the term starts with ^'
35
- opts.separator ' name !~ /term/ if term[0] == "^"'
35
+ opts.separator ' name !~ /term/'
36
36
  opts.separator ''
37
37
  opts.separator 'Options:'
38
-
39
- opts.on('-n', '--test', 'just output ssh command') do |n|
40
- @options[:test] = n
41
- end
42
- opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
43
- @options[:verbose] = v
44
- end
45
38
  opts.on('-V', '--version', 'print version') do |v|
46
39
  puts "awssh version: #{Awssh::Version::STRING}"
47
40
  exit 0
48
41
  end
49
- opts.on('-c', "--config", "config file (default: ~/.awssh)") do |c|
50
- @options[:config] = c
51
- end
52
- opts.on('-m', '--[no-]multi', 'connect to multiple servers') do |m|
53
- @options[:multi] = m
54
- end
55
42
  opts.on('-i', '--init', 'initialize config') do |i|
56
43
  path = File.expand_path("~/.awssh")
57
- File.open(path, "w+") { |f| f.write config.to_yaml }
44
+ File.open(path, "w+") { |f| f.write @config.to_yaml }
58
45
  puts "created config file: #{path}"
59
46
  exit 0
60
47
  end
61
- opts.on('-u', '--user', 'override user setting') do |u|
62
- @config['user'] = u
63
- end
48
+ opts.separator ''
64
49
  opts.on('-l', '--list', 'just list servers') do |l|
65
50
  @options[:list] = true
66
51
  end
52
+ opts.on('-n', '--test', 'just output ssh command') do |n|
53
+ @options[:test] = n
54
+ end
55
+ opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
56
+ @options[:verbose] = v
57
+ end
58
+
59
+ opts.separator ''
67
60
  opts.on('-U', '--update', 'just update the cache') do |u|
68
61
  @options[:update] = true
69
62
  get_servers
70
63
  exit 0
71
64
  end
65
+ opts.on('--no-cache', 'disable cache for this run') do |u|
66
+ @config['cache'] = false
67
+ end
68
+ opts.separator ''
69
+ opts.on('-m', '--[no-]multi', 'connect to multiple servers') do |m|
70
+ @options[:multi] = m
71
+ end
72
+ opts.on('-c', "--config", "override config file (default: ~/.awssh)") do |c|
73
+ @options[:config] = c
74
+ end
75
+ opts.on('-u', '--user', 'override user setting') do |u|
76
+ @config['user'] = u
77
+ end
72
78
  end.parse!(argv)
73
79
 
74
80
  @search = argv
@@ -2,7 +2,7 @@ module Awssh
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 6
5
+ TINY = 7
6
6
  TAG = nil
7
7
  LIST = [MAJOR, MINOR, TINY, TAG].compact
8
8
  STRING = LIST.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shawn Catanzarite