bastion-cli 0.8.0 → 0.8.2

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
  SHA1:
3
- metadata.gz: 30e468497b9e751497941893f0078bf70d8a7088
4
- data.tar.gz: 78cbf4d372567df0e755ddb0b817c524b1068a27
3
+ metadata.gz: 368027cce69ffb8cc0f689ed1f9e11e8a14d1e93
4
+ data.tar.gz: 5b793260b991616d8ad6cba9f26af3f1aecdf432
5
5
  SHA512:
6
- metadata.gz: 317f92619bf0623345d0bf153a6edda2a21ce3ace5e26dd165d18c2499eb2a9beb98ee57370fd17d80c67a860abd879b6a9fc23792ca32eed26c79da04194e30
7
- data.tar.gz: 013eae5e5fdbe28d5fa10c69002e27e4faefac0072c5b574258382f6cffef0882ff9baefdfb0ee72d2e14a852454fd1e747833d2a63b13442a548d913734f570
6
+ metadata.gz: 09845b33382e6b3d525ec0731cdc9b85073f03e320f386ffb3dca562a91ce18e7557db0926f157e9a1e4a6be833413de20d2013c9a240266e94ca54b1ff16d92
7
+ data.tar.gz: 63280256b578dfcb0a6fe7658532df2682bd728e783e61d3a70f87462ac4043246b9e0fb8408c1a6adbdafc2909be9456d72ccab539afc0c5e45192586f679a7
data/.rubocop.yml CHANGED
@@ -1,10 +1,7 @@
1
- Metrics/LineLength:
2
- Max: 80
3
-
4
- Style/StringLiterals:
1
+ Style/MethodMissing:
5
2
  Enabled: false
6
3
 
7
- Style/ClassVars:
4
+ Style/StringLiterals:
8
5
  Enabled: false
9
6
 
10
7
  Style/MutableConstant:
@@ -13,9 +10,6 @@ Style/MutableConstant:
13
10
  Style/TrailingCommaInLiteral:
14
11
  Enabled: false
15
12
 
16
- Metrics/MethodLength:
17
- Enabled: false
18
-
19
13
  AllCops:
20
14
  Include:
21
15
  - Rakefile
data/.travis.yml CHANGED
@@ -2,14 +2,14 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3-p551
4
4
  - 2.3.0
5
- deploy:
6
- provider: rubygems
7
- api_key:
8
- secure: a0KqUg2kBe4aVmisadDybBXbAuolX5tKtbX6YGacbjwAeOb+aoemejgRHJKg8zGOlL8FvHwSY5kER+uapQpRXKW/pZnWTYL+GjCP66iF6qfq4Pueo09J3rIT/pnWz36nfZkd2AXSdKX/UtQQxZTzRdCiglVk0jeEiIFzhxXFS2FCBUt5h2ltciU4WKS5esHvtm+EixjLLFFbatdbeVs+mhbjp2ejmOjwTAZWbjM6bScFxksRrdeQhztK7eUbM+i2DzOC26iV9ejNBjqmFtNE6GPZJ0c24KtGnmy6VwxfGS89yibNnmkGHotPYFzn2mceH75h8U00Rn1d7EdGnGlE10UqVH9lTOLqAbhhxNmBscD+19Q2SnkWZ0u0khYX0fo6BBA0Q/TPAZfg/hBjGm42DVXz1ZS5PFmEa8eEmVZ/vXG2sQGchPEwj3IQlfY/pSSlgmFReHP2VzQO8hUCC4+NquZTQ6hgltIxZiWGbBcJgnU/GeSRd78drIWpAVl8BE1dnzWkcMyT5rgekDhWX8fyiJVYYKXO446vaE0rNyjXOOP4xCRfQ/5LRtoyEQcAPpH3rcXN+iUNKEvzl/YnBLiInEDlE5R7kTxqvE82YH0i2RhGfo568fQ4YKbRjVepahb47mxR1anL56e/9aV8jz44nWcCwvg2UH0NqdXanRzd4vk=
9
- gem: bastion-cli
10
- on:
11
- tags: true
12
- repo: ptdorf/bastion-cli
5
+ # deploy:
6
+ # provider: rubygems
7
+ # api_key:
8
+ # secure: a0KqUg2kBe4aVmisadDybBXbAuolX5tKtbX6YGacbjwAeOb+aoemejgRHJKg8zGOlL8FvHwSY5kER+uapQpRXKW/pZnWTYL+GjCP66iF6qfq4Pueo09J3rIT/pnWz36nfZkd2AXSdKX/UtQQxZTzRdCiglVk0jeEiIFzhxXFS2FCBUt5h2ltciU4WKS5esHvtm+EixjLLFFbatdbeVs+mhbjp2ejmOjwTAZWbjM6bScFxksRrdeQhztK7eUbM+i2DzOC26iV9ejNBjqmFtNE6GPZJ0c24KtGnmy6VwxfGS89yibNnmkGHotPYFzn2mceH75h8U00Rn1d7EdGnGlE10UqVH9lTOLqAbhhxNmBscD+19Q2SnkWZ0u0khYX0fo6BBA0Q/TPAZfg/hBjGm42DVXz1ZS5PFmEa8eEmVZ/vXG2sQGchPEwj3IQlfY/pSSlgmFReHP2VzQO8hUCC4+NquZTQ6hgltIxZiWGbBcJgnU/GeSRd78drIWpAVl8BE1dnzWkcMyT5rgekDhWX8fyiJVYYKXO446vaE0rNyjXOOP4xCRfQ/5LRtoyEQcAPpH3rcXN+iUNKEvzl/YnBLiInEDlE5R7kTxqvE82YH0i2RhGfo568fQ4YKbRjVepahb47mxR1anL56e/9aV8jz44nWcCwvg2UH0NqdXanRzd4vk=
9
+ # gem: bastion-cli
10
+ # on:
11
+ # tags: true
12
+ # repo: ptdorf/bastion-cli
13
13
  notifications:
14
14
  email:
15
15
  - ptdorf@gmail.com
data/Rakefile CHANGED
@@ -3,35 +3,10 @@ require "rubocop/rake_task"
3
3
 
4
4
  RuboCop::RakeTask.new do |task|
5
5
  task.options = ["-D"]
6
- # task.fail_on_error = false
6
+ task.fail_on_error = true
7
7
  end
8
8
 
9
- desc "Cleans up stuff"
10
- task :clean do
11
- system("rm -fr pkg")
12
- end
13
-
14
- desc "Reinstalls"
15
- task :reinstall do
16
- puts "I'm going to remove this gem to install it again"
17
- system "sudo gem uninstall -x bastion-cli"
18
- print "Sleeping for 20 seconds"
19
- i = 0
20
- while i < 20
21
- print "."
22
- i += 1
23
- sleep 1
24
- end
25
- system "sudo gem install bastion-cli"
26
- end
27
-
28
- task go: [
29
- :rubocop,
30
- :release,
31
- :clean,
32
- :reinstall,
33
- ]
34
-
35
9
  task default: [
36
10
  :rubocop,
11
+ :release,
37
12
  ]
data/Readme.md CHANGED
@@ -4,6 +4,7 @@ Log into things through bastions.
4
4
 
5
5
 
6
6
  [![Build Status](https://travis-ci.org/ptdorf/bastion-cli.svg?branch=master)](https://travis-ci.org/ptdorf/bastion-cli)
7
+ [![Build Status](https://app.snap-ci.com/ptdorf/bastion-cli/branch/master/build_image)](https://app.snap-ci.com/ptdorf/bastion-cli/branch/master)
7
8
  [![Gem Version](https://badge.fury.io/rb/bastion-cli.svg)](https://badge.fury.io/rb/bastion-cli)
8
9
 
9
10
 
@@ -47,8 +48,8 @@ $ bastion tunnel
47
48
  $ bastion tunnel 1337 --host 12.34.56.78
48
49
  ```
49
50
 
50
- You can also set the `BASTION_HOST` environment variable with the address of the
51
- bastion host:
51
+ You can also set the `BASTION_HOST` environment variable to temporarily override
52
+ the saved default:
52
53
 
53
54
  BASTION_HOST=bastion.example.com bastion ssh web.example.com
54
55
 
@@ -56,7 +57,7 @@ The pecking order is:
56
57
 
57
58
  - The `--host` option
58
59
  - The `BASTION_HOST` environment variable
59
- - The user default value that lives in `/etc/bastion/bastion`
60
- - The system default value that lives in `${HOME}/.bastion`
60
+ - The user default value, that lives in `${HOME}/.bastion`
61
+ - The system default value, that lives in `/etc/bastion/bastion`
61
62
 
62
63
  In doubt, just run `bastion host --all` to see what are your options.
data/bastion-cli.gemspec CHANGED
@@ -1,26 +1,22 @@
1
- lib = File.expand_path("../lib", __FILE__)
2
- $LOAD_PATH.unshift lib
1
+ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
3
2
 
4
- require "date"
5
3
  require "bastion/version"
6
4
 
7
- Gem::Specification.new do |spec|
8
- spec.name = "bastion-cli"
9
- spec.version = Bastion::VERSION
10
- spec.date = (Date.today << 1).to_s
11
- # File.read(lib + "/../readme.md")
12
- spec.summary = "Log into things through bastions"
13
- spec.description = "Log into things through bastions."
14
- spec.authors = ["ptdorf"]
15
- spec.email = ["ptdorf@gmail.com"]
16
- spec.homepage = "https://github.com/ptdorf/bastion-cli"
17
- spec.license = "MIT"
18
- spec.require_paths = ["lib"]
5
+ Gem::Specification.new do |s|
6
+ s.name = "bastion-cli"
7
+ s.version = Bastion::VERSION
8
+ s.summary = "Log into things through bastions"
9
+ s.description = "Log into things through bastions."
10
+ s.authors = ["ptdorf"]
11
+ s.email = ["ptdorf@gmail.com"]
12
+ s.homepage = "https://github.com/ptdorf/bastion-cli"
13
+ s.license = "MIT"
14
+ s.require_paths = ["lib"]
19
15
 
20
- spec.files = `git ls-files`.split $/
21
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename f }
16
+ s.files = `git ls-files`.split $/
17
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename f }
22
18
 
23
- spec.add_dependency "thor"
24
- spec.add_development_dependency "rake"
25
- spec.add_development_dependency "rubocop"
19
+ s.add_dependency "thor"
20
+ s.add_development_dependency "rake"
21
+ s.add_development_dependency "rubocop"
26
22
  end
data/bin/bastion CHANGED
@@ -20,14 +20,18 @@ module Bastion
20
20
  end
21
21
 
22
22
  desc "host [HOST]", "Show or set the default bastion host"
23
- option :all, type: :boolean
24
23
  def host(address = nil)
25
24
  config = Config.new(options)
26
- return config.save(address) if address
27
- return config.info if options[:all]
25
+ return puts(config.save(address)) if address
28
26
  puts config.host
29
27
  end
30
28
 
29
+ desc "info", "Show all bastion info"
30
+ def info
31
+ config = Config.new(options)
32
+ config.info
33
+ end
34
+
31
35
  desc "ssh [INSTANCE]", "Logs into an instance"
32
36
  def ssh(instance = nil)
33
37
  config = Config.new(options)
@@ -43,7 +47,7 @@ module Bastion
43
47
  end
44
48
 
45
49
  desc "tunnel [PORT]", "Starts a new tunnel"
46
- def tunnel(port = 1200)
50
+ def tunnel(port = 1337)
47
51
  config = Config.new(options)
48
52
  puts "==> Starting tunnel to host #{config.host} on port #{port}"
49
53
  exec "ssh -D#{port} #{config.host}"
@@ -3,8 +3,8 @@ module Bastion
3
3
  #
4
4
  #
5
5
  class Config
6
- USER = "#{ENV['HOME']}/.bastion"
7
- SYSTEM = "/etc/bastion/bastion"
6
+ USER = "#{ENV['HOME']}/.bastion/config"
7
+ SYSTEM = "/etc/bastion/config"
8
8
  ENVVAR = "BASTION_HOST"
9
9
 
10
10
  def initialize(options)
@@ -21,7 +21,7 @@ module Bastion
21
21
  puts "User : #{@user}"
22
22
  puts "Env : #{@env}"
23
23
  puts "Option : #{@option}"
24
- puts "Used : #{@host}"
24
+ puts "Using : #{@host}"
25
25
  end
26
26
 
27
27
  def read(file, default = nil)
@@ -31,13 +31,14 @@ module Bastion
31
31
  end
32
32
 
33
33
  def save(value)
34
- puts "Saved with value #{value}"
34
+ dir = File.dirname(USER)
35
+ Dir.mkdir(dir) unless Dir.exist?(dir)
35
36
  File.write USER, value
37
+ File.read USER
36
38
  end
37
39
 
38
40
  def method_missing(name)
39
41
  instance_variable_get :"@#{name}"
40
- # class_variable_get(:"@@#{name}")
41
42
  end
42
43
  end
43
44
  end
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Bastion
3
- VERSION = "0.8.0"
3
+ VERSION = "0.8.2"
4
4
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bastion-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ptdorf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-10 00:00:00.000000000 Z
11
+ date: 2017-01-09 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'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubocop
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: Log into things through bastions.
@@ -60,9 +60,9 @@ executables:
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - .gitignore
64
- - .rubocop.yml
65
- - .travis.yml
63
+ - ".gitignore"
64
+ - ".rubocop.yml"
65
+ - ".travis.yml"
66
66
  - Gemfile
67
67
  - Rakefile
68
68
  - Readme.md
@@ -81,17 +81,17 @@ require_paths:
81
81
  - lib
82
82
  required_ruby_version: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - '>='
84
+ - - ">="
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - '>='
89
+ - - ">="
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  requirements: []
93
93
  rubyforge_project:
94
- rubygems_version: 2.0.14
94
+ rubygems_version: 2.6.6
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: Log into things through bastions