Skip to content

Fix the bug that the redirection file is not copied when building - #263

Merged
urfreespace merged 3 commits into
mainfrom
cp-redirect-file
Oct 25, 2022
Merged

urfreespace merged 3 commits into
mainfrom
cp-redirect-file

Conversation

@urfreespace

@urfreespace urfreespace commented Oct 24, 2022 •

Copy link
Copy Markdown
Member

@tisonkun tisonkun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for taking care of this issue! Looks good to me.

Comment inline. And you can write close apache/pulsar#18174 instead of just referring it.


cp -r build-assets/* build/assets/
rm -rf build-assets
cp static/.htaccess build/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shall we copy all static files to build here and specially handle the hidden files like .htaccess?

In this way, we don't have to specially copy static files in:

"$TOOLS_DIR"/pulsar-admin-doc-gen.sh "$WEBSITE_DIR" "$VERSION"
"$TOOLS_DIR"/pulsar-client-doc-gen.sh "$WEBSITE_DIR" "$VERSION"
"$TOOLS_DIR"/pulsar-perf-doc-gen.sh "$WEBSITE_DIR" "$VERSION"
"$TOOLS_DIR"/pulsar-doc-gen.sh "$WEBSITE_DIR" "$VERSION"
"$TOOLS_DIR"/pulsar-config-doc-gen.sh "$WEBSITE_DIR" "$VERSION"
cd "$WEBSITE_DIR"
mkdir -p "$GEN_SITE_DIR"/reference
cp -r docsify/* "$GEN_SITE_DIR"/reference
CONTENT_DIR="$GEN_SITE_DIR"/content
rm -rf "$CONTENT_DIR"
mkdir -p "$CONTENT_DIR"
cp -R "$GEN_SITE_DIR"/reference "$CONTENT_DIR"
# cp -R "$GEN_SITE_DIR"/api "$CONTENT_DIR"
cp -R ./build/* "$CONTENT_DIR"
cp -R "$WEBSITE_DIR"/static/swagger/* "$CONTENT_DIR"/swagger/

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

good idea

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems that we don't need this line then.

Signed-off-by: Li Li <[email protected]>

@tisonkun tisonkun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems that if we simply write:

cp -R ./build/ "$CONTENT_DIR"

We can copy the hidden files as well. No need for special handling.

https://superuser.com/questions/61611/how-to-copy-with-cp-to-include-hidden-files-and-hidden-directories-and-their-con

Signed-off-by: Li Li <[email protected]>
@urfreespace

Copy link
Copy Markdown
Member Author

fixed, PTAL again, thanks @tisonkun

@tisonkun tisonkun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comments inline.


cp -r build-assets/* build/assets/
rm -rf build-assets
cp static/.htaccess build/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems that we don't need this line then.

| xargs rm -rf
fi
cp -r $GENERATED_SITE_DIR/content/* $PULSAR_SITE_TMP/content
cp -r $GENERATED_SITE_DIR/content/ $PULSAR_SITE_TMP/content

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps using -R to avoid behavior inconsistency. For the implementation on a darwin OS:

     Historic versions of the cp utility had a -r option.  This implementation
     supports that option, however, its behavior is different from historical
     FreeBSD behavior.  Use of this option is strongly discouraged as the
     behavior is implementation-dependent.  In FreeBSD, -r is a synonym for -RL
     and works the same unless modified by other flags.  Historical
     implementations of -r differ as they copy special files as normal files
     while recreating a hierarchy.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed with #264

Comment thread site2/tools/build-site.sh
# cp -R "$GEN_SITE_DIR"/api "$CONTENT_DIR"
cp -R ./build/* "$CONTENT_DIR"
cp -R ./build/ "$CONTENT_DIR"
cp -R "$WEBSITE_DIR"/static/swagger/* "$CONTENT_DIR"/swagger/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps we don't need this line since the static swagger is copyed at the line above.

@tisonkun tisonkun Oct 25, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed with #264

zeo1995 pushed a commit to zeo1995/pulsar-site that referenced this pull request Oct 26, 2022
* main: (1021 commits)
  Docs sync done from apache/pulsar(#6cc30c9)
  Add python client doc for 2.10.2 (apache#260)
  [cleanup][doc] Remove incubating documents from the site repo (apache#267)
  Docs sync done from apache/pulsar(#6cc30c9)
  Docs sync done from apache/pulsar(#6cc30c9)
  Docs sync done from apache/pulsar(#82237d3)
  Docs sync done from apache/pulsar(#82237d3)
  fix build process to release content in a correct layout (apache#265)
  fix build error caused by cp swagger dir (apache#264)
  Fix the bug that the redirection file is not copied when building (apache#263)
  Docs sync done from apache/pulsar(#573c8f6)
  Docs sync done from apache/pulsar(#e913a10)
  Docs sync done from apache/pulsar(#d1b5c02)
  Redirect incubating docs to pulsar.staged.apache.org (apache#261)
  Docs sync done from apache/pulsar(#39270f0)
  Docs sync done from apache/pulsar(#55d6c5f)
  Docs sync done from apache/pulsar(#c55be38)
  Docs sync done from apache/pulsar(#c55be38)
  Docs sync done from apache/pulsar(#c55be38)
  Docs sync done from apache/pulsar(#845d992)
  ...

# Conflicts:
#	site2/website-next/package-lock.json
#	site2/website-next/package.json
#	site2/website-next/src/css/custom.css
#	site2/website-next/yarn.lock
@tisonkun
tisonkun deleted the cp-redirect-file branch November 15, 2022 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Release all static resources under $WEBSITE/static in the site repo

2 participants