Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/narazaka/sana-mvcbase
Ukagaka SHIORI subsystem 'Sana' MVC Helper
https://github.com/narazaka/sana-mvcbase
shiori ukagaka
Last synced: about 1 month ago
JSON representation
Ukagaka SHIORI subsystem 'Sana' MVC Helper
- Host: GitHub
- URL: https://github.com/narazaka/sana-mvcbase
- Owner: Narazaka
- Created: 2016-02-21T01:49:21.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-05-04T20:26:59.000Z (over 4 years ago)
- Last Synced: 2024-04-26T22:03:21.235Z (8 months ago)
- Topics: shiori, ukagaka
- Language: Ruby
- Size: 8.79 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# [Sana MVC Base](https://github.com/Narazaka/sana-mvcbase)
[![Gem](https://img.shields.io/gem/v/sana-mvcbase.svg)](https://rubygems.org/gems/sana-mvcbase)
[![Gem](https://img.shields.io/gem/dtv/sana-mvcbase.svg)](https://rubygems.org/gems/sana-mvcbase)
[![Gemnasium](https://gemnasium.com/Narazaka/sana-mvcbase.svg)](https://gemnasium.com/Narazaka/sana-mvcbase)
[![Inch CI](http://inch-ci.org/github/Narazaka/sana-mvcbase.svg)](http://inch-ci.org/github/Narazaka/sana-mvcbase)
[![Travis Build Status](https://travis-ci.org/Narazaka/sana-mvcbase.svg)](https://travis-ci.org/Narazaka/sana-mvcbase)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/Narazaka/sana-mvcbase?svg=true)](https://ci.appveyor.com/project/Narazaka/sana-mvcbase)
[![codecov.io](https://codecov.io/github/Narazaka/sana-mvcbase/coverage.svg?branch=master)](https://codecov.io/github/Narazaka/sana-mvcbase?branch=master)
[![Code Climate](https://codeclimate.com/github/Narazaka/sana-mvcbase/badges/gpa.svg)](https://codeclimate.com/github/Narazaka/sana-mvcbase)Ukagaka SHIORI subsystem 'Sana' MVC Helper
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'sana-mvcbase'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install sana-mvcbase
## Usage
```ruby
require 'sana-mvcbase'
require 'shiolink'# define controllers
# for load(), unload()
class DLController < SanaController
def _load(dirpath)
MySave.load
p dirpath
enddef _unload
p :unload
end
end# view rendering module
module MyViewModule
def render_response(name)
MyView.talk(name || event_id)
end
end# view rendering base controller
class MyWithViewController < SanaAnyEventController
include MyViewModule
end# normal talk controller
class TalkEventsController < MyWithViewController
def OnBoot
@foo = MySave.foo_flag
@bar = MyModel.bar(params.shell_name)
enddef OnFirstBoot
@foo = MySave.foo_flag
render :OnBoot
end
end# resource controller
class ResourcesController < SanaController
def homeurl
"http://www.example.com/foo/"
end
end# register routing
router = SanaRouter.new(TalkEventsController)
router.draw do
controller DLController do
load
unload
endcontroller ResourcesController do
route :homeurl
endroute :OnBoot, {shell_name: 0, halted: 6, halted_ghost_name: 7}
# OnFirstBoot is not registered but will called with default controller (= TalkEventsController)
end# app start
sana = Sana.new(router.events)
shiolink = Shiolink.new(sana.method(:load), sana.method(:unload), sana.method(:request))
shiolink.start
```## API
[API Document](http://www.rubydoc.info/github/Narazaka/sana-mvcbase)
## License
This is released under [MIT License](http://narazaka.net/license/MIT?2016).