Skip to content

Instantly share code, notes, and snippets.

@hotakasaito
Created January 18, 2016 15:01
Show Gist options
  • Save hotakasaito/9e604c6da76837c263df to your computer and use it in GitHub Desktop.
Save hotakasaito/9e604c6da76837c263df to your computer and use it in GitHub Desktop.
aws elastic beanstalkでdeployが失敗する ref: http://qiita.com/hotakasaito/items/918b1456bbd5d7d2a773
#!/usr/bin/env /opt/rubies/ruby-current/bin/ruby
#==============================================================================
# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Amazon Software License (the "License"). You may not use
# this file except in compliance with the License. A copy of the License is
# located at
#
# https://aws.amazon.com/asl/
#
# or in the "license" file accompanying this file. This file is distributed on
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or
# implied. See the License for the specific language governing permissions
# and limitations under the License.
#==============================================================================
require 'bundler'
Dir.chdir '/var/app/ondeck'
groups = Bundler.definition.groups
begin
Bundler.definition.resolve_with_cache!
rescue Bundler::GemNotFound
Bundler.definition(true).resolve_remotely!
end
gems = Bundler.definition.specs_for(groups).collect(&:name)
exit 0 if gems.include? ARGV[0]
exit 1
files:
"/opt/elasticbeanstalk/support/scripts/check-for-gem.rb":
mode: "000755"
owner: "root"
group: "root"
content: |
#!/usr/bin/env /opt/rubies/ruby-current/bin/ruby
require 'bundler'
require 'timeout'
Dir.chdir '/var/app/ondeck'
groups = Bundler.definition.groups
begin
Bundler.definition.resolve_with_cache!
rescue Bundler::GemNotFound
begin
timeout(5) do
Bundler.definition(true).resolve_remotely!
end
rescue Timeout::Error
puts $!
end
end
gems = Bundler.definition.specs_for(groups).collect(&:name)
exit 0 if gems.include? ARGV[0]
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment