{"id":18557996,"url":"https://github.com/zh/yarf","last_synced_at":"2025-05-15T14:30:57.796Z","repository":{"id":2297701,"uuid":"3256192","full_name":"zh/yarf","owner":"zh","description":"Yet Another Rack Framework","archived":false,"fork":false,"pushed_at":"2012-02-03T05:50:21.000Z","size":132,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-17T11:44:35.430Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-24T13:50:44.000Z","updated_at":"2015-06-12T21:58:02.000Z","dependencies_parsed_at":"2022-09-07T07:11:17.442Z","dependency_job_id":null,"html_url":"https://github.com/zh/yarf","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zh%2Fyarf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zh%2Fyarf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zh%2Fyarf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zh%2Fyarf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zh","download_url":"https://codeload.github.com/zh/yarf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254358554,"owners_count":22057942,"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-11-06T21:38:37.536Z","updated_at":"2025-05-15T14:30:57.741Z","avatar_url":"https://github.com/zh.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YARF - Yet Another Ruby(Rack) Framework\n\nA minimalist (and relatively useless) Ruby web applications framework.\n\n\n## Features\n\n* Small (\u003c 100 LOC) and fast\n* Powered by [Rack](https://github.com/chneukirchen/rack)\n* Templates via [Tilt](https://github.com/rtomayko/tilt)\n* Routing via [HTTP-Router](https://github.com/joshbuddy/http_router)\n* Routes with parameters - \u003ccode\u003e'/show/:id'\u003c/code\u003e\n* Redirects with status - 301 or 302\n* Global and per action layouts\n* Partial views\n* Nesting routes - \u003ccode\u003ewith '/admin' do ... end\u003c/code\u003e\n* Static assets - via *Rack::Static*\n* Authentication *via Warden* (see the example application)\n* Lots of tests included - using *rspec* and *rack-test*\n\n\n## Pre-requirements\n\n* rack\n* erubis\n* tilt\n* http_router\n\n\n## Usage\n\nInstall pre-requirements:\n\n    gem install bundler --pre  # (if not installed)\n    bundle install\n\nExample application in *myapp.rb*:\n\n    require 'yarf'\n    class MyApp \u003c Yarf\n      static \"/static\", Yarf.root(\"public\")\n      layout :bootstrap\n      get \"/\" do\n        render :index\n      end\n      get \"/intro\" do\n        redirect_to \"/readme\"\n      end\n      get \"/readme\" do\n        render :readme, :engine =\u003e :md\n      end\n      with \"/admin\" do\n        get \"/dashboard\" do\n          render :admin, :layout =\u003e :admin\n        end\n      end\n    end\n\nRackup script *config.ru*:\n\n    require 'myapp'\n    run HttpRouter.new {\n      add('/static').static(Yarf.root(\"public\"))\n      add('/*').to {|env| MyApp.new.call(env) }\n    }\n\nUse the Rackup script to launch the application:\n\n    thin start -R config.ru -p 8080\n\nor\n\n    ruby myapp.rb -p 8080\n\n## YARF in the wild\n\n* [YARF development](https://github.com/zh/yarf)\n* [YARF site](http://yarf.herokuapp.com/) itself\n* [Travis CI building results](http://travis-ci.org/#!/zh/yarf)\n\n\n## TODO\n\n* support for helpers\n* embedded templates - \u003ccode\u003eerb '\u003c%= ... %\u003e'\u003c/code\u003e\n* more tests\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzh%2Fyarf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzh%2Fyarf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzh%2Fyarf/lists"}