oops 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/lib/oops/opsworks_deploy.rb +7 -3
- data/lib/oops/tasks.rb +11 -11
- data/lib/oops/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6a255d502aa90de7fd7a2cf40eac417a5ab5649
|
4
|
+
data.tar.gz: 502b71a512ee084635b9e1423b0f305d347af825
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 702ef3e4ce160079933112775cb1cb77048695ef4f8ada71caec433344acacf781da105d3e77cffb6184058de8798d9451f7e7642f3c5fe954187ce30ce496ce
|
7
|
+
data.tar.gz: f0cc792a810b3ffa44e18dbb05c8dc716813df120a1299411609ca21b960d9e14d63a5226c9f3a7b08dab697c09f58c4d017e036216735013baa4bcf34515051
|
data/README.md
CHANGED
@@ -39,6 +39,19 @@ To deploy a build:
|
|
39
39
|
|
40
40
|
By default, these tasks will all deploy what is in your current HEAD, but can also be passed an optional ref to deploy a specific revision.
|
41
41
|
|
42
|
+
## OpsWorks Permissions
|
43
|
+
|
44
|
+
It is good practice to configure a specific IAM user for deployments. For more details see the [Security and Permissions section](http://docs.aws.amazon.com/opsworks/latest/userguide/workingsecurity.html) of the [AWS OpsWorks User Guide](http://docs.aws.amazon.com/opsworks/latest/userguide/welcome.html)
|
45
|
+
|
46
|
+
Actions needed for oops to run are:
|
47
|
+
|
48
|
+
* opsworks:DescribeStacks
|
49
|
+
* opsworks:DescribeApps
|
50
|
+
* opsworks:DescribeDeployments
|
51
|
+
* opsworks:UpdateApp
|
52
|
+
* opsworks:DescribeInstances
|
53
|
+
* opsworks:CreateDeployment
|
54
|
+
|
42
55
|
## Contributing
|
43
56
|
|
44
57
|
1. Fork it
|
data/lib/oops/opsworks_deploy.rb
CHANGED
@@ -39,13 +39,17 @@ module Oops class OpsworksDeploy
|
|
39
39
|
private
|
40
40
|
|
41
41
|
def stack_id
|
42
|
-
@stack_id ||= @client.describe_stacks[:stacks]
|
42
|
+
@stack_id ||= get_by_name(@client.describe_stacks[:stacks], stack_name)[:stack_id]
|
43
43
|
end
|
44
44
|
|
45
45
|
def app_id
|
46
|
-
@app_id ||= @client.describe_apps(stack_id: stack_id)[:apps]
|
46
|
+
@app_id ||= get_by_name(@client.describe_apps(stack_id: stack_id)[:apps], app_name)[:app_id]
|
47
47
|
end
|
48
48
|
|
49
|
+
def get_by_name collection, name
|
50
|
+
collection.detect do |x|
|
51
|
+
x[:name] == name
|
52
|
+
end || abort("Can't find #{name.inspect} among #{collection.map{|x| x[:name] }.inspect}")
|
53
|
+
end
|
49
54
|
end
|
50
|
-
|
51
55
|
end
|
data/lib/oops/tasks.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'oops/opsworks_deploy'
|
2
2
|
require 'aws'
|
3
3
|
namespace :oops do
|
4
|
-
task :build, [:
|
5
|
-
args.with_defaults
|
4
|
+
task :build, [:filename] => 'assets:precompile' do |t, args|
|
5
|
+
args.with_defaults filename: default_filename
|
6
6
|
|
7
|
-
file_path =
|
7
|
+
file_path = args.filename
|
8
8
|
|
9
9
|
sh %{mkdir -p build}
|
10
10
|
sh %{git archive --format zip --output build/#{file_path} HEAD}
|
@@ -17,10 +17,10 @@ namespace :oops do
|
|
17
17
|
puts "Packaged Application: #{file_path}"
|
18
18
|
end
|
19
19
|
|
20
|
-
task :upload, :
|
21
|
-
args.with_defaults
|
20
|
+
task :upload, :filename do |t, args|
|
21
|
+
args.with_defaults filename: default_filename
|
22
22
|
|
23
|
-
file_path =
|
23
|
+
file_path = args.filename
|
24
24
|
s3 = s3_object(file_path)
|
25
25
|
|
26
26
|
puts "Starting upload..."
|
@@ -28,11 +28,11 @@ namespace :oops do
|
|
28
28
|
puts "Uploaded Application: #{s3.url_for(:read)}"
|
29
29
|
end
|
30
30
|
|
31
|
-
task :deploy, :app_name, :stack_name, :
|
31
|
+
task :deploy, :app_name, :stack_name, :filename do |t, args|
|
32
32
|
raise "app_name variable is required" unless (app_name = args.app_name)
|
33
33
|
raise "stack_name variable is required" unless (stack_name = args.stack_name)
|
34
|
-
args.with_defaults
|
35
|
-
file_path =
|
34
|
+
args.with_defaults filename: default_filename
|
35
|
+
file_path = args.filename
|
36
36
|
file_url = s3_url file_path
|
37
37
|
|
38
38
|
ENV['AWS_REGION'] = 'us-east-1'
|
@@ -69,8 +69,8 @@ namespace :oops do
|
|
69
69
|
@build_hash ||= `git rev-parse HEAD`.strip
|
70
70
|
end
|
71
71
|
|
72
|
-
def
|
73
|
-
"git-#{
|
72
|
+
def default_filename
|
73
|
+
ENV['PACKAGE_FILENAME'] || "git-#{build_hash}.zip"
|
74
74
|
end
|
75
75
|
|
76
76
|
def package_folder
|
data/lib/oops/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oops
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clarke Brunsdon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|