<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Huddled Masses &#187; CPAN</title>
	<atom:link href="http://joelbennett.net/tag/cpan/feed/" rel="self" type="application/rss+xml" />
	<link>http://joelbennett.net</link>
	<description>The internet home of Joel "Jaykul" Bennett...</description>
	<lastBuildDate>Sat, 28 Jan 2012 21:37:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<cloud domain='joelbennett.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>A question about PowerShell Module Manifests</title>
		<link>http://joelbennett.net/a-question-about-powershell-module-manifests/</link>
		<comments>http://joelbennett.net/a-question-about-powershell-module-manifests/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 05:44:23 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[CPAN]]></category>
		<category><![CDATA[Metadata]]></category>
		<category><![CDATA[Module Manifest]]></category>
		<category><![CDATA[Modules]]></category>
		<category><![CDATA[PoshCode]]></category>
		<category><![CDATA[Windows PowerShell]]></category>

		<guid isPermaLink="false">http://huddledmasses.org/?p=1382</guid>
		<description><![CDATA[So, I&#8217;m building the next PoshCode around modules, with CPAN as my model &#8230; Scripts are still there, but they&#8217;re still basically done the way they are now: you just upload a single file. Modules, however, will be treated specially. You&#8217;ll have to have an account to upload, but you&#8217;ll be able to just upload [...]]]></description>
			<content:encoded><![CDATA[	<p>So, I&#8217;m building the next PoshCode around modules, with <span class="caps">CPAN</span> as my model &#8230; </p>

	<p>Scripts are still there, but they&#8217;re still basically done the way they are now: you just upload a single file. </p>

	<p>Modules, however, will be treated specially. You&#8217;ll have to have an account to upload, but you&#8217;ll be able to just upload a .zip file of your module folder using your login and not fill in any other forms. Our system will take care of parsing the metadata out of the <a href="http://msdn.microsoft.com/en-us/library/dd878337%28VS.85%29.aspx">manifest</a> in your module folder.</p>

	<p>The problem is that I need a little data that isn&#8217;t a part of the <a href="http://msdn.microsoft.com/en-us/library/dd878337%28VS.85%29.aspx">standard module manifest</a> format&#8230; and I can&#8217;t add it because PowerShell won&#8217;t load a module with extra fields in the manifest metadata hashtable: https://connect.microsoft.com/PowerShell/feedback/ViewFeedback.aspx?FeedbackID=421837 &#8212; My request was closed &#8220;by design&#8221; early in the beta cycle and I wasn&#8217;t able to convince them to rethink that.</p>

	<p>At a minimum, PoshCode <strong>requires</strong> a <span class="caps">LICENSE</span> field, and a <span class="caps">CATEGORY</span> field (think of the categories on <span class="caps">CPAN</span> or TechNet Script Center).</p>

	<p>So I&#8217;m having an informal poll. (you&#8217;ll have to &#8220;vote&#8221; by commenting or tweeting to me, because I want more than just &#8220;I choose A&#8221;).</p>

	<p>Which option do you prefer, or can you think of a better way:</p>

	<h4>Require the License and Category to be part of the <span class="caps">PRIVATEDATA</span> field in the standard manifest</h4>

	<p>This might require authors to rewrite parts of their modules, because we&#8217;d be forcing PrivateData to be a Hashtable, and to contain keys that they don&#8217;t need in the module.</p>

	<p>Some existing modules use an array in PrivateData, or even a simple string, rather than a Hashtable. However, it&#8217;s not a <strong>huge</strong> difference, and might be the cleanest method: it wouldn&#8217;t require you to manage a second file of data, and the additional data will be easily available to users and scripts via the standard Get-Module output.</p>

	<h4>Add a &#8220;doc comment&#8221; system for Module manifest files.</h4>

	<p>The upside of this is that PoshCode wants to create module-level documentation anyway. If we use documentation comments like those used on functions we would be able to just create our own standard for them, and add any extra fields we need. It would be guaranteed not to conflict with anything you&#8217;re already doing, and in addition to missing metadata, you could have some module-level documentation beyond just the Description field of the metadata.  </p>

	<p>The problem with this is that there&#8217;s no built-in way to parse that, and doing so isn&#8217;t trivial, so you would need to just read it on our website, or read the source of the file, or have our PoshCode cmdlets in order to make any sense of it once you had a module on your system. It doesn&#8217;t integrate with PowerShell in any meaningful way.</p>

	<h4>Embed the extra data right in the manifest hashtable, using a special comment to hide it from Get-Module</h4>

	<p><code lang=&#8220;posh&#8221;<br />
@{<br />
author=&#8220;Joel Bennett&#8221;<br />
description=&#8220;My latest crazy module&#8221;<br />
<#!PoshCode<br />
License=&#8220;Ms-PL&#8221;<br />
Category=&#8220;WPF&#8221;,&#8220;GUI&#8221;,&#8220;Toolkit&#8221;
#><br />
CompanyName=&#8220;Huddled Masses&#8221;<br />
...<br />
}<br />
</code></p>

	<p>I like this because it&#8217;s fairly trivial for us to strip out the comment and just turn that into a plain-old <span class="caps">DATA</span> section.  It also lends itself to reminding the PowerShell team that these fields are missing, and maintains the existing simple syntax of the manifest.  </p>

	<p>The problem here is, again, that the data doesn&#8217;t appear using any of the standard PowerShell tools &#8212; but getting it out is significantly easier than getting out document comments&#8230;</p>

	<h4>Require a separate &#8220;ReadMe.psd1&#8221; (or &#8220;PoshCode.pds1&#8221; or &#8220;Metadata.psd1&#8221;) metadata file</h4>

	<p>You could start with a copy of your module manifest, and then add the extra stuff that PoshCode needs. This would be nice because we would be able to add any extra fields we wanted as mandatory members, and we could include the &#8220;documentation&#8221; stuff I mentioned earlier&#8230;</p>

	<p>But the downside is that it would be a third file (second manifest) that authors would have to maintain and keep current.</p>

	<p>Any thoughts? Suggestions? </p>

	<p>I&#8217;ve put some further thoughts <a href="http://wiki.poshcode.org/PoshCode_Project/CPAN_and_PoshCode_vNext">about CPAN</a> and the <a href="http://wiki.poshcode.org/PoshCode_Project/Module_Upload_System">data problem</a> on the wiki.</p>

<div class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/afd48ed4-ce64-4ce4-a1a3-9d7daffc69ed/" title="Reblog this post [with Zemanta]"><img class="zemanta-pixie-img" src="http://img.zemanta.com/reblog_e.png?x-id=afd48ed4-ce64-4ce4-a1a3-9d7daffc69ed" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related pretty-attribution"><script type="text/javascript" src="http://static.zemanta.com/readside/loader.js" defer="defer"></script></span></div>]]></content:encoded>
			<wfw:commentRss>http://joelbennett.net/a-question-about-powershell-module-manifests/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Automating the PowerShell Script Repository</title>
		<link>http://joelbennett.net/automating-the-powershell-script-repository/</link>
		<comments>http://joelbennett.net/automating-the-powershell-script-repository/#comments</comments>
		<pubDate>Fri, 30 May 2008 04:16:39 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[CPAN]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Repository]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[wGet]]></category>

		<guid isPermaLink="false">http://HuddledMasses.org/?p=547</guid>
		<description><![CDATA[So, people keep talking about a better PowerShell script repository, and there&#8217;s at least 3 or 4 different people working on improvements, but for now, the one we have is working ok, and already has hundreds of scripts in it &#8212; but there hasn&#8217;t been a way to add or retrieve scripts from within PowerShell. [...]]]></description>
			<content:encoded><![CDATA[	<p>So, people keep talking about a better PowerShell script repository, and there&#8217;s at least 3 or 4 different people working on improvements, but for now, the one we have is working ok, and already has hundreds of scripts in it &#8212; but there hasn&#8217;t been a way to add or retrieve scripts from within PowerShell.</p>

	<p>So while I was taking a break from working on my own replacement script repository  <img src='http://joelbennett.net/wordpress/wp-includes/' alt=';)' class='wp-smiley' />  I whipped up some scripts to <code>Send-Paste</code>, <code>Get-Paste</code> and <code>Find-Paste</code>.  These scripts still need some work, but I think you&#8217;ll find them useful, so I&#8217;ve posted a version that is compatible with PowerShell v1 (and works fine on the 2.0 <span class="caps">CTP</span>) and doesn&#8217;t need any additional scripts (it <em>includes</em> the latest <a href="http://powershellcentral.com/scripts/417">Get-WebFile</a> script for downloading the files).</p>

	<p>The <code>Find-Paste</code> function takes a search string, and adds wildcards &#8212; but otherwise performs the same search as you can already do on the web page. It returns the results in a PowerShell friendly PSObject which by default is just displayed in the host.  </p>

	<p>In order to download a script using <code>Get-Paste</code>, you must know the ID of the script &#8212; which you can get from the output of Find-Paste.  Note that because Find-Paste does a full-text search, you may get results that are not the script you&#8217;re looking for (if they call that script, for instance), and you may get many versions of the script (and newer versions are not necessarily at the top of the search results).</p>

	<p>The <code>Send-Paste</code> script is most useful for sending things to the <a href="http://posh.Jaykul.com/p/">temporary PowerShell pastebin on my site</a> but can be used successfully to send scripts to the permanent <a href="http://PowerShellCentral.com/scripts/">PowerShell Script Repository</a> &#8230; in fact, that&#8217;s how I uploaded the <a href='http://HuddledMasses.org/automating-the-powershell-script-repository/pastebin/' rel='attachment wp-att-550'>PowerShell Pastebin Functions</a> <a href="http://powershellcentral.com/scripts/421">to the repository</a> &#8230; you just have to be careful to specify the title and description when you do that. <strong>Edit</strong>: I attached the script <a href="http://huddledmasses.org/wordpress/wp-content/uploads/2008/06/pastebin.ps1">here on my site</a> also because I made a mistake and deleted the original copy from the repository.  <img src='http://joelbennett.net/wordpress/wp-includes/' alt='[new]' class='wp-smiley' /> </p>

	<p>So, you now have something a little bit more like a proper script repository.  Hopefully the <em>Usage</em> comments in the script will be enough to help you figure out how to use the various commands, (and I did blog about the <a href="http://huddledmasses.org/powershell-send-paste-script/">Send-Paste</a> script about a month ago) but just in case you need help, let me give you a simple example.</p>

	<p>Suppose I need to find a script to encrypt text so I can store some SecureString objects (like the passwords in a PSCredential object) in a file&#8230;</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #333;">&#91;</span><span style="color: #cc66cc;">100</span><span style="color: #333;">&#93;</span>: <span style="color: #0066cc; font-style: italic;">Find-<span style="font-style: normal;">Paste</span></span> encrypt<br />
<br />
Id &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color: #cc66cc;">116</span><br />
Title &nbsp; &nbsp; &nbsp; : <span style="color: #0066cc; font-style: italic;">Start-<span style="font-style: normal;">Encryption</span></span><br />
Description : Functions to encrypt <span style="color: #333399; font-weight: bold; font-style: italic;">and</span> decrypt strings <span style="color: #666699; font-weight: bold;">using</span> the Rijndael symmetric key algorithm<br />
Author &nbsp; &nbsp; &nbsp;: Joel Bennett<br />
Date &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color: #cc66cc;">133</span> days ago<br />
Link &nbsp; &nbsp; &nbsp; &nbsp;: http:<span style="color: #66cc66;">//</span>powershellcentral.<span style="color: #003366;">com</span><span style="color: #66cc66;">/</span>scripts<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">116</span><br />
<br />
Id &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color: #cc66cc;">416</span><br />
Title &nbsp; &nbsp; &nbsp; : Pastebin Functions<br />
Description : <span style="color: #0066cc; font-style: italic;">Send-<span style="font-style: normal;">Paste</span></span>, <span style="color: #0066cc; font-style: italic;">Get-<span style="font-style: normal;">Paste</span></span>, <span style="color: #333399; font-weight: bold; font-style: italic;">and</span> <span style="color: #0066cc; font-style: italic;">Find-<span style="font-style: normal;">Paste</span></span> ... <span style="color: #003366;">to</span> let you use PowerShellCentral.<span style="color: #003366;">com</span><span style="color: #66cc66;">/</span>Scripts a little bit <span style="color: #660033;">more</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #333399; font-weight: bold; font-style: italic;">like</span> CPAN <span style="color: #666699; font-weight: bold;">while</span> you wait <span style="color: #666699; font-weight: bold;">for</span> us to get our act together <span style="color: #333399; font-weight: bold; font-style: italic;">and</span> give you something better. :<span style="color: #333;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IMPORTANT NOTE: the <span style="color: #0066cc; font-style: italic;">Send-<span style="font-style: normal;">Paste</span></span> script defaults to our <span style="color: #66cc66;">*</span>temporary<span style="color: #66cc66;">*</span> pastebin site because we <span style="color: #666699; font-weight: bold;">do</span> <span style="color: #333399; font-weight: bold; font-style: italic;">not</span> want <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; you to fill up the central pastebin site with snippets ... <span style="color: #003366;">but</span> the other two default to the main long<span style="color: #66cc66;">-</span>term <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; script repository.<br />
<span style="color: #003366;">Author</span> &nbsp; &nbsp; &nbsp;: Joel Bennett<br />
Date &nbsp; &nbsp; &nbsp; &nbsp;: <span style="color: #cc66cc;">1</span> hour ago<br />
Link &nbsp; &nbsp; &nbsp; &nbsp;: http:<span style="color: #66cc66;">//</span>powershellcentral.<span style="color: #003366;">com</span><span style="color: #66cc66;">/</span>scripts<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">416</span></div>

	<p>It looks like I found two, but clearly the second one is not the right one (I mentioned this in one of my examples in the pastebin scripts, and amusingly enough, that screwed up my example). So to download the script I want, I just do:</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #333;">&#91;</span><span style="color: #cc66cc;">101</span><span style="color: #333;">&#93;</span>: <span style="color: #0066cc; font-style: italic;">Get-<span style="font-style: normal;">Paste</span></span> <span style="color: #cc66cc;">116</span> <span style="color: #0066cc; font-style: italic;">Start-<span style="font-style: normal;">Encryption</span></span>.<span style="color: #003366;">ps1</span><br />
<br />
&nbsp; &nbsp; Directory: Microsoft.<span style="color: #003366; font-weight: bold;">PowerShell</span>.<span style="color: #003366;">Core</span>\FileSystem::<span style="color: #003366;">C</span>:\Users\Joel\Documents\WindowsPowerShell\Scripts<br />
<br />
Mode &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LastWriteTime &nbsp; &nbsp; &nbsp; Length Name<br />
<span style="color: #66cc66;">----</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">-------------</span> &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">------</span> <span style="color: #66cc66;">----</span><br />
<span style="color: #66cc66;">-</span>a<span style="color: #66cc66;">---</span> &nbsp; &nbsp; <span style="color: #cc66cc;">5</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">30</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2008</span> <span style="color: #cc66cc;">12</span>:<span style="color: #cc66cc;">23</span> AM &nbsp; &nbsp; <span style="color: #cc66cc;">2.378</span> KB <span style="color: #0066cc; font-style: italic;">Start-<span style="font-style: normal;">Encryption</span></span>.<span style="color: #003366;">ps1</span></div>

	<p>Simple enough, right? I could have used the -Passthru option to <em>see</em> the script in the console, but since I was pretty sure it was the only one that might be useful (and since using -Passthrough just to display it on the console would mean downloading it a second time, if I actually wanted it).  Another option would be to use the Tee-Object cmdlet, which would let us download it, show it in the host, and also save it in the file, all at once!  <img src='http://joelbennett.net/wordpress/wp-includes/' alt=':)' class='wp-smiley' /> </p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #0066cc; font-style: italic;">Get-<span style="font-style: normal;">Paste</span></span> <span style="color: #cc66cc;">116</span> <span style="color: #000066;">-Passthru</span> <span style="color: #66cc66;">|</span> <span style="color: #660033;">tee</span> <span style="color: #000066;">-file</span> <span style="color: #0066cc; font-style: italic;">Start-<span style="font-style: normal;">Encryption</span></span>.<span style="color: #003366;">ps1</span></div>

	<p>Incidentally, I have a version of this which uses my <a href="http://huddledmasses.org/get-web-another-round-of-wget-for-powershell/">PoshHttp snapin and Get-Web cmdlet</a>, but it&#8217;s also written as a module and therefore requires PowerShell 2.0 CTP2 &#8212; for various reasons, I&#8217;m choosing to release that one separately later.  If you <strong>are</strong> using the <span class="caps">CTP</span>, you could take advantage of the <span class="caps">WPF</span> UI abilities and try piping <code>Find-Script ... | &#34;Select-Grid&#34;:http://huddledmasses.org/wpf-from-powershell-select-grid/ | Get-Script</code> to pick the script you want visually.  <img src='http://joelbennett.net/wordpress/wp-includes/' alt=':-D' class='wp-smiley' /> </p>]]></content:encoded>
			<wfw:commentRss>http://joelbennett.net/automating-the-powershell-script-repository/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

