Skip to content

Upgrade middleman [WIP] #154

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

Closed
wants to merge 8 commits into from
Closed

Upgrade middleman [WIP] #154

wants to merge 8 commits into from

Conversation

JonRowe
Copy link
Member

@JonRowe JonRowe commented Jul 31, 2020

Todo:

  • fix assets
  • restore deploy
  • restore or just hardcode favicon

Copy link
Member

@pirj pirj left a comment

Choose a reason for hiding this comment

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

Is this needed? They don't seem to use any SCSS syntax (AFAIR @keyframes isa native CSS) asciinema-player.css -> asciinema-player.scss?

Side observation: a good part of Asciinema CSS can be dropped, as it contains styles for different themes, and we only use one.

The original is in LESS.

Random notes.

The idea with submodules for deployment should work. I didn't play much around it, but was able to create some mess inside build directory.

WDYT if I send a PR to replace middleman-deploy with submodules first, and we apply this PR with Middleman 3->4 upgrade after with less pain?

Dir.glob(File.join(source_dir, "/documentation/#{version}/#{gem_name}/**/*")).select { |f| File.file? f }.each do |f|
relative_path = Pathname.new(f).relative_path_from(Pathname.new(source_dir))
RSpecInfo::Helpers.rspec_documentation_latest(app.source_dir).each do |gem_name, version|
Dir.glob(File.join(app.source_dir, "/documentation/#{version}/#{gem_name}/**/*")).select { |f| File.file? f }.each do |f|
Copy link
Member

Choose a reason for hiding this comment

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

I ended up with **/*.html, otherwise it was replacing CSS and JS with some nonsense.

Copy link
Member Author

Choose a reason for hiding this comment

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

I mean this is supposed to replace css and js...

Gemfile Outdated
@@ -1,12 +1,14 @@
source 'https://rubygems.org'

gem "middleman", "~> 3.3.6"
gem "middleman", "~> 4.0.0"
gem "middleman-syntax"
gem "middleman-blog"
gem "middleman-favicon-maker"
gem "middleman-deploy"
Copy link
Member

Choose a reason for hiding this comment

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

middleman-deploy won't work, can be dropped.

@JonRowe
Copy link
Member Author

JonRowe commented Jul 31, 2020

The idea with submodules for deployment should work. I didn't play much around it, but was able to create some mess inside build directory.

WDYT if I send a PR to replace middleman-deploy with submodules first, and we apply this PR with Middleman 3->4 upgrade after with less pain?

I mean thats an orthogonal approach, so it doesn't hurt to try, (replacing deploy before upgrading), but remember the source of the master branch is what github sees and deploys, so I'm sceptical that submodules can work.

@JonRowe
Copy link
Member Author

JonRowe commented Jul 31, 2020

Is this needed? They don't seem to use any SCSS syntax (AFAIR @Keyframes isa native CSS) asciinema-player.css -> asciinema-player.scss?

Side observation: a good part of Asciinema CSS can be dropped, as it contains styles for different themes, and we only use one.

Its the as bundled file, the file was renamed as an attempt to get sass rendering to work (I think it's bundled?) if its not bundled it can probably be left alone.

@JonRowe
Copy link
Member Author

JonRowe commented Jul 31, 2020

I've been able to mostly get HTML rendering working, whats needed mostly is a replacement/restore for sprockets

@JonRowe JonRowe force-pushed the upgrade-middleman-wip branch from efd0d78 to a3e2b91 Compare August 3, 2020 11:41
@pirj
Copy link
Member

pirj commented Aug 18, 2020

Got a response from support:


The CNAME in the repo is what’s used to direct traffic to the right place. What Custom Domain settings does is to create the CNAME file in the repo in an automated fashion. The CNAME isn’t being stored anywhere else.

what is the best way to achieve a "git push"-style deployment to both the stable main site (with a canonical domain name) and a Staging site (with no canonical name) from a single repository?

You still need a way to prevent the CNAME file from being pushed to staging.

I'm sorry I could not be of much help here, you may have to find a third-party tool similar "Middleman" or otherwise reach out to "Middleman" support team to check your options after their recent update.

I guess we'll have to use something like this to push to staging:

git rm docs/CNAME
git commit docs -m 'rm CNAME'
git push staging HEAD:source
git reset --hard HEAD~1

This is what our previous middleman deploy was doing anyway, right?

@JonRowe
Copy link
Member Author

JonRowe commented Aug 18, 2020

Previously Github had master hardcoded as the page branch, so middleman deploy built the site, checked out master, copied the files and commited them, and thus it could ignore files when copying.

@JonRowe
Copy link
Member Author

JonRowe commented Aug 18, 2020

Maybe your submodule approach is cleaner here, because build will output to a directory, and we can commit and push to the submodules (preferably with a helper command) similar to how the old middleware worked.

That way a commit deleting CNAME will stay in the history and as long as we never change CNAME it'll persist.

tombruijn added a commit to tombruijn/rspec.github.io that referenced this pull request Jan 31, 2021
Fix the `ignored_sitemap_matchers` for partials.

I copied the middleman implementation of this proc and adjusted the
docs exception to work with the new method.

The `source_file` object is now a struct with multiple versions of the
source file path. The exception needed to be checked against the full
path and not the relative_path that only included the filename and not
the directories.

In the proxy file generation for the "latest" version of the docs, that
redirects to the actual latest version of the docs, I only selected the
`.html` files. This should be okay, and I tested it works. But I had to
add this filter because otherwise all the `.css` and `.js` files would
be parsed as CSS and JavaScript files. That would then break because
those included HTML and cause syntax errors during compilation.

Previously in PR rspec#154 this solution was mentioned. I don't know the
background here. I think the site doesn't also need to redirect the
`.css` and `.js` files. Only the `.html` files redirection should be
enough, as it will load the assets from the actual versioned docs.
JonRowe pushed a commit to tombruijn/rspec.github.io that referenced this pull request Feb 5, 2021
Fix the `ignored_sitemap_matchers` for partials.

I copied the middleman implementation of this proc and adjusted the
docs exception to work with the new method.

The `source_file` object is now a struct with multiple versions of the
source file path. The exception needed to be checked against the full
path and not the relative_path that only included the filename and not
the directories.

In the proxy file generation for the "latest" version of the docs, that
redirects to the actual latest version of the docs, I only selected the
`.html` files. This should be okay, and I tested it works. But I had to
add this filter because otherwise all the `.css` and `.js` files would
be parsed as CSS and JavaScript files. That would then break because
those included HTML and cause syntax errors during compilation.

Previously in PR rspec#154 this solution was mentioned. I don't know the
background here. I think the site doesn't also need to redirect the
`.css` and `.js` files. Only the `.html` files redirection should be
enough, as it will load the assets from the actual versioned docs.
@pirj
Copy link
Member

pirj commented May 9, 2022

We're already on Middleman 4.x, done in #163
@JonRowe Do you think there's anything useful left in this PR, or it can be closed?

@JonRowe JonRowe closed this May 10, 2022
@JonRowe JonRowe deleted the upgrade-middleman-wip branch May 10, 2022 10:05
@JonRowe
Copy link
Member Author

JonRowe commented May 10, 2022

Nope! Closed :)

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.

2 participants