Camping

4k 袖珍充满了噱头的 web 微框架。「the 4k pocket full-of-gags web microframework」

  • 所有者: camping/camping
  • 平台: Windows,Linux,Mac
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Build Status

Camping, a Microframework

Camping is a micro web framework which stays as small as possible.
You can probably view the complete source code on a single page. But, you
know, it's so small that, if you think about it, what can it really do? Apparently
it can do a lot. It's pretty swell.

The idea here is to store a complete fledgling web application in a single
file like many small CGIs. But to organize it as a Model-View-Controller
application. And with time, you can move your Models, Views, and Controllers into
other files as your app grows.

Camping supports multiple apps, capsuled code that runs together. Each app can
have independent models, routes, and controllers.

Pack your gear when you go Camping! With a simple plugin system, Camping is easily
extensible. Add all sorts of useful and silly things.

A Camping Skeleton

A skeletal Camping blog could look like this:

require 'camping'

Camping.goes :Blog

module Blog::Models
  class Post < Base; belongs_to :user; end
  class Comment < Base; belongs_to :user; end
  class User < Base; end
end

module Blog::Controllers
  class Index
    def get
      @posts = Post.find :all
      render :index
    end
  end
end

module Blog::Views
  def layout
    html do
      head { title "My Blog" }
      body do
        h1 "My Blog"
        self << yield
      end
    end
  end

  def index
    @posts.each do |post|
      h1 post.title
    end
  end
end

Installation

Interested yet? Luckily it's quite easy to install Camping. We'll be using
a tool called RubyGems, so if you don't have that installed yet, go grab it!
Once that's sorted out, open up a Terminal or Command Line and enter:

gem install camping

Even better, install the Camping Omnibus, a full package of recommended libs: Camping Omnibus will return for summer vacation.

gem install camping-omnibus

If not, you should be aware of that Camping itself only depends on
Rack, and if you're going to use the views you also
need to install markaby, and if you're going to use the database you need
activerecord as well.

gem install markaby
gem install activerecord

Learning

First of all, you should read the first chapters
of The Camping Book. It should hopefully get you started pretty quick. While
you're doing that, you should be aware of the reference which contains
documentation for all the different parts of Camping.

The wiki is the place for all tiny,
useful tricks that we've collected over the years. Don't be afraid to share
your own discoveries; the more, the better!

And if there's anything you're wondering about, don't be shy, but rather
subscribe to the mailing list
and ask there. We also have an IRC channel over at Freenode, so if you feel
like chatting with us, you should join #camping @ irc.freenode.net.

Running Tests

Tests should be run using bundler and rake: bundle exec rake.

Authors

Camping was originally crafted by why the lucky stiff,
but is now maintained by the community. This simply means that if we like your
patch, it will be applied. Everything is managed through the mailing list,
so just subscribe and you can instantly take part in shaping Camping.

主要指標

概覽
名稱與所有者camping/camping
主編程語言Ruby
編程語言Ruby (語言數: 4)
平台
許可證MIT License
所有者活动
創建於2009-08-21 13:59:40
推送於2025-05-08 15:06:21
最后一次提交
發布數22
最新版本名稱3.2.6 (發布於 )
第一版名稱1.0 (發布於 )
用户参与
星數1k
關注者數31
派生數104
提交數0.9k
已啟用問題?
問題數129
打開的問題數36
拉請求數46
打開的拉請求數9
關閉的拉請求數11
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?