Skip to content

Latest commit

 

History

History
87 lines (58 loc) · 2.2 KB

README.md

File metadata and controls

87 lines (58 loc) · 2.2 KB

Dhh

Build Status

Welcome to Dhh project! This web framework created as an easy to use and small clone of Rails, which is working on top of Rack.

2018 NOTE: Hey, it's long time since I've not contributed to this project, I think I know where I wanna lead this. It will be async highlevel framework, super simple, super lightweight. Stay tuned.

Installation

Add this line to your application's Gemfile:

gem 'dhh'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dhh

Usage

Controllers:

Extend your controller with Dhh::Controller. And you will get the route called https://base_url/controller_name/action_name

class HelloController < Dhh::Controller
  # this will be https://base_url/hello/index
  def index
    render :index, noun: :unicorn
  end
  
  # dump_controller which show rack content
  def env_info
    ar = env.to_s.split(',')
    output = ''
    ar.each do |line|
      output += "#{line.to_s}" + "<br>"
    end
    output
  end
end

Views:

To create a view you should follow next rules:

  1. In app/views folder create folder with controller name, e.g. HelloController's view folder should have a name app/views/hello/.
  2. To bind view to an an action use render method.

Controller:

# app/controllers/hello_controller.rb
class HelloController < Dhh::Controller
  def index
    render :index, noun: :unicorn
  end
end

View:

# app/views/hello/index.html.erb
<h1>This is my <%= unicorn %></h1>

Models:

Comming soon...

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/raventid/dhh.