
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Quick and easy static site generation with a familiar API.
class App < Sharpie::Base
get "/" do
"Hello, world."
end
# get posts from ActiveRecord or elsewhere
def self.posts
Post.all
end
posts.each do |post|
get "/posts/#{post.id}" do
erb :post
end
get "/posts/#{post.id}.json" do
post.to_json
end
end
end
App.build!("_site")
Or use with an existing Sinatra application:
class App < Sinatra::Base
register Sinatra::AdvancedRoutes # this is required
def self.posts
Post.all
end
posts.each do |post|
get "/posts/#{post['id']}.json" do
post.to_json
end
end
get "/" do
erb :index
end
end
builder = Sharpie::Builder.new(App)
builder.build!("_site")
Sharpie::Base
subclasses from Sinatra::Base
.
Add this line to your application's Gemfile:
gem 'sharpie'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sharpie
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Sinatra routes make web app and API creation dead-simple. The syntax is straightforward and allows for your site to feel more like Ruby and less like a bloated framework. And there's also no reason why this powerful API should be limited to dynamic web applications. Sinatra routes simply describe a path and a response. Whether the response is evaluated ahead of time or on fly should not matter.
Jekyll is great for blogs and other types of sites where content is "hand created." That is, a human creates a file in a folder and writes some Markdown. Sharpie is more geared towards use-cases where the original content is already in a machine-readable format. For example, if you have a database whose contents you want to expose via REST API. You also don't want to maintain a server and you don't want to worry about scaling. With Sharpie, you can write such an API with very few (yet straightfoward) lines of code.
This software is mostly a fork of the sinatra-static gem by Paul Asmuth. Paul's code is very well-written. I'd rather copy and attribute it than re-invent a well-made wheel. I'm focusing on building an interface that suits my needs. More specifically, I want Sharpie to be part of a toolchain for rapidly developing static file-backed REST APIs.
This software, which is a fork of MIT-licensed software, is also MIT-licensed. See LICENSE.txt
.
FAQs
Unknown package
We found that sharpie demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.