This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rvm --trace install jruby 2>&1 | |
+__rvm_parse_args:669> [[ -n 4.3.11 ]] | |
+__rvm_parse_args:704> [[ -z '' && -n '' ]] | |
+__rvm_parse_args:707> [[ error == || 0 -eq 1 || -n '' ]] | |
+__rvm_parse_args:16> [[ -n install ]] | |
+__rvm_parse_args:18> rvm_token=install | |
+__rvm_parse_args:20> (( 1 > 0 )) | |
+__rvm_parse_args:22> next_token=jruby | |
+__rvm_parse_args:23> shift | |
+__rvm_parse_args:28> case install ([[:alnum:]]*|@*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IntegratedPage < Page | |
# Define multiple outputs for this page. Each one will be accessible by adding | |
# the relevant extension to the page's URL. e.g. | |
# /my-page => HTML | |
# /my-page.xml => XML | |
# /my-page.rss => RSS | |
outputs :html, :rss, :json, :xml | |
# If the output specified doesn't map to the extension of a a known MIME type | |
# then you can define the format manually. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FeaturedBand is an alias to instances of BandPage. | |
# Within templates it has access to all of the fields of its target | |
# as well as its own. | |
class FeaturedBand < Piece | |
alias_of :BandPage | |
field :image | |
field :strapline, :markdown | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Photo < Piece | |
field :image do | |
# Define a list of outputs that will be generated for each image | |
size :large do | |
# Here you have access to a minimagick context which can be used to | |
# apply any ImageMagick process to your uploaded image. | |
# https://github.com/minimagick/minimagick | |
fit 640, 360 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install RVM | |
$ curl -L https://get.rvm.io | bash -s stable | |
# Install Ruby 2.1.3 | |
$ rvm install 2.1.3 | |
# Install Spontaneous (which is still in alpha/beta) | |
$ gem install spontaneous --pre | |
# Use the `spot` binary to generate a site skeleton |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BlogPost < Page | |
controller :comments do | |
# The comments controller is a Sinatra app | |
# so you can use its excellent DSL to define | |
# routes and behaviour for your page application | |
get "/comments" do | |
# … load and return a list of comments in JSON format | |
# each action has access to the current page through | |
# the `page` variable. | |
content_type :json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A site-wide search | |
Site.index :everything | |
# And a specific index for blog post tags | |
Site.index :tags do | |
# Each index has a list of content types to include which defaults to all of them. | |
# Using #include limits the types to include to the ones specified in this list. | |
include :BlogPost | |
# OR we could work with all types except for a few | |
# exclude :Homepage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Member < Piece | |
# Store people's names in separate first_name & last_name | |
# fields to enable sorting on the surname | |
field :first_name | |
field :last_name | |
# Call Member::names to get a list of all Members names sorted by their last name | |
# Member::all returns all the instances of Member from the database. | |
def self.names | |
Member.all.sort { |m1, m2| m1.sort_name <=> m2.sort_name }.map(&:name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define a SectionPage that holds fields common across all top-level pages in our site | |
class SectionPage < Page | |
# A field to hold some introductory text. All subclasses of this type will inherit this field. | |
field :welcome_text, :markdown | |
end | |
# Create a home page type inheriting methods & fields from our SectionPage | |
class Homepage < SectionPage | |
# Add a field for a photo of us | |
field :photo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a ${ name } template. | |
Cutaneous supports multiple syntaxes, but in this example expressions | |
are embedded using the syntax `\${ expression }`. | |
Using the expression tags `\%{ ... }` allows you to embed pure Ruby | |
code in your templates e.g. | |
%{ ["Hello", "World"].each do |word| -} | |
${ word } |