-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.rails.sh
32 lines (29 loc) · 934 Bytes
/
.rails.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
alias test_migrate="RAILS_ENV=test rails db:migrate"
alias rt="bundle exec rails test"
alias bnd="bundle"
### ruby gems update with bundler #####
function gem_update() {
echo "Updating gems >>>"
logger "Running bundle update ........"
update_output=$(bundle update)
if [ $? -eq 0 ]; then
echo "Bundle update completed successfully."
else
echo "Error: Bundle update failed."
return 1
fi
if ! git diff --quiet --exit-code Gemfile.lock; then
# Run RuboCop
echo "Running RuboCop..."
rubocop -A
# Commit changes to Gemfile.lock with update output as part of the commit message
echo "Committing changes..."
git add Gemfile.lock
git commit -m "Update gems: $(echo "$update_output" | grep -E '^Bundle complete!' | tail -1)"
# Push changes to Git repository
logger "Pushing changes to Git repository..."
git push
else
echo "No changes to commit, git exit "
fi
}