maccman-bowline 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Manifest.txt CHANGED
@@ -9,12 +9,11 @@ assets/jquery.chain.js
9
9
  assets/jquery.js
10
10
  bin/bowline-gen
11
11
  bowline.gemspec
12
- examples/account_binder.rb
12
+ examples/account.rb
13
13
  examples/example.js
14
14
  examples/twitter.html
15
- examples/twitter_binder.rb
16
- examples/twitter_login.html
17
- examples/users_binder.rb
15
+ examples/tweets.rb
16
+ examples/users.rb
18
17
  lib/bowline.rb
19
18
  lib/bowline/binders.rb
20
19
  lib/bowline/binders/collection.rb
data/README.txt CHANGED
@@ -4,15 +4,15 @@ http://github.com/maccman/bowline
4
4
 
5
5
  = DESCRIPTION
6
6
 
7
- My take on Ruby desktop GUIs
7
+ Ruby desktop application framework
8
8
 
9
9
  = FEATURES
10
10
 
11
- * Cross platform
12
11
  * MVC
13
12
  * Uses Webkit
14
13
  * View in HTML/JavaScript
15
14
  * Binding between HTML & Ruby
15
+ * Will be cross platform (though only OSX atm)
16
16
 
17
17
  = CONTACT
18
18
 
@@ -20,16 +20,39 @@ info@eribium.org
20
20
  http://eribium.org
21
21
  http://twitter.com/maccman
22
22
 
23
- = Usage
23
+ = Usage - Building a basic Twitter client
24
24
 
25
- bowline-gen app bowline_twitter
26
- cd bowline_twitter
27
- bowline-gen binder twitter
25
+ Build Titanium by following the instructions here:
26
+ http://wiki.github.com/marshall/titanium/build-instructions
28
27
 
28
+ Install the gem:
29
+ >> sudo gem install maccman-bowline --source http://gems.github.com
29
30
 
30
- = EXAMPLES
31
+ Run the app/binder generators:
32
+ >> bowline-gen app bowline_twitter
33
+ >> cd bowline_twitter
34
+ >> bowline-gen binder tweets
35
+
36
+ Copy tweets.rb from examples to app/binders/tweets.rb
37
+ Add your Twitter credentials to tweets.rb - in this simple example they're not dynamic.
38
+
39
+ Copy twitter.html from examples to public/index.html
40
+
41
+ Install the Twitter gem:
42
+ >> sudo gem install twitter
31
43
 
32
- Have a look at the examples for an example twitter client.
44
+ Add the Twitter gem to config/environment.rb:
45
+ config.gem "twitter"
46
+
47
+ run:
48
+ >> rake app:package TIPATH=~/path/to/titanium
49
+
50
+ run:
51
+ ./script/run
52
+
53
+ That's it
54
+
55
+ = EXAMPLES
33
56
 
34
57
  Usage for a collection (of users):
35
58
 
data/bowline.gemspec CHANGED
@@ -2,24 +2,24 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{bowline}
5
- s.version = "0.1.4"
5
+ s.version = "0.1.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Alex MacCaw"]
9
9
  s.date = %q{2009-04-24}
10
10
  s.default_executable = %q{bowline-gen}
11
- s.description = %q{My take on Ruby desktop GUIs}
11
+ s.description = %q{Ruby desktop application framework}
12
12
  s.email = ["info@eribium.org"]
13
13
  s.executables = ["bowline-gen"]
14
14
  s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
15
- s.files = [".gitignore", "History.txt", "MIT-LICENSE", "Manifest.txt", "README.txt", "Rakefile", "assets/jquery.bowline.js", "assets/jquery.chain.js", "assets/jquery.js", "bin/bowline-gen", "bowline.gemspec", "examples/account_binder.rb", "examples/example.js", "examples/twitter.html", "examples/twitter_binder.rb", "examples/twitter_login.html", "examples/users_binder.rb", "lib/bowline.rb", "lib/bowline/binders.rb", "lib/bowline/binders/collection.rb", "lib/bowline/binders/singleton.rb", "lib/bowline/commands/console.rb", "lib/bowline/commands/generate.rb", "lib/bowline/commands/run.rb", "lib/bowline/ext/array.rb", "lib/bowline/ext/class.rb", "lib/bowline/ext/object.rb", "lib/bowline/ext/string.rb", "lib/bowline/gem_dependency.rb", "lib/bowline/generators.rb", "lib/bowline/generators/application.rb", "lib/bowline/generators/binder.rb", "lib/bowline/generators/migration.rb", "lib/bowline/generators/model.rb", "lib/bowline/initializer.rb", "lib/bowline/jquery.rb", "lib/bowline/observer.rb", "lib/bowline/tasks/app.rake", "lib/bowline/tasks/bowline.rb", "lib/bowline/tasks/database.rake", "lib/bowline/tasks/log.rake", "lib/bowline/tasks/misk.rake", "templates/Rakefile", "templates/binder.rb", "templates/config/application.yml", "templates/config/boot.rb", "templates/config/database.yml", "templates/config/environment.rb", "templates/config/manifest", "templates/config/tiapp.xml", "templates/gitignore", "templates/migration.rb", "templates/model.rb", "templates/public/index.html", "templates/public/javascripts/application.js", "templates/public/stylesheets/application.css", "templates/script/console", "templates/script/init", "templates/script/run"]
15
+ s.files = [".gitignore", "History.txt", "MIT-LICENSE", "Manifest.txt", "README.txt", "Rakefile", "assets/jquery.bowline.js", "assets/jquery.chain.js", "assets/jquery.js", "bin/bowline-gen", "bowline.gemspec", "examples/account.rb", "examples/example.js", "examples/twitter.html", "examples/tweets.rb", "examples/users.rb", "lib/bowline.rb", "lib/bowline/binders.rb", "lib/bowline/binders/collection.rb", "lib/bowline/binders/singleton.rb", "lib/bowline/commands/console.rb", "lib/bowline/commands/generate.rb", "lib/bowline/commands/run.rb", "lib/bowline/ext/array.rb", "lib/bowline/ext/class.rb", "lib/bowline/ext/object.rb", "lib/bowline/ext/string.rb", "lib/bowline/gem_dependency.rb", "lib/bowline/generators.rb", "lib/bowline/generators/application.rb", "lib/bowline/generators/binder.rb", "lib/bowline/generators/migration.rb", "lib/bowline/generators/model.rb", "lib/bowline/initializer.rb", "lib/bowline/jquery.rb", "lib/bowline/observer.rb", "lib/bowline/tasks/app.rake", "lib/bowline/tasks/bowline.rb", "lib/bowline/tasks/database.rake", "lib/bowline/tasks/log.rake", "lib/bowline/tasks/misk.rake", "templates/Rakefile", "templates/binder.rb", "templates/config/application.yml", "templates/config/boot.rb", "templates/config/database.yml", "templates/config/environment.rb", "templates/config/manifest", "templates/config/tiapp.xml", "templates/gitignore", "templates/migration.rb", "templates/model.rb", "templates/public/index.html", "templates/public/javascripts/application.js", "templates/public/stylesheets/application.css", "templates/script/console", "templates/script/init", "templates/script/run"]
16
16
  s.has_rdoc = true
17
17
  s.homepage = %q{http://github.com/maccman/bowline}
18
18
  s.rdoc_options = ["--main", "README.txt"]
19
19
  s.require_paths = ["lib"]
20
20
  s.rubyforge_project = %q{maccman}
21
21
  s.rubygems_version = %q{1.3.2}
22
- s.summary = %q{My take on Ruby desktop GUIs}
22
+ s.summary = %q{Ruby desktop application framework}
23
23
 
24
24
  if s.respond_to? :specification_version then
25
25
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -0,0 +1,31 @@
1
+ module Binders
2
+ class Account < Bowline::Binders::Singleton
3
+ class << self
4
+ # self.collection is a special method
5
+ # Basically it'll update users on the client side
6
+ def index
7
+ self.item = current_account
8
+ end
9
+
10
+ def destroy
11
+ current_account.destroy
12
+ self.item = nil
13
+ end
14
+ end
15
+
16
+ # Everything has a js_id which is basically the lowercase classname + _ + self.id
17
+ def highlight
18
+ # Calls $(element).highlight()
19
+ self.element.highlight
20
+ end
21
+
22
+ # Overrides charge on user
23
+ def charge!
24
+ # calls charge on model (i.e. do sql commit )
25
+ self.item.charge!
26
+ # Now gui stuff
27
+ flash[:notice] = "Successfully charged"
28
+ highlight
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,28 @@
1
+ module Binders
2
+ class Tweets < Bowline::Binders::Collection
3
+ class << self
4
+ def index
5
+ self.items = timeline
6
+ end
7
+
8
+ def update(status)
9
+ twitter.update(status)
10
+ index # update timeline
11
+ end
12
+
13
+ protected
14
+ def twitter
15
+ httpauth = Twitter::HTTPAuth.new('user', 'pass')
16
+ Twitter::Base.new(httpauth)
17
+ end
18
+
19
+ def timeline
20
+ twitter.friends_timeline.collect {|t|
21
+ t.delete('user')
22
+ t.to_hash
23
+ }
24
+ end
25
+ end
26
+
27
+ end
28
+ end # Binders
@@ -4,40 +4,36 @@
4
4
  <html lang="en">
5
5
  <head>
6
6
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
7
- <title>twitter</title>
8
- <meta name="generator" content="TextMate http://macromates.com/">
9
- <meta name="author" content="Alex MacCaw">
10
- <!-- Date: 2009-01-10 -->
11
- <script src="jquery.js" type="text/javascript" charset="utf-8"></script>
12
- <script src="chain.js" type="text/javascript" charset="utf-8"></script>
13
- <script src="bowline.js" type="text/javascript" charset="utf-8"></script>
14
- <script type="text/javascript" charset="utf-8">
15
- jQuery(function($){
16
- var tweets = $('#tweets').bowline.init('twitter_binder');
17
-
18
- // Update status
19
- var update = function(){
20
- tweets.invoke('update', $('#update').val());
21
- }
22
-
23
- // Add event handlers
24
- $('#updateForm').submit(update);
25
-
26
- tweets.invoke('index');
27
- });
28
- </script>
7
+ <title>Twitter</title>
8
+ <!--
9
+ <script src="http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js" type="text/javascript"></script>
10
+ -->
11
+ <script src="javascripts/jquery.js" type="text/javascript" charset="utf-8"></script>
12
+ <script src="javascripts/jquery.chain.js" type="text/javascript" charset="utf-8"></script>
13
+ <script src="javascripts/jquery.bowline.js" type="text/javascript" charset="utf-8"></script>
14
+ <script src="../script/init" type="text/ruby" charset="utf-8"></script>
15
+ <script src="javascripts/application.js" type="text/javascript" charset="utf-8"></script>
16
+ <link rel="stylesheet" href="stylesheets/application.css" type="text/css" charset="utf-8">
17
+ <script type="text/javascript" charset="utf-8">
18
+ jQuery(function($){
19
+ var tweets = $('#tweets').bowline('tweets');
20
+ tweets.invoke('index');
21
+
22
+ $('#updateSubmit').click(function(){
23
+ tweets.invoke('update', $('#updateText').val());
24
+ return false;
25
+ })
26
+ });
27
+ </script>
29
28
  </head>
30
- <body>
31
- <div id="tweets">
32
- <div class="item">
33
- <img class="profile_image_url" />
34
- <span class="text">Loading...</span>
29
+ <body>
30
+ <div id="tweets">
31
+ <div class="item">
32
+ <span class="text"></span>
33
+ </div>
35
34
  </div>
36
- </div>
37
-
38
- <form action="updateForm" method="get" accept-charset="utf-8">
39
- <input type="text" name="update" id="update">
40
- <input type="submit" value="Update &rarr;">
41
- </form>
35
+
36
+ <input type="text" id="updateText">
37
+ <input type="submit" value="Update &rarr;" id="updateSubmit">
42
38
  </body>
43
39
  </html>
data/examples/users.rb ADDED
@@ -0,0 +1,37 @@
1
+ module Binders
2
+ class Users < Bowline::Binders::Collection
3
+ class << self
4
+ # self.items is a special method
5
+ # Basically it'll update users on the client side
6
+ def index
7
+ self.items = User.all
8
+ end
9
+
10
+ def admins
11
+ self.items = User.admins.all
12
+ end
13
+ end
14
+
15
+ def update(attrs)
16
+ if @item.update_attributes(attrs)
17
+ flash[:notice] = "Successfully updated"
18
+ else
19
+ flash[:notice] = "Errors updating users"
20
+ end
21
+ end
22
+
23
+ def highlight
24
+ # Calls $('user_1').highlight()
25
+ self.element.highlight
26
+ end
27
+
28
+ # Overrides charge on user
29
+ def charge!
30
+ # calls charge! on model (i.e. do sql commit )
31
+ self.item.charge!
32
+ # Now gui stuff
33
+ flash[:notice] = "Successfully charged"
34
+ highlight
35
+ end
36
+ end
37
+ end
@@ -1,3 +1,4 @@
1
+ require "config/environment"
1
2
  exec_path = File.join(APP_ROOT, 'build', 'osx', "#{APP_NAME}.app")
2
3
 
3
4
  unless File.exist?(exec_path)
@@ -6,8 +7,5 @@ unless File.exist?(exec_path)
6
7
  Rake::Task['app:bundle'].invoke
7
8
  end
8
9
 
9
- if ENV['debug']
10
- `open #{File.join(exec_path, 'Contents', 'MacOS', APP_NAME)}`
11
- else
12
- `open #{exec_path}`
13
- end
10
+ # Debug view
11
+ `open #{File.join(exec_path, 'Contents', 'MacOS', APP_NAME)}`
@@ -9,9 +9,14 @@ module Bowline::Generators
9
9
  end
10
10
 
11
11
  def destination_root
12
+ # Todo - only works relative
12
13
  File.join(@destination_root, base_name)
13
14
  end
14
15
 
16
+ def full_name
17
+ File.basename(name).camel_case
18
+ end
19
+
15
20
  first_argument :name, :required => true, :desc => "application name"
16
21
 
17
22
  empty_directory :tmp, "tmp"
@@ -26,7 +31,7 @@ module Bowline::Generators
26
31
  file :gitignore, "gitignore", ".gitignore"
27
32
 
28
33
  empty_directory :public, "public"
29
- file :index, "public/index.html", "public/index.html"
34
+ template :index, "public/index.html", "public/index.html"
30
35
  glob! "public/javascripts"
31
36
  glob! "public/stylesheets"
32
37
 
data/lib/bowline.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Bowline
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.6'
3
3
 
4
4
  # The raw JavaScript window object
5
5
  def self.js
@@ -2,7 +2,7 @@
2
2
  require File.join(File.dirname(__FILE__), 'boot')
3
3
 
4
4
  Bowline::Initializer.run do |config|
5
- config.name = <%= name.camel_case.inspect %>
5
+ config.name = <%= full_name.inspect %>
6
6
 
7
7
  # config.gem "net-mdns", :lib => 'net/dns/mdns'
8
8
  # config.gem "rack"
@@ -4,8 +4,10 @@
4
4
  <html lang="en">
5
5
  <head>
6
6
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
7
- <title>Bowline</title>
8
- <script type='text/javascript' src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
7
+ <title><%= full_name %></title>
8
+ <!--
9
+ <script src="http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js" type="text/javascript"></script>
10
+ -->
9
11
  <script src="javascripts/jquery.js" type="text/javascript" charset="utf-8"></script>
10
12
  <script src="javascripts/jquery.chain.js" type="text/javascript" charset="utf-8"></script>
11
13
  <script src="javascripts/jquery.bowline.js" type="text/javascript" charset="utf-8"></script>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maccman-bowline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex MacCaw
@@ -52,7 +52,7 @@ dependencies:
52
52
  - !ruby/object:Gem::Version
53
53
  version: 1.8.0
54
54
  version:
55
- description: My take on Ruby desktop GUIs
55
+ description: Ruby desktop application framework
56
56
  email:
57
57
  - info@eribium.org
58
58
  executables:
@@ -75,12 +75,11 @@ files:
75
75
  - assets/jquery.js
76
76
  - bin/bowline-gen
77
77
  - bowline.gemspec
78
- - examples/account_binder.rb
78
+ - examples/account.rb
79
79
  - examples/example.js
80
80
  - examples/twitter.html
81
- - examples/twitter_binder.rb
82
- - examples/twitter_login.html
83
- - examples/users_binder.rb
81
+ - examples/tweets.rb
82
+ - examples/users.rb
84
83
  - lib/bowline.rb
85
84
  - lib/bowline/binders.rb
86
85
  - lib/bowline/binders/collection.rb
@@ -149,6 +148,6 @@ rubyforge_project: maccman
149
148
  rubygems_version: 1.2.0
150
149
  signing_key:
151
150
  specification_version: 3
152
- summary: My take on Ruby desktop GUIs
151
+ summary: Ruby desktop application framework
153
152
  test_files: []
154
153
 
@@ -1,29 +0,0 @@
1
- class AccountBinder < Bowline::Singleton
2
- class << self
3
- # self.collection is a special method
4
- # Basically it'll update users on the client side
5
- def index
6
- self.item = current_account
7
- end
8
-
9
- def destroy
10
- current_account.destroy
11
- self.item = nil
12
- end
13
- end
14
-
15
- # Everything has a js_id which is basically the lowercase classname + _ + self.id
16
- def highlight
17
- # Calls $(element).highlight()
18
- self.element.highlight
19
- end
20
-
21
- # Overrides charge on user
22
- def charge!
23
- # calls charge on model (i.e. do sql commit )
24
- self.item.charge!
25
- # Now gui stuff
26
- flash[:notice] = "Successfully charged"
27
- highlight
28
- end
29
- end
@@ -1,46 +0,0 @@
1
- class TwitterBinder < Bowline::Binders::Collection
2
- cattr_accessor :user, :pass
3
-
4
- class << self
5
- def index
6
- self.items = timeline
7
- end
8
-
9
- def update(text)
10
- twit.update(text)
11
- index # update timeline
12
- end
13
-
14
- def login
15
- self.user, self.pass = params[:user], params[:pass]
16
- if logged_in?
17
- show_view :twitter
18
- index
19
- else
20
- js.alert('Credentials invalid')
21
- end
22
- end
23
-
24
- def logged_in?
25
- return false unless self.user && self.pass
26
- begin
27
- twit.timeline && true
28
- rescue Twitter::CantConnect
29
- false
30
- end
31
- end
32
-
33
- protected
34
- def twit
35
- httpauth = Twitter::HTTPAuth.new(self.user, self.pass)
36
- Twitter::Base.new(httpauth)
37
- end
38
-
39
- def timeline
40
- twit.friends_timeline.collect {|t|
41
- t.delete('user')
42
- t.to_hash
43
- }
44
- end
45
- end
46
- end
@@ -1,29 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
2
- "http://www.w3.org/TR/html4/strict.dtd">
3
-
4
- <html lang="en">
5
- <head>
6
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
7
- <title>twitter_login</title>
8
- <meta name="generator" content="TextMate http://macromates.com/">
9
- <meta name="author" content="Alex MacCaw">
10
- <!-- Date: 2009-01-10 -->
11
- <script src="jquery.js" type="text/javascript" charset="utf-8"></script>
12
- <script src="chain.js" type="text/javascript" charset="utf-8"></script>
13
- <script src="bowline.js" type="text/javascript" charset="utf-8"></script>
14
- </head>
15
- <body>
16
- <script type="text/javascript" charset="utf-8">
17
- jQuery(function($){
18
- $.setupForms();
19
- });
20
- </script>
21
-
22
- <form action="twitter_binder.login" method="get">
23
- <input type="text" name="user" id="user">
24
- <input type="password" name="pass" id="pass">
25
-
26
- <p><input type="submit" value="Login &rarr;"></p>
27
- </form>
28
- </body>
29
- </html>
@@ -1,39 +0,0 @@
1
- class UsersBinder < Bowline::Collection
2
- class << self
3
- # self.items is a special method
4
- # Basically it'll update users on the client side
5
- def index
6
- self.items = User.all
7
- end
8
-
9
- # def index(offset)
10
- # self.items = User.all(:conditions => ['id > ?', offset])
11
- # end
12
-
13
- def admins
14
- self.items = User.admins.all
15
- end
16
- end
17
-
18
- def update(attrs)
19
- if @item.update_attributes(attrs)
20
- flash[:notice] = "Successfully updated"
21
- else
22
- flash[:notice] = "Errors updating users"
23
- end
24
- end
25
-
26
- def highlight
27
- # Calls $('user_1').highlight()
28
- self.element.highlight
29
- end
30
-
31
- # Overrides charge on user
32
- def charge!
33
- # calls charge! on model (i.e. do sql commit )
34
- self.item.charge!
35
- # Now gui stuff
36
- flash[:notice] = "Successfully charged"
37
- highlight
38
- end
39
- end