railsworks 0.0.2 → 0.1

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: 01674808ff092468f361d5471a53b518cd9902d9
4
- data.tar.gz: e9647f6fcb5f47dea8ba899c67e2dc32b0834fbd
3
+ metadata.gz: 3dae062115203e2a40db72f13168a6a67ca47ace
4
+ data.tar.gz: 175b79f94aeab40cf8b2341f24d0604cd76ae785
5
5
  SHA512:
6
- metadata.gz: ee97241d54e1c55c682fa15931527d78df3bfbe3b33975067caeb7f0b9e381c20789f5537943450b7687a7e04ba3eceea6b81fbbe06913b8e6b76925454b7b23
7
- data.tar.gz: 4b68bb80da3d32fe4181625538882814b78124b0c2fb656501935fb87539877b3bc36cad5e5819c5bc08dbd6a33046cae558cd0bb228cd66e6d37ae1f91a050c
6
+ metadata.gz: e61b74f2b486872706922b43e841ff1f4e93f6adff8af5efbe804b00d2b641905c429a54ad959bcd713e3958922098eb8c23036512656d6a4be79afea4900456
7
+ data.tar.gz: f3ff545af7883e10cc18db619865b3c3b6ae6b2494148cca9f7039f8d6ecff1e993ccdc8f3171c8282827fa81f2a0995236cfada4e266874a74786d88ea45e0b
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
4
+ cache: bundler
5
+ bundler_args: --without production
6
+ notifications:
7
+ email: false
8
+ script:
9
+ - bundle exec rspec --format progress
@@ -8,17 +8,18 @@ namespace :console do
8
8
  task :staging do
9
9
  regions = YAML.load_file('config/opsworks.yml')['staging']
10
10
  ip = get_ip(regions)
11
- path = '/srv/www/bouncer/current'
12
- run_interactively("SEGMENT_KEY='' bundle exec rails console --environment=production", ip, path)
11
+ path = '/srv/www/' + get_name(regions) + '/current'
12
+ environment = setup_environment(regions)
13
+ run_interactively("#{environment} bundle exec rails console --environment=production", ip, path)
13
14
  end
14
15
 
15
16
  desc "Connecting to production console"
16
17
  task :production do
17
18
  regions = YAML.load_file('config/opsworks.yml')['production']
18
19
  ip = get_ip(regions)
19
- # Change myapp to your app name
20
- path = '/srv/www/bouncer/current'
21
- run_interactively("SEGMENT_KEY='' bundle exec rails console --environment=production", ip, path)
20
+ path = '/srv/www/' + get_name(regions) + '/current'
21
+ environment = setup_environment(regions)
22
+ run_interactively("#{environment} bundle exec rails console --environment=production", ip, path)
22
23
  end
23
24
 
24
25
  def get_ip(regions)
@@ -34,6 +35,25 @@ namespace :console do
34
35
  ip
35
36
  end
36
37
 
38
+ def setup_environment(regions)
39
+ cmd = []
40
+ regions.each do |region, value|
41
+ client = Aws::OpsWorks::Client.new(region: region)
42
+ env = client.describe_apps({app_ids: [value['app_id']]})[0][0].environment
43
+ env.each do |v|
44
+ cmd << v.key+'="'+v.value+'"' unless v.secure
45
+ end
46
+ end
47
+ cmd.join ' '
48
+ end
49
+
50
+ def get_name(regions)
51
+ regions.each do |region, value|
52
+ client = Aws::OpsWorks::Client.new(region: region)
53
+ return client.describe_apps({app_ids: [value['app_id']]})[0][0].shortname
54
+ end
55
+ end
56
+
37
57
  def run_interactively(command, server, path)
38
58
  exec %Q(ssh #{server} -t 'cd #{path} && sudo #{command}') if server && path
39
59
  end
@@ -1,3 +1,3 @@
1
1
  module Railsworks
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1"
3
3
  end
data/railsworks.gemspec CHANGED
@@ -21,4 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency "aws-sdk", "~> 2.0.33"
22
22
  spec.add_development_dependency "bundler", "~> 1.7"
23
23
  spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec"
24
25
  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.0.2
4
+ version: '0.1'
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-03-30 00:00:00.000000000 Z
11
+ date: 2015-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  description: Console and deploy task for OpsWorks
56
70
  email:
57
71
  - kurtisnelson@gmail.com
@@ -60,6 +74,7 @@ extensions: []
60
74
  extra_rdoc_files: []
61
75
  files:
62
76
  - ".gitignore"
77
+ - ".travis.yml"
63
78
  - Gemfile
64
79
  - LICENSE
65
80
  - LICENSE.txt