REM Update Gem223 until someone fixes the Ruby Windows installer Ĭall update_rubygems -no-ri -no-rdoc > updaterubygemsout REM If you don't need DevKit for your Gems, rem this out.ĭ:\7zip\7za x -y -oDevKit DevKit.zip > outĮcho - d:/local/temp/r/ruby-2.1.5-圆4-mingw32 > config.yml REM Note Azure deployments run faster with 7Zip not spewing so much. REM If you need things to be persistent, then put them elsewhere, not in TEMPĮCHO START Unzipping Ruby. REM Note that D:\local\temp is a LOCAL drive on Azure, and very fast The getruby.cmd is my automating what you'd have to any way on a Windows machine without Ruby. That's all you need, plus a Basic Azure Website. All we have is a standard "Middleman init" site plus the Azure-generator deploy.cmd and my getruby.cmd. NOTE: If this seems confusing or complex, it's because I like to give folks LOTS of detail. The exists check handles the case when a deploy happens but %temp% has been cleared so it'll get Ruby again. As it is, the deploy is fast (less than a minute) when Ruby is there, and just about 3 minutes to get and setup Ruby when it's not. However, it's cleared out often, so if I wanted things to be persistent but slower to deploy, I'd put them in D:\deployments\tools. Turns out %temp% a local drive, so it's a few times faster than using the main drive, which makes this deployment faster. Note that I'm putting stuff in %temp% for speed. Here's an annotated part of the first bit, but the actual file is on GitHub. Then at the very end, Kudu takes the results from the /build folder and moves them to /wwwroot, which makes the changes live. The second part is what runs every time a source file for my static site generator is checked in. I just need to make sure Ruby is around and in the path. The first part is a one time thing for a new website. Install eventmachine 1.0.7, a problematic gem on WindowsĪnd then, every deployment run the Middleman static site generator.Update RubyGems to 2.2.3 until the Windows version of Ruby has this included.Ensure the DevKit (which includes native compilers, etc) is installed.Ensure Ruby is installed and in the path.Kudu supports custom deployment scripts where you can jump in and do whatever you like (within the limits of the security sandbox)īasically I needed to do these things before running Middleman on my source: There is still a cool debug "sidecar" website for every Azure site, it's at but now a version of the console is in the portal as well.Īzure Websites uses an open source project called Kudu to deploy from locations with source like Github. I could have also used a shell script or PowerShell, but Batch was easy given what I was doing.ĪSIDE: You may recognize that console from this video I did about the "Super Secret Debug Console" in Azure. When I got it working, I put together a batch file called GetRuby. I tried a number of different commands, all from the browser, and explored a number of ideas. This is where I did my practice work to see if I could programmatically download and install Ruby via a script. The Azure Portal lets you open a command line from your website.Ĭheck me out, here in the new Azure Portal. You've got a LOT of control and can even get a hold of a console where you can run commands and install stuff. However, even though Azure Websites are totally "platform as a service" there's still a Windows Virtual Machine underneath, and you can use the disk space however you like. You might be thinking, oh, this'll be hard, I'll need to use a VM and do this myself. Also, Azure Websites doesn't know formally about the idea of a static site generator. The DevKit is a lovely set of tools that "makes it easy to build and use native C/C extensions such as RDiscount and RedCloth for Ruby on Windows."Īzure Websites supports not just ASP.NET today, but also node.js, PHP, Python, and Java, all built in. That means if you are a Windows user, your system will need not just Ruby, but the Ruby DevKit so you can build those native gems. Middleman uses Ruby for its build system and views, and some of the Gems it uses are native gems. However, static site generators are even more fun when you can host the source code in Git and have your static site build and deploy in the cloud. Middleman is "a static site generator using all the shortcuts and tools in modern web development." With any static site generator you can run it all locally and then push/FTP/whatever the resulting HTML to any host.
0 Comments
Leave a Reply. |