railsworks 0.1.3 → 0.2.0

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: 59a47a622dbc4bdb15ba1c57faa21728cf8deccd
4
- data.tar.gz: c2ecfc2e29db1d5d5e6d8857e06f3b3bb2bda657
3
+ metadata.gz: 95e2164b947acb951ae5a1d9c453498a2308ba67
4
+ data.tar.gz: 28a2dbe3b7fbbf429420e46ca63eebfbef296bad
5
5
  SHA512:
6
- metadata.gz: 2a894923e666b251f16235fc17bcddfdbc5ac8733a8325a4c797cf0fa113b0375a343e77c6f969b5e0af372047a06a38f49af0cb91187b18189be28052c4968d
7
- data.tar.gz: 0b60af0f47f6e98de88c5b5e4aeed89c68a94ac7ef9201c1e7b3c35d6f5db4c8e78881ad4c48ad5004cc5506f67584fd40b38d5ce1e4f9c606833a9cacb5eec9
6
+ metadata.gz: 96bf199dcc4e860c99e67724644b8ad4bf5de01483bdb7d7b94e7447f8e43a0e3444b81086ed2bd072df6821a546a6e6165cf35596dc198bc6ccb3c6adb4acf3
7
+ data.tar.gz: eb2fc5c6e6e425c96a53a461445b850f3b70e3e31d0cefbc576117df86c2808105dc977f45163d5deec2e6e068bb024914c8a2dbd8ca01ac73f98c985ad64ddc
data/.gitignore CHANGED
@@ -12,3 +12,4 @@
12
12
  *.o
13
13
  *.a
14
14
  mkmf.log
15
+ *.gem
@@ -0,0 +1,48 @@
1
+ # Rakefile
2
+ require 'rubygems'
3
+ require 'bundler'
4
+ Bundler.require if defined?(Bundler)
5
+
6
+ namespace :shell do
7
+ desc "Connecting to staging console"
8
+ task :staging do
9
+ regions = YAML.load_file('config/opsworks.yml')['staging']
10
+ ip = get_ip(regions)
11
+ path = '/srv/www/' + get_name(regions) + '/current'
12
+ run_interactively(ip, path)
13
+ end
14
+
15
+ desc "Connecting to production console"
16
+ task :production do
17
+ regions = YAML.load_file('config/opsworks.yml')['production']
18
+ ip = get_ip(regions)
19
+ path = '/srv/www/' + get_name(regions) + '/current'
20
+ run_interactively(ip, path)
21
+ end
22
+
23
+ def get_ip(regions)
24
+ regions.each do |region, value|
25
+ client = Aws::OpsWorks::Client.new(region: region)
26
+ client.describe_instances({layer_id: value['layer_id']}).each do |page|
27
+ page.instances.each do |instance|
28
+ return instance.public_ip if instance.status == "online"
29
+ end
30
+ break
31
+ end
32
+ break
33
+ end
34
+ raise "Could not find online instance"
35
+ end
36
+
37
+ def get_name(regions)
38
+ regions.each do |region, value|
39
+ client = Aws::OpsWorks::Client.new(region: region)
40
+ return client.describe_apps({app_ids: [value['app_id']]})[0][0].shortname
41
+ end
42
+ end
43
+
44
+ def run_interactively(server, path)
45
+ server = ENV['AWS_USERNAME'] + "@" + server if ENV['AWS_USERNAME']
46
+ exec %Q(ssh #{server} -t 'cd #{path}') if server && path
47
+ end
48
+ end
@@ -1,3 +1,3 @@
1
1
  module Railsworks
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railsworks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kurt Nelson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-20 00:00:00.000000000 Z
11
+ date: 2015-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -85,6 +85,7 @@ files:
85
85
  - lib/railsworks/tasks/console.rake
86
86
  - lib/railsworks/tasks/deploy.rake
87
87
  - lib/railsworks/tasks/rollbar.rake
88
+ - lib/railsworks/tasks/shell.rake
88
89
  - lib/railsworks/version.rb
89
90
  - railsworks.gemspec
90
91
  homepage: https://github.com/kurtisnelson/railsworks