-
Notifications
You must be signed in to change notification settings - Fork 3
Add prototype dead method script #4
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
base: master
Are you sure you want to change the base?
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 |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #!/usr/bin/env ruby | ||
| ENV['RAILS_ENV'] = 'development' | ||
|
|
||
| require '../manageiq/config/environment' | ||
|
|
||
| #in miq-ui-classic ls | grep "controller.rb" | cut -d '.' -f 1 | ||
| all_controllers = `ls app/controllers/ | grep "controller.rb" | cut -d '.' -f1`.split("\n") | ||
|
|
||
| whitelist = [] | ||
|
|
||
| all_controllers.each do |controller_name| | ||
| break if controller_name == "oauth_sessions_controller" | ||
| controller = controller_name.classify.constantize | ||
| buttons = controller.constants.select{|x| x.to_s.include?("ALLOWED_ACTIONS")} | ||
| break unless buttons.present? | ||
| buttons.each do |button| | ||
| whitelist.concat(controller.const_get(button).keys) | ||
| end | ||
| end | ||
| whitelist.sort.uniq.each { |item| puts item } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| #!/bin/bash | ||
| #all temp files | ||
| ROUTES=`mktemp` | ||
| ALLOWEDMETHODS=`mktemp` | ||
| OLD=`mktemp` | ||
| NEW=`mktemp` | ||
|
|
||
| #in miq get routes | ||
| bundle exec rake routes | ag "\s#*([\S]+)$" -o | ag '(?<=#).*' -o > "$ROUTES" | ||
| echo "routes DONE" | ||
|
|
||
| #in miq-ui | ||
| cd .. | ||
| cd manageiq-ui-classic | ||
| echo "moved to miq-ui-classic" | ||
|
|
||
| if [[ -n $0 ]]; then | ||
| git checkout $0 | ||
| bin/update | ||
| fi | ||
| ruby /Users/zita/Desktop/all.rb > "$ALLOWEDMETHODS" | ||
| sed -i "" '/^\*/ d' "$ALLOWEDMETHODS" | ||
|
Contributor
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. to me, this always fails with sed: can't read /^\*/ d: No such file or directoryI must be doing something wrong
Owner
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. Mac vs Linux: in macs, -i takes a required parameter (which extension to add to the backup file) => |
||
|
|
||
| echo "extra methods DONE" | ||
|
|
||
| debride --rails app/ --whitelist "$ROUTES" "$ALLOWEDMETHODS" | cut -d ":" -f1 > "$OLD" | ||
|
|
||
| echo "old possibly dead methods DONE" | ||
|
|
||
| if [[ -n $1 ]]; then | ||
| git checkout $1 | ||
| bin/update | ||
| ruby /Users/zita/Desktop/all.rb > "$ALLOWEDMETHODS" | ||
| sed -i "" '/^\*/ d' "$ALLOWEDMETHODS" | ||
| debride --rails app/ --whitelist "$ROUTES" "$ALLOWEDMETHODS" | cut -d ":" -f1 > "$NEW" | ||
| echo "ALL DEFFERENCES" | ||
| diff -Naur "$OLD" "$NEW" | ||
| else | ||
| cat "$OLD" | while read line; do | ||
| echo "$line" | ||
| done | ||
| fi | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
/Users/zita/Desktop/🙀should work :) (
$0is the current script)