oops 0.0.2 → 0.0.3

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: 40a6a8750526f8eb0d177e952cde5126505744b1
4
- data.tar.gz: ad6843aae63560c6ee79aa218940094c49c06db0
3
+ metadata.gz: a6a255d502aa90de7fd7a2cf40eac417a5ab5649
4
+ data.tar.gz: 502b71a512ee084635b9e1423b0f305d347af825
5
5
  SHA512:
6
- metadata.gz: ee3e902b7220aeb9d5a112fa04f7ebb1c6570a39bed0d5e4c97c927be77dbe7665652fefecf00928d565209a39ca9b7600ebcb8febbc56aaea7219f88dd73580
7
- data.tar.gz: 819cae424559825508aeb416d46321d3aebf15e597b301ca5cd7385e45924fbd33f144ee8b1343a46f07a34a812c5f4a2a79bbb10319ebe0186cdef28c2a38bd
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
@@ -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].detect { |x| x[:name] == stack_name }[:stack_id]
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].detect { |x| x[:name] == app_name }[:app_id]
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, [:ref] => 'assets:precompile' do |t, args|
5
- args.with_defaults ref: build_hash
4
+ task :build, [:filename] => 'assets:precompile' do |t, args|
5
+ args.with_defaults filename: default_filename
6
6
 
7
- file_path = zip_file args.ref
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, :ref do |t, args|
21
- args.with_defaults ref: build_hash
20
+ task :upload, :filename do |t, args|
21
+ args.with_defaults filename: default_filename
22
22
 
23
- file_path = zip_file args.ref
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, :ref do |t, args|
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 ref: build_hash
35
- file_path = zip_file args.ref
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 zip_file ref
73
- "git-#{ref}.zip"
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
@@ -1,3 +1,3 @@
1
1
  module Oops
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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: 2013-12-24 00:00:00.000000000 Z
11
+ date: 2014-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk