-
-
Notifications
You must be signed in to change notification settings - Fork 638
Update assets_precompile_spec.rb #490
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
Update assets_precompile_spec.rb #490
Conversation
symlink tests with tempfs
@dzirtusss GREAT START! @mapreal19 can you please do a quick review. Reviewed 1 of 1 files at r1. spec/react_on_rails/assets_precompile_spec.rb, line 10 [r1] (raw file):
this should either be a let block or a before block (before block requires the use of @assets_path) I'd suggest a let block. spec/react_on_rails/assets_precompile_spec.rb, line 18 [r1] (raw file):
be sure to run you will need to run
the red dots mean spaces. spec/react_on_rails/assets_precompile_spec.rb, line 51 [r1] (raw file):
How about http://apidock.com/ruby/FileUtils/touch/class spec/react_on_rails/assets_precompile_spec.rb, line 95 [r1] (raw file):
this should be a temp dir so not sure why this won't work Comments from Reviewable |
Reviewed 1 of 1 files at r1. spec/react_on_rails/assets_precompile_spec.rb, line 10 [r1] (raw file):
|
@dzirtusss Let's get the suggestions implemented and get your change merged. Thanks again! |
I have added all the changes (+rubocop) except clobber test Last test for clobber still have problems. In assets_precompile.rb in clobber we have ABSOLUTE FIXED path as follows: dir = Rails.root.join(@generated_assets_dir) in all other places paths are RELATIVE and are set up in initialize method. So we can substitute them with any tempfs dir we want. Inside clobber it is substituted to this: Rails.root.join(tempdir) which is NOT our testing tempdir Plus for some reason I didn't understand yet, while testing on my system Rails.root is nil and thus generates no method error (which can be my setup mistake). But, if it is right to do smth like: dir = @generated_assets_dir in clobber presuming it has full path, than everything is easy to update. Please advise on the right logic. |
As for introducing context do U mean smth like this? Thanks
|
Review status: 0 of 1 files reviewed at latest revision, 9 unresolved discussions, some commit checks failed. spec/react_on_rails/assets_precompile_spec.rb, line 58 [r2] (raw file):
@dzirtusss what I meant is having a context per each blocks of code here. Instead of having comments we could have something like:
Also we try to follow the four-phase test (See: https://robots.thoughtbot.com/four-phase-test) instead of abusing the use of Comments from Reviewable |
Review status: 0 of 1 files reviewed at latest revision, 9 unresolved discussions, some commit checks failed. spec/react_on_rails/assets_precompile_spec.rb, line 10 [r1] (raw file):
|
Review status: 0 of 1 files reviewed at latest revision, 9 unresolved discussions. spec/react_on_rails/assets_precompile_spec.rb, line 40 [r1] (raw file):
|
Review status: 0 of 1 files reviewed at latest revision, 9 unresolved discussions, some commit checks failed. spec/react_on_rails/assets_precompile_spec.rb, line 95 [r1] (raw file):
|
Reviewed 1 of 1 files at r3. Comments from Reviewable |
One small comment. Review status: all files reviewed at latest revision, 1 unresolved discussion, some commit checks failed. spec/react_on_rails/assets_precompile_spec.rb, line 102 [r3] (raw file):
the generated_assets_dir should not be inside of the assets_path. See this for the generated assets dir:
Since we're only using the generated_assets_dir here, then just don't pass the param for the assets_path. def clobber
dir = Rails.root.join(@generated_assets_dir)
if dir.present? && File.directory?(dir)
puts "Deleting files in directory #{dir}"
FileUtils.rm_r(Dir.glob(Rails.root.join("#{@generated_assets_dir}/*")))
else
puts "Could not find generated_assets_dir #{dir} defined in react_on_rails initializer: "
end
end Comments from Reviewable |
@dzirtusss Please see why the travis build failed per the link in "checks". |
Rails.root was nil. Didn't know how to stub )) now ok Review status: 0 of 1 files reviewed at latest revision, 1 unresolved discussion. spec/react_on_rails/assets_precompile_spec.rb, line 102 [r3] (raw file):
|
config.generated_assets_dir = File.join(%w(app assets webpack)) |
Since we're only using the generated_assets_dir here, then just don't pass the param for the assets_path.
def clobber
dir = Rails.root.join(@generated_assets_dir)
if dir.present? && File.directory?(dir)
puts "Deleting files in directory #{dir}"
FileUtils.rm_r(Dir.glob(Rails.root.join("#{@generated_assets_dir}/*")))
else
puts "Could not find generated_assets_dir #{dir} defined in react_on_rails initializer: "
end
end
Comments from Reviewable
Review status: 0 of 1 files reviewed at latest revision, 1 unresolved discussion. spec/react_on_rails/assets_precompile_spec.rb, line 102 [r3] (raw file):
|
Thanks @dzirtusss! Great job! Reviewed 1 of 1 files at r4. Comments from Reviewable |
48cb445
into
shakacode:alleycat-at-git-alexey/replace_symlinks_copy
When I tried to use a Git branch of the Node Renderer in Popmenu, it failed because the package isn't built after downloading. This PR fixes the issue. It should work for all package managers consuming this package: * npm runs both `prepare` and `prepack` (and I think prepack is the more recommended) for Git dependencies; * Yarn v1 runs only `prepare` * Yarn v2+ runs only `prepack` * pnpm doesn't document it anywhere I could find, but probably still runs one of them. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Introduced a new `prepack` script for enhanced build processes prior to packaging. - Added streaming server rendering support with new helper methods for improved performance and debugging. - **Improvements** - Updated the `build` script to be categorized under `default`, maintaining its existing functionality while improving organization. - Enhanced error handling during server rendering with new configuration options. - Transitioned logging mechanism to Pino for better integration with Fastify. - Updated project to enable usage as a `git:` dependency. - Shifted dependencies from local paths to GitHub repository URLs for better version control. - **Documentation** - Updated `CHANGELOG.md` to reflect recent changes and enhancements, including versioning updates and detailed modifications. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Alexey Romanov <alexey.v.romanov@gmail.com>
When I tried to use a Git branch of the Node Renderer in Popmenu, it failed because the package isn't built after downloading. This PR fixes the issue. It should work for all package managers consuming this package: * npm runs both `prepare` and `prepack` (and I think prepack is the more recommended) for Git dependencies; * Yarn v1 runs only `prepare` * Yarn v2+ runs only `prepack` * pnpm doesn't document it anywhere I could find, but probably still runs one of them. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Introduced a new `prepack` script for enhanced build processes prior to packaging. - Added streaming server rendering support with new helper methods for improved performance and debugging. - **Improvements** - Updated the `build` script to be categorized under `default`, maintaining its existing functionality while improving organization. - Enhanced error handling during server rendering with new configuration options. - Transitioned logging mechanism to Pino for better integration with Fastify. - Updated project to enable usage as a `git:` dependency. - Shifted dependencies from local paths to GitHub repository URLs for better version control. - **Documentation** - Updated `CHANGELOG.md` to reflect recent changes and enhancements, including versioning updates and detailed modifications. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Alexey Romanov <alexey.v.romanov@gmail.com>
Symlink tests with tempfs. Please don't kill - I'm new to ruby/rspec/git world. Waiting for any comments.
This change is