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 +4 -4
- data/.gitignore +1 -0
- data/lib/railsworks/tasks/shell.rake +48 -0
- data/lib/railsworks/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95e2164b947acb951ae5a1d9c453498a2308ba67
|
4
|
+
data.tar.gz: 28a2dbe3b7fbbf429420e46ca63eebfbef296bad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96bf199dcc4e860c99e67724644b8ad4bf5de01483bdb7d7b94e7447f8e43a0e3444b81086ed2bd072df6821a546a6e6165cf35596dc198bc6ccb3c6adb4acf3
|
7
|
+
data.tar.gz: eb2fc5c6e6e425c96a53a461445b850f3b70e3e31d0cefbc576117df86c2808105dc977f45163d5deec2e6e068bb024914c8a2dbd8ca01ac73f98c985ad64ddc
|
data/.gitignore
CHANGED
@@ -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
|
data/lib/railsworks/version.rb
CHANGED
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.
|
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-
|
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
|