-
Notifications
You must be signed in to change notification settings - Fork 183
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
Extract bundle fluentd plugins function #946
Extract bundle fluentd plugins function #946
Conversation
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.
Couple of nitpicks. Let me create another PR with them.
@@ -18,6 +18,39 @@ function get_branch_to_checkout() { | |||
|| echo "${TRAVIS_BRANCH}" | |||
} | |||
|
|||
function bundle_fluentd_plugins() { | |||
local VERSION="${1}" |
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.
😍
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.
Let's change the VERSION variable into version
to indicate it's a local one.
local VERSION="${1}" | |
local version="${1}" |
function bundle_fluentd_plugins() { | ||
local VERSION="${1}" | ||
|
||
if [[ "${VERSION}" == "" ]] ; then |
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.
One could also use local VERSION="${1:?}"
above to check if the variable is set but I like the explicit error in here 👍
if [[ -d "${i}" ]]; then | ||
( | ||
cd "${i}" || exit 1 | ||
PLUGIN_NAME="$(basename "${i}")" |
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.
PLUGIN_NAME="$(basename "${i}")" | |
local plugin_name="$(basename "${i}")" |
cd "${i}" || exit 1 | ||
PLUGIN_NAME="$(basename "${i}")" | ||
# Strip everything after "-" (longest match) to avoid gem prerelease behavior | ||
GEM_VERSION="${VERSION%%-*}" |
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.
GEM_VERSION="${VERSION%%-*}" | |
local gem_version="${version%%-*}" |
function bundle_fluentd_plugins() { | ||
local VERSION="${1}" | ||
|
||
if [[ "${VERSION}" == "" ]] ; then |
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.
if [[ "${VERSION}" == "" ]] ; then | |
if [[ "${version}" == "" ]] ; then |
echo "Building gem ${PLUGIN_NAME} version ${GEM_VERSION} in $(pwd) ..." | ||
sed -i.bak "s/0.0.0/${GEM_VERSION}/g" ./"${PLUGIN_NAME}".gemspec | ||
rm -f ./"${PLUGIN_NAME}".gemspec.bak |
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.
echo "Building gem ${PLUGIN_NAME} version ${GEM_VERSION} in $(pwd) ..." | |
sed -i.bak "s/0.0.0/${GEM_VERSION}/g" ./"${PLUGIN_NAME}".gemspec | |
rm -f ./"${PLUGIN_NAME}".gemspec.bak | |
echo "Building gem ${plugin_name} version ${gem_version} in $(pwd) ..." | |
sed -i.bak "s/0.0.0/${gem_version}/g" ./"${plugin_name}".gemspec | |
rm -f ./"${plugin_Name}".gemspec.bak |
Testing performed