Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 45 additions & 40 deletions author/copy-from-rbenv.sh
Original file line number Diff line number Diff line change
@@ -1,45 +1,50 @@
#!/bin/bash
mkdir -p libexec completions
rm -f completions/*
rm -f \
libexec/plenv \
libexec/plenv---version \
libexec/plenv-commands \
libexec/plenv-completions \
libexec/plenv-exec \
libexec/plenv-global \
libexec/plenv-help \
libexec/plenv-hooks \
libexec/plenv-init \
libexec/plenv-local \
libexec/plenv-prefix \
libexec/plenv-rehash \
libexec/plenv-root \
libexec/plenv-sh-rehash \
libexec/plenv-sh-shell \
libexec/plenv-shims \
libexec/plenv-version \
libexec/plenv-version-file \
libexec/plenv-version-file-read \
libexec/plenv-version-file-write \
libexec/plenv-version-name \
libexec/plenv-version-origin \
libexec/plenv-versions \
libexec/plenv-whence \
libexec/plenv-which
cp ~/.rbenv/libexec/* libexec/
cp ~/.rbenv/completions/* completions/
if [[ "$(ls -A ~/.rbenv)" && "$(ls -A ~/.rbenv/libexec)" && "$(ls -A ~/.rbenv/completions)" ]];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it enough to use -d file test operator instead of ls -A ? ls -A some_path shows error if some_path does not exist like ls: /Users/shohei.yoshida/.rbenv: No such file or directory.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with using -d if that's preferred.

then
mkdir -p libexec completions
rm -f completions/*
rm -f \
libexec/plenv \
libexec/plenv---version \
libexec/plenv-commands \
libexec/plenv-completions \
libexec/plenv-exec \
libexec/plenv-global \
libexec/plenv-help \
libexec/plenv-hooks \
libexec/plenv-init \
libexec/plenv-local \
libexec/plenv-prefix \
libexec/plenv-rehash \
libexec/plenv-root \
libexec/plenv-sh-rehash \
libexec/plenv-sh-shell \
libexec/plenv-shims \
libexec/plenv-version \
libexec/plenv-version-file \
libexec/plenv-version-file-read \
libexec/plenv-version-file-write \
libexec/plenv-version-name \
libexec/plenv-version-origin \
libexec/plenv-versions \
libexec/plenv-whence \
libexec/plenv-which
cp ~/.rbenv/libexec/* libexec/
cp ~/.rbenv/completions/* completions/


rename 's/rbenv/plenv/' libexec/* completions/*
/usr/bin/perl -i -pe 's!github.com/sstephenson/rbenv!github.com/tokuhirom/plenv!g; s/RUBY/PERL/g; s/rbenv/plenv/g;s/RBENV/PLENV/g;s/Ruby/Perl/g;s/ruby/perl/g; s/1.9.3-p327/5.18.0/g; s/bundle install/carton install/g' libexec/* completions/*
chmod +x libexec/*
grep sstephenson libexec/* plugins/*/* completions/*
rename 's/rbenv/plenv/' libexec/* completions/*
/usr/bin/perl -i -pe 's!github.com/sstephenson/rbenv!github.com/tokuhirom/plenv!g; s/RUBY/PERL/g; s/rbenv/plenv/g;s/RBENV/PLENV/g;s/Ruby/Perl/g;s/ruby/perl/g; s/1.9.3-p327/5.18.0/g; s/bundle install/carton install/g' libexec/* completions/*
chmod +x libexec/*
grep sstephenson libexec/* plugins/*/* completions/*

# enable --no-rehash by default
perl -i -pe 's/no_rehash=""/no_rehash=1/' libexec/plenv-init
# enable --no-rehash by default
perl -i -pe 's/no_rehash=""/no_rehash=1/' libexec/plenv-init

git_revision="$(git describe --tags HEAD | sed -e 's/-.*//' 2>/dev/null || true)"
export GIT_REVISION=$git_revision
perl -i -pe 's/version="[0-9.]+"/version="$ENV{GIT_REVISION}"/' libexec/plenv---version
perl -i -pe 's!print_summaries commands local global shell install uninstall rehash version versions which whence!print_summaries commands local global shell install uninstall rehash version versions which whence list-modules migrate-modules install-cpanm!; s!%-9s!%-17s!' libexec/plenv-help
git_revision="$(git describe --tags HEAD | sed -e 's/-.*//' 2>/dev/null || true)"
export GIT_REVISION=$git_revision
perl -i -pe 's/version="[0-9.]+"/version="$ENV{GIT_REVISION}"/' libexec/plenv---version
perl -i -pe 's!print_summaries commands local global shell install uninstall rehash version versions which whence!print_summaries commands local global shell install uninstall rehash version versions which whence list-modules migrate-modules install-cpanm!; s!%-9s!%-17s!' libexec/plenv-help
else
echo "rbenv not detected for this user, no changes were made."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation of else block is different from then block. IMO Indent size should be 2 space because other scripts uses it.

fi