• Stars
    star
    637
  • Rank 68,214 (Top 2 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 15 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Ruby/JS GUI and Binding framework (deprecated)
= Bowline

http://github.com/maccman/bowline
  
= DESCRIPTION

Ruby, HTML and JS desktop application framework.

= FEATURES

* MVC
* Uses Webkit
* View in HTML/JavaScript
* Binding between HTML & Ruby
* Cross platform (OSX & Ubuntu) - Windows soon

= INTRODUCTION

If you've ever wished creating a desktop application was as simple
as creating a Rails website you'll be interested in Bowline.
Bowline is a Ruby GUI framework. You can design and build your 
applications in an agile way, deploying them cross platform.

Bowline lets you take your existing skills and apply them to the desktop.
You can write apps in HTML/JavaScript/Ruby without having to worry about
different platforms or a complex GUI API.

Compared to existing Ruby desktop frameworks, such as Shoes, Bowline's strengths
are its adherence to MVC and use of HTML/JavaScript. We think that, although Ruby is 
a great language for the backend, the view should be written in languages designed 
for that purpose, HTML and JavaScript.

Bowline also takes inspiration from Flex through its binders. Bowline will bind 
up Ruby and HTML - letting you concentrate on the more interesting things.

= CONTACT

[email protected]
http://eribium.org
http://twitter.com/maccman

= COMMUNITY

http://groups.google.com/group/bowline-dev

= REQUIREMENTS

- Mac OSX >=10.5 or Ubuntu
- Ruby 1.9 (32 bit atm)
- Bowline gem

If you're on Ubuntu, you'll need to run:
  apt-get install libwebkit-dev

The other required libraries, such as bowline-desktop, are downloaded later by Bowline - you don't need to worry about these.

Unfortunately, if you're using Ruby C extensions, you'll need to have Ruby compiled in 32 bit mode (which isn't the default on Snow Leopard). This will be fixed shortly.

= INSTALLATION

Install the gem:
>> sudo gem install bowline

= USAGE

See the Twitter example at the end of this document, 
or browse the completed version here:
  http://github.com/maccman/bowline-twitter

= GENERATING

Using the bowline-gen binary (installed with Bowline) you can generate the following things:
  app       
  binder    
  helper    
  migration 
  model     
  window
  
Run 'bowline-gen --help' for more information.

= COMMANDS

App console:
>> script/console

Run application:
>> bowline-bundle
>> script/run

Build package for distribution:
>> script/build

= BINDERS

Binders are the core of Bowline. They're a model abstraction for the view which you can bind HTML to.
Binders in turn are associated with a Model. When the model gets changed, the binder makes sure that the HTML stays in sync.

You can create a binder like this:
>> bowline-gen binder users

Which will generate code a bit like this:
  class UsersBinder < Bowline::Binders::Base
  end

Now, in the view you can bind HTML to this collection, by
using the following javascript:
  $('#users').bowlineChain('UsersBinder');
  
You should probably become familiar with Chain.js (which bowline uses for binding): http://wiki.github.com/raid-ox/chain.js/

Suffice to say, the HTML looks a bit like this:
  <div id="users">
    <div class="item">
      <span class="name"></span>
      <span class="email"></span>
      <a href="#" class="destroy">Delete</a>
    </div>
  </div>
  
= METHODS IN BINDERS

You can call both class and instance methods of the binders.
Following on from the above example with 'users', you could call a class
method called 'admins' on the users binder like so:

$('#users').invoke('admins')

It's the same syntax for invoking instance methods, just called
on one of the individual users:

$('#users div:first').invoke('instance_meth', 'arg1')

= HELPERS

Helpers are similar to helpers in Rails - they're helper methods for the view which
don't need a full blown binder to cater for.

You can call helpers with JavaScript like so:
$.bowline.helper('name', 'arg1', ['arg2'])

= MODELS

Bowline supports ActiveRecord and the Sqlite3 database. 
The packaging for distributing databases is still in development though.
You can use the SuperModel gem (http://github.com/maccman/supermodel) for models held in memory.

= WINDOWS

Bowline lets you control your application's windows. The API is under Bowline::Desktop::Window. 
There's a generator for creating new windows; they live under app/windows. 
Every window lives under the MainWindow class. If the MainWindow is closed, the app exits.
  
= BOWLINE-DESKTOP

Bowline-desktop is an abstraction upon wxWidgets for Bowline. It gives your app access to numerous APIs & system features, such as the Clipboard, Dock, Speakers and Windows.

The binary is built in C++, and statically linked with Ruby 1.9 and wxWidgets so it has no local dependencies. Compiling it isn't a requirement to use Bowline, but if you want to extend or contribute to Bowline-desktop, you can find it here:
http://github.com/maccman/bowline-desktop

= DISTRIBUTING

Once your app is ready for a release, you should run the following command to make sure all the gems required have been vendorised:
  bowline-bundle

Then, run:
  ./script/build

You can only build distributions for your local platform at the moment, but we're planning to extend this.

= THEMES

The Cappuccino Aristo theme has been specially customized for Bowline, you can see
examples of it in the Twitter client, and find it here:
  http://github.com/maccman/aristo

= EXAMPLES

Usage for a collection (of users):

    class Users < Bowline::Binders::Base
      bind User
      # These are class methods
      # i.e. methods that appear on
      # users, rather an user
      class << self
        def admins
          # This just replaces all the listed
          # users with just admins
          self.items = User.admins.all
        end
      end
  
      # Singleton methods, get added
      # to individual users.
      # 
      # self.element is the jQuery element
      # for that user, so calling highlight
      # on it is equivalent to:
      #  $(user).highlight()
      # 
      # self.item is the user object, in this case
      # an ActiveRecord instance
      # 
      # self.page gives you access to the dom, e.g:
      #  self.page.alert('hello world').call
  
      def destroy
        self.item.destroy
        self.element.remove
      end
    end
  end

  <html>
  <head>
  	<script src="javascripts/jquery.js" type="text/javascript"></script>
  	<script src="javascripts/jquery.chain.js" type="text/javascript"></script>
    <script src="javascripts/jquery.bowline.js" type="text/javascript"></script>
    <script src="javascripts/application.js" type="text/javascript"></script>
  	<script type="text/javascript" charset="utf-8">
  		jQuery(function($){
  		  $.bowline.ready(function(){
          // Bind the element users to UserBinder
      	  var users = $('#users').bowlineChain('UsersBinder', function(){
      	    var self = $(this);
      	    self.find('.destroy').click(function(){
      	      self.invoke('destroy');
      	      return false;
      	    })
      	  });
    	
        	$('#showAdmins').click(function(){
        	  users.invoke('admins');
        	  return false;
        	});
    	
          // Populate with all the users
        	users.invoke('index');
        	
          // Invoke a helper
        	var time = $.bowline.helper('current_time');
      	});
  	  });
  	</script>
  </head>
  <body>
    <div id="users">
      <div class="item">
        <span class="name"></span>
        <span class="email"></span>
        <a href="#" class="destroy">Delete</a>
      </div>
    </div>
  
    <a href="#" id="showAdmins">Show admins</a>
  </body>
  </html>

= Building a basic Twitter client

  Install the gem:
  >> sudo gem install bowline

  Run the app/binder generators:
  >> bowline-gen app bowline_twitter
  >> cd bowline_twitter
  >> bowline-gen binder tweets

  Copy tweets_binder.rb from examples to app/binders/tweets_binder.rb
  Copy tweet.rb from examples to app/models/tweet.rb
  Add your Twitter credentials to config/application.yml - in this simple example they're not dynamic.

  Copy twitter.html from examples to public/index.html

  Install the Twitter gem:
  >> sudo gem install twitter

  Add the Twitter gem to Gemfile: 
     gem "twitter"
     
  Bundle gems:
  >> bowline-bundle

  run:
  >> script/run

  That's it. You can see a snazzed up version here:
  http://github.com/maccman/bowline-twitter

More Repositories

1

juggernaut

[DEPRECATED] Realtime server push with node.js, WebSockets and Comet
JavaScript
1,626
star
2

monocle

Link and news sharing
Ruby
1,453
star
3

abba

A/B testing framework
Ruby
1,351
star
4

holla

Holla! - Rich JavaScript Application
JavaScript
1,069
star
5

jquery.magicmove

Animate DOM transitions.
JavaScript
644
star
6

stylo

Spine/CoffeeScript example GUI designer
JavaScript
526
star
7

saasy

Rails SaaS and SSO solution
Ruby
523
star
8

gfx

CSS3 3D animation library
JavaScript
511
star
9

nestful

Simple Ruby HTTP/REST client with a sane API
Ruby
505
star
10

ace

Sinatra for Node
CoffeeScript
461
star
11

supermodel

Ruby in-memory models
Ruby
367
star
12

acts_as_recommendable

Collaborative Filtering for Rails
Ruby
325
star
13

book-assets

Files for the O'Reilly book JavaScript Web Applications
JavaScript
310
star
14

go

go
Ruby
257
star
15

trevi

An opinionated Sinatra app generator
Ruby
251
star
16

flarevideo

HTML5 & Flash Video Player
JavaScript
243
star
17

spine.todos

A Backbone alternative idea
JavaScript
239
star
18

hermes

Messaging re-invented
Ruby
206
star
19

motivation

New Chrome tab page showing your age
JavaScript
197
star
20

juggernaut_plugin

Realtime Rails
JavaScript
195
star
21

spine.contacts

Spine demo contact manager
CoffeeScript
182
star
22

sprockets-commonjs

Adds CommonJS support to Sprockets
Ruby
179
star
23

macgap-rb

Generator for MacGap
Objective-C
159
star
24

sinatra-blog

A example Sinatra blog
Ruby
157
star
25

headsup

A simple Heads Up display
Ruby
145
star
26

catapult

A Sprockets/Rack build tool
Ruby
139
star
27

remail

RESTful email for Rails
Ruby
138
star
28

spine.rails3

Sample app demonstrating Spine and Rails integration
Ruby
130
star
29

bowline-twitter

Bowline Twitter client
JavaScript
112
star
30

wysiwyg

CoffeeScript
104
star
31

sinatra-pubsub

Push & Streaming for Sinatra.
Ruby
99
star
32

push-mac

Objective-C
94
star
33

stitch-rb

Stitch ported to Ruby
Ruby
93
star
34

dhash

Compare image similarity with a dhash
Ruby
93
star
35

101-school

AI generated courses
TypeScript
89
star
36

ichabod

Headless JavaScript testing with WebKit
JavaScript
85
star
37

colorcanvas

JavaScript
83
star
38

roauth

*Simple* Ruby OAuth library
Ruby
82
star
39

push

Ruby
81
star
40

juggernaut_gem

Realtime Rails
Ruby
79
star
41

spine.mobile

Spine Mobile Framework
CoffeeScript
77
star
42

super.js

Simple JavaScript framework for building RIAs (with jQuery)
JavaScript
64
star
43

oped

Email based diary
Ruby
57
star
44

remail-engine

RESTful email for Rails - see http://github.com/maccman/remail
Python
48
star
45

syncro

Synchronize state across remote clients.
Ruby
47
star
46

spine.mobile.currency

Spine Mobile currency convertor example
CoffeeScript
46
star
47

sourcemap

Ruby library for using Source Maps
Ruby
43
star
48

superapp

JavaScript state machine and class abstraction for building RIAs (deprecated! - use http://github.com/maccman/super.js)
JavaScript
31
star
49

sprockets-source-url

Adds @sourceURL support to Sprockets
Ruby
30
star
50

spine.infinite

Infinite scrolling with Spine & Rails
JavaScript
29
star
51

bowline-desktop

wxWidgets/Ruby/Webkit framework for Bowline apps
C++
28
star
52

ymockup

UI mockups using HTML and CSS
JavaScript
28
star
53

supermodel-js

SuperModel in JavaScript (deprecated! - use http://github.com/maccman/super.js)
JavaScript
26
star
54

zombies

A Facebook/Spine game.
Ruby
24
star
55

quora2

Redesigning Quora's interface, turning it into a JavaScript web application powered by Spine.
JavaScript
21
star
56

spine.mobile.contacts

Example Spine Mobile App
CoffeeScript
20
star
57

humanapi

Ruby
20
star
58

request-profile

API to access autocomplete data
JavaScript
19
star
59

gwo

Rails plugin integrating Google Web Optimizer for AB tests
Ruby
18
star
60

cft

CoffeeScript
17
star
61

jquery.upload.js

Upload files using Ajax
JavaScript
17
star
62

spine.realtime

Realtime Spine app with Rails
Ruby
15
star
63

rbyte

Byte compile Ruby 1.9.1 files and "require" support for loading compiled files.
Ruby
14
star
64

phonegap

Gem for building PhoneGap apps
Shell
13
star
65

segment-hooks

Trigger arbitrary JavaScript from Segment.com events
JavaScript
13
star
66

spine.mobile.workout

Spine Mobile Workouts Example
CoffeeScript
11
star
67

restful_email

AppEngine that provides a RESTful interface to sending emails (decrep - use http://github.com/maccman/remail)
Python
10
star
68

csbook

CoffeeScript
10
star
69

statster

Merb Web Analytics
Ruby
9
star
70

rack-modulr

Use CommonJS modules in your Rack/Rails applications
9
star
71

blossom

Demonstration chat app
JavaScript
9
star
72

dtwitter

Distributed Twitter
9
star
73

canonical

Rails plugin providing helper for canonical URLs
8
star
74

jquery.drop.js

jQuery lib abstracting the drag/drop API
JavaScript
8
star
75

alexmaccaw

Portfolio
Ruby
8
star
76

omniauth-humanapi

OmniAuth strategy for HumanAPI.
Ruby
8
star
77

the-managers-handbook

JavaScript
8
star
78

syncro-js

JavaScript library for Syncro
JavaScript
8
star
79

less-rb

Less using ExecJS
Ruby
7
star
80

bowline-bundler

Specialized version of the Bundler gem for Bowline apps
Ruby
6
star
81

spine.tutorials

Spine tutorials (DEPRECATED - use http://spinejs.com)
JavaScript
6
star
82

serveup

JavaScript
5
star
83

gdata

Recent clone of http://code.google.com/p/gdata-ruby-util (with Ruby 1.9 support)
Ruby
5
star
84

package-jquery

JavaScript
5
star
85

package-jquery-ui

JavaScript
4
star
86

node-twitter-stream

Twitter Streaming API Library for Node.js
JavaScript
4
star
87

jquery.tmpl

jQuery.tmpl for Hem
JavaScript
4
star
88

counterman

Ruby
4
star
89

monocle-assets

Ruby
4
star
90

jlink

jQuery data binding library - bind objects to HTML elements
JavaScript
4
star
91

cloudflare-r2-edge

TypeScript
4
star
92

super.todos

Port of Backbone.js Todos to Super
JavaScript
4
star
93

jeco

jQuery extension to eco
CoffeeScript
3
star
94

invoices

Test Spine app
JavaScript
3
star
95

like-detector

TypeScript
3
star
96

bp-p2p

Browser Plus P2P
Ruby
3
star
97

renoir

Simple Canvas physics engine using Verlet Integration
JavaScript
3
star
98

hnv2

Hacker News V2
CoffeeScript
3
star
99

elb-nginx-vhosts

Shell
2
star
100

socialmod

Ruby/Python/PHP client libs
PHP
2
star