<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://devlicio.us/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Mike Nichols - Son Of Nun Technology : Builds</title><link>http://devlicio.us/blogs/mike_nichols/archive/tags/Builds/default.aspx</link><description>Tags: Builds</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><item><title>The Rake’s Progress – Part II</title><link>http://devlicio.us/blogs/mike_nichols/archive/2009/09/13/the-rake-s-progress-part-ii.aspx</link><pubDate>Sun, 13 Sep 2009 08:56:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:51218</guid><dc:creator>Michael Nichols</dc:creator><slash:comments>3</slash:comments><comments>http://devlicio.us/blogs/mike_nichols/archive/2009/09/13/the-rake-s-progress-part-ii.aspx#comments</comments><description>&lt;p&gt;Some things I have loved so far about working with rake/ruby:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;File enumeration &lt;/li&gt;
&lt;li&gt;Blending regular expressions where it makes things more readable &lt;/li&gt;
&lt;li&gt;Testability &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After checking out lots of other rake files, it is easy to see how much simpler ruby can make things. Along the way I am picking up some idiom&amp;rsquo;s that (seem) more acceptable and concise. &lt;/p&gt;
&lt;h3&gt;File Selects&lt;/h3&gt;
&lt;p&gt;For example, I can do this:&lt;/p&gt;
&lt;p&gt;Dir.glob(Path.join(&amp;ldquo;/path/to/my/files/**&amp;rdquo;,&amp;rdquo;*.dll&amp;rdquo;) + Dir.glob(Path.join(&amp;ldquo;/path/to/my/files/**&amp;rdquo;,&amp;rdquo;*.pdb&amp;rdquo;)&lt;/p&gt;
&lt;p&gt;or better I can use rake&amp;rsquo;s FileList and a more concise File.join:&lt;/p&gt;
&lt;p&gt;FileList.new(Path.join(&amp;ldquo;path&amp;rdquo;,&amp;rdquo;to&amp;rdquo;,&amp;rdquo;my&amp;rdquo;,&amp;rdquo;files&amp;rdquo;,&amp;rdquo;*.{dll,pdb,xml}&amp;rdquo;))&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Directory Ops&lt;/h3&gt;
&lt;p&gt;I wanted to copy a file structure from one directory to another, but preserving the structure from the original. I had a hard time figuring out the ruby way of doing this, but this seems to do the trick:&lt;/p&gt;
&lt;pre class="brush: rails;"&gt;FileList.new(File.join(WEB_DIR,&amp;quot;**&amp;quot;,&amp;quot;*.{spark,asax,aspx,ascx,ashx}&amp;quot;),&lt;br /&gt;	File.join(WEB_DIR,&amp;quot;bin&amp;quot;,&amp;quot;*.{dll,pdb}&amp;quot;),&lt;br /&gt;	File.join(&amp;quot;#{BUILD_CONFIG_DIR}/**&amp;quot;, &amp;quot;*&amp;quot;)&lt;br /&gt;	).each do |file|			&lt;br /&gt;	path = File.join(DEPLOY_WEB_DIR,file.gsub(WEB_DIR,&amp;quot;&amp;quot;))&lt;br /&gt;	target = File.dirname(path)&lt;br /&gt;	File.makedirs(target)			&lt;br /&gt;	cp Pathname.new(file), Pathname.new(target)#bug in ruby for to_str invocation workaround&lt;br /&gt;end	&lt;/pre&gt;
&lt;h3&gt;Configuration &amp;amp; Templating&lt;/h3&gt;
&lt;p&gt;I like the config.yaml RoR convention, so here&amp;rsquo;s what I came up with. First, two simple classes:&lt;/p&gt;
&lt;pre class="brush: rails;"&gt;require &amp;#39;yaml&amp;#39;&lt;br /&gt;class Environment&lt;br /&gt;	attr_accessor :development,:test,:production&lt;br /&gt;	&lt;br /&gt;	def [](name)&lt;br /&gt;		if name.downcase==&amp;quot;development&amp;quot; then development&lt;br /&gt;		elsif name.downcase==&amp;quot;test&amp;quot; then test&lt;br /&gt;		elsif name.downcase==&amp;quot;production&amp;quot; then production&lt;br /&gt;		end	&lt;br /&gt;	end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;class Configuration&lt;br /&gt;	attr_accessor :service_path, :database_name, :connection_string, :log_level,:static_files_url  ,:dev  	&lt;br /&gt;	# Support templating of member data.&lt;br /&gt;    def get_binding				&lt;br /&gt;		binding&lt;br /&gt;    end&lt;br /&gt;end&lt;/pre&gt;
&lt;pre&gt;&lt;span style="font-family:Trebuchet MS;"&gt;&lt;span style="font-family:Courier New;"&gt;Plz&amp;hellip;&lt;/span&gt;Ignore the crappy [] hack in Environment . These two classes will be read in by ERB like so:&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="brush: rails;"&gt;desc &amp;quot;Expand templates&amp;quot;&lt;br /&gt;task :expand =&amp;gt; [:clean] do				&lt;br /&gt;	config = YAML::load(File.open(File.join(CONFIG_DIR,&amp;quot;config.yaml&amp;quot;)))			&lt;br /&gt;	b = config[ENVIRONMENT].get_binding		&lt;br /&gt;	FileList.new(File.join(CONFIG_DIR,&amp;quot;**&amp;quot;,&amp;quot;*.{template}&amp;quot;),File.join(INSTALLER_DIR,&amp;quot;**&amp;quot;,&amp;quot;*.{template}&amp;quot;)).each do |file|&lt;br /&gt;		path = ExpandTemplate.new().write(file,b)			&lt;br /&gt;	end				&lt;br /&gt;end 	&lt;/pre&gt;
&lt;p&gt;Here&amp;rsquo;s my config.yaml. Note how we map to the objects I defined above :&lt;/p&gt;
&lt;pre class="brush: rails;"&gt;--- !ruby/object:Environment &lt;br /&gt;development: !ruby/object:Configuration    &lt;br /&gt;    database_name: MaterialsTesting_Dev &lt;br /&gt;    connection_string: my_connection_string &lt;br /&gt;    log_level: DEBUG &lt;br /&gt;    static_files_url: http://static.local.com/MaterialsTesting &lt;br /&gt;test: !ruby/object:Configuration    &lt;br /&gt;    database_name: MaterialsTesting_Test &lt;br /&gt;    connection_string: my_connection_string &lt;br /&gt;    log_level: DEBUG &lt;br /&gt;    static_files_url: http://static.local.com/MaterialsTesting &lt;br /&gt;production: !ruby/object:Configuration    &lt;br /&gt;    database_name: MaterialsTesting &lt;br /&gt;    connection_string: my_connection_string &lt;br /&gt;    log_level: INFO &lt;br /&gt;    static_files_url: http://static.local.com/MaterialsTesting&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now we can use the ExpandTemplate call:&lt;/p&gt;
&lt;pre class="brush: rails;"&gt;class ExpandTemplate		&lt;br /&gt;	def write(file,b)							&lt;br /&gt;		template = File.read(file)&lt;br /&gt;		erb = ERB.new(template,0,&amp;quot;%&amp;lt;&amp;gt;&amp;quot;)&lt;br /&gt;		output_file_name = File.join(BUILD_DIR,file.gsub(&amp;quot;.template&amp;quot;,&amp;quot;&amp;quot;))		&lt;br /&gt;		output = File.open(output_file_name, &amp;#39;w&amp;#39;) do |file|&lt;br /&gt;			file.puts erb.result(b) 			&lt;br /&gt;		end	&lt;br /&gt;		output_file_name&lt;br /&gt;	end&lt;br /&gt;	&lt;br /&gt;end&lt;/pre&gt;
&lt;p&gt;So far this has been fun ripping&amp;nbsp; out nant scripts and replacing them with rake. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=51218" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/mike_nichols/archive/tags/Builds/default.aspx">Builds</category><category domain="http://devlicio.us/blogs/mike_nichols/archive/tags/Rake/default.aspx">Rake</category></item><item><title>The Rake’s Progress</title><link>http://devlicio.us/blogs/mike_nichols/archive/2009/09/06/the-rake-s-progress.aspx</link><pubDate>Mon, 07 Sep 2009 05:40:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:51150</guid><dc:creator>Michael Nichols</dc:creator><slash:comments>0</slash:comments><comments>http://devlicio.us/blogs/mike_nichols/archive/2009/09/06/the-rake-s-progress.aspx#comments</comments><description>&lt;p&gt;I have been porting my builds from NAnt to Rake as their complexity has become unmanageable. I couldn&amp;rsquo;t recall the way I installed Ruby (and associated gems) on my Win 2K3 server and I came across a few issues that I had to resolve to get up and running. Here are some things that helped me.&lt;/p&gt;
&lt;h3&gt;&lt;/h3&gt;
&lt;h3&gt;iconv.dll errors&lt;/h3&gt;
&lt;p&gt;Running Ruby 1.8.7 required me to follow the steps &lt;a href="http://techtest.wordpress.com/2009/01/13/howto-install-ruby-187-on-windows/" target="_blank"&gt;here&lt;/a&gt; . This straightened out an error I was getting from Windows about iconv.dll.&lt;/p&gt;
&lt;h3&gt;Rake examples&lt;/h3&gt;
&lt;p&gt;There are a number of good &lt;b&gt;rake &lt;/b&gt;(rakefile.rb) samples out there people have been kind enough to share. Here are the ones that were valuable in helping me:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://jonfuller.codingtomusic.com/2009/02/23/build-automation-evolution-rake-and-net/" target="_blank"&gt;Jon Fuller&lt;/a&gt; : He has a link to his googlecode repo of this file and accompanying utilities&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.neverrunwithscissors.com/2008/12/25/i-never-want-to-see-xml-driven-build-scripts-again-now-that-ive-used-rake/" target="_blank"&gt;Peter Mounce&lt;/a&gt; : He has a set of useful tasks for his &lt;i&gt;rake dotnet &lt;/i&gt;project &lt;a href="http://github.com/petemounce/rake-dotnet/tree/master" target="_blank"&gt;here&lt;/a&gt; which are definitely worth look at&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=51150" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/mike_nichols/archive/tags/Builds/default.aspx">Builds</category><category domain="http://devlicio.us/blogs/mike_nichols/archive/tags/Rake/default.aspx">Rake</category></item><item><title>Third Party Libraries Organization</title><link>http://devlicio.us/blogs/mike_nichols/archive/2008/05/09/third-party-libraries-organization.aspx</link><pubDate>Sat, 10 May 2008 04:46:57 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:40428</guid><dc:creator>Michael Nichols</dc:creator><slash:comments>4</slash:comments><comments>http://devlicio.us/blogs/mike_nichols/archive/2008/05/09/third-party-libraries-organization.aspx#comments</comments><description>&lt;p&gt;I finally have my CI environment and am wondering what the heck took me so long to take time to get it set up. This has had me looking again at how I set my project folders up. Typically I am using the libraries from Castle/Nhib/Rhino stack and build them all at the same time quite frequently since the Rhino build process simply ROCKS. However I notice everyone putting all their dependencies in separate folders like this:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;/lib/Castle&lt;/li&gt;    &lt;li&gt;/lib/NHibernate&lt;/li&gt;    &lt;li&gt;/lib/Rhino&lt;/li&gt;    &lt;li&gt;/lib/...&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Personally, I have just thrown all my dependencies in a single /lib folder and haven&amp;#39;t come across issues with this. I still keep tools like mbunit or nant in a separate /tools directory.&lt;/p&gt;  &lt;p&gt;My /lib directory isn&amp;#39;t as pretty organized looking but like I said most of my dependencies are getting rebuilt at the same time anyways. So what advantage am I missing out on by just throwing everything into a single folder? It has made it much simpler for copying assemblies from other builds (I know I could automate that too).&amp;#160; Am I being overly simplistic? &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=40428" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/mike_nichols/archive/tags/Project+Structure/default.aspx">Project Structure</category><category domain="http://devlicio.us/blogs/mike_nichols/archive/tags/Builds/default.aspx">Builds</category></item></channel></rss>