From e1aa49f24a227b1b888504c9c282b47211a2c7ae Mon Sep 17 00:00:00 2001 From: stevan Date: Sun, 10 Feb 2008 17:40:27 +0000 Subject: [PATCH] adding in the use drag command git-svn-id: http://code2.0beta.co.uk/moose/svn/Moose-TM_bundle/trunk@3600 3efe9002-19ed-0310-8735-a98156148065 --- Moose.tmbundle/DragCommands/use.tmDragCommand | 59 +++++++++++++++++++ Moose.tmbundle/info.plist | 46 +++++++++------ 2 files changed, 88 insertions(+), 17 deletions(-) create mode 100644 Moose.tmbundle/DragCommands/use.tmDragCommand diff --git a/Moose.tmbundle/DragCommands/use.tmDragCommand b/Moose.tmbundle/DragCommands/use.tmDragCommand new file mode 100644 index 0000000..75d1464 --- /dev/null +++ b/Moose.tmbundle/DragCommands/use.tmDragCommand @@ -0,0 +1,59 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/perl -w + +use strict; + +my $module_name = $ENV{TM_DROPPED_FILEPATH}; + +$module_name =~ s/\.pm//; + +my @path = grep { !/\.\./ } split '/' => $module_name; + +do { + shift @path; +} until ($path[0] eq 'lib'); + +shift @path; + +$module_name = join '::' => @path; + +my $use_statement = + $ENV{TM_MODIFIER_FLAGS} =~ /OPTION/ + ? "use_ok('$module_name');" + : "use $module_name;"; + +if ($ENV{TM_MODIFIER_FLAGS} =~ /COMMAND/) { + if ($ENV{TM_CURRENT_LINE} =~ /^\s*$/) { + $use_statement = "$use_statement\n"; + } + $use_statement = "\n$use_statement"; +} + +print "$use_statement"; + +#print join "\n" => +# map { "$_ => $ENV{$_}" } +# grep { /^TM_/ } +# keys %ENV; + draggedFileExtensions + + pm + + input + selection + name + use + output + insertAsSnippet + scope + source.perl.moose + uuid + AB4BFB75-C6F3-499E-BF02-4FA8B466A5CC + + diff --git a/Moose.tmbundle/info.plist b/Moose.tmbundle/info.plist index 4dad248..cba1298 100644 --- a/Moose.tmbundle/info.plist +++ b/Moose.tmbundle/info.plist @@ -2,23 +2,35 @@ - name - Moose - ordering - - 09D0B47F-8CF4-498E-ABB0-CFDA07749A16 - A8B31369-129E-4434-98B0-A2842E283995 - 01655046-2EF4-4629-8BEF-18FAAEDB5ADA - B66E1E6A-C593-4B84-9519-ACD90A84679F - FE31C261-480F-4E87-86AD-E9E1D2A76DA1 - 88C17DEE-2F55-4793-ABDB-BB311F8F2404 - 95A6BB0F-B46E-4ED0-B5AC-4CF4B047F6A0 - D13FA99A-93ED-4326-9300-CC103426CAE9 - 790DEF12-4956-4A08-96C0-261EDA93FDE4 - 5135BB5F-C3DA-453E-806A-47390B95226B - 912327D9-A5D7-4575-B9C4-79233E3C6244 - 96B00D6A-7982-4052-BF3A-01546BBEA95F - + changed + + ordering + + 09D0B47F-8CF4-498E-ABB0-CFDA07749A16 + A8B31369-129E-4434-98B0-A2842E283995 + 55F400AB-7C31-4477-9331-F5B17C43A7EB + 01655046-2EF4-4629-8BEF-18FAAEDB5ADA + B66E1E6A-C593-4B84-9519-ACD90A84679F + FE31C261-480F-4E87-86AD-E9E1D2A76DA1 + 88C17DEE-2F55-4793-ABDB-BB311F8F2404 + 95A6BB0F-B46E-4ED0-B5AC-4CF4B047F6A0 + D13FA99A-93ED-4326-9300-CC103426CAE9 + 790DEF12-4956-4A08-96C0-261EDA93FDE4 + 5135BB5F-C3DA-453E-806A-47390B95226B + 912327D9-A5D7-4575-B9C4-79233E3C6244 + 9400BEE4-8742-480A-9F5F-9E92D5D38D25 + 96B00D6A-7982-4052-BF3A-01546BBEA95F + FDA7FA2C-2BD0-438C-9224-A1867A3A363F + 440F46B6-AAE0-4DA5-96B5-339126CADA04 + 90362A37-0C85-4A10-9542-D04F50B2DBB7 + EC6571E9-46CB-4185-9C85-6BC956743681 + AB4BFB75-C6F3-499E-BF02-4FA8B466A5CC + + + deleted + + isDelta + uuid 9B9C960E-D75D-4CEF-A3D2-BFEA907565BC