bowline 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.txt +62 -62
- data/Rakefile +10 -0
- data/TODO +3 -1
- data/VERSION +1 -1
- data/assets/bowline.js +118 -3
- data/bowline.gemspec +6 -6
- data/examples/example.js +2 -15
- data/examples/tweet.rb +35 -0
- data/examples/tweets_binder.rb +6 -0
- data/examples/twitter.html +6 -8
- data/examples/users.rb +8 -14
- data/lib/bowline/binders.rb +130 -42
- data/lib/bowline/dependencies/lib/dependencies.rb +2 -1
- data/lib/bowline/dependencies/lib/ext/rubygems.rb +4 -4
- data/lib/bowline/desktop.rb +11 -2
- data/lib/bowline/desktop/app.rb +7 -3
- data/lib/bowline/desktop/bridge.rb +8 -9
- data/lib/bowline/desktop/clipboard.rb +11 -2
- data/lib/bowline/desktop/dialog.rb +19 -0
- data/lib/bowline/desktop/dock.rb +14 -3
- data/lib/bowline/desktop/host.rb +13 -4
- data/lib/bowline/desktop/js.rb +2 -2
- data/lib/bowline/desktop/misc.rb +7 -3
- data/lib/bowline/desktop/network.rb +1 -1
- data/lib/bowline/desktop/proxy.rb +28 -30
- data/lib/bowline/desktop/sound.rb +3 -2
- data/lib/bowline/desktop/window.rb +147 -21
- data/lib/bowline/desktop/window_manager.rb +53 -5
- data/lib/bowline/desktop/window_methods.rb +2 -2
- data/lib/bowline/ext/object.rb +1 -1
- data/lib/bowline/generators.rb +1 -1
- data/lib/bowline/generators/binder.rb +1 -1
- data/lib/bowline/helpers.rb +1 -1
- data/lib/bowline/initializer.rb +37 -4
- data/lib/bowline/library.rb +11 -0
- data/lib/bowline/local_model.rb +45 -19
- data/lib/bowline/logging.rb +1 -1
- data/lib/bowline/platform.rb +8 -6
- data/lib/bowline/tasks/app.rake +4 -3
- data/lib/bowline/version.rb +1 -1
- data/lib/bowline/watcher.rb +18 -8
- data/templates/binder.rb +1 -1
- data/vendor/pathname.rb +0 -4
- metadata +6 -6
- data/examples/account.rb +0 -31
- data/examples/tweets.rb +0 -28
data/lib/bowline/logging.rb
CHANGED
data/lib/bowline/platform.rb
CHANGED
@@ -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
|
-
#
|
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?
|
data/lib/bowline/tasks/app.rake
CHANGED
@@ -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 =
|
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
|
33
|
+
makeicns = File.join(assets_path, "makeicns")
|
34
34
|
if config.icon
|
35
|
-
makeicns_in = File.
|
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
|
data/lib/bowline/version.rb
CHANGED
data/lib/bowline/watcher.rb
CHANGED
@@ -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
|
-
|
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
data/vendor/pathname.rb
CHANGED
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.
|
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-
|
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/
|
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/
|
184
|
-
- examples/
|
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
|