diff --git a/.gitignore b/.gitignore index 4c0c270..76fbc61 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -**/.precomp \ No newline at end of file +**/.precomp +raku-modules +SixPM-0.0.11.tar.gz +SixPM-0.0.11 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 93ad2f2..0000000 --- a/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: perl6 -perl6: - - latest -install: - - rakudobrew build-zef - - zef install . --deps-only -script: - - PERL6_TEST_META=1 PERL6LIB=$PWD/lib zef test . -sudo: false diff --git a/Changes b/Changes new file mode 100644 index 0000000..d71fb00 --- /dev/null +++ b/Changes @@ -0,0 +1,4 @@ +Revision history for SixPM + +{{$NEXT}} + - Initial version diff --git a/META6.json b/META6.json index 0b9f820..cb18cf7 100644 --- a/META6.json +++ b/META6.json @@ -1,47 +1,50 @@ { - "name": "6pm", - "support": { - "source": "git://github.com/FCO/6pm.git" - }, - "bin": { - "6pm": "bin/6pm" - }, - "perl": "v6.*", - "build-depends": [ - - ], - "scripts": { - "test": "zef test ." - }, - "depends": [ - "zef", - "JSON::Class:auth" - ], - "tags": [ - "PACKAGE", - "INSTALL", - "CLI", - "DEVEL", - "TERMINAL", - "UTILS", - "COMMAND LINE" - ], - "license": "Artistic-2.0", - "test-depends": [ - "Test::Mock", - "Test::META" - ], - "provides": { - "App::six-pm::Installer": "lib/App/six-pm/Installer.pm6", - "App::six-pm::Meta6": "lib/App/six-pm/Meta6.pm6", - "App::six-pm::SixPM": "lib/App/six-pm/SixPM.pm6", - "App::six-pm::ZefInstaller": "lib/App/six-pm/ZefInstaller.pm6", - "SixPM": "lib/SixPM.pm6" - }, - "production": false, - "version": "0.0.11", - "authors": [ - "Fernando Correa de Oliveira" + "auth": "zef:FCO", + "authors": [ + "Fernando Correa de Oliveira" ], - "description": "Raku module dependency manager (aka npm for Raku)" + "bin": { + "6pm": "bin/6pm" + }, + "build-depends": [ + ], + "depends": [ + "zef", + "JSON::Class:auth" + ], + "description": "Raku module dependency manager (aka npm for Raku)", + "license": "Artistic-2.0", + "name": "SixPM", + "perl": "v6.*", + "production": true, + "provides": { + "App::six-pm::Installer": "lib/App/six-pm/Installer.rakumod", + "App::six-pm::Meta6": "lib/App/six-pm/Meta6.rakumod", + "App::six-pm::SixPM": "lib/App/six-pm/SixPM.rakumod", + "App::six-pm::ZefInstaller": "lib/App/six-pm/ZefInstaller.rakumod", + "SixPM": "lib/SixPM.rakumod" + }, + "resources": [ + ], + "scripts": { + "test": "zef test ." + }, + "source-url": "https://github.com/FCO/6pm.git", + "support": { + "source": "git://github.com/FCO/6pm.git" + }, + "tags": [ + "PACKAGE", + "INSTALL", + "CLI", + "DEVEL", + "TERMINAL", + "UTILS", + "COMMAND LINE" + ], + "test-depends": [ + "Test::Mock", + "Test::META" + ], + "version": "0.0.11" } diff --git a/README.md b/README.md index e6178c1..31a2432 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,12 @@ -![](https://github.com/FCO/6pm/workflows/linux/badge.svg) -# 🕕 - 6pm +🕕 - 6pm +======= 6pm is a NPM for raku -## Create META6.json +Create META6.json +----------------- -``` +```bash $ mkdir TestProject $ cd TestProject/ $ 6pm init @@ -14,9 +15,10 @@ Project tags: raku version [6.*]: ``` -## Locally install a Module +Locally install a Module +------------------------ -``` +```bash $ 6pm install Heap ===> Searching for: Heap ===> Testing: Heap:ver('0.0.1') @@ -24,9 +26,10 @@ $ 6pm install Heap ===> Installing: Heap:ver('0.0.1') ``` -## Locally install a Module and add it on depends of META6.json +Locally install a Module and add it on depends of META6.json +------------------------------------------------------------ -``` +```bash $ 6pm install Heap --save ===> Searching for: Heap ===> Testing: Heap:ver('0.0.1') @@ -34,34 +37,38 @@ $ 6pm install Heap --save ===> Installing: Heap:ver('0.0.1') ``` -## Run code using the local dependencies +Run code using the local dependencies +------------------------------------- -``` +```bash $ 6pm exec -- raku -MHeap -e 'say Heap.new: ' Heap.new: [e r q w] ``` -## Run a file using the local dependencies +Run a file using the local dependencies +--------------------------------------- -``` +```bash $ echo "use Heap; say Heap.new: " > bla.p6 $ 6pm exec-file bla.p6 Heap.new: [e r q w] ``` -## Make your code always use 6pm +Make your code always use 6pm +----------------------------- -``` +```bash $ echo "use SixPM; use Heap; say Heap.new: " > bla.p6 $ raku bla.p6 Heap.new: [e r q w] ``` -## Running scripts +Running scripts +--------------- Add your script at your META6.json scripts field and run it with: -``` +```bash $ cat META6.json { "name": "TestProject", @@ -96,3 +103,4 @@ $ cat META6.json $ 6pm run my-script Heap.new: [0 1 2 3 4 5 6 7 8 9] ``` + diff --git a/dist.ini b/dist.ini new file mode 100644 index 0000000..816ab35 --- /dev/null +++ b/dist.ini @@ -0,0 +1,10 @@ +name = 6pm + +[ReadmeFromPod] +; enable = false +filename = lib/SixPM.rakumod + +[PruneFiles] +; match = ^ 'xt/' + +[UploadToZef] diff --git a/lib/App/six-pm/Installer.pm6 b/lib/App/six-pm/Installer.rakumod similarity index 100% rename from lib/App/six-pm/Installer.pm6 rename to lib/App/six-pm/Installer.rakumod diff --git a/lib/App/six-pm/Meta6.pm6 b/lib/App/six-pm/Meta6.rakumod similarity index 94% rename from lib/App/six-pm/Meta6.pm6 rename to lib/App/six-pm/Meta6.rakumod index e40c21d..ce7dad7 100644 --- a/lib/App/six-pm/Meta6.pm6 +++ b/lib/App/six-pm/Meta6.rakumod @@ -11,7 +11,7 @@ has Str $.version is json-skip-null is rw = "0.0.1"; has Str $.description is json-skip-null is rw = ""; has Str @.authors is json-skip-null is rw = [%*ENV // Empty]; has Str %.provides is json-skip-null is rw; -has Str %.bin is json-skip-null is rw; +has Str %.bin is json-skip-null is rw; has Str %.emulates is json-skip-null is rw; has Str %.supersedes is json-skip-null is rw; has Str %.superseded-by is json-skip-null is rw; @@ -25,7 +25,7 @@ has Bool $.production is json-skip-null is rw = False; has Str $.license is json-skip-null is rw = "https://opensource.org/licenses/Artistic-2.0"; has Str @.tags is json-skip-null is rw; has Str $.source-url is json-skip-null is rw; -has Str %.scripts is json-skip-null is rw = { +has Str %.scripts is json-skip-null is rw = { test => "zef test ." } diff --git a/lib/App/six-pm/SixPM.pm6 b/lib/App/six-pm/SixPM.rakumod similarity index 100% rename from lib/App/six-pm/SixPM.pm6 rename to lib/App/six-pm/SixPM.rakumod diff --git a/lib/App/six-pm/ZefInstaller.pm6 b/lib/App/six-pm/ZefInstaller.rakumod similarity index 100% rename from lib/App/six-pm/ZefInstaller.pm6 rename to lib/App/six-pm/ZefInstaller.rakumod diff --git a/lib/SixPM.pm6 b/lib/SixPM.pm6 deleted file mode 100644 index f83efff..0000000 --- a/lib/SixPM.pm6 +++ /dev/null @@ -1,26 +0,0 @@ -no precompilation; - -sub find-sixpm-path($cwd is copy = $*PROGRAM.resolve.parent) { - repeat { - last if $++ > 10; - my $p6m = $cwd.child("raku-modules"); - return $p6m.resolve if $p6m.d; - $cwd .= parent - } while $cwd.resolve.absolute !~~ "/"; - "./raku-modules".IO -} - -sub EXPORT($find-path?) { - unless $find-path { - if find-sixpm-path() -> IO::Path $path { - use MONKEY-SEE-NO-EVAL; - EVAL "use lib 'inst#{$path.absolute}'"; - } else { - die "'raku-modules' not found"; - } - } - - { - '&find-sixpm-path' => &find-sixpm-path - } -} diff --git a/lib/SixPM.rakumod b/lib/SixPM.rakumod new file mode 100644 index 0000000..06ce9bf --- /dev/null +++ b/lib/SixPM.rakumod @@ -0,0 +1,143 @@ +#!raku +no precompilation; + +sub find-sixpm-path($cwd is copy = $*PROGRAM.resolve.parent) { + repeat { + last if $++ > 10; + my $p6m = $cwd.child("raku-modules"); + return $p6m.resolve if $p6m.d; + $cwd .= parent + } while $cwd.resolve.absolute !~~ "/"; + "./raku-modules".IO +} + +sub EXPORT($find-path? --> Map()) { + unless $find-path { + if find-sixpm-path() -> IO::Path $path { + use MONKEY-SEE-NO-EVAL; + EVAL "use lib 'inst#{$path.absolute}'"; + } else { + die "'raku-modules' not found"; + } + } + + { + '&find-sixpm-path' => &find-sixpm-path + } +} + +=begin pod + +=head1 🕕 - 6pm + +6pm is a NPM for raku + +=head2 Create META6.json + +=begin code :lang + +$ mkdir TestProject +$ cd TestProject/ +$ 6pm init +Project name [TestProject]: +Project tags: +raku version [6.*]: + +=end code + +=head2 Locally install a Module + +=begin code :lang + +$ 6pm install Heap +===> Searching for: Heap +===> Testing: Heap:ver('0.0.1') +===> Testing [OK]: Heap:ver('0.0.1') +===> Installing: Heap:ver('0.0.1') + +=end code + +=head2 Locally install a Module and add it on depends of META6.json + +=begin code :lang + +$ 6pm install Heap --save +===> Searching for: Heap +===> Testing: Heap:ver('0.0.1') +===> Testing [OK]: Heap:ver('0.0.1') +===> Installing: Heap:ver('0.0.1') + +=end code + +=head2 Run code using the local dependencies + +=begin code :lang + +$ 6pm exec -- raku -MHeap -e 'say Heap.new: ' +Heap.new: [e r q w] + +=end code + +=head2 Run a file using the local dependencies + +=begin code :lang + +$ echo "use Heap; say Heap.new: " > bla.p6 +$ 6pm exec-file bla.p6 +Heap.new: [e r q w] + +=end code + +=head2 Make your code always use 6pm + +=begin code :lang + +$ echo "use SixPM; use Heap; say Heap.new: " > bla.p6 +$ raku bla.p6 +Heap.new: [e r q w] + +=end code + +=head2 Running scripts + +Add your script at your META6.json scripts field and run it with: + +=begin code :lang + +$ cat META6.json +{ + "name": "TestProject", + "source-url": "", + "perl": "6.*", + "resources": [ + + ], + "scripts": { + "test": "zef test .", + "my-script": "raku -MHeap -e 'say Heap.new: ^10'" + }, + "depends": [ + + ], + "test-depends": [ + "Test", + "Test::META" + ], + "provides": { + + }, + "tags": [ + + ], + "version": "0.0.1", + "authors": [ + "fernando" + ], + "description": "" +} +$ 6pm run my-script +Heap.new: [0 1 2 3 4 5 6 7 8 9] + +=end code + +=end pod diff --git a/t/00-test-meta.t b/t/00-test-meta.rakutest similarity index 99% rename from t/00-test-meta.t rename to t/00-test-meta.rakutest index 72b8ace..b79ca7b 100644 --- a/t/00-test-meta.t +++ b/t/00-test-meta.rakutest @@ -11,5 +11,4 @@ plan 1; # That's it meta-ok(); - done-testing; diff --git a/t/01-six-pm.t b/t/01-six-pm.rakutest similarity index 98% rename from t/01-six-pm.t rename to t/01-six-pm.rakutest index 5b631f6..8f599d8 100644 --- a/t/01-six-pm.t +++ b/t/01-six-pm.rakutest @@ -1,9 +1,9 @@ +use lib "lib"; use Test; use Test::Mock; use App::six-pm::Meta6; use App::six-pm::Installer; use App::six-pm::ZefInstaller; -use lib "lib"; plan 8; @@ -44,7 +44,7 @@ sub name is rw { state $a } $_6pm does role :: { has $.get-project-name is rw = "my_test"; has $.get-project-tags is rw = "bla ble bli"; - has $.get-raku-version is rw = "v6.*"; + has $.get-raku-version is rw = "v6.*"; }; $_6pm.init;