@@ -75,6 +75,72 @@ sub process_support_files {
75
75
}
76
76
77
77
}
78
+
79
+ my $re_version = qr/our\s+\$VERSION\s*=\s*[\"\']
80
+ v?([0-9]+\.[0-9]+\.[0-9]+(?:\-.+?)?)
81
+ [\"\']\s*\;/x;
82
+
83
+ # ./Build versions
84
+ sub ACTION_versions {
85
+ if (-d ".git") {
86
+ require File::Slurp;
87
+ @files = grep { m/.pm$/i } split /\r?\n/, `git ls-files`;
88
+ for(my $i = 0; $i < scalar(@ARGV) - 1; $i++) {
89
+ if ($ARGV[$i] eq "versionize") {
90
+ $tag = $ARGV[$i+1]; last;
91
+ }
92
+ }
93
+ my $file_opt = { binmode => ':raw' };
94
+ foreach my $filename (@files) {
95
+ my $data = File::Slurp::read_file($filename, $file_opt);
96
+ if ($data =~ m/$re_version/i) {
97
+ print " $filename ($1)\n";
98
+ } else {
99
+ print " $filename ([NA])\n";
100
+ }
101
+ }
102
+ } else {
103
+ die "git directory not found";
104
+ }
105
+ }
106
+
107
+ # ./Build versionize [2.4.6]
108
+ sub ACTION_versionize {
109
+ if (-d ".git") {
110
+ my $tag;
111
+ require File::Slurp;
112
+ @files = grep { m/.pm$/i } split /\r?\n/, `git ls-files`;
113
+ for(my $i = 0; $i < scalar(@ARGV) - 1; $i++) {
114
+ if ($ARGV[$i] eq "versionize") {
115
+ $tag = $ARGV[$i+1]; last;
116
+ }
117
+ }
118
+ unless ($tag) {
119
+ $tag = `git describe --abbrev=0 --always`;
120
+ $tag =~ s/(?:\A\s+|\Av|\s+\z)//g;
121
+ unless ( $tag =~ m/(\d+\.\d+\.)(\d+)(?:\-|\z)/ )
122
+ { die "tag <$tag> invalid (\\d+.\\d+.\\d+)\n"; }
123
+ # increment patch level
124
+ else { $tag = $1 . ($2 + 1); }
125
+ }
126
+ $tag =~ s/(?:\A\s+|\Av|\s+\z)//g;
127
+ my $file_opt = { binmode => ':raw' };
128
+ print "update *.pm with new version <$tag>\n";
129
+ unless ( $tag =~ m/(\d+\.\d+\.)(\d+)(?:\-|\z)/ )
130
+ { die "tag <$tag> invalid (\\d+.\\d+.\\d+)\n"; }
131
+ foreach my $filename (@files) {
132
+ my $data = File::Slurp::read_file($filename, $file_opt);
133
+ if ($data =~ s/$re_version/our \$VERSION = \"v$tag\";/i) {
134
+ next if $tag eq $1;
135
+ print " update version $filename (was $1)\n";
136
+ File::Slurp::write_file($filename, $file_opt, $data);
137
+ }
138
+ }
139
+ } else {
140
+ die "git directory not found";
141
+ }
142
+ }
143
+
78
144
SUBCLASS
79
145
80
146
my $cover = $ARGV [0] && $ARGV [0] eq " cover=1" ? 1 : 0;
@@ -85,7 +151,7 @@ my %config = (
85
151
dist_author => [
q{ David Caldwell <[email protected] >} ,
86
152
q{ Marcel Greter <[email protected] >} ],
87
153
dist_version_from => ' lib/CSS/Sass.pm' ,
88
- release_status => ' unstable ' ,
154
+ release_status => ' stable ' ,
89
155
create_license => 0,
90
156
configure_requires => {
91
157
' Module::Build' => 0,
0 commit comments