Dhh

Framework for web-development with Ruby. This framework dedicated to DHH, author of Rails and I'm not sure it is good.

View the Project on GitHub raventid/dhh

Dhh

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

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.