summaryrefslogtreecommitdiff
path: root/bin
Commit message (Collapse)AuthorAgeFilesLines
* Remove dependencies on Hash::Merge and Clone::ChooseAdam Spiers2019-06-291-11/+17
| | | | | | | | | | | | | | | | | | stow 2.3.0 added external runtime dependencies on Hash::Merge and Clone::Choose. Historically stow hasn't had runtime dependencies other than Perl itself, which is a useful property if you're managing the installation of Perl using stow; the bootstrapping instructions in stow's manual would need updating to describe how to install these two modules (and any dependencies they have now or in the future) as well. However, Hash::Merge is much more general than stow actually needs, so replace the merge() call with a few lines of equivalent code -- this avoids the external dependencies, and is clearer than the merge() call. Many thanks to Adam Sampson for this patch: https://lists.gnu.org/archive/html/bug-stow/2019-06/msg00001.html
* Use Clone backend for Hash::Merge, not StorableAdam Spiers2019-06-281-1/+4
| | | | | | | | Need to avoid Storable backend, since it can't deal with regexps: https://rt.perl.org/Public/Bug/Display.html?id=50608 This should fix the Docker builds.
* Add separate tests for .stowrc from $HOME and $PWDAdam Spiers2019-06-281-6/+7
| | | | | | | | | | | .stowrc can be obtained from $HOME and/or the current working directory; however only the $HOME case was tested before, because during tests Stow was being run from $HOME. So switch $TEST_DIR to an absolute path, create a new run_from/ subdirectory, and chdir to that before invoking any Stow code. This allows us to test the behaviour of .stowrc in $HOME and run_from/ separately.
* Avoid dereferencing $ENV{HOME} if it is undefined (#32)Adam Spiers2019-06-281-1/+5
|\ | | | | Avoid dereferencing $ENV{HOME} if it is undefined
| * Avoid dereferencing $ENV{HOME} if it is undefinedWill Aoki2019-04-031-1/+5
| |
* | Upgrade to GPL v3 and add headers to files (#44)Adam Spiers2019-06-272-6/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Following advice from maintainers@gnu.org, bring Stow in line with other GNU projects by upgrading it from GPL v2 to v3 https://www.gnu.org/prep/maintain/html_node/Licensing-of-GNU-Packages.html#Licensing-of-GNU-Packages as obtained in plain text and texinfo formats from https://www.gnu.org/licenses/ and adding appropriate headers: https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Code.html#License-Notices-for-Code Fixes #44: https://github.com/aspiers/stow/issues/44
* | Add function to expand ~ in .stowrc files (#14)Charles LeDoux2019-06-251-3/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new expand_tilde() function that performs tilde expansion of strings, and corresponding unit tests: * A ~ at the beginning of a path is expanded to the user's home directory. * Literal '~' can be provided with '\~' Combine this with expand_environment() in a new expand_filepath() function which applies all (both) required expansion functions to a string, and use that in get_config_file_options() to expand .stowrc options. Add more tests to check that tilde expanded in correct places, i.e.: * expanded for --target and --dir * not expanded for --ignore, --defer, or --override Update documentation on stowrc files according to this functionality change. Fixes #14: https://github.com/aspiers/stow/issues/14
* | Apply environment expansion to options in .stowrc filesCharles LeDoux2019-06-251-2/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expand environment variables used in stowrc, as requested in https://savannah.gnu.org/bugs/?41826 This is achieved by creating a new function expand_environment() that replaces any substring of the form '$VAR' or '${VAR}' with contents of environment variable $VAR. Literal '$' can be given by '\$'. N.B. The function is only applied to the --target and --dir options, and only for options specified in .stowrc; cli options are left untouched. Undefined variables are expanded to the empty string, as they would be in normal shell parameter expansion. Unit tests added accordingly: - Test expand_environment(): * Expand $HOME * Expand ${HOME} * Expand ${WITH SPACE} * Expand '\$HOME'. Expected is '$HOME' * Expand ${UNDEFINED}. Expected is ''. - Test that it's applied to the correct options. - Test that CLI options are not expanded.
* | Parse cli and stowrc files separatelyCharles LeDoux2019-06-251-13/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * We want to selectively apply expansion to: * Only options from stowrc files. * Only options that take a path. * This requires ability to: * Differentiate cli options from stowrc options * Distinguish between individual stowrc options. This change addresses the need by: * Options from ARGV and stowrc files are separately parsed, resulting in two options hashes. * Creating an option hash from stowrc files allows modification of specific arguments without having to rely on something like regex parsing of the options. * get_config_file_options modified to return options hash. * Uses the same parse_options function that parses ARGV * Add Hash:Merge to dependencies in order to merge the two option hashes. * process_options() merges the two option hashes. * Get option hash for ARGV * Get option hash from get_config_file_options(). * Merge the two hashes with Hash::Merge. * Sanitation and checks are ran on the merged options. * The options -S, -D, and -R are ignored in stowrc files. * Due to the way argument parsing happens, the effect of these actions is not carried from stowrc into parsing of cli options. * It doesn't seem to make sense to put these options in stowrc anyway.
* | Factor out parsing of optionsCharles LeDoux2019-06-251-10/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * Want to be able to selectively apply filepath expansion to: 1. Only options in a stowrc file. 2. Only options that take a file path. * Because of need 1, any expansion must be performed on stowrc options before merging with cli options. * Because of need 2, stowrc options need to be parsed before expansion in order to know which options need expanding. This change addresses the need by: * Create parse_options() * Implements option parsing logic previously in process_options() * Takes an array as parameter instead of assuming ARGV * Edit process_options() to still work as expected. * Only change was to call parse_options() instead of directly parsing ARGV * By factoring out the option parsing code, we can reuse the existing parsing code for stowrc options. * Allows expansion of only the option itself, i.e expansion on "$HOME/target" rather than "--target=$HOME/target" * Allows easy determination of which options need expansion.
* | Don't warn when .stowrc is usedAdam Spiers2019-06-251-1/+0
| | | | | | | | | | We fully support and expect some users using .stowrc, so there is no reason to issue a warning when they do.
* | Fix old descriptions of Stow (#22)Adam Spiers2019-06-251-29/+33
| | | | | | | | | | | | | | | | | | | | | | De-emphasise the package management aspects, since these days almost everyone prefers to use modern package managers such as rpm / dpkg / Nix for (system-wide) package management. Also include more popular modern use cases for Stow such as management of dotfiles and software compiled in the user's $HOME directory. Fixes #22: https://github.com/aspiers/stow/issues/22
* | Return non-zero exit code when invalid option is specified (#34)Adam Spiers2019-06-251-1/+1
| | | | | | | | | | | | Also add a unit test for this. Fixes #34: https://github.com/aspiers/stow/issues/34
* | remove duplicate "the" typoAdam Spiers2019-06-251-1/+1
|/
* make chkstow honour $STOW_DIR environment variableAdam Spiers2019-02-091-1/+1
| | | | Thanks to Matan Nassau for reporting this deficiency.
* fix documentation for --verboseAdam Spiers2016-12-181-2/+2
| | | | | | | It actually goes up to 5 these days. Thanks to Kristoffer Haugsbakk for spotting that: http://lists.gnu.org/archive/html/bug-stow/2016-08/msg00000.html
* Special processing for dotfilesJoris Vankerschaver2016-10-041-1/+17
|
* Allow directory with trailing and leading spacesLE Manh Cuong2015-11-131-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | - The `sanitize_path_options` functions remove all trailing and leading spaces. So any valid directory like ` 123`, `123 ` can not be used - Also if there are two directories ` 123` and `123`, and if user pick the ` 123` as option to `-d` or `-t`, then stow pick directory `123` as the argument instead of ` 123` as user want. ``` STOW_DIR=. stow -n -v3 -t \ 123 456 stow dir is /tmp/test stow dir path relative to target 123 is .. cwd now 123 cwd restored to /tmp/test cwd now 123 Planning stow of package 456... Stowing contents of ../456 (cwd=/tmp/test/123) Planning stow of package 456... done cwd restored to /tmp/test WARNING: in simulation mode so not modifying filesystem. ``` - This commit remove the check in `sanitize_path_options` function, and now stow can work with those directories. There have been a check for valid directory, so we are safe.
* Do more validation on --dir / --target directories (#7)Adam Spiers2015-11-111-1/+6
| | | | | | | | Previously STOW_DIR=0 would cause the cwd to be used as the STOW_DIR. Make that instead raise an error. Do similar validation on the target directory. Closes #7 - https://github.com/aspiers/stow/pull/7
* Correctly handle empty STOW_DIR (#5, #6)Adam Spiers2015-11-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | In shell, a variable is often considered unset even if it is set to the empty string. In other words, STOW_DIR= stow [args] is an idiomatic alternative to writing: unset STOW_DIR stow [args] and it also has the advantage of temporarily "unsetting" STOW_DIR for a single command. Therefore we should treat STOW_DIR being set to the empty string as equivalent to it not being set at all. Thanks to Cuong Manh Le for highlighting this issue! Fixes #6 - https://github.com/aspiers/stow/issues/6 Closes #5 - https://github.com/aspiers/stow/pull/5
* Fix RT ticket #75349Adam Spiers2012-07-091-1/+1
| | | | https://rt.cpan.org/Ticket/Display.html?id=75349
* Bug #36478 - fix Perl warnings from 'require 5.6.1;'Adam Spiers2012-05-162-2/+2
| | | | https://savannah.gnu.org/bugs/?36478
* Add --no-folding option.Adam Spiers2012-02-181-1/+6
|
* Remove -a option for safety reasons (but keep --adopt).Adam Spiers2012-02-181-4/+2
|
* Add --adopt to usage text.Adam Spiers2012-02-181-0/+2
|
* Improve ordering of options in usage text.Adam Spiers2012-02-181-4/+5
|
* Include --simulate in usage text.Adam Spiers2012-02-181-1/+1
|
* Remove reference to old FSF address (thank you rpmlint for catching this!)Adam Spiers2012-01-121-2/+1
|
* Add --adopt / -a option.Adam Spiers2012-01-091-0/+18
|
* Make stow script return true for t/stow.tv2.1.2Adam Spiers2011-12-111-0/+1
| | | | | According to http://matrix.cpantesters.org/?dist=Stow this only seems to be an issue with Perl <= 5.8.7.
* Significantly improve the handling of --with-pmdir.Adam Spiers2011-12-071-0/+1
|
* Make capitalisation consistent in usage text.Adam Spiers2011-12-071-4/+4
|
* Add bug-reporting email address and a couple of URLs to usage textAdam Spiers2011-12-061-0/+4
| | | | to comply with GNU Coding Standards for --help option.
* Fix corner case where only -d is specified as a single directory.Adam Spiers2011-12-011-1/+1
|
* Tidy up chkstow code and documentation.Adam Spiers2011-11-261-8/+13
|
* Remove quote stripping code.Adam Spiers2011-11-261-24/+3
| | | | | | | | | | | | | | | I'm guessing it was added due to a misunderstanding of how shell quoting works. When you invoke stow --ignore=".#.*" ... the shell strips out the quotes before the Perl process ever sees them. I can't imagine any sensible scenario in which you would need to invoke stow --ignore='"foo"' but if the user has a filename containing quotes at the beginning and end, they can now choose to ignore it (prior to this patch, they couldn't).
* Improve conflict reportingAdam Spiers2011-11-261-9/+14
|
* Ditch obsolete --conflicts option and update misleading documentation.Adam Spiers2011-11-261-21/+10
|
* Strip superfluous quotes from $hash{'lookups'}Adam Spiers2011-11-261-15/+15
|
* Avoid use of map in void contextAdam Spiers2011-11-261-1/+1
|
* Convert man page to POD format which is easier to maintain within stow.in.Adam Spiers2011-11-261-2/+383
|
* Reorganise more files into subdirectories and add CPAN support via Module::BuildAdam Spiers2011-11-262-0/+390