Permalink
Browse files

Squashed 'maint-travis-ci/' content from commit 3c5ecaf

git-subtree-dir: maint-travis-ci
git-subtree-split: 3c5ecaf
  • Loading branch information...
0 parents commit b6449d248ec2fb8ac07f484ea1005e3669272e6f @kentfredric kentfredric committed Jan 13, 2014
Showing with 142 additions and 0 deletions.
  1. +53 −0 README.mkdn
  2. +31 −0 merge_travis_yml.pl
  3. +16 −0 sterilize_env.pl
  4. +29 −0 sync_tree.pl
  5. +13 −0 yamls/sterile.yaml
@@ -0,0 +1,53 @@
+# ABOUT
+
+This repository contains a directory full of utilities to bolt on
+to CPAN-targeting distributions, to add useful `travis-ci` features to those dists.
+
+# PREREQS
+
+All that is needed at present to get started, is a copy of `git` that provides `git subtree`, and a copy of `Path::FindDev` from `CPAN`.
+
+You don't need `Path::FindDev` during deployment, its just used to streamline
+automated patching.
+
+# INSTALLING
+
+First, check out a copy of these scripts, it can be a temporary directory,
+and you'll only need to do this once.
+
+```shell
+$ mkdir /tmp/tci-scripts
+$ cd /tmp/tci-scripts
+$ git clone https://github.com/kentfredric/travis-scripts.git
+```
+
+Then, chdir to the root of your project
+
+```shell
+$ chdir $PROJECT
+```
+
+And lastly, execute the installer
+
+```shell
+$ /tmp/tci-scripts/sync_tree.pl
+```
+
+This will create the folder called `maint-travis-ci` within your distribution,
+with a tree installed by `git subtree`, which will track this distribution.
+
+To update your copy of `/maint-travis-ci` to the latest, simply execute
+
+```shell
+$ $PROJECT/maint-travis-ci/sync_tree.pl
+```
+
+While somewhere in your project.
+
+# CAVEATS
+
+Note, this tool uses `Path::FindDev`, and by proxy, `Path::IsDev` to find a development
+root directory somewhere in the ancestry of `$CWD`.
+
+As such, you will likely need to appease `Path::IsDev` by having a file of some description that
+marks the root of the development tree.
@@ -0,0 +1,31 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use utf8;
+
+use Path::FindDev qw( find_dev );
+
+my $hashref = {};
+
+my $template = find_dev('./')->child('.travis-template.yml');
+my $target = find_dev('./')->child('.travis.yml');
+
+if ( -f -e $template ) {
+ require YAML::Loader;
+ my $loader = YAML::Loader->new();
+ $hashref = $loader->load($template->slurp);
+}
+
+if ( not exists $hashref->{language} ) {
+ $hashref->{language} = 'perl';
+}
+if ( not exists $hashref->{perl} ) {
+ $hashref->{perl} = [ '5.18', '5.19' ];
+}
+
+use Data::Dump qw(pp);
+pp($hashref);
+require YAML::Dumper;
+my $dumper = YAML::Dumper->new();
+$target->spew($dumper->dump($hashref));
@@ -0,0 +1,16 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use utf8;
+
+if ( not exists $ENV{TRAVIS} ) {
+ die "Is not travis!";
+}
+for my $i (@INC) {
+ next if $i !~ /site/;
+ next if $i eq '.';
+# printf "%s\n", $i;
+ system('find',$i, '-type', 'f', '-delete');
+ system('find',$i, '-depth', '-type', 'd', '-delete' );
+}
+
@@ -0,0 +1,29 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use utf8;
+
+use Path::FindDev qw( find_dev );
+my $root = find_dev('./');
+
+chdir "$root";
+
+sub git_subtree {
+ system( 'git', 'subtree', @_ ) == 0 or die "Git subtree had nonzero exit";
+}
+
+my $travis = 'https://github.com/kentfredric/travis-scripts.git';
+my $prefix = 'maint-travis-ci';
+
+if ( not -d -e $root->child($prefix) ) {
+ git_subtree( 'add', '--prefix=' . $prefix, $travis, 'master' );
+}
+else {
+ git_subtree(
+ 'pull', '-m',
+ 'Synchronise git subtree maint-travis-ci',
+ '--prefix=' . $prefix,
+ $travis, 'master'
+ );
+}
+
@@ -0,0 +1,13 @@
+language: perl
+perl:
+ - "5.16"
+ - "5.14"
+ - "5.18"
+ - "5.19"
+before_install:
+ - perl ./maint-travis-ci/sterilize_env.pl
+branches:
+ only:
+ - "build/master"
+ - "releases"
+

0 comments on commit b6449d2

Please sign in to comment.