~rjpcasalino/bss

f6a06576c78687680c43ba8caa38c5c52753c268 — rjpc 2 years ago 55682be
new flake and updates bss somewhat but not really
8 files changed, 81 insertions(+), 209 deletions(-)

A Makefile.PL
M bss.pl
D cpanfile
D cpanfile.snapshot
A flake.lock
M flake.nix
M lib/Web.pm
M shell.nix
A Makefile.PL => Makefile.PL +13 -0
@@ 0,0 1,13 @@
use inc::Module::Install; 

name 'bss';
version '0.1';

requires 'Config::IniFiles';
requires 'Template::Toolkit';
requires 'Text::Markdown';
requires 'YAML';

auto_install;
WriteAll;


M bss.pl => bss.pl +22 -24
@@ 17,21 17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

=head1 NAME

boring static site generator

=head1 SYNOPSIS

bss build [options]

     Options:
       --help     	 display this help message
       --server		 serves config DEST
       --verbose     	 gets talkative
=cut

use v5.32;
use v5.30;

use autodie;
use Config::IniFiles;


@@ 44,7 30,6 @@ use FindBin qw($Bin);
use lib "$Bin/lib";
use Getopt::Long qw(GetOptions);
use IO::File;
use Log::Log4perl::Config::Watch;
use POSIX qw(setsid strftime);
use Pod::Usage qw(pod2usage);
use Text::Markdown qw(markdown);


@@ 112,13 97,13 @@ sub do_build {
    $config{TT_CONFIG}->{ENCODING}     = $config{ENCODING};

    say qq{
		SRC: $config{SRC}
		DEST: $config{DEST}
		Excluding: $config{EXCLUDE}
		Encoding: $config{ENCODING}
		Server -
		 PORT:$config{PORT}
	 } if $opts{verbose};
	SRC: $config{SRC}
	DEST: $config{DEST}
	Excluding: $config{EXCLUDE}
	Encoding: $config{ENCODING}
	Server -
	 PORT:$config{PORT}
    } if $opts{verbose};

    mkdir( $config{DEST} ) unless -e $config{DEST};



@@ 262,7 247,7 @@ sub server {

    my $listen_socket = IO::Socket::INET->new(
        LocalPort => $config{PORT},
        Listen    => SOMAXCONN,
        Listen    => "SOMAXCONN",
        Reuse     => 1
    ) or die "Can't create listen socket: $!";
    say "Started local dev server on $config{PORT}!";


@@ 281,3 266,16 @@ sub server {
        $connection->close;
    }
}
=head1 NAME

boring static site generator

=head1 SYNOPSIS

bss build [options]

     Options:
       --help     display this help message
       --server   serves config DEST
       --verbose  gets talkative
=cut

D cpanfile => cpanfile +0 -2
@@ 1,2 0,0 @@
requires 'Config::IniFiles';
requires 'Template::Toolkit';

D cpanfile.snapshot => cpanfile.snapshot +0 -164
@@ 1,164 0,0 @@
# carton snapshot format: version 1.0
DISTRIBUTIONS
  AppConfig-1.71
    pathname: N/NE/NEILB/AppConfig-1.71.tar.gz
    provides:
      AppConfig 1.71
      AppConfig::Args 1.71
      AppConfig::CGI 1.71
      AppConfig::File 1.71
      AppConfig::Getopt 1.71
      AppConfig::State 1.71
      AppConfig::Sys 1.71
    requirements:
      ExtUtils::MakeMaker 0
      Test::More 0
      perl 5.008008
  Config-IniFiles-3.000003
    pathname: S/SH/SHLOMIF/Config-IniFiles-3.000003.tar.gz
    provides:
      Config::IniFiles 3.000003
    requirements:
      Carp 0
      ExtUtils::MakeMaker 0
      Fcntl 0
      File::Basename 0
      File::Temp 0
      IO::Scalar 0
      List::Util 1.33
      Module::Build 0.28
      Symbol 0
      perl 5.008
      strict 0
      vars 0
      warnings 0
  IO-Stringy-2.113
    pathname: C/CA/CAPOEIRAB/IO-Stringy-2.113.tar.gz
    provides:
      IO::AtomicFile 2.113
      IO::InnerFile 2.113
      IO::Lines 2.113
      IO::Scalar 2.113
      IO::ScalarArray 2.113
      IO::Stringy 2.113
      IO::Wrap 2.113
      IO::WrapTie 2.113
    requirements:
      Carp 0
      Exporter 5.57
      ExtUtils::MakeMaker 0
      File::Spec 0
      FileHandle 0
      IO::File 0
      IO::Handle 0
      Symbol 0
      overload 0
      parent 0
      strict 0
      warnings 0
  Module-Build-0.4231
    pathname: L/LE/LEONT/Module-Build-0.4231.tar.gz
    provides:
      Module::Build 0.4231
      Module::Build::Base 0.4231
      Module::Build::Compat 0.4231
      Module::Build::Config 0.4231
      Module::Build::Cookbook 0.4231
      Module::Build::Dumper 0.4231
      Module::Build::Notes 0.4231
      Module::Build::PPMMaker 0.4231
      Module::Build::Platform::Default 0.4231
      Module::Build::Platform::MacOS 0.4231
      Module::Build::Platform::Unix 0.4231
      Module::Build::Platform::VMS 0.4231
      Module::Build::Platform::VOS 0.4231
      Module::Build::Platform::Windows 0.4231
      Module::Build::Platform::aix 0.4231
      Module::Build::Platform::cygwin 0.4231
      Module::Build::Platform::darwin 0.4231
      Module::Build::Platform::os2 0.4231
      Module::Build::PodParser 0.4231
    requirements:
      CPAN::Meta 2.142060
      Cwd 0
      Data::Dumper 0
      ExtUtils::CBuilder 0.27
      ExtUtils::Install 0
      ExtUtils::Manifest 0
      ExtUtils::Mkbootstrap 0
      ExtUtils::ParseXS 2.21
      File::Basename 0
      File::Compare 0
      File::Copy 0
      File::Find 0
      File::Path 0
      File::Spec 0.82
      Getopt::Long 0
      Module::Metadata 1.000002
      Perl::OSType 1
      Pod::Man 2.17
      TAP::Harness 3.29
      Text::Abbrev 0
      Text::ParseWords 0
      perl 5.006001
      version 0.87
  Template-Toolkit-3.009
    pathname: A/AT/ATOOMIC/Template-Toolkit-3.009.tar.gz
    provides:
      Template 3.009
      Template::Base 3.009
      Template::Config 3.009
      Template::Constants 3.009
      Template::Context 3.009
      Template::Directive 3.009
      Template::Document 3.009
      Template::Exception 3.009
      Template::Filters 3.009
      Template::Grammar 3.009
      Template::Iterator 3.009
      Template::Monad::Assert 3.009
      Template::Monad::Scalar 3.009
      Template::Namespace::Constants 3.009
      Template::Parser 3.009
      Template::Perl 3.009
      Template::Plugin 3.009
      Template::Plugin::Assert 3.009
      Template::Plugin::CGI 3.009
      Template::Plugin::Datafile 3.009
      Template::Plugin::Date 3.009
      Template::Plugin::Date::Calc 3.009
      Template::Plugin::Date::Manip 3.009
      Template::Plugin::Directory 3.009
      Template::Plugin::Dumper 3.009
      Template::Plugin::File 3.009
      Template::Plugin::Filter 3.009
      Template::Plugin::Format 3.009
      Template::Plugin::HTML 3.009
      Template::Plugin::Image 3.009
      Template::Plugin::Iterator 3.009
      Template::Plugin::Math 3.009
      Template::Plugin::Pod 3.009
      Template::Plugin::Procedural 3.009
      Template::Plugin::Scalar 3.009
      Template::Plugin::String 3.009
      Template::Plugin::Table 3.009
      Template::Plugin::URL 3.009
      Template::Plugin::View 3.009
      Template::Plugin::Wrap 3.009
      Template::Plugins 3.009
      Template::Provider 3.009
      Template::Service 3.009
      Template::Stash 3.009
      Template::Stash::Context 3.009
      Template::Stash::XS undef
      Template::Test 3.009
      Template::TieString 3.009
      Template::Toolkit 3.009
      Template::VMethods 3.009
      Template::View 3.009
    requirements:
      AppConfig 1.56
      ExtUtils::MakeMaker 0
      File::Spec 0.8
      File::Temp 0.12
      Scalar::Util 0

A flake.lock => flake.lock +27 -0
@@ 0,0 1,27 @@
{
  "nodes": {
    "nixpkgs": {
      "locked": {
        "lastModified": 1621537868,
        "narHash": "sha256-b4/ypTdrW2Q0eQSOdlwg5YCxKNbQCWbcyquIxGW0RHc=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "af0a54285ed4ff131f205517aeafb94a9a5898cb",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "af0a54285ed4ff131f205517aeafb94a9a5898cb",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "nixpkgs": "nixpkgs"
      }
    }
  },
  "root": "root",
  "version": 7
}

M flake.nix => flake.nix +18 -14
@@ 1,21 1,25 @@
{
  description = "A flake for building bss";

  inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-20.03;
  inputs.nixpkgs.url = github:NixOS/nixpkgs/af0a54285ed4ff131f205517aeafb94a9a5898cb;

  outputs = { self, nixpkgs }: {
  
    defaultPackage.x86_64-linux =
      with import nixpkgs { system = "x86_64-linux"; };
      stdenv.mkDerivation {
        name = "bss";
        src = self;
        buildInputs = [ perl ];
        preInstall = ''
         echo -n "$src"
        '';
        installPhase = "mkdir -p $out/bin; cp bss.pl $out/bin/bss";
      };

    defaultPackage.x86_64-darwin =
    with import nixpkgs { system = "x86_64-darwin"; };
      buildPerlPackage {
      pname = "bss";
      version = "0.1";
      src = self;
      propagatedBuildInputs = [
       perlPackages.TemplateToolkit
       perlPackages.ModuleInstall
       perlPackages.ConfigIniFiles
       perlPackages.YAML
       perlPackages.TextMarkdown
      ];
      buildInputs = [ 
       rsync
      ];
    };
  };
}

M lib/Web.pm => lib/Web.pm +1 -3
@@ 4,8 4,6 @@

package Web;

use v5.10;

use vars '@ISA', '@EXPORT';
require Exporter;



@@ 64,7 62,7 @@ sub lookup_file {

sub redirect {
	my ($c, $url) = @_;
	my $hots = $c->sockhost;
	my $host = $c->sockhost;
	my $port = $c->sockport;
	my $moved_to = "http://$host:$port$url";
	print $c "HTTP/1.0 301 Moved permanently$CRLF";

M shell.nix => shell.nix +0 -2
@@ 9,8 9,6 @@ pkgs.mkShell {
    pkgs.perlPackages.TextMarkdown 
    pkgs.perlPackages.TemplateToolkit 
    pkgs.perlPackages.YAML
    pkgs.perlPackages.AppFatPacker
    pkgs.perlPackages.LogLog4perl
    pkgs.rsync
  ];
}