{"id":18088629,"url":"https://github.com/jish/sinatra-gen","last_synced_at":"2025-04-06T02:14:36.069Z","repository":{"id":22714870,"uuid":"26059125","full_name":"jish/sinatra-gen","owner":"jish","description":"A simple Sinatra generator","archived":false,"fork":false,"pushed_at":"2018-01-11T19:42:34.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-12T08:17:57.217Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jish.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-01T18:21:31.000Z","updated_at":"2018-01-11T19:42:35.000Z","dependencies_parsed_at":"2022-07-23T19:47:08.563Z","dependency_job_id":null,"html_url":"https://github.com/jish/sinatra-gen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jish%2Fsinatra-gen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jish%2Fsinatra-gen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jish%2Fsinatra-gen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jish%2Fsinatra-gen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jish","download_url":"https://codeload.github.com/jish/sinatra-gen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423521,"owners_count":20936626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-31T17:13:56.440Z","updated_at":"2025-04-06T02:14:36.047Z","avatar_url":"https://github.com/jish.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## sinatra-gen -- A simple Sinatra generator\n\nI write small [Ruby][1] web services in [Sinatra][2] every once in a while. I\nfound myself writing the same boilerplate code over and over again. This bash\nscript will generate a simple Sinatra app.\n\n[1]: https://www.ruby-lang.org/en/\n[2]: https://github.com/sinatra/sinatra/\n\n## Installation\n\nThe `sinatra-gen` script will run on its own as a standalone execuatable. You can clone this repository, or download the script.\n\nTo clone:\n\n    $ git clone git@github.com:jish/sinatra-gen.git\n\nTo download:\n\n    $ curl \"https://raw.githubusercontent.com/jish/sinatra-gen/master/sinatra-gen\" \u003e ~/bin/sinatra-gen\n\n### Generating a new project\n\n`sinatra-gen` generates a Sinatra project in the current directory.\n\n    $ mkdir foo\n    $ cd foo\n    $ sinatra-gen foo\n\nA test suite is created for you.\n\n    $ rake test\n    $ autotest\n\n### What is generated?\n\nWhen you generate a new project the following files are generated:\n\n    $ find .\n    .\n    ./.autotest\n    ./config.ru\n    ./Gemfile\n    ./Gemfile.lock\n    ./lib\n    ./lib/foo.rb\n    ./Rakefile\n    ./test\n    ./test/foo_test.rb\n\nThe implementation\n\n```ruby\n# lib/foo.rb\nrequire 'sinatra/base'\n\nclass Foo \u003c Sinatra::Base\n\n  get \"/\" do\n    [200, {}, [\"Hello World!\"]]\n  end\n\nend\n```\n\nA test\n\n```ruby\n# test/foo_test.rb\nrequire 'minitest/autorun'\nrequire 'rack/test'\nrequire 'foo'\n\nclass FooTest \u003c MiniTest::Test\n\n  include Rack::Test::Methods\n\n  def app\n    Foo.new\n  end\n\n  def test_root_route\n    get \"/\"\n    assert last_response.ok?, \"Must respond with '200 OK' at the root route\"\n  end\n\nend\n```\n\nA rackup configuration file\n\n```ruby\n# config.ru\n$LOAD_PATH.unshift(\"lib\") unless $LOAD_PATH.include?(\"lib\")\nrequire 'foo'\n\nrun Foo\n```\n\nA `Gemfile`\n\n```ruby\n# Gemfile\nsource \"https://rubygems.org\"\n\ngem \"sinatra\"\n\ngroup :development do\n  gem \"rake\"\nend\n\ngroup :test do\n  gem \"autotest\"\n  gem \"autotest-suffix\"\n  gem \"rack-test\"\nend\n```\n\nA `Rakefile`\n\n```ruby\n# Rakefile\nrequire 'rake/testtask'\n\nRake::TestTask.new do |test|\n  test.libs \u003c\u003c \"test\" \u003c\u003c \"lib\"\n  test.pattern = \"test/**/*_test.rb\"\nend\n```\n\nAn `.autotest` configuration file\n\n```ruby\n# .autotest\nrequire 'autotest/restart'\nrequire 'autotest/suffix'\n\nAutotest.add_hook :initialize do |at|\n  at.testlib = \"minitest/autorun\"\nend\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjish%2Fsinatra-gen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjish%2Fsinatra-gen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjish%2Fsinatra-gen/lists"}