Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gregkrsak/gk-application
A simple state machine framework for creating applications in Ruby. Installable via RubyGems.
https://github.com/gregkrsak/gk-application
ruby state-machine
Last synced: 26 days ago
JSON representation
A simple state machine framework for creating applications in Ruby. Installable via RubyGems.
- Host: GitHub
- URL: https://github.com/gregkrsak/gk-application
- Owner: gregkrsak
- License: other
- Created: 2014-03-09T00:47:47.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-04-09T19:28:31.000Z (almost 10 years ago)
- Last Synced: 2024-12-30T12:06:25.954Z (27 days ago)
- Topics: ruby, state-machine
- Language: Ruby
- Homepage:
- Size: 160 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Gem: gk-application
===================[![Gem Version](https://badge.fury.io/rb/gk-application.svg)](http://badge.fury.io/rb/gk-application)
A simple framework for creating applications in Ruby
----------------------------------------------------An instance of ```GK::Application``` allows you to easily mange your Ruby application's state, with minimal fuss. Supported states are ```:starting```, ```:running```, ```:stopping``` and ```:stopped```.
Install with gem
----------------Quick installation with ```gem```:
```bash
gem install gk-application
```Get started with a new project
------------------------------Need a project template? No problem:
```bash
ruby -e 'require "rubygems"; require "gk-application"' -e 'GK::Application.new.project'
```Or using ```irb```:
```
$ irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'gk-application'
=> true
irb(main):003:0> GK::Application.new.project
=> nil
irb(main):004:0> quit
```And you'll have a brand-new ```my_app.rb``` ready to go in the current folder!
Here's what an application looks like
-------------------------------------```ruby
#!/usr/bin/env rubyrequire 'gk-application'
my_app = GK::Application.new
my_app.on_starting = proc {
puts 'Starting.'
my_app.state = :running
}my_app.on_running = proc {
puts 'Running.'
my_app.state = :stopping
}my_app.on_stopping = proc {
puts 'Stopping.'
my_app.state = :stopped
}my_app.on_stopped = proc {
puts 'Stopped.'
}my_app.state = :starting
```