commit 55ab71a7eed4ea32688ec5f80e5d3098f928fdd4
parent dfbfbfad514770b2095c02419ef519ce8fd0eebe
Author: Daniel Barlow <dan@telent.net>
Date: Mon, 9 Aug 2021 21:07:17 +0100
add Makefile to make the README simpler
Diffstat:
4 files changed, 37 insertions(+), 18 deletions(-)
diff --git a/Makefile b/Makefile
@@ -0,0 +1,11 @@
+default: moss.rb
+
+install: default
+ mkdir -p $(prefix)/bin
+ cp moss.rb $(prefix)/bin/moss
+
+gemset.nix: Gemfile
+ nix-shell -p bundler -p bundix --run "bundle lock && bundix"
+
+watch:
+ find . -type f | entr cucumber --publish-quiet -i
diff --git a/README.md b/README.md
@@ -10,20 +10,34 @@ uses and limitations of anyone else's. I am not a security
professional, so the best offer I can make for its abilities is that
it *may* be OK
-* moss.rb is a standalone Ruby file that uses nothing but stdlib
+## Installation
-* The scenarios in features/moss.feature should illustrate what it does:
-add, generate, edit, show a password, search password names.
+`moss.rb` is a standalone Ruby file. You can `make install` or just copy it to somewhere on your PATH
-* the Gemfile is needed for installing Cucumber
+Or if you are a Nix user, you can run
-* the gemset.nix and shell.nix are for Nix users. If you need to edit
-the Gemfile, use `nix-shell -p bundix --run "bundle lock && bundix"` to
-regenerate gemset.nix
+ nix-env -i -f release.nix
-* if you have `entr` installed, you can get fast test feedback by doing
-`find . -type f | entr cucumber --publish-quiet -i`. For Nix users,
-there is an alias `run_watch` that does this
+## Development
+
+### Prerequisites
+
+On Nix, run `nix-shell`
+
+On other Unixlikes, you will need to install Ruby and run `bundle
+install` to get cucumber and rspec
+
+### Running tests
+
+The scenarios in `features/moss.feature` should illustrate what it
+does: add, generate, edit, show a password, search password names.
+Run `cucumber`, or if you have `entr` installed, you can use it to
+rerun tests whenever something changes.
+
+ make watch
+
+If you need to edit the Gemfile, use `make gemset.nix` to regenerate
+`gemset.nix`
## Converting from pass
diff --git a/default.nix b/default.nix
@@ -3,10 +3,9 @@
let age = callPackage ./age.nix {};
in stdenv.mkDerivation {
name = "moss";
+ src = ./.;
buildInputs = [ age ];
- phases = ["installPhase"];
installPhase = ''
- mkdir -p $out/bin
- cp ${./moss.rb} $out/bin/moss
+ make install prefix=$out
'';
}
diff --git a/shell.nix b/shell.nix
@@ -10,9 +10,4 @@ in mkShell {
gems gems.wrappedRuby
bundix age pkgs.entr
];
- shellHook = ''
- run_watch() {
- find . -type f | entr cucumber --publish-quiet -i;
- }
- '';
}