-
Notifications
You must be signed in to change notification settings - Fork 613
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
Make PackageTask
be able to omit parent directory while packing files
#310
Conversation
@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! |
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: