App-DuckPAN

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    Merge pull request #157 from mwmiller/inclusiveness

    duckpan: fail on missing include directory. 

  Change: 752f8af8822dcb2c0d606d38bef10e43c7059230
  Author: Matt Miller <mwmiller@outlook.com>
  Date : 2014-11-05 07:53:48 +0000

    Merge pull request #161 from duckduckgo/zaahir/calm-down-duckpan

    Don't be so quick to throw the manpage in my face 

  Change: e7099c780f0d8c14deb7eaaa4056e5829d3bab06
  Author: Matt Miller <mwmiller@outlook.com>
  Date : 2014-11-05 07:14:51 +0000

    DuckPAN: dead code elimination.

    Remove a line which could never be hit. 

  Change: 666b2e09e6a0b24177312b9a2f4406c5b232e32e

Changes  view on Meta::CPAN

  Change: 6ec9a319902763d218ade2b815c6a6f255fddb24
  Author: Zaahir Moolla <moollaza@fastmail.fm>
  Date : 2014-11-04 16:16:28 +0000

    Add a period to error message 

  Change: 106f9cc916f910726643388911a02eced92ef939
  Author: Zaahir Moolla <moollaza@fastmail.fm>
  Date : 2014-11-04 16:06:19 +0000

    Don't be so quick to throw the manpage in my face

    This has bugged me for a long time... 

  Change: e767ebf44070dd707978243022cdac9bc8d8e37c
  Author: Matt Miller <mwmiller@outlook.com>
  Date : 2014-11-04 10:59:11 +0000

    bin/duckpan: give them the absolute path, if we can't get realpath

    I still think the realpath is more useful, but if throws an
    exception, just go with absolute.

    The absolute is not in a `catch` block, because we lose our `$_`. If
    this was any more complex I would write it a different way.

    Also, split out into to sub-tests. 

  Change: 768b50556465d3e01841f0e8800ddb1970c040be
  Author: Matt Miller <mwmiller@outlook.com>
  Date : 2014-11-04 10:59:11 +0000

Changes  view on Meta::CPAN

  Change: e8995137e97ef4bf1a2a4f66d4eac124e381bd48
  Author: Usman Raza <usman.r123@gmail.com>
  Date : 2014-09-08 14:17:17 +0000

    updated condition 

  Change: 3a10454ff2ac83982bcd550abbf7f272f86dd370
  Author: Usman Raza <usman.r123@gmail.com>
  Date : 2014-09-08 03:32:20 +0000

    throw depedency msg only on dependency errors 

  Change: 6a99ec68124a9f08ae4991512a6b4901377a76fc
  Author: Zaahir Moolla <moollaza@duckduckgo.com>
  Date : 2014-09-04 16:58:58 +0000

    Merge pull request #114 from mwmiller/reinstall

    DuckPAN: add 'reinstall' command. 

  Change: ba278e6f9aa8ae3e1b838733bc9370887436d1d1

Changes  view on Meta::CPAN


    git keeps saying I've modified these 

  Change: 76a5bd2f0216a5a0e03317ac3d174b98d6b3b100
  Author: Dylan Lloyd <dylan@dylansserver.com>
  Date : 2013-03-09 16:01:14 +0000

    Fix for strings with extra newlines/carriage returns

    The \n escaping is working fine, but for HTML output that still has
    weird returns, Javascript will take that as a newline and throw an
    "Unterminated string literal" error in the browser-side. Removing \R
    after the \n have been escaped solves the issue.

    Thank you to bureado <https://github.com/bureado>, who authored this
    change and commit. 

  Change: e8c710baa7348b9b8f8013fc5cbf832a64416b3d
  Author: Dylan Lloyd <dylan@dylansserver.com>
  Date : 2013-02-21 12:42:47 +0000

t/templates.t  view on Meta::CPAN


# check if all the template sets have been read
is_deeply [ sort map { $_->name } @template_sets ],
	[qw(all_optional errors required_and_optional subdir_support_not_defined subdir_support_specified)],
	'template defs: read all template sets';

###############################
# Template definitions errors #
###############################

throws_ok {
		my $templates_defs = App::DuckPAN::TemplateDefinitions->new(
			templates_yml => 't/template/templates-nonexistent.yml'
		);
	} qr/Error loading/,
	'template defs: non-existent template definitions file throws error';

########################
# Individual Templates #
########################

# check if all fields of a template are read
is $template_map{pm}->label, 'Perl Module',
	'template defs: set template label field';
is $template_map{pm}->input_file, 't/template/lib/DDG/Default.pm',
	'template defs: set template input field';

t/templates.t  view on Meta::CPAN

is $pm_file_content, <<EOT, 'template: generated file content is as expected';
package $package_name;
my \$id = '$ia_id';
EOT

#########################################
# File generation errors from templates #
#########################################

# overwriting file
throws_ok {
		$template_map{pm}->generate(\%vars);
	} qr/already exists/,
	'template: overwriting generated file throws error';

# input file not present
throws_ok { $template_map{no_input}->generate(\%vars) }
	qr/not found/,
	'template: non-existent template file throws error';


# create a directory with no write access
mkdir "$TEMPLATE_OUT/readonly", 0500;
throws_ok {
		$template_map{no_write_perm}->generate(\%vars)
	}
	qr/Error creating output/,
	'template: failure creating template output file throws error';

{
	my $got_warning;
	local $SIG{__WARN__} = sub { $got_warning = 1 };

	clear_output_directory();

	# all variables were passed to template; no warnings should be shown
	$template_map{pm}->generate(\%vars);
	ok !$got_warning, 'template: no warning when all variables are passed to template';

t/templates.t  view on Meta::CPAN

	for ($pm_out_file, $test_out_file);

ok  -f $js_out_file,  "template set: selected optional file '$js_out_file' generated from template set";
ok !-f $css_out_file, "template set: unselected optional file '$css_out_file' not generated from template set";

#############################################
# File generation errors from template sets #
#############################################

clear_output_directory();
throws_ok {
		$template_set_map{required_and_optional}->generate(\%vars, [ $template_map{pm} ])
	}
	qr/Unknown template/,
	'template set: die when invalid templates passed in optional templates list';

# individual template errors while generating output
%generate_res = $template_set_map{errors}->generate(\%vars, [ $template_map{no_input} ]);

# required files are generated before optional files, thus we get the .pm file
# in the created files list. Feel free to change this behaviour and update the



( run in 0.358 second using v1.01-cache-2.11-cpan-496ff517765 )