46 |
} elsif ( $ref eq '' ) { |
} elsif ( $ref eq '' ) { |
47 |
$path =~ s{^/+}{}; |
$path =~ s{^/+}{}; |
48 |
|
|
|
my $ext = ''; |
|
|
|
|
49 |
if ( $tree =~ m{^\s*function}i ) { |
if ( $tree =~ m{^\s*function}i ) { |
50 |
$ext = '.js'; |
$path .= '.js'; |
51 |
} elsif ( $tree =~ m{<\w+>} ) { |
} elsif ( $tree =~ m{<\w+>} ) { |
52 |
$ext = '.html'; |
$path .= '.html'; |
53 |
} |
} |
54 |
|
|
55 |
write_file $path . $ext , $tree; |
write_file $path, $tree; |
56 |
print "$path ", -s $path, " bytes\n"; |
print "$path ", -s $path, " bytes\n"; |
57 |
} |
} |
58 |
|
|
59 |
} |
} |
60 |
|
|
61 |
my $json = $response->decoded_content; |
my $json = $response->decoded_content; |
62 |
write_file 'design.js', $json; |
write_file "../$database-$design.js", $json; |
63 |
|
|
64 |
unroll( from_json $json, '/' ); |
unroll( from_json $json, '/' ); |
65 |
|
|