simple_deploy_ssh 0.0.1 → 0.0.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: 70e46f4f0d904d7c82ac94ddd50889192613ff74
4
- data.tar.gz: 30dfffc43352df9aa0a3ebe8f4742d62b88a5ad5
3
+ metadata.gz: 52e6a9914e11368c5df880b81ec94036b9300f28
4
+ data.tar.gz: e7d5f8479482b062e82d5b80f4899f2a8f773638
5
5
  SHA512:
6
- metadata.gz: c2b754754a6953de380c0fea9c6ae8bfdef8c19cc25480d9d4d84c456c3a08982168684431b49a5c93cb60f87fafe15efc95ff1fce8d887b2fdaada683d609bf
7
- data.tar.gz: a53daa7feebc88111d4859553011ee5438e6815179c76c6b2f82ad9b6b502b2b9a901da453cfac5280ed75857cea8843bee79087ca24c6424ea76f6f974780ca
6
+ metadata.gz: eb037b870158e6ca06df687e6460178ba26aaf361d14aae0037d276c38d72bc57ceb412b89dacde6b1561fb2169439939bc11f385ec76daec6b4a67312fb0c1f
7
+ data.tar.gz: 4d4dd35384be6ec01540941faa05b327781d110b059167ba68a1d55879c72f93222abaa0ebb6b902b1e57950210703380ccdd962ce325665d20f5439df8fb042
@@ -1,6 +1,20 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'simple_deploy_ssh'
4
+ require 'yaml'
4
5
 
5
- ARGV.length == 2 || abort('usage: simple_deploy_ssh env stack')
6
- SimpleDeploySSH.new(*ARGV).connect!
6
+ ARGV.length == 2 || ARGV.length == 3 || abort('usage: simple_deploy_ssh env stack or simple_deploy_ssh env stack instance')
7
+
8
+ args = if ARGV.length == 2
9
+ envs = YAML.load_file(File.expand_path('~/.simple_deploy.yml'))
10
+ env = ARGV[0]
11
+ default_stack = envs.fetch("environments").fetch(env)["default_stack"]
12
+ if default_stack.nil? || default_stack == ''
13
+ abort("You must pass a stack name or have a default stack defined for your environment in your ~/.simple_deploy.yml")
14
+ end
15
+ [env, default_stack, ARGV[1]]
16
+ else
17
+ ARGV
18
+ end
19
+
20
+ SimpleDeploySSH.new(*args).connect!
@@ -1,9 +1,10 @@
1
1
  class SimpleDeploySSH
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
 
4
- def initialize(env_name, stack_name)
5
- @env_name = env_name
6
- @stack_name = stack_name
4
+ def initialize(env_name, stack_name, instance_name)
5
+ @env_name = env_name
6
+ @stack_name = stack_name
7
+ @instance_name = instance_name
7
8
  end
8
9
 
9
10
  def connect!
@@ -17,14 +18,14 @@ class SimpleDeploySSH
17
18
  end
18
19
 
19
20
  def full_stack_name
20
- fsn = list.find { |line| line.match /-\d-#@env_name-\d-#@stack_name-\d/ }
21
- raise "stack not found" if fsn.nil?
21
+ fsn = list.find { |line| line.match /-\d-#@stack_name-\d-#@instance_name-\d/ }
22
+ raise "instance not found" if fsn.nil?
22
23
  fsn
23
24
  end
24
25
 
25
26
  def ip
26
27
  command = "simple_deploy instances -e #@env_name -n #{full_stack_name}"
27
- `#{command}`
28
+ `#{command}`.split.first
28
29
  end
29
30
 
30
31
  def ssh_command
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_deploy_ssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bradly Feeley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-26 00:00:00.000000000 Z
11
+ date: 2014-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simple_deploy
@@ -67,7 +67,6 @@ files:
67
67
  - Rakefile
68
68
  - bin/simple_deploy_ssh
69
69
  - lib/simple_deploy_ssh.rb
70
- - lib/simple_deploy_ssh/version.rb
71
70
  - simple_deploy_ssh.gemspec
72
71
  homepage: https://github.com/bradly/simple_deploy_ssh
73
72
  licenses:
@@ -1,3 +0,0 @@
1
- module SimpleDeploySSH
2
- VERSION = "0.0.1"
3
- end