Commit graph

313 commits

Author SHA1 Message Date
Adam Spiers 833abc4d93 Update maintainership to reflect reality
Troy hasn't been active on the project for many years.

https://lists.gnu.org/archive/html/stow-devel/2011-11/msg00009.html
2019-06-26 13:59:58 +01:00
Adam Spiers 8b0733a8a0 add tools/get-version to MANIFEST
Forgot to do this, and it broke ./Build.PL distcheck.
2019-06-25 20:33:48 +01:00
Adam Spiers 66d511b07b Merge remote-tracking branch 'bricewge/fix-34' 2019-06-25 20:10:43 +01:00
Adam Spiers e647c53af1 Add some polish to the release process 2019-06-25 20:05:47 +01:00
Adam Spiers 42ed9ed942
Perform shell expansion on the contents of .stowrc (#40)
Perform shell expansion on the contents of .stowrc
2019-06-25 19:49:46 +01:00
Charles LeDoux dc42c34107 Add function to expand ~ in .stowrc files (#14)
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
2019-06-25 19:38:43 +01:00
Charles LeDoux 9674738792 Apply environment expansion to options in .stowrc files
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.
2019-06-25 19:38:26 +01:00
Charles LeDoux 4d1167ffd7 Parse cli and stowrc files separately
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.
2019-06-25 19:38:25 +01:00
Charles LeDoux feb885fda6 Factor out parsing of options
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.
2019-06-25 19:38:25 +01:00
Charles LeDoux ebc895a540 Add test for conflicting stowrc and cli args
Why:

* Want to add feature to stowrc parsing.
* Missing regression test for conflicting cli and stowrc options.

This change addresses the need by:

* Add missing regression tests to rc_options.t
    * Two types of tests for the two types of options possible.

* For scalar options such as --target, cli arguments should overwrite
  stowrc arguments.

* For options that result in a list, such as --ignore, the arguments
  from cli and stowrc files should be merged.
2019-06-25 19:38:25 +01:00
Charles LeDoux 237288fb7e Add test harness for stowrc files
Why:

* Planning on developing a new feature for parsing of stowrc files.
* Need a test harness that performs initialization and clean up
    * Initialization: Create directory structure that allows creation of
      stowrc files without worrying about squashing existing files.
    * Clean up: Remove all files created during testing.

This change addresses the need by:

* Add intialization and cleanup harness in t/rc_options.t
    * Define the location to write stowrc files to in $RC_FILE
    * Ensures that location $RC_FILE does not already exist.
    * Calls the init_test_dirs to bootstrap directory tree.
    * After all tests are run, removes $RC_FILE and the testing
      directory tree.

* Add basic test of stowrc parsing to t/rc_options.t
    * Provides a template of how to create and test a stowrc file.

* Newly created t/rc_options.t file added to MANIFEST
2019-06-25 19:38:25 +01:00
Charles LeDoux 048203b7f9 Change init_test_dirs to point $HOME at $OUT_DIRS
Why:

* Want to add a new feature to parsing of stowrc files.
* Need ability to write .stowrc files for testing without risk of
  squashing existing files.

This change addresses the need by:

* Reusing logic in init_test_dirs
    * init_test_dirs already creates new directory structure and overwrites
      $HOME to point into /tmp.
* This commit changes init_test_dirs to point $HOME at the newly created
  directory structure ($OUT_DIR) instead of /tmp.
    * Grants ability to write .stowrc to $HOME without fear.
    * Pointing $HOME at $OUT_DIR instead of /tmp also makes cleanup easier.
        * Remove $OUT_DIR vs remove specific files in /tmp.
2019-06-25 19:38:25 +01:00
Adam Spiers bb8b79e031 Don't warn when .stowrc is used
We fully support and expect some users using .stowrc, so there is
no reason to issue a warning when they do.
2019-06-25 19:38:25 +01:00
Adam Spiers 0f3e1b33fc Group news items for 2.3.0
Since 2.3.0 is a long overdue release and has many changes,
document them in NEWS in three groups:

- New features / changes in behaviour
- Documentation fixes and enhancements
- Fixes for bugs and technical debt
2019-06-25 19:36:49 +01:00
Adam Spiers 2eb3be13c5
Update docs according to recent commits (#39)
Update docs according to recent commits
2019-06-25 17:48:07 +01:00
Adam Spiers f6bf45af9c Update NEWS and THANKS according to recent commits 2019-06-25 17:41:17 +01:00
Adam Spiers c3cbdeb812 Synchronise --verbose documentation
The man page was updated with regard to higher --verbose levels but
not the info manual, so fix that.
2019-06-25 17:41:17 +01:00
Adam Spiers b9c13df5f7
Fix old descriptions of Stow (#22) (#38)
Fix old descriptions of Stow (#22)
2019-06-25 17:05:43 +01:00
Adam Spiers 72ef83cebd Fix old descriptions of Stow (#22)
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
2019-06-25 16:52:33 +01:00
Adam Spiers a70c60e888
Merge pull request #37 from aspiers/invalid-option-exit-code
Return non-zero exit code when invalid option is specified (#34)
2019-06-25 15:55:15 +01:00
Adam Spiers e79c5938bc Return non-zero exit code when invalid option is specified (#34)
Also add a unit test for this.

Fixes #34: https://github.com/aspiers/stow/issues/34
2019-06-25 15:43:08 +01:00
Adam Spiers 1e9fa23d2e
Add black box CLI testing and 2 other tweaks (#36)
Add black box CLI testing and 2 other tweaks
2019-06-25 15:41:41 +01:00
Adam Spiers 8394507891 Add cli.t for testing invocation of stow executable
Unlike the other tests, this actually treats stow(1) as a black box
script, running it directly rather than require-ing it as a library.
This allows us to check things like the exit codes returned.
2019-06-25 15:26:25 +01:00
Adam Spiers bd4241b3e4 Make dotfiles.t executable for consistency with other tests 2019-06-25 14:30:30 +01:00
Adam Spiers e618ef1526 remove duplicate "the" typo 2019-06-25 13:46:30 +01:00
Brice Waegeneire 77b0cf8f45 retrun exit code 1 when unknown option 2019-06-11 14:13:51 +02:00
Brice Waegeneire c86d9aa148 make non docker scripts more portable 2019-06-11 10:53:28 +02:00
Brice Waegeneire d6924bdbc3 fix dockerfile apt-get lock issue
E: Could not open lock file /var/cache/apt/archives/lock - open (2: No such file or directory)
E: Unable to lock the download directory
2019-06-11 10:28:25 +02:00
Adam Spiers 74defd4812
Merge pull request #30 from aspiers/chkstow-stow-dir
make chkstow honour $STOW_DIR environment variable
2019-02-09 17:08:44 +00:00
Adam Spiers 1a752bf70b make chkstow honour $STOW_DIR environment variable
Thanks to Matan Nassau for reporting this deficiency.
2019-02-09 17:03:45 +00:00
Adam Spiers 88ec3f58aa add Jean Louis to THANKS file
Forgot to do this in e7e6c7f.
2018-02-11 17:58:33 +00:00
Adam Spiers dd42b09a5b avoid "regex" abbreviation for consistency 2018-02-11 17:55:40 +00:00
Adam Spiers c84de4eb14 fix erroneous glob examples in --ignore documentation
Many thanks to Daniel Shahaf for noticing this.

http://lists.gnu.org/archive/html/bug-stow/2017-07/msg00000.html
2018-02-11 17:55:31 +00:00
Adam Spiers e2af22c11a update aclocal.m4 using aclocal 1.15.1 2018-02-11 11:52:56 +00:00
Adam Spiers e7e6c7fbde update the introductory text to clarify Stow's common usage
Thanks to Jean Louis for some suggestions on this.
2018-02-11 11:47:39 +00:00
Adam Spiers 655e8e4a3d INSTALL.md: document how to build from git (#20)
Fixes https://github.com/aspiers/stow/issues/20
2017-03-19 21:12:46 +00:00
Adam Spiers ea11f266a5 fix typo in "Deleting Packages" chapter
Thanks to Hongyi Zhao for spotting this error and reporting it.
2017-03-04 14:29:06 +00:00
Adam Spiers b160a1c807 clarify that ~/.stowrc args don't get processed by a shell
Address confusion reported here:

  http://lists.gnu.org/archive/html/bug-stow/2016-08/msg00000.html
2016-12-18 23:17:19 +00:00
Adam Spiers 5a8d275c47 replace a "you" typo with better text
The contents are prepended to the arguments; they still come after the
stow executable.
2016-12-18 23:14:39 +00:00
Adam Spiers 8d738353f8 fix documentation for --verbose
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
2016-12-18 23:11:23 +00:00
Adam Spiers 6e5209fb2d Bump version to 2.3.0 2016-11-20 22:57:39 +00:00
Adam Spiers 94b155d99b Prepare NEWS file for 2.3.0 release 2016-11-20 22:57:39 +00:00
Adam Spiers fd10706ce3 HOWTO-RELEASE: use Docker to test before releasing
Charles LeDoux did some awesome work providing this Docker environment
which can test across multiple Perl versions using perlbrew, so it
would be crazy not to use it.
2016-11-20 22:57:39 +00:00
Adam Spiers 5123a585a2 ignore cover_db generated by Coveralls 2016-11-20 22:57:39 +00:00
Adam Spiers 03480626a2 tag Docker images with the corresponding version number 2016-11-20 22:50:22 +00:00
Adam Spiers 98a8f7e3e7 use PAUSE upload for final validation step of release 2016-11-20 22:50:22 +00:00
Adam Spiers a9f79c6a5b make sure release tags are also pushed to GitHub 2016-11-20 22:50:22 +00:00
Adam Spiers 17bbfb05c6 further refine the release process
Let's try a new approach where we increment the version number
immediately after publishing a release, not just before.

This will mean that anyone who builds from git gets a version of Stow
which is higher than the release which was just cut, and this could
provide valuable debugging hints in case a bug report does not clearly
state whether the problem arose with the latest release or with a build
from git.
2016-11-20 22:50:22 +00:00
Adam Spiers 08bff6df00 whitespace cleanups 2016-11-20 22:20:46 +00:00
Adam Spiers 68838c8d9d THANKS: add some recent contributors 2016-11-20 22:07:52 +00:00