Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sitespec

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sitespec

  • 1.2.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Sitespec

Generate static site from your rack application & test files.

  • Provides the same way to create both dynamic & static website
  • Generates static website from your existing dynamic website
  • Sitespec can be executable specification, good documentation, and well-tested implementation

Usage

1. Add sitespec into your Gemfile

# Gemfile
gem "sitespec"

2. Require sitespec/rspec in your specs

# spec/spec_helper.rb
require "sitespec/rspec"

3. Write request-specs with :sitespec metadata

Note: rack/test is automatically enabled in the example groups that have :sitespec.

# spec/site_spec.rb
describe "Sitespec" do
  let(:app) do
    MyRackApp
  end

  %w[
    /
    /2000/01/01/hello
    /stylesheets/all.css
  ].each do |path|
    describe "GET #{path}", :sitespec do
      it "returns 200" do
        expect(get(path).status).to eq 200
      end
    end
  end
end

4. Run rspec to build static files

Note: only successful examples generate static files.

$ bundle exec rspec

Example application
  GET /
    returns 200
  GET /2000/01/01/hello
    returns 200
  GET /stylesheets/all.css
    returns 200

Sitespec generated 3 files into build directory.

Finished in 0.08302 seconds (files took 0.79161 seconds to load)
3 examples, 0 failures

Configuration

  • Sitespec.configuration.auto_complete_html_path - Autocomplete .html (default: true)
  • Sitespec.configuration.build_path - Where to locate files (default: build)
  • Sitespec.configuration.enabled - Enable sitespec (default: true)

Advanced topics

Sitespec is excellent with GitHub Pages. r7kamura/r7kamura.github.io is a working example that uses Sitespec to build static files from Rack application. It uses TravisCI to build and push files to GitHub repo's master branch. See .travis.yml for more information about how to to it.

FAQs

Package last updated on 18 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc