bowline 0.5.3 → 0.5.4

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.
Files changed (47) hide show
  1. data/.gitignore +1 -0
  2. data/README.txt +62 -62
  3. data/Rakefile +10 -0
  4. data/TODO +3 -1
  5. data/VERSION +1 -1
  6. data/assets/bowline.js +118 -3
  7. data/bowline.gemspec +6 -6
  8. data/examples/example.js +2 -15
  9. data/examples/tweet.rb +35 -0
  10. data/examples/tweets_binder.rb +6 -0
  11. data/examples/twitter.html +6 -8
  12. data/examples/users.rb +8 -14
  13. data/lib/bowline/binders.rb +130 -42
  14. data/lib/bowline/dependencies/lib/dependencies.rb +2 -1
  15. data/lib/bowline/dependencies/lib/ext/rubygems.rb +4 -4
  16. data/lib/bowline/desktop.rb +11 -2
  17. data/lib/bowline/desktop/app.rb +7 -3
  18. data/lib/bowline/desktop/bridge.rb +8 -9
  19. data/lib/bowline/desktop/clipboard.rb +11 -2
  20. data/lib/bowline/desktop/dialog.rb +19 -0
  21. data/lib/bowline/desktop/dock.rb +14 -3
  22. data/lib/bowline/desktop/host.rb +13 -4
  23. data/lib/bowline/desktop/js.rb +2 -2
  24. data/lib/bowline/desktop/misc.rb +7 -3
  25. data/lib/bowline/desktop/network.rb +1 -1
  26. data/lib/bowline/desktop/proxy.rb +28 -30
  27. data/lib/bowline/desktop/sound.rb +3 -2
  28. data/lib/bowline/desktop/window.rb +147 -21
  29. data/lib/bowline/desktop/window_manager.rb +53 -5
  30. data/lib/bowline/desktop/window_methods.rb +2 -2
  31. data/lib/bowline/ext/object.rb +1 -1
  32. data/lib/bowline/generators.rb +1 -1
  33. data/lib/bowline/generators/binder.rb +1 -1
  34. data/lib/bowline/helpers.rb +1 -1
  35. data/lib/bowline/initializer.rb +37 -4
  36. data/lib/bowline/library.rb +11 -0
  37. data/lib/bowline/local_model.rb +45 -19
  38. data/lib/bowline/logging.rb +1 -1
  39. data/lib/bowline/platform.rb +8 -6
  40. data/lib/bowline/tasks/app.rake +4 -3
  41. data/lib/bowline/version.rb +1 -1
  42. data/lib/bowline/watcher.rb +18 -8
  43. data/templates/binder.rb +1 -1
  44. data/vendor/pathname.rb +0 -4
  45. metadata +6 -6
  46. data/examples/account.rb +0 -31
  47. data/examples/tweets.rb +0 -28
@@ -1,5 +1,5 @@
1
1
  module Bowline
2
- # To be included in classes to allow some basic logging
2
+ # To be included in classes to allow some basic logging.
3
3
  module Logging
4
4
  def trace(msg=nil)
5
5
  Bowline.logger.info(msg)
@@ -1,8 +1,8 @@
1
- # naive platform detection for Ruby
2
- # Based on code by Matt Mower <self@mattmower.com>
3
- # http://matt.blogs.it/gems/ruby/platform.rb
4
-
5
1
  module Bowline
2
+ # Naive platform detection for Ruby
3
+ #
4
+ # Based on code by Matt Mower <self@mattmower.com>
5
+ # http://matt.blogs.it/gems/ruby/platform.rb
6
6
  module Platform
7
7
  if RUBY_PLATFORM =~ /darwin/i
8
8
  OS = :unix
@@ -60,8 +60,10 @@ module Bowline
60
60
  end
61
61
  module_function :win32?
62
62
 
63
- # Return OS type:
64
- # Bowline::Platform.type # => :osx
63
+ # Return OS type. An error is raised
64
+ # on platforms unsupported by Bowline.
65
+ # Example:
66
+ # Bowline::Platform.type # => :osx
65
67
  def type
66
68
  return :osx if osx?
67
69
  return :linux if linux?
@@ -11,7 +11,7 @@ namespace :app do
11
11
 
12
12
  config = Bowline.configuration
13
13
  assets_path = File.join(Bowline.assets_path, "osx")
14
- build_path = File.join(APP_ROOT, "build")
14
+ build_path = Bowline::Library.local_build_path
15
15
  app_path = File.join(build_path, "#{config.name}.app")
16
16
  FileUtils.rm_rf(app_path)
17
17
  contents_path = File.join(app_path, "Contents")
@@ -30,9 +30,9 @@ namespace :app do
30
30
  FileUtils.mkdir("English.lproj")
31
31
 
32
32
  # Make icon
33
- makeicns = File.join(assets_path, "makeicns")
33
+ makeicns = File.join(assets_path, "makeicns")
34
34
  if config.icon
35
- makeicns_in = File.join(APP_ROOT, config.icon)
35
+ makeicns_in = File.expand_path(config.icon, APP_ROOT)
36
36
  else
37
37
  makeicns_in = File.join(assets_path, "bowline.png")
38
38
  end
@@ -96,5 +96,6 @@ namespace :app do
96
96
  desc "Build app"
97
97
  task :build do
98
98
  Rake::Task["app:build:#{Bowline::Platform.type}"].invoke
99
+ puts "Successfully built application: #{Bowline::Library.local_build_path}"
99
100
  end
100
101
  end
@@ -2,7 +2,7 @@ module Bowline
2
2
  module Version #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 5
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
 
@@ -18,8 +18,11 @@ module Bowline
18
18
  #
19
19
  # MyClass.on_update { puts 'update' }
20
20
  # MyClass.new.on_create { puts 'create' }
21
-
22
- module Base
21
+ module Base
22
+ # Create a helper method to easily add new callbacks.
23
+ # Example:
24
+ # watch :on_load
25
+ # on_load { puts "Loaded!" }
23
26
  def watch(*names)
24
27
  names.each do |name|
25
28
  # Because define_method only takes a block,
@@ -45,11 +48,13 @@ module Bowline
45
48
  def initialize(watcher, event, prok)
46
49
  @watcher, @event, @prok = watcher, event, prok
47
50
  end
48
-
51
+
52
+ # Execute callback
49
53
  def call(*args)
50
54
  @prok.call(*args)
51
55
  end
52
-
56
+
57
+ # Remove callback from watcher
53
58
  def remove
54
59
  @watcher.remove(@event, @prok)
55
60
  end
@@ -58,20 +63,24 @@ module Bowline
58
63
  def initialize
59
64
  @listeners = {}
60
65
  end
61
-
66
+
67
+ # Add new method/proc to a specific event.
62
68
  def append(event, method = nil, &block)
63
69
  callback = Callback.new(self, event, method||block)
64
70
  (@listeners[event] ||= []) << callback
65
71
  callback
66
72
  end
67
-
73
+
74
+ # Call an event's callbacks with provided arguments.
68
75
  def call(event, *args)
69
76
  return unless @listeners[event]
70
77
  @listeners[event].each do |callback|
71
78
  callback.call(*args)
72
79
  end
73
80
  end
74
-
81
+
82
+ # Remove an specific callback on an event,
83
+ # or all an event's callbacks.
75
84
  def remove(event, value=nil)
76
85
  return unless @listeners[event]
77
86
  if value
@@ -83,7 +92,8 @@ module Bowline
83
92
  @listeners.delete(event)
84
93
  end
85
94
  end
86
-
95
+
96
+ # Clear all events and callbacks.
87
97
  def clear
88
98
  @listeners = {}
89
99
  end
data/templates/binder.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class <%= class_name %>
2
- # expose <%= expose_name %>
2
+ # bind <%= bind_name %>
3
3
  end
data/vendor/pathname.rb CHANGED
@@ -1084,10 +1084,6 @@ class Pathname # * mixed *
1084
1084
  end
1085
1085
  end
1086
1086
 
1087
- class Pathname
1088
- undef =~
1089
- end
1090
-
1091
1087
  module Kernel
1092
1088
  # create a pathname object.
1093
1089
  #
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.3
4
+ version: 0.5.4
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-20 00:00:00 +00:00
12
+ date: 2009-12-22 00:00:00 +00:00
13
13
  default_executable: bowline-gen
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -68,9 +68,9 @@ files:
68
68
  - assets/osx/makeicns
69
69
  - bin/bowline-gen
70
70
  - bowline.gemspec
71
- - examples/account.rb
72
71
  - examples/example.js
73
- - examples/tweets.rb
72
+ - examples/tweet.rb
73
+ - examples/tweets_binder.rb
74
74
  - examples/twitter.html
75
75
  - examples/users.rb
76
76
  - lib/bowline.rb
@@ -180,6 +180,6 @@ signing_key:
180
180
  specification_version: 3
181
181
  summary: Bowline GUI framework
182
182
  test_files:
183
- - examples/account.rb
184
- - examples/tweets.rb
183
+ - examples/tweet.rb
184
+ - examples/tweets_binder.rb
185
185
  - examples/users.rb
data/examples/account.rb DELETED
@@ -1,31 +0,0 @@
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
data/examples/tweets.rb DELETED
@@ -1,28 +0,0 @@
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