blib/script/spvmdist

filter: Statementstmt 89.2% 25 / 28 Branchbran 75.0% 6 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 87.8% 36 / 41 CC 1 SCAR 0.0
CC
1
Cov
86%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/SPVM/Builder/compile.pl ↑ Summary blib/lib/SPVM/Builder/Util/API.pm »
1 #!/usr/local/bin/perl
2  
3 36 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 36 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 36 ▶use SPVM();
Subroutine BEGIN: called CC=1 SCAR=0.0
7 36 ▶use SPVM::Dist;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 36 ▶use SPVM::Builder::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 36 SPVM::Builder::Util::getopt
11 'h|help' => \my $help,
12 'v|version' => \my $show_version,
13 'q|quiet' => \my $quiet,
14 'f|force' => \my $force,
15 'native=s' => \my $native,
16 'precompile' => \my $precompile,
17 'resource' => \my $resource,
18 'interface' => \my $interface,
19 'only-lib-files' => \my $only_lib_files,
20 'no-pm-file' => \my $no_pm_file,
21 'genlib' => \my $genlib,
22 'user-name=s' => \my $user_name,
23 'user-email=s' => \my $user_email,
24 'version_from=s' => \my $version_from,
25 ;
26  
27 35 ▶if ($help) {
Branch: 2 branches
BranchTrueFalseTotal
if ($help) { } 2 33 35
elsif ($show_version) { } 0 33 33
28 2 print SPVM::Builder::Util::extract_usage;
29 }
30 elsif ($show_version) {
31 0 my $version_string = "spvmdist v$SPVM::VERSION";
32 0 print "$version_string\n";
33 }
34 else {
35 33 my ($class_name, $output_dir) = @ARGV;
36 33 ▶ unless (defined $class_name) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $class_name) 0 33 33
37 0 die SPVM::Builder::Util::extract_usage;
38 }
39
40 33 ▶ if ($genlib) {
Branch: 1 branch
BranchTrueFalseTotal
if ($genlib) 1 32 33
41 1 $only_lib_files = 1;
42 1 $no_pm_file = 1;
43 }
44
45 33 my $gendist= SPVM::Dist->new(
46 class_name => $class_name,
47 quiet => $quiet,
48 force => $force,
49 output_dir => $output_dir,
50 native => $native,
51 precompile => $precompile,
52 only_lib_files => $only_lib_files,
53 no_pm_file => $no_pm_file,
54 interface => $interface,
55 resource => $resource,
56 user_name => $user_name,
57 user_email => $user_email,
58 version_from => $version_from,
59 );
60
61 33 $gendist->generate_dist;
62 }
63  
64 =encoding utf8
65  
66 =head1 Name
67  
68 spvmdist - Generating SPVM Distribution
69  
70 =head1 Usage
71  
72 Usage: spvmdist [OPTIONS] CLASS_NAME [DIR]
73
74 spvmdist Foo
75 spvmdist Foo My-Foo
76 spvmdist Foo::Bar::Baz
77 spvmdist --native c Foo
78 spvmdist --native c++ Foo
79 spvmdist --precompile Foo
80 spvmdist --resource Foo
81  
82 Options:
83 -h, --help Show this message
84 -v, --version Show the version
85 -q, --quiet Quiet output
86 -f, --force Force to generate files
87 --native LANGUAGE Output a distributioon for a native class
88 --precompile Add precompilattion setting
89 --only-lib-files Output only the files in "lib" directory
90 --no-pm-file Don't output Perl module(.pm) file
91 --resource Output a distributioon for for a resource
92 --genlib Shortcut for --only-lib-files --no-pm-file
93 --user-name NAME User name
94 --user-email EMAIL User email
95 --version_from CLASS_NAME Add version_from statement
96  
97  
98 =head1 Description
99  
100 C<spvmdist> is the command to generate a SPVM distribution.
101  
102 =head1 Details
103  
104 spvmdist [OPTIONS] CLASS_NAME [DIR]
105  
106 I<OPTIONS> are L<options|/"Options">. These are optional.
107  
108 C<E<lt>class nameE<gt>> is the name of the class contained in the distribution.
109  
110 I<DIR> is the output directory. This is optional. The default is the current directory.
111  
112 These are the output files when C<E<lt>class nameE<gt>> is C<MyClass>.
113  
114 SPVM-MyClass
115 SPVM-MyClass/.gitattributes
116 SPVM-MyClass/MANIFEST.SKIP
117 SPVM-MyClass/.gitignore
118 SPVM-MyClass/LICENSE
119 SPVM-MyClass/Makefile.PL
120 SPVM-MyClass/t
121 SPVM-MyClass/t/basic.t
122 SPVM-MyClass/t/lib
123 SPVM-MyClass/t/lib/SPVM
124 SPVM-MyClass/t/lib/SPVM/TestCase
125 SPVM-MyClass/t/lib/SPVM/TestCase/MyClass.spvm
126 SPVM-MyClass/README.md
127 SPVM-MyClass/Changes
128 SPVM-MyClass/lib
129 SPVM-MyClass/lib/SPVM
130 SPVM-MyClass/lib/SPVM/MyClass.spvm
131 SPVM-MyClass/lib/SPVM/MyClass.pm
132  
133 If a file is already exists, the file is not overwritten.
134  
135 =head1 Options
136  
137 =head2 --help
138  
139 --help
140  
141 Outputs how to use the C<spvmdist> command to standard output.
142  
143 =head2 -h
144  
145 -h
146  
147 Same as L</"--help">.
148  
149 =head2 --version
150  
151 --version
152  
153 Outputs the version of the C<spvmdist> command to standard output. This version is the same as the version of L<SPVM>.
154  
155 =head2 -v
156  
157 -v
158  
159 Same as L</"--version">.
160  
161 =head2 --quiet
162  
163 --quiet
164  
165 Suppresses messages from the C<spvmdist> command.
166  
167 =head2 -q
168  
169 -q
170  
171 Same as L</"--quiet">.
172  
173 =head2 --force
174  
175 --force
176  
177 If this option is specified and files as the same name as the files output by the C<spvmdist> command are exists, the files are overwritten.
178  
179 =head2 -f
180  
181 -f
182  
183 Same as L</"--force">.
184  
185 =head2 --native
186  
187 --native LANGUAGE
188  
189 Outputs a distribution for a L<native class|SPVM::Document::NativeClass> specified in I<LANGUAGE>.
190  
191 The default is C<c>.
192  
193 The List of Option Values:
194  
195 =over 2
196  
197 =item * C<c>
198  
199 The C language.
200  
201 =item * C<c++>
202  
203 C++
204  
205 =back
206  
207 =head2 --precompile
208  
209 --precompile
210  
211 Adds precompilation setting. If the class has precompilation methods, it is good to specify this option.
212  
213 =head2 --only-lib-files
214  
215 --only-lib-files
216  
217 Output only files output to the C<lib> directory. These files are a SPVM class file (.spvm) and a Perl module file (.pm).
218  
219 =head2 --no-pm-file
220  
221 --no-pm-file
222  
223 Dose not output a Perl module file (.pm).
224  
225 =head2 --resource
226  
227 --resource
228  
229 Output a distribution for a L<resource|SPVM::Document::Resource>.
230  
231 =head2 --genlib
232  
233 --genlib
234  
235 Specifies both L</"--only-lib-files"> and L<"--no-pm-file">.
236  
237 =head2 --user-name
238  
239 --user-name NAME
240  
241 Specifies the user name I<NAME>.
242  
243 =head2 --user-email
244  
245 --user-email EMAIL
246  
247 Specifies the user email I<EMAIL>.
248  
249 =head2 --version_from
250  
251 --version_from CLASS_NAME
252  
253 Add version_from statement given I<CLASS_NAME>.
254  
255 =head1 Copyright & License
256  
257 Copyright 2023 Yuki Kimoto. All Rights Reserved.
258  
259 MIT License.
« blib/lib/SPVM/Builder/compile.pl ↑ Summary blib/lib/SPVM/Builder/Util/API.pm »