bowline 0.5.5 → 0.5.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/TODO CHANGED
@@ -3,11 +3,21 @@ Use new Rails gem packaging system
3
3
  Ideas:
4
4
  * bowline-notification gem (Growl)
5
5
 
6
- Investigate performance issue (happens when lots of js is executed without a break)
7
6
  Investigate thread safety
8
7
 
9
8
  Load all required JS through Bowline (so you only have to require one JS file)
10
9
 
11
10
  Add --version to bowline-gen
12
11
 
13
- Update bowline-twitter
12
+ Developer tools:
13
+ F5 to reload page
14
+ Show inspector
15
+ Reload ruby
16
+
17
+ Tutorials:
18
+ Drag and drop
19
+ CSS gradients
20
+ CSS webkit-box (layouts)
21
+ CSS search box & placeholder
22
+
23
+ Don't run initializers during rake tasks
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.5
1
+ 0.5.6
data/assets/bowline.js CHANGED
@@ -114,7 +114,6 @@
114
114
  */
115
115
 
116
116
  var Bowline = {
117
- msgs: [],
118
117
  callbacks: {},
119
118
  uuid: 0,
120
119
  bounds: {},
@@ -146,7 +145,10 @@ var Bowline = {
146
145
 
147
146
  Bowline.log("New message:")
148
147
  Bowline.log(msg);
149
- Bowline.msgs.push(msg);
148
+
149
+ // wx is a function defined in Objective C
150
+ if(typeof(wx) != undefined)
151
+ wx.call(JSON.stringify(msg));
150
152
  },
151
153
 
152
154
  // Usage: instanceInvoke(klass, id, method, *args)
@@ -183,12 +185,6 @@ var Bowline = {
183
185
 
184
186
  // Bowline functions
185
187
 
186
- pollJS: function(){
187
- var res = JSON.stringify(Bowline.msgs);
188
- Bowline.msgs = [];
189
- return res;
190
- },
191
-
192
188
  invokeJS: function(str){
193
189
  Bowline.log("Invoking: " + str);
194
190
  return JSON.stringify(eval(str));
data/bowline.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bowline}
8
- s.version = "0.5.5"
8
+ s.version = "0.5.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Alex MacCaw"]
12
- s.date = %q{2009-12-23}
12
+ s.date = %q{2009-12-27}
13
13
  s.default_executable = %q{bowline-gen}
14
14
  s.description = %q{Ruby/JS GUI framework}
15
15
  s.email = %q{alex@leadthinking.com}
@@ -65,20 +65,24 @@ module Bowline
65
65
  def windows
66
66
  @windows ||= []
67
67
  end
68
+
69
+ def setup(window) #:nodoc:
70
+ self.windows << window
71
+ window.bowline.populate(
72
+ name, initial.to_js
73
+ ).call
74
+ true
75
+ end
68
76
 
69
77
  # Called by a window's JavaScript whenever that window is bound to this Binder.
70
78
  # This method populates the window's HTML with all bound class' records.
71
79
  # Override this if you don't want to send all the class' records to the window.
72
80
  # Example:
73
- # def setup(window)
74
- # super(window, last_10_tweets)
75
- # end
76
- def setup(window, items = all)
77
- self.windows << window
78
- window.bowline.populate(
79
- name, items.to_js
80
- ).call
81
- true
81
+ # def initial
82
+ # klass.all(:limit => 10)
83
+ # end
84
+ def initial
85
+ klass.all
82
86
  end
83
87
 
84
88
  def js_invoke(window, method, *args) #:nodoc:
@@ -100,12 +104,6 @@ module Bowline
100
104
  klass.find(id)
101
105
  end
102
106
 
103
- # Calls .all on the klass sent to the bind method.
104
- # This method is called internally by the setup method.
105
- def all
106
- klass.all
107
- end
108
-
109
107
  # Set the binder's items. This will replace all items, and update the HTML.
110
108
  def items=(items)
111
109
  bowline.populate(name, items.to_js).call
@@ -38,10 +38,6 @@ module Bowline
38
38
  class Message #:nodoc:
39
39
  include Bowline::Logging
40
40
 
41
- def self.from_array(window, arr)
42
- arr.map {|i| self.new(window, i) }
43
- end
44
-
45
41
  attr_reader :window, :id, :klass, :method, :args
46
42
 
47
43
  def initialize(window, atts)
@@ -74,23 +70,13 @@ module Bowline
74
70
  end
75
71
  end
76
72
 
77
- def setup #:nodoc:
78
- Desktop.on_tick(method(:poll))
79
- end
80
- module_function :setup
81
-
82
- def poll #:nodoc:
83
- WindowManager.allocated_windows.each do |window|
84
- result = window.run_script("try {Bowline.pollJS()} catch(e) {false}")
85
- next if result.blank? || result == "false"
86
- result = JSON.parse(result)
87
- messages = Message.from_array(window, result)
88
- messages.each(&:invoke)
89
- end
73
+ def call(window, str) #:nodoc:
74
+ result = JSON.parse(str)
75
+ Message.new(window, result).invoke
90
76
  rescue => e
91
77
  Bowline::Logging.log_error(e)
92
78
  end
93
- module_function :poll
79
+ module_function :call
94
80
  end
95
81
  end
96
82
  end
@@ -63,6 +63,9 @@ module Bowline
63
63
  else
64
64
  @window = Window.new
65
65
  end
66
+ @window.script_callback = Proc.new {|str|
67
+ Bowline::Desktop::Bridge.call(self, str)
68
+ }
66
69
  end
67
70
 
68
71
  # Evaluate JavaScript in this window. Pass
@@ -267,7 +267,6 @@ module Bowline
267
267
  def initialize_js
268
268
  return unless Bowline::Desktop.enabled?
269
269
  Bowline::Desktop::JS.setup
270
- Bowline::Desktop::Bridge.setup
271
270
  end
272
271
 
273
272
  def initialize_windows
@@ -2,7 +2,7 @@ module Bowline
2
2
  module Version #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 5
5
- TINY = 5
5
+ TINY = 6
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
 
@@ -10,11 +10,10 @@
10
10
  <script src="javascripts/bowline.js" type="text/javascript" charset="utf-8"></script>
11
11
  <script src="javascripts/application.js" type="text/javascript" charset="utf-8"></script>
12
12
  <script type="text/javascript" charset="utf-8">
13
- // Example:
13
+ // Binder Example:
14
14
  // jQuery(function($){
15
15
  // $.bowline.ready(function(){
16
- // $('#tweets').bowline('tweets');
17
- // $('#tweets').invoke('index');
16
+ // $('#tweets').bindto('TweetsBinder');
18
17
  // })
19
18
  // });
20
19
  </script>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bowline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex MacCaw
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-23 00:00:00 +00:00
12
+ date: 2009-12-27 00:00:00 +00:00
13
13
  default_executable: bowline-gen
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency