Permalink
Browse files

convert to Milla

  • Loading branch information...
1 parent 919a256 commit 0ea7a59d39b0a8e25fbe89c93b03a5912faa5dd2 @miyagawa committed Mar 24, 2013
Showing with 166 additions and 7 deletions.
  1. +3 −6 .gitignore
  2. +3 −0 Build.PL
  3. +4 −1 Changes
  4. +48 −0 META.json
  5. +103 −0 README.md
  6. +3 −0 cpanfile
  7. +2 −0 dist.ini
View
@@ -1,10 +1,7 @@
META.yml
MYMETA.*
-Makefile
-inc/
-pm_to_blib
-blib
*~
.*
-!.gitignore
-!.shipit
+/Module-CPANfile-*
+/.build
+!META.json
View
@@ -0,0 +1,3 @@
+use 5.006;
+use Module::Build::Tiny 0.013;
+Build_PL();
View
@@ -1,4 +1,7 @@
-Revision history for Perl extension Module::Install::CPANfile
+Revision history for Module::Install::CPANfile
+
+{{$NEXT}}
+ - Convert to Milla
0.9021 Sat Mar 23 09:11:46 PDT 2013
- added mymeta-cpanfile utility script for migration from Makefile.PL/Build.PL
View
@@ -0,0 +1,48 @@
+{
+ "abstract" : "Parse cpanfile",
+ "author" : [
+ "Tatsuhiko Miyagawa <miyagawa@bulknews.net>"
+ ],
+ "dynamic_config" : 0,
+ "generated_by" : "Dist::Zilla version 4.300031, CPAN::Meta::Converter version 2.120921",
+ "license" : [
+ "perl_5"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "Module-CPANfile",
+ "prereqs" : {
+ "configure" : {
+ "requires" : {
+ "Module::Build::Tiny" : "0.013"
+ }
+ },
+ "develop" : {
+ "requires" : {
+ "Test::Pod" : "1.41"
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "CPAN::Meta" : "2.12091",
+ "CPAN::Meta::Prereqs" : "2.12091"
+ }
+ }
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "bugtracker" : {
+ "web" : "https://github.com/miyagawa/cpanfile/issues"
+ },
+ "homepage" : "https://github.com/miyagawa/cpanfile",
+ "repository" : {
+ "type" : "git",
+ "url" : "https://github.com/miyagawa/cpanfile.git",
+ "web" : "https://github.com/miyagawa/cpanfile"
+ }
+ },
+ "version" : "0.9021"
+}
+
View
103 README.md
@@ -0,0 +1,103 @@
+# NAME
+
+Module::CPANfile - Parse cpanfile
+
+# SYNOPSIS
+
+ use Module::CPANfile;
+
+ my $file = Module::CPANfile->load("cpanfile");
+ my $prereqs = $file->prereqs; # CPAN::Meta::Prereqs object
+
+ $file->merge_meta('MYMETA.json');
+
+# DESCRIPTION
+
+Module::CPANfile is a tool to handle [cpanfile](http://search.cpan.org/perldoc?cpanfile) format to load application
+specific dependencies, not just for CPAN distributions.
+
+# METHODS
+
+- load
+
+ $file = Module::CPANfile->load;
+ $file = Module::CPANfile->load('cpanfile');
+
+ Load and parse a cpanfile. By default it tries to load `cpanfile` in
+ the current directory, unless you pass the path to its argument.
+
+- from\_prereqs
+
+ $file = Module::CPANfile->from_prereqs({
+ runtime => { requires => { DBI => '1.000' } },
+ });
+
+ Creates a new Module::CPANfile object from prereqs hash you can get
+ via [CPAN::Meta](http://search.cpan.org/perldoc?CPAN::Meta)'s `prereqs`, or [CPAN::Meta::Prereqs](http://search.cpan.org/perldoc?CPAN::Meta::Prereqs)'
+ `as_string_hash`.
+
+ # read MYMETA, then feed the prereqs to create Module::CPANfile
+ my $meta = CPAN::Meta->load_file('MYMETA.json');
+ my $file = Module::CPANfile->from_prereqs($meta->prereqs);
+
+ # load cpanfile, then recreate it with round-trip
+ my $file = Module::CPANfile->load('cpanfile');
+ $file = Module::CPANfile->from_prereqs($file->prereq_specs);
+ # or $file->prereqs->as_string_hash
+
+- prereqs
+
+ Returns [CPAN::Meta::Prereqs](http://search.cpan.org/perldoc?CPAN::Meta::Prereqs) object out of the parsed cpanfile.
+
+- prereq\_specs
+
+ Returns a hash reference that should be passed to `CPAN::Meta::Prereqs->new`.
+
+- to\_string($include\_empty)
+
+ $file->to_string;
+ $file->to_string(1);
+
+ Returns a canonical string (code) representation for cpanfile. Useful
+ if you want to convert [CPAN::Meta::Prereqs](http://search.cpan.org/perldoc?CPAN::Meta::Prereqs) to a new cpanfile.
+
+ # read MYMETA's prereqs and print cpanfile representation of it
+ my $meta = CPAN::Meta->load_file('MYMETA.json');
+ my $file = Module::CPANfile->from_prereqs($meta->prereqs);
+ print $file->to_sring;
+
+ By default, it omits the phase where there're no modules
+ registered. If you pass the argument of a true value, it will print
+ them as well.
+
+- save
+
+ $file->save('cpanfile');
+
+ Saves the currently loaded prereqs as a new `cpanfile` by calling
+ `to_string`. Beware __this method will overwrite the existing
+ cpanfile without any warning or backup__. Taking a backup or giving
+ warnings to users is a caller's responsibility.
+
+ # Read MYMETA.json and creates a new cpanfile
+ my $meta = CPAN::Meta->load_file('MYMETA.json');
+ my $file = Module::CPANfile->from_prereqs($meta->prereqs);
+ $file->save('cpanfile');
+
+- merge\_meta
+
+ $file->merge_meta('META.yml');
+ $file->merge_meta('MYMETA.json', '2.0');
+
+ Merge the effective prereqs with Meta speicifcation loaded from the
+ given META file, using CPAN::Meta. You can specify the META spec
+ version in the second argument, which defaults to 1.4 in case the
+ given file is YAML, and 2 if it is JSON.
+
+# AUTHOR
+
+Tatsuhiko Miyagawa
+
+# SEE ALSO
+
+[cpanfile](http://search.cpan.org/perldoc?cpanfile), [CPAN::Meta](http://search.cpan.org/perldoc?CPAN::Meta), [CPAN::Meta::Spec](http://search.cpan.org/perldoc?CPAN::Meta::Spec)
View
@@ -0,0 +1,3 @@
+requires 'CPAN::Meta', 2.12091;
+requires 'CPAN::Meta::Prereqs', 2.12091;
+
View
@@ -0,0 +1,2 @@
+name = Module-CPANfile
+[@Milla]

0 comments on commit 0ea7a59

Please sign in to comment.