-
Notifications
You must be signed in to change notification settings - Fork 613
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Make PackageTask
be able to omit parent directory while packing files
#310
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@tonytonyjan Can you add a test-case with |
2b1151a
to
382e804
Compare
Hi, @hsbt, I added a new test case with the following diff. Since I did not see any IO or shell-like operation in the test file, I infer that I should only write tests for If you have any opinion about the test, please let me know. Thanks for reviewing. :) diff --git a/test/test_rake_package_task.rb b/test/test_rake_package_task.rb
index d3886f8..25a1baa 100644
--- a/test/test_rake_package_task.rb
+++ b/test/test_rake_package_task.rb
@@ -78,4 +78,16 @@ class TestRakePackageTask < Rake::TestCase # :nodoc:
assert_equal "a", pkg.package_name
end
+ def test_without_parent_dir
+ pkg = Rake::PackageTask.new("foo", :noversion)
+
+ assert_equal "pkg", pkg.working_dir
+ assert_equal "foo", pkg.target_dir
+
+ pkg.without_parent_dir = true
+
+ assert_equal "pkg/foo", pkg.working_dir
+ assert_equal ".", pkg.target_dir
+ end
+
end |
Seems good. Thanks! |
This was referenced Mar 8, 2021
This was referenced Mar 15, 2021
This was referenced Mar 15, 2021
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Expected
Actual
Why Do We Need This Feature?
The problem emerged when I want to use
PackageTask
to package my Chrome/Firefox extension.PackageTask
can only package the whole directory but Mozilla does not accept such structure:Before (Workaround)
There is no way to omit parent directory by set config to
PackageTask
, alternatively below is a workaround to achieve this:After
With this pull request, we can now make it easier: