Download Static Site Generators Webscripts In Ruby For Mac

2020. 2. 14. 02:49카테고리 없음

Spress lets developers create simple websites using a bloat-free application known in the industry as a 'static site generator.' Made famous by Jekyll and GitHub.

December 28, 2016 / I just got a new MacBook Pro, and I decided to research the fastest, most efficient method to set up a clean, organized, and up-to-date development environment for my new computer. I wrote about some of these steps in my post, and now I’m going to go into more detail. I documented everything I did after taking the Mac out of the box.

This post will be useful to anyone setting up a new Mac, whatever your preferred apps and settings are. Simply change variables as necessary. Goals I’m a front end web developer, and most of the software I install will pertain to that. I still have much to learn, but this process will setup my Mac to run, an server, and more. I’ve included all the commands from this article without any of the explanation on a GitHub readme. Feel free to fork, modify, and keep for your own future records.

MacOS Mojave v. 10.14 Setup The Setup Assistant will launch once you turn the computer on. Here you’ll enter your language, time zone, Apple ID, and so on.

I choose not to use “Migration Assistant”, and set up my computer from scratch. The first thing you should do is update macOS to get the latest security updates and patches. If you’re setting up for the first time, you’ll have to install App Store software through the App Store itself, but if you’ve installed them before, you’ll be able to use Homebrew, Cask, and Mas to install all your programs from the command line. Homebrew Install the package manager. This will allow you to install almost any app from the command line. In previous versions, you’d have to install XCode or Command Line Tools before using this, but that step is no longer necessary.

/usr/bin/ruby -e '$(curl -fsSL Mac App Store The Mac App Store command line interface, or, will allow you to install from the App Store. Brew install mas Sign in If you haven’t already logged into the App Store, you can do so now. Mas signin Brewfile Now I’ll create a file called Brewfile in my main directory, which will list all the programs I want on the computer, and install them in a bundle. Open Terminal, which will be in your home folder by default ( /Users/you). Create the file. Touch Brewfile You can edit the file with TextEdit, or by typing nano Brewfile. If you choose to edit with nano, you can save the file by typing Control + O to save, and Control + X to exit the file.

List of Programs Here are all the programs I intend to install with a brief description. You can choose to add or subtract any programs you’d like. They’re all free. – an extension to Homebrew that will allow you to install almost any program that exists for a Mac. – for version control. – Node Package Manager (yes, we’re installing package managers with package managers.

Welcome to current year! Also, npm doesn’t actually stand for that, but shh. – Was my text editor when I originally wrote this. Feel free to install Atom, VSC, or alternative instead or in addition to Brackets. – Night Shift for your Mac. Save your eyes!. – a front end dev should have all the major browsers installed.

– a free Photoshop alternative. – web browser.

– simplify and sandbox your development environment, if you choose. – web browser. – excellent free app for resizing your windows. – excellent free GUI for MySQL databases. – it plays everything!.

– the communication app. – indispensable free app to gather the color/HEX code of any pixel on your screen. – my note-taking app of choice. – my to-do app of choice. – the Apple equivalent of Excel – should come preinstalled. – the Apple equivalent of Word Note: I no longer use f.lux, as Mac comes with this feature now, and I use VSC instead of Brackets.

Below are the entire contents of my Brewfile, which will install all the above programs with a single command. Tap 'caskroom/cask' brew 'git' brew 'npm' cask 'brackets' cask 'flux' cask 'firefox' cask 'gimp' cask 'google-chrome' cask 'mamp' cask 'opera' cask 'spectacle' cask 'sequel-pro' cask 'vlc' mas 'Numbers', id: 409203825 mas 'Pages', id: 409201541 mas 'Slack', id: 803453959 mas 'Sip', id: 507257563 mas 'Simplenote', id: 692867256 mas 'Todoist', id: 585829637 Now simply run this command to install the bundle. Brew bundle install Bash Config – /.bashprofile Now that we have all our programs installed and Homebrew all nice and new, we should create a simple script to keep Homebrew up to date. I found this handy command on this gist. First, create a.bashprofile dotfile in your home folder.

Touch.bashprofile We’ll create a bash alias to combine all the commands to keep Homebrew clean and up to date. Alias brewup='brew update; brew upgrade; brew prune; brew cleanup; brew doctor' Run the following command. Source /.bashprofile Now you can run brewup to update, upgrade, prune, cleanup, and doctor Homebrew. It’s a good idea to do this often, even daily. Brewup GitHub Config – /.gitconfig The first thing you should do with Git is.

We can do this by running a lot of small commands which will update the Git configuration file. Git config -global user.name 'First Last' Or we can just create the Git configuration file and input it all ourselves. Touch.gitconfig Here I’ll input my name, email, GitHub username, some aliases to be able to type less and do more, and connect Git to the OS X Keychain so I don’t have to type my username and password every time I want to push to GitHub. user name = First Last email = github user = username alias a = add ca = commit -a cam = commit -am s = status pom = push origin master pog = push origin gh-pages puom = pull origin master puog = pull origin gh-pages cob = checkout -b credential helper = osxkeychain With the above aliases, I can run git s instead of git status, for example. The less I have to type repeatedly, the happier I am. SSH If you use SSH (Secure Shell) to connect to any remote hosts via the command line, you can simplify the process.

Config – /.ssh/config Create an SSH config file. Touch.ssh/config Add the following contents, changing the variables for any hosts that you connect to. Using the below will connect to -i key.pem.

You can remove the IdentityFile if you don’t connect with a pem key. The output will then simply be and you’ll be prompted for password authentication. Host example HostName example.com User example-user IdentityFile key.pem Now just run the alias to connect. Ssh example Generate SSH key You can to distribute. Ssh-keygen -t rsa -b 4096 -C ' Node.js We’re going to use to install Node.js. Curl -o- bash Install the latest version. Nvm install node Restart terminal and run the final command.

Nvm use node Confirm that you are using the latest version. Node -v You can also test with which node, which will output your Node path and version number. /Users/yourusername/.nvm/versions/node/v7.8.0/bin/node And for later, here’s how to update: nvm install node -reinstall-packages-from=node Node Package Manager I have npm installed, and npm is mostly used locally for projects.

The only thing I use globally at the moment is Gulp. Gulp Install Gulp globally. Npm install -global gulp-cli Ruby Ruby is required to run, a popular static site generator. I’m going to download to make sure I have the updated version of Ruby without messing with the built-in system Ruby. Download rvm curl -sSL bash -s stable Install Ruby version You can look for and install the latest version by number, or by running the below command.

Rvm install ruby-head You can run rvm list to see the full list of versions available. To use the latest version, find the number and run this command. Rvm -default use 2.4.0 Confirm that you are using the latest version. Rvm -v You can also test with which ruby, which will output your Ruby path and version number. Hi Tania, Talking about popular virtualization tools you mentioned (Docker, Vagrant, VB etc) I’d suggest Docker to learn deeper, because nowadays it is widely used in production and test environments as the main DevOps tool. I used all of them and stuck in Docker because of its huge images warehouse on DockerHub, simplicity of packaging and deploying, system resources isolation, low memory consumption and so on.

In other words you pack and deliver on server only your app and environment and nothing more. Vagrant and VirtualBox are usually used as just virtual machines with guest OS.

As for Ansible – I use it as orchestration tool for delivering builds on remote servers via ssh and it is very handful due to its, so to speak, agentless tool. All you need is ssh access and prepared scripts (playbooks). So, Docker + Ansible is a comprehensive toolbox, swiss knife, to perform DevOps tasks.

Try it and you won’t regret 🙂.

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. 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 uses Ruby for its build system and views, and some of the Gems it uses are native gems.

That means if you are a Windows user, your system will need not just Ruby, but the so you can build those native gems. 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.' Azure Websites supports not just ASP.NET today, but also node.js, PHP, Python, and Java, all built in.

But not Ruby, directly, yet. Also, Azure Websites doesn't know formally about the idea of a static site generator. You might be thinking, oh, this'll be hard, I'll need to use a VM and do this myself. 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've got a LOT of control and can even get a hold of a console where you can run commands and install stuff. The lets you open a command line from your website.

Check me out, here in the new. This is where I did my practice work to see if I could programmatically download and install Ruby via a script. I tried a number of different commands, all from the browser, and explored a number of ideas. When I got it working, I put together a batch file called GetRuby.

I could have also used a shell script or PowerShell, but Batch was easy given what I was doing. ASIDE: You may recognize that console from this video I did about the. It's not so secret now, it's a feature.

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. Uses an open source project called to deploy from locations with source like Github. Kudu supports where you can jump in and do whatever you like (within the limits of the security sandbox) Basically I needed to do these things before running Middleman on my source:. Ensure Ruby is installed and in the path.

Ensure the DevKit (which includes native compilers, etc) is installed. Initialize and setup DevKit for builds. Update RubyGems to 2.2.3 until the Windows version of Ruby has this included. Install eventmachine 1.0.7, a problematic gem on Windows. Run the Ruby Bundler's update. Install Middleman And then, every deployment run the Middleman static site generator.

Middleman build The first part is a one time thing for a new website. I just need to make sure Ruby is around and in the path. The second part is what runs every time a source file for my static site generator is checked in. It runs middleman build.

Download Static Site Generators Webscripts In Ruby For Mac

Then at the very end, Kudu takes the results from the /build folder and moves them to /wwwroot, which makes the changes live. Here's an annotated part of the first bit, but the. Note that I'm putting stuff in%temp% for speed. Turns out%temp% a local drive, so it's a few times faster than using the main drive, which makes this deployment faster.

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. 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. The exists check handles the case when a deploy happens but%temp% has been cleared so it'll get Ruby again.

NOTE: If this seems confusing or complex, it's because I like to give folks LOTS of detail. But just look at my repository. All we have is a standard 'Middleman init' site plus the Azure-generator deploy.cmd and my getruby.cmd. That's all you need, plus a Basic Azure Website.

The getruby.cmd is my automating what you'd have to any way on a Windows machine without Ruby. REM Note that D: local temp is a LOCAL drive on Azure, and very fast SET PATH=%PATH%;D: local temp r ruby-2.1.5-x64-mingw32 bin pushd%temp% REM If you need things to be persistent, then put them elsewhere, not in TEMP if not exist r md r cd r if exist ruby-2.1.5-x64-mingw32 goto end echo No Ruby, need to get it! REM Get 64-bit Ruby curl -o ruby215.zip ECHO START Unzipping Ruby. 7Zip is already on Azure Websites REM Note Azure deployments run faster with 7Zip not spewing so much. Redirect to a file.

D: 7zip 7za x -y ruby215.zip out REM Get DevKit to build Ruby native gems REM If you don't need DevKit for your Gems, rem this out. Curl -o DevKit.zip ECHO START Unzipping DevKit d: 7zip 7za x -y -oDevKit DevKit.zip out ECHO DONE Unzipping DevKit ruby DevKit dk.rb init REM Tell DevKit where Ruby is echo - config.yml echo - d:/local/temp/r/ruby-2.1.5-x64-mingw32 config.yml REM Setup DevKit ruby DevKit dk.rb install REM Update Gem223 until someone fixes the Ruby Windows installer curl -L -o update.gem call gem install -local update.gem call updaterubygems -no-ri -no-rdoc updaterubygemsout ECHO What's our new Rubygems version? Call gem -version call gem uninstall rubygems-update -x REM This is needed on Windows, why is this gem such a problem? ECHO Install eventmachine 1.0.7 call gem install eventmachine -v '1.0.7' -no-ri -no-rdoc updateventmachineout call bundle update ECHO Install middleman.the whole point! Call gem install middleman -no-ri -no-rdoc:end popd call middleman build REM KuduSync and actual /build to /wwwroot is after this in deploy.cmd! And in the Deploy.cmd all I needed to change was this under SETUP.

This is where YOU can do whatever you like. Note since I'm using Batch, I need to put CALL in front of other Batch files (and Ruby uses them also!) otherwise my script will just end early. ECHO CALLING GET RUBY call getruby.cmd ECHO WE MADE IT Then later, still in Deploy.cmd, I just added build to the source directory name. Call:ExecuteCmd '%KUDUSYNCCMD%' -v 50 -f '%DEPLOYMENTSOURCE% build' -t '%DEPLOYMENTTARGET%' -n '%NEXTMANIFESTPATH%' -p '%PREVIOUSMANIFESTPATH%' -i '.git.hg.deployment;deploy.cmd' And that's it. Now whenever I updated my views or other things in my Middleman source on GitHub, it automatically deploys to my live site.

Yes, again, to be clear, I realize it's a static site generator that I could run locally and FTP the results, but I'm working in a small team and this is a great way for us to collaborate on our static site. Plus, when it's done, it's all done and I don't have to mess with it again. Debugging Custom Azure Website Deployments I thought debugging my GetRuby batch file was going to be a nightmare. However, it turns out that the Azure cross-platform command line (the Azure x-plat CLI, open source, and written in nodejs, BTW) can connect to Azure's log streaming service. 'Azure Site Log Tail' lets me see the LIVE console output as the deploy happens! Now, note that the need for this whole 'getruby.bat' file totally goes away if the Azure Websites folks start including Ruby and DevKit in the Azure Websites VM image by default.

That would make Ruby, Rails, Gems, DevKit, etc. Available to everyone. Do you want Ruby on Azure? Sound off in the comments! HELP:, especially for robustness as well as Ruby-correctness as I'm likely confused about a few things, but it works for me and it's a great start.

Sometimes different native gems don't build, though, or Gems complains about conflicting versions and asks me to run Bundler. I have no idea why.

Running things twice clears it. It's either my bug or someone else's.:) I'm just happy that Azure Websites is as flexible as it is that I was able to console into it from the browser, look around, add my own custom deployment hook, and do something I initially didn't think was possible! Give Azure Websites a try FOR FREE, no signup, no credit card for an hour in a sandbox with PHP, Node, ASP.NET, or Java at. (Full Disclosure, I helped a little with this site, so I'm a fan.) Related Links.!. Did you know Azure Friday has playlists now?

I wanted to use Azure recently to host a static site, but I had to choose AWS because I can serve static sites right out of S3 without deploying a web server at all. Azure Storage is missing a bunch of features in this regard. You have to create a container for each root folder (manually or using the API I suppose) instead of just uploading a root folder. And, among other minor features missing from Azure Storage, there is no facility to let users directly upload files.

Serving static sites that use a set of distributed APIs seems to be way that much of the new 'programmable web' is being built, so Microsoft is going to have to fill in some blanks here I think. Amazing stuff! Strange coincidence as I have been looking at static site generators recently and playing with Jekyll which also runs on Ruby and seems to be very popular at the moment. You should check out which is a.net port of Jekyll and also supports razor syntax!

So far it is working well for me and is easily installed through (which can also be installed with a single Powershell command so I'm sure this would be possible in Azure). When I started developing websites the first thing I worked on was an asp.net site to replace something that was statically generated and considered outdated technology. Funny how things go in cycles and come back, just somehow that bit better than before:). If you use the Ruby Dev Kit you may need to download the sources or precompiled binaries for libraries needed by certain gems.

An alternative I found recently to the Ruby Dev Kit is MSYS2. It can build native Windows applications using the MinGW-w64 toolchain. It uses the pacman package manager from Arch Linux and allows you to build packages on Windows (it can manage dependences and has the development libraries and sources you would need for most gems).

Download Static Site Generators Web Scripts In Ruby For Mac Pro

For example, you can install a 64-bit version of Ruby using the command: pacman -S mingw-w64-x8664-ruby You will need to force gems to build using the mingw-w64 toolchain though (by specifying (-platform=ruby (for example, gem install puma -platform=ruby)).