Skip to content

Commit

Permalink
Merge pull request #7 from JJ/master
Browse files Browse the repository at this point in the history
Adds `source-url`, with config from default, and test
  • Loading branch information
FCO authored Dec 18, 2017
2 parents 31789fe + 40d148a commit a0bc6b1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/.precomp
4 changes: 2 additions & 2 deletions lib/App/six-pm/Meta6.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ has Str %.support is json-skip-null is rw;
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 %.scripts 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 = {
test => "zef test ."
}

Expand Down
7 changes: 6 additions & 1 deletion lib/App/six-pm/SixPM.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class SixPM {
has Installer $.installer = ZefInstaller.new: :$!default-to, :$!DEBUG;

method get-project-name { prompt "Project name [{$!meta.name}]: " }
method get-project-tags { prompt("Project tags: ") }
method get-project-tags { prompt("Project tags (separated by space): ") }
method get-perl6-version { prompt "perl6 version [{$!meta.perl}]: " }

method init(:$name, :@tags, :$perl-version) {
Expand All @@ -31,6 +31,11 @@ class SixPM {
$!meta.perl = $perl
}
}

if ".git/config".IO.e {
my $git-config = ".git/config".IO.slurp;
$!meta.source-url = ($git-config ~~ m{ \[remote \s+ \"origin\"\] \s+ url \s+ \= \s+ <(\S*)> }).Str;
}
$!meta.save
}
}
Expand Down
1 change: 1 addition & 0 deletions t/01-six-pm.t
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ sub name is rw { state $a }
is $meta.name, "my_test";
is-deeply $meta.tags, <bla ble bli>;
is $meta.perl, "v6.*";
isnt $meta.source-url, "";
}

subtest {
Expand Down

0 comments on commit a0bc6b1

Please sign in to comment.