-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fewer ActiveSupport core extensions #318
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require 'rubygems' | ||
require 'stack_master' | ||
|
||
if ENV['STUB_AWS'] == 'true' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,9 @@ | |
require 'aws-sdk-sns' | ||
require 'aws-sdk-ssm' | ||
require 'colorize' | ||
require 'active_support/core_ext/string' | ||
require 'active_support/core_ext/hash/keys' | ||
require 'active_support/core_ext/object/blank' | ||
require 'active_support/core_ext/string/inflections' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previously, when requiring Which would in turn load a bunch of other core extensions. Let's be a little more explicit about the extensions StackMaster uses, and only load these. |
||
require 'multi_json' | ||
|
||
MultiJson.use :json_gem | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ def resolve(value) | |
owners = Array(value.fetch('owners', 'self').to_s) | ||
ami_finder = AmiFinder.new(@stack_definition.region) | ||
filters = ami_finder.build_filters_from_hash(value.fetch('filters')) | ||
ami_finder.find_latest_ami(filters, owners).try(:image_id) | ||
ami_finder.find_latest_ami(filters, owners)&.image_id | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that we require Ruby >= 2.4, we can use the Ruby safe navigation operator, instead of ActiveSupport's |
||
end | ||
end | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,7 @@ def format | |
newlines = lines.split("\n").map do |line| | ||
"#{line}#{newlines.pop}" | ||
end | ||
if lines.starts_with?("\n") | ||
if lines.start_with?("\n") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Active support aliases Ruby's Let's just use the method that comes with Ruby. |
||
newlines.insert(0, "\n") | ||
end | ||
newlines | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed.