Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove `core.uri` from config file.

No longer used or required.
  • Loading branch information...
commit a86f4378fb2271208a58a23f3daa5d50e7f401fe 1 parent ffa6c30
@theory authored
Showing with 11 additions and 47 deletions.
  1. +0 −1  Build.PL
  2. +1 −14 lib/App/Sqitch/Command/init.pm
  3. +10 −32 t/init.t
View
1  Build.PL
@@ -50,7 +50,6 @@ Module::Build::Sqitch->new(
'Throwable' => 0,
'Try::Tiny' => 0,
'User::pwent' => 0,
- 'UUID::Tiny' => '1.02',
'URI' => 0,
},
build_requires => {
View
15 lib/App/Sqitch/Command/init.pm
@@ -86,7 +86,7 @@ sub write_plan {
$fh->print(
'%syntax-version=', App::Sqitch::Plan::SYNTAX_VERSION(), $/,
'%project=', $project, $/,
- ( $self->uri ? ('%uri=', $self->uri, $/) : () ), $/,
+ ( $self->uri ? ('%uri=', $self->uri->canonical, $/) : () ), $/,
);
$fh->close or hurl add => __x(
'Error closing {file}: {error}',
@@ -112,19 +112,6 @@ sub write_config {
my ( @vars, @comments );
- # Start with a URI.
- my $uri = try { $sqitch->uri } || do {
- require UUID::Tiny;
- require URI;
- URI->new(
- 'urn:uuid:' . UUID::Tiny::create_uuid_as_string(UUID::Tiny::UUID_V4())
- );
- };
- push @vars => {
- key => 'core.uri',
- value => $uri->canonical,
- };
-
# Write the engine.
my $engine = $sqitch->engine;
if ($engine) {
View
42 t/init.t
@@ -4,7 +4,7 @@ use strict;
use warnings;
use v5.10.1;
use utf8;
-use Test::More tests => 123;
+use Test::More tests => 122;
#use Test::More 'no_plan';
use App::Sqitch;
use Locale::TextDomain qw(App-Sqitch);
@@ -113,19 +113,11 @@ chdir $write_dir;
END { chdir File::Spec->updir }
my $conf_file = $sqitch->config->local_file;
-# Mock UUID::Tiny.
-my $uuid_mock = Test::MockModule->new('UUID::Tiny');
-my $uuid_type;
-$uuid_mock->mock(create_uuid_as_string => sub {
- $uuid_type = shift;
- return 'bb70577f-56d6-488c-bbcb-6d093f81de91';
-});
-my $uri = 'urn:uuid:bb70577f-56d6-488c-bbcb-6d093f81de91';
+my $uri = URI->new('https://github.com/theory/sqitch/');
$sqitch = App::Sqitch->new;
ok $init = $CLASS->new(
sqitch => $sqitch,
- uri => URI->new('https://github.com/theory/sqitch/'),
), 'Another init object';
file_not_exists_ok $conf_file;
@@ -133,19 +125,16 @@ file_not_exists_ok $conf_file;
ok $init->write_config, 'Write the config';
file_exists_ok $conf_file;
is_deeply read_config $conf_file, {
- 'core.uri' => $uri,
-}, 'The configuration file should have one variable';
+}, 'The configuration file should have no variables';
is_deeply +MockOutput->get_info, [
[__x 'Created {file}', file => $conf_file]
], 'The creation should be sent to info';
-is $uuid_type, UUID::Tiny::UUID_V4(), 'Should use a V4 UUID';
my $top_dir = File::Spec->curdir;
my $deploy_dir = File::Spec->catdir(qw(deploy));
my $revert_dir = File::Spec->catdir(qw(revert));
my $test_dir = File::Spec->catdir(qw(test));
my $plan_file = $sqitch->top_dir->file('sqitch.plan')->cleanup->stringify;
file_contents_like $conf_file, qr{\Q[core]
- uri = $uri
# engine =
# plan_file = $plan_file
# top_dir = $top_dir
@@ -153,7 +142,7 @@ file_contents_like $conf_file, qr{\Q[core]
# revert_dir = $revert_dir
# test_dir = $test_dir
# extension = sql
-}m, 'All but URI in core section should be commented-out';
+}m, 'All in core section should be commented-out';
unlink $conf_file;
# Set two options.
@@ -162,9 +151,8 @@ ok $init = $CLASS->new( sqitch => $sqitch ), 'Another init object';
ok $init->write_config, 'Write the config';
file_exists_ok $conf_file;
is_deeply read_config $conf_file, {
- 'core.uri' => $uri,
'core.extension' => 'foo',
-}, 'The configuration should have been written with the two settings';
+}, 'The configuration should have been written with the one setting';
is_deeply +MockOutput->get_info, [
[__x 'Created {file}', file => $conf_file]
], 'The creation should be sent to info';
@@ -181,7 +169,6 @@ file_contents_like $conf_file, qr{
# Go again.
ok $init->write_config, 'Write the config again';
is_deeply read_config $conf_file, {
- 'core.uri' => $uri,
'core.extension' => 'foo',
}, 'The configuration should be unchanged';
is_deeply +MockOutput->get_info, [
@@ -198,9 +185,8 @@ USERCONF: {
ok $init->write_config, 'Write the config with a user conf';
file_exists_ok $conf_file;
is_deeply read_config $conf_file, {
- 'core.uri' => $uri,
'core.extension' => 'foo',
- }, 'The configuration should just have core.uri and core.top_dir';
+ }, 'The configuration should just have core.top_dir';
is_deeply +MockOutput->get_info, [
[__x 'Created {file}', file => $conf_file]
], 'The creation should be sent to info again';
@@ -225,7 +211,6 @@ SYSTEMCONF: {
ok $init->write_config, 'Write the config with a system conf';
file_exists_ok $conf_file;
is_deeply read_config $conf_file, {
- 'core.uri' => $uri,
'core.extension' => 'foo',
'core.engine' => 'pg',
}, 'The configuration should have local and system config';
@@ -267,7 +252,6 @@ is_deeply +MockOutput->get_info, [
], 'The creation should be sent to info once more';
is_deeply read_config $conf_file, {
- 'core.uri' => $uri,
'core.plan_file' => 'my.plan',
'core.deploy_dir' => 'dep',
'core.revert_dir' => 'rev',
@@ -293,7 +277,6 @@ is_deeply +MockOutput->get_info, [
], 'The creation should be sent to info yet again';
is_deeply read_config $conf_file, {
- 'core.uri' => $uri,
'core.engine' => 'sqlite',
'core.sqlite.client' => '/to/sqlite3',
'core.sqlite.db_name' => 'my.db',
@@ -312,7 +295,6 @@ is_deeply +MockOutput->get_info, [
[__x 'Created {file}', file => $conf_file]
], 'The creation should be sent to info again again';
is_deeply read_config $conf_file, {
- 'core.uri' => $uri,
'core.engine' => 'sqlite',
}, 'The configuration should have been written with only the engine var';
@@ -340,7 +322,6 @@ USERCONF: {
], 'The creation should be sent to info once more';
is_deeply read_config $conf_file, {
- 'core.uri' => $uri,
'core.engine' => 'sqlite',
'core.sqlite.db_name' => 'my.db',
}, 'New config should have been written with sqlite values';
@@ -372,7 +353,6 @@ is_deeply +MockOutput->get_info, [
], 'The creation should be sent to info one more time';
is_deeply read_config $conf_file, {
- 'core.uri' => $uri,
'core.engine' => 'pg',
'core.pg.client' => '/to/psql',
'core.pg.db_name' => 'thingies',
@@ -396,9 +376,8 @@ is_deeply +MockOutput->get_info, [
[__x 'Created {file}', file => $conf_file]
], 'The creation should be sent to info again again again';
is_deeply read_config $conf_file, {
- 'core.uri' => $uri,
'core.engine' => 'pg',
-}, 'The configuration should have been written with only the uri & engine vars';
+}, 'The configuration should have been written with only the engine var';
file_contents_like $conf_file, qr{^\Q# [core "pg"]
# db_name =
@@ -427,7 +406,6 @@ USERCONF: {
], 'The pg config creation should be sent to info';
is_deeply read_config $conf_file, {
- 'core.uri' => $uri,
'core.engine' => 'pg',
'core.pg.db_name' => 'thingies',
}, 'The configuration should have been written with pg options';
@@ -471,7 +449,7 @@ file_contents_like $plan_file, qr/testing 1, 2, 3/,
$plan_file->remove;
ok $init = $CLASS->new(
sqitch => $sqitch,
- uri => URI->new('https://github.com/theory/sqitch/'),
+ uri => $uri,
), 'Create new init with sqitch with project and URI';
ok $init->write_plan( 'howdy' ), 'Write the plan file again';
is_deeply +MockOutput->get_info, [
@@ -481,7 +459,7 @@ file_exists_ok $plan_file, 'Plan file should again exist';
file_contents_is $plan_file,
'%syntax-version=' . App::Sqitch::Plan::SYNTAX_VERSION() . "$/" .
'%project=howdy' . "$/" .
- '%uri=https://github.com/theory/sqitch/' . "$/$/",
+ '%uri=' . $uri->canonical . "$/$/",
'The plan should include the project and uri pragmas';
##############################################################################
@@ -512,5 +490,5 @@ is_deeply +MockOutput->get_info, [
file_contents_is $plan_file,
'%syntax-version=' . App::Sqitch::Plan::SYNTAX_VERSION() . "$/" .
'%project=foofoo' . "$/" .
- '%uri=https://github.com/theory/sqitch/' . "$/$/",
+ '%uri=' . $uri->canonical . "$/$/",
'The plan should have the --project name';
Please sign in to comment.
Something went wrong with that request. Please try again.