maccman-bowline 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +2 -4
- data/VERSION +1 -1
- data/assets/jquery.bowline.js +16 -9
- data/bowline.gemspec +5 -4
- data/lib/bowline/binders/collection.rb +1 -1
- data/lib/bowline/binders.rb +2 -33
- data/lib/bowline/generators/application.rb +4 -0
- data/lib/bowline/helpers.rb +4 -0
- data/lib/bowline/initializer.rb +29 -8
- data/lib/bowline/observer.rb +42 -19
- data/lib/bowline/tasks/app.rake +125 -76
- data/lib/bowline/tasks/{misk.rake → misc.rake} +0 -0
- data/lib/bowline.rb +2 -1
- data/templates/config/boot.rb +1 -1
- data/templates/config/environment.rb +6 -2
- data/templates/gitignore +0 -2
- data/templates/public/icon.png +0 -0
- data/templates/public/index.html +1 -1
- metadata +5 -4
- data/Manifest.txt +0 -58
data/README.txt
CHANGED
@@ -43,12 +43,10 @@ Install the Twitter gem:
|
|
43
43
|
|
44
44
|
Add the Twitter gem to config/environment.rb:
|
45
45
|
config.gem "twitter"
|
46
|
-
|
47
|
-
run:
|
48
|
-
>> rake app:bundle TIPATH=~/path/to/titanium
|
49
46
|
|
50
47
|
run:
|
51
|
-
|
48
|
+
>> rake app:bundle
|
49
|
+
>> rake app:build
|
52
50
|
|
53
51
|
That's it
|
54
52
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.8
|
data/assets/jquery.bowline.js
CHANGED
@@ -43,15 +43,12 @@
|
|
43
43
|
// Length on a Ruby array is a function
|
44
44
|
rubyMap: function( elems, callback ) {
|
45
45
|
var ret = [];
|
46
|
-
|
47
|
-
for ( var i = 0, length = elems.length(); i < length; i++ ) {
|
46
|
+
for (var i = 0, length = elems.length(); i < length; i++) {
|
48
47
|
var value = callback( elems[ i ], i );
|
49
|
-
|
50
|
-
|
51
|
-
ret[ ret.length ] = value;
|
48
|
+
if (value != null)
|
49
|
+
ret[ret.length] = value;
|
52
50
|
}
|
53
|
-
|
54
|
-
return ret.concat.apply( [], ret );
|
51
|
+
return ret.concat.apply([], ret);
|
55
52
|
}
|
56
53
|
},
|
57
54
|
|
@@ -85,12 +82,22 @@
|
|
85
82
|
return $.bowline.rubyHash(n);
|
86
83
|
});
|
87
84
|
$(this).items('replace', items);
|
88
|
-
$(this).trigger('update
|
85
|
+
$(this).trigger('update.bowline');
|
89
86
|
};
|
90
87
|
|
91
88
|
$.fn.updateSingleton = function( item ){
|
92
89
|
item = $.bowline.rubyHash(item);
|
93
90
|
$(this).item('replace', item);
|
94
|
-
$(this).trigger('update
|
91
|
+
$(this).trigger('update.bowline');
|
95
92
|
};
|
93
|
+
|
94
|
+
$(function(){
|
95
|
+
$(document.body).trigger('loading.bowline');
|
96
|
+
// Todo - http://support.appcelerator.net/discussions/support/117-ruby-script-tag-cant-be-added-dynamically
|
97
|
+
// var script = $("<script />");
|
98
|
+
// script.attr('type', 'text/ruby');
|
99
|
+
// script.attr('src', '../script/init');
|
100
|
+
// $(document.body).append(script);
|
101
|
+
$(document.body).trigger('loaded.bowline');
|
102
|
+
})
|
96
103
|
})(jQuery)
|
data/bowline.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{bowline}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.8"
|
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
|
-
s.date = %q{2009-07-
|
9
|
+
s.date = %q{2009-07-09}
|
10
10
|
s.default_executable = %q{bowline-gen}
|
11
11
|
s.description = %q{Ruby/JS GUI framework}
|
12
12
|
s.email = %q{alex@leadthinking.com}
|
@@ -18,7 +18,6 @@ Gem::Specification.new do |s|
|
|
18
18
|
".gitignore",
|
19
19
|
"History.txt",
|
20
20
|
"MIT-LICENSE",
|
21
|
-
"Manifest.txt",
|
22
21
|
"README.txt",
|
23
22
|
"Rakefile",
|
24
23
|
"VERSION",
|
@@ -49,6 +48,7 @@ Gem::Specification.new do |s|
|
|
49
48
|
"lib/bowline/generators/binder.rb",
|
50
49
|
"lib/bowline/generators/migration.rb",
|
51
50
|
"lib/bowline/generators/model.rb",
|
51
|
+
"lib/bowline/helpers.rb",
|
52
52
|
"lib/bowline/initializer.rb",
|
53
53
|
"lib/bowline/jquery.rb",
|
54
54
|
"lib/bowline/observer.rb",
|
@@ -56,7 +56,7 @@ Gem::Specification.new do |s|
|
|
56
56
|
"lib/bowline/tasks/bowline.rb",
|
57
57
|
"lib/bowline/tasks/database.rake",
|
58
58
|
"lib/bowline/tasks/log.rake",
|
59
|
-
"lib/bowline/tasks/
|
59
|
+
"lib/bowline/tasks/misc.rake",
|
60
60
|
"templates/Rakefile",
|
61
61
|
"templates/binder.rb",
|
62
62
|
"templates/config/application.yml",
|
@@ -68,6 +68,7 @@ Gem::Specification.new do |s|
|
|
68
68
|
"templates/gitignore",
|
69
69
|
"templates/migration.rb",
|
70
70
|
"templates/model.rb",
|
71
|
+
"templates/public/icon.png",
|
71
72
|
"templates/public/index.html",
|
72
73
|
"templates/public/javascripts/application.js",
|
73
74
|
"templates/public/stylesheets/application.css",
|
data/lib/bowline/binders.rb
CHANGED
@@ -34,8 +34,7 @@ module Bowline
|
|
34
34
|
when String
|
35
35
|
# Params comes in a string (since it's a
|
36
36
|
# serialized form) - we need to make it into
|
37
|
-
# a nestled hash.
|
38
|
-
# Stolen from Ramaze
|
37
|
+
# a nestled hash. Stolen from Ramaze
|
39
38
|
m = proc {|_,o,n|o.merge(n,&m)}
|
40
39
|
@@params = params.inject({}) do |hash, (key, value)|
|
41
40
|
parts = key.split(/[\]\[]+/)
|
@@ -55,9 +54,7 @@ module Bowline
|
|
55
54
|
def instance(el)
|
56
55
|
self.new(el).method(:send)
|
57
56
|
end
|
58
|
-
|
59
|
-
# todo - flash?
|
60
|
-
|
57
|
+
|
61
58
|
def inherited(child)
|
62
59
|
return if self == Bowline::Binders::Base
|
63
60
|
return if child == Bowline::Binders::Singleton
|
@@ -73,11 +70,6 @@ module Bowline
|
|
73
70
|
attr_reader :element
|
74
71
|
attr_reader :item
|
75
72
|
|
76
|
-
# Todo
|
77
|
-
# We want initialize method to take
|
78
|
-
# no argument, and for every item in items
|
79
|
-
# to have initialize called on startup,
|
80
|
-
# so they can set up event handlers etc
|
81
73
|
def self.new(element, *args) #:nodoc:
|
82
74
|
allocate.instance_eval do
|
83
75
|
# jQuery element
|
@@ -102,29 +94,6 @@ module Bowline
|
|
102
94
|
self.element.trigger(event, data)
|
103
95
|
end
|
104
96
|
|
105
|
-
# Bind event to element:
|
106
|
-
# bind(:click) { puts "element clicked" }
|
107
|
-
# todo - two events with the same item/event overwrite each other
|
108
|
-
# todo - need initalize method on class - so we can set events there
|
109
|
-
def bind(event, method_name, &block)
|
110
|
-
event_name = [event, item_id].join(":")
|
111
|
-
callback = block
|
112
|
-
callback ||= begin
|
113
|
-
method_name.is_a?(Method) ?
|
114
|
-
method_name : method(method_name)
|
115
|
-
end
|
116
|
-
self.observer.append(event_name, callback)
|
117
|
-
self.element.bind(
|
118
|
-
event.to_s,
|
119
|
-
event_name,
|
120
|
-
self.observer.method(:call)
|
121
|
-
)
|
122
|
-
end
|
123
|
-
|
124
|
-
def click(method_name = nil, &block)
|
125
|
-
bind(:click, method, &block)
|
126
|
-
end
|
127
|
-
|
128
97
|
# Raw DOM element
|
129
98
|
def dom
|
130
99
|
self.element[0]
|
@@ -31,7 +31,10 @@ module Bowline::Generators
|
|
31
31
|
file :gitignore, "gitignore", ".gitignore"
|
32
32
|
|
33
33
|
empty_directory :public, "public"
|
34
|
+
|
34
35
|
template :index, "public/index.html", "public/index.html"
|
36
|
+
file :logo, "public/icon.png", "public/icon.png"
|
37
|
+
|
35
38
|
glob! "public/javascripts"
|
36
39
|
glob! "public/stylesheets"
|
37
40
|
|
@@ -44,6 +47,7 @@ module Bowline::Generators
|
|
44
47
|
empty_directory :app, "app"
|
45
48
|
empty_directory :models, "app/models"
|
46
49
|
empty_directory :binders, "app/binders"
|
50
|
+
empty_directory :binders, "app/helpers"
|
47
51
|
empty_directory :config, "config"
|
48
52
|
|
49
53
|
template :environment, "config/environment.rb", "config/environment.rb"
|
data/lib/bowline/initializer.rb
CHANGED
@@ -173,14 +173,7 @@ module Bowline
|
|
173
173
|
end
|
174
174
|
|
175
175
|
def initialize_rubygems
|
176
|
-
|
177
|
-
# $LOAD_PATH << File.join(root, 'ruby', 'rubygems')
|
178
|
-
# ::GEM_DIR = File.join(root, 'ruby', 'gems')
|
179
|
-
# $LOAD_PATH << GEM_DIR
|
180
|
-
# ENV['GEM_HOME'] = GEM_DIR
|
181
|
-
# require 'rubygems'
|
182
|
-
# Gem.use_paths(GEM_DIR, [GEM_DIR])
|
183
|
-
# Gem.source_index.refresh!
|
176
|
+
require 'rubygems'
|
184
177
|
end
|
185
178
|
|
186
179
|
def add_gem_load_paths
|
@@ -212,6 +205,13 @@ module Bowline
|
|
212
205
|
end
|
213
206
|
end
|
214
207
|
|
208
|
+
def load_application_helpers
|
209
|
+
helpers = configuration.helpers
|
210
|
+
helpers = helpers.map(&:constantize)
|
211
|
+
helpers.each {|h| Helpers.module_eval { include h } }
|
212
|
+
Bowline.js.helper = Helpers
|
213
|
+
end
|
214
|
+
|
215
215
|
def load_application_classes
|
216
216
|
if configuration.cache_classes
|
217
217
|
configuration.eager_load_paths.each do |load_path|
|
@@ -286,6 +286,7 @@ module Bowline
|
|
286
286
|
after_initialize
|
287
287
|
|
288
288
|
load_application_classes
|
289
|
+
load_application_helpers
|
289
290
|
|
290
291
|
Bowline.initialized = true
|
291
292
|
end
|
@@ -399,9 +400,19 @@ module Bowline
|
|
399
400
|
|
400
401
|
attr_accessor :plugin_glob
|
401
402
|
|
403
|
+
attr_accessor :helper_glob
|
404
|
+
|
402
405
|
attr_accessor :initializer_glob
|
403
406
|
|
404
407
|
attr_accessor :name
|
408
|
+
attr_accessor :id
|
409
|
+
attr_accessor :version
|
410
|
+
attr_accessor :description
|
411
|
+
attr_accessor :publisher
|
412
|
+
attr_accessor :url
|
413
|
+
attr_accessor :icon
|
414
|
+
attr_accessor :sdk
|
415
|
+
attr_accessor :copyright
|
405
416
|
|
406
417
|
# Create a new Configuration instance, initialized with the default
|
407
418
|
# values.
|
@@ -422,6 +433,7 @@ module Bowline
|
|
422
433
|
self.app_config_file = default_app_config_file
|
423
434
|
self.gems = default_gems
|
424
435
|
self.plugin_glob = default_plugin_glob
|
436
|
+
self.helper_glob = default_helper_glob
|
425
437
|
self.initializer_glob = default_initalizer_glob
|
426
438
|
|
427
439
|
for framework in default_frameworks
|
@@ -462,6 +474,10 @@ module Bowline
|
|
462
474
|
YAML::load(ERB.new(IO.read(database_configuration_file)).result) if File.exists?(database_configuration_file)
|
463
475
|
end
|
464
476
|
|
477
|
+
def helpers
|
478
|
+
Dir[helper_glob].map {|f| File.basename(f) }
|
479
|
+
end
|
480
|
+
|
465
481
|
# Adds a block which will be executed after bowline has been fully initialized.
|
466
482
|
# Useful for per-environment configuration which depends on the framework being
|
467
483
|
# fully initialized.
|
@@ -515,6 +531,7 @@ module Bowline
|
|
515
531
|
app/models
|
516
532
|
app/remote
|
517
533
|
app/binders
|
534
|
+
app/helpers
|
518
535
|
).map { |dir| "#{root_path}/#{dir}" }.select { |dir| File.directory?(dir) }
|
519
536
|
end
|
520
537
|
|
@@ -554,6 +571,10 @@ module Bowline
|
|
554
571
|
File.join(root_path, *%w{ vendor plugins * })
|
555
572
|
end
|
556
573
|
|
574
|
+
def default_helper_glob
|
575
|
+
File.join(root_path, *%w{ app helpers *.rb })
|
576
|
+
end
|
577
|
+
|
557
578
|
def default_initalizer_glob
|
558
579
|
File.join(root_path, *%w{ config initializers **/*.rb })
|
559
580
|
end
|
data/lib/bowline/observer.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# o =
|
1
|
+
# o = Observable.new
|
2
2
|
# o.append('greet') {
|
3
3
|
# puts 'hi'
|
4
4
|
# }
|
@@ -7,35 +7,58 @@
|
|
7
7
|
# def greet(who)
|
8
8
|
# puts "Hi #{who}"
|
9
9
|
# end
|
10
|
-
# o.append('greet', method(:greet), 'Alex')
|
10
|
+
# event = o.append('greet', method(:greet), 'Alex')
|
11
11
|
# o.call('greet')
|
12
|
+
# event.remove
|
12
13
|
|
13
14
|
module Bowline
|
14
|
-
class
|
15
|
+
class Observable
|
16
|
+
class Event
|
17
|
+
attr_reader :type, :callback
|
18
|
+
def initialize(observable, type, callback = nil)
|
19
|
+
@observable = observable
|
20
|
+
@type = type
|
21
|
+
@callback = callback
|
22
|
+
end
|
23
|
+
|
24
|
+
def call(*args)
|
25
|
+
@callback.call(*args)
|
26
|
+
end
|
27
|
+
|
28
|
+
def remove
|
29
|
+
@observable.remove(self)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
15
33
|
def initialize
|
16
34
|
@listeners = {}
|
17
35
|
end
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
(@listeners[event
|
36
|
+
|
37
|
+
def append(event, method = nil, &block)
|
38
|
+
event = Event.new(self, event, method||block)
|
39
|
+
(@listeners[event] ||= []) << event
|
40
|
+
event
|
22
41
|
end
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
42
|
+
|
43
|
+
def call(event, *args)
|
44
|
+
return unless @listeners[event]
|
45
|
+
@listeners[event].each do |callback|
|
46
|
+
callback.call(*args)
|
47
|
+
end
|
28
48
|
end
|
29
49
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
50
|
+
def remove(event, value=nil)
|
51
|
+
return unless @listeners[event]
|
52
|
+
if value
|
53
|
+
@listeners[event].delete(value)
|
54
|
+
if @listeners[event].empty?
|
55
|
+
@listeners.delete(event)
|
56
|
+
end
|
57
|
+
else
|
58
|
+
@listeners.delete(event)
|
35
59
|
end
|
36
|
-
@listeners.delete(event)
|
37
60
|
end
|
38
|
-
|
61
|
+
|
39
62
|
def clear
|
40
63
|
@listeners = {}
|
41
64
|
end
|
data/lib/bowline/tasks/app.rake
CHANGED
@@ -1,90 +1,139 @@
|
|
1
1
|
require 'fileutils'
|
2
|
-
namespace :app do
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
namespace :app do
|
3
|
+
task :configure => :environment do
|
4
|
+
build_path = File.join(APP_ROOT, 'build')
|
5
|
+
|
6
|
+
conf = Bowline.configuration
|
7
|
+
|
8
|
+
# Titanium complains about whitespace
|
9
|
+
manifest = <<-EOF
|
10
|
+
#appname:#{conf.name}
|
11
|
+
#appid:#{conf.id}
|
12
|
+
#publisher:#{conf.publisher}
|
13
|
+
#image:public/logo.png
|
14
|
+
#url:#{conf.url}
|
15
|
+
#guid:0e70684a-dd4b-4d97-9396-6bc01ba10a4e
|
16
|
+
#desc:#{conf.description}
|
17
|
+
#type:desktop
|
18
|
+
runtime:0.4.4
|
19
|
+
api:0.4.4
|
20
|
+
tiapp:0.4.4
|
21
|
+
tifilesystem:0.4.4
|
22
|
+
tiplatform:0.4.4
|
23
|
+
tiui:0.4.4
|
24
|
+
javascript:0.4.4
|
25
|
+
tianalytics:0.4.4
|
26
|
+
ruby:0.4.4
|
27
|
+
tidatabase:0.4.4
|
28
|
+
tidesktop:0.4.4
|
29
|
+
tigrowl:0.4.4
|
30
|
+
timedia:0.4.4
|
31
|
+
timonkey:0.4.4
|
32
|
+
tinetwork:0.4.4
|
33
|
+
tinotification:0.4.4
|
34
|
+
tiprocess:0.4.4
|
35
|
+
EOF
|
36
|
+
|
37
|
+
conf.publisher ||= 'Bowline'
|
38
|
+
conf.copyright ||= "Copyright © #{Time.now.year}"
|
39
|
+
|
40
|
+
tiapp = <<-EOF
|
41
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
42
|
+
<ti:app xmlns:ti='http://ti.appcelerator.org'>
|
43
|
+
<id>#{conf.id}</id>
|
44
|
+
<name>#{conf.name}</name>
|
45
|
+
<version>#{conf.version}</version>
|
46
|
+
<publisher>#{conf.publisher}</publisher>
|
47
|
+
<url>#{conf.url}</url>
|
48
|
+
<icon>public/icon.png</icon>
|
49
|
+
<copyright>#{conf.copyright}</copyright>
|
50
|
+
<window>
|
51
|
+
<id>initial</id>
|
52
|
+
<title>#{conf.name}</title>
|
53
|
+
<url>app://public/index.html</url>
|
54
|
+
<width>700</width>
|
55
|
+
<max-width>3000</max-width>
|
56
|
+
<min-width>0</min-width>
|
57
|
+
<height>800</height>
|
58
|
+
<max-height>3000</max-height>
|
59
|
+
<min-height>0</min-height>
|
60
|
+
<fullscreen>false</fullscreen>
|
61
|
+
<resizable>true</resizable>
|
62
|
+
<chrome scrollbars="true">true</chrome>
|
63
|
+
<maximizable>true</maximizable>
|
64
|
+
<minimizable>true</minimizable>
|
65
|
+
<closeable>true</closeable>
|
66
|
+
</window>
|
67
|
+
</ti:app>
|
68
|
+
EOF
|
69
|
+
|
70
|
+
FileUtils.makedirs(build_path)
|
71
|
+
FileUtils.cd(build_path) do
|
72
|
+
File.open('manifest', 'w+') {|f| f.write manifest }
|
73
|
+
File.open('tiapp.xml', 'w+') {|f| f.write tiapp }
|
11
74
|
end
|
75
|
+
end
|
12
76
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
titanium_path = File.expand_path(titanium_path)
|
77
|
+
desc "Bundles up app into executables"
|
78
|
+
task :bundle do
|
79
|
+
build_path = File.join(APP_ROOT, 'build')
|
80
|
+
app_path = File.join(build_path, 'app')
|
18
81
|
|
19
|
-
|
20
|
-
|
21
|
-
FileUtils.rm_rf(build_path)
|
82
|
+
tiapp = File.join(build_path, 'tiapp.xml')
|
83
|
+
manifest = File.join(build_path, 'manifest')
|
22
84
|
|
23
|
-
|
24
|
-
|
85
|
+
if !File.exists?(tiapp) || !File.exists?(manifest)
|
86
|
+
Rake::Task['app:configure'].invoke
|
87
|
+
end
|
25
88
|
|
26
|
-
|
27
|
-
|
89
|
+
# Todo - check gem dependencies
|
90
|
+
FileUtils.rm_rf(app_path)
|
91
|
+
FileUtils.makedirs(app_path)
|
28
92
|
|
29
|
-
|
30
|
-
|
31
|
-
FileUtils.cp_r('runtime/installer', build_path)
|
32
|
-
FileUtils.cp_r('modules', build_path)
|
33
|
-
FileUtils.cp_r('runtime', build_path)
|
34
|
-
# FileUtils.cp_r('Frameworks', build_path) # todo
|
35
|
-
end
|
36
|
-
|
37
|
-
# Todo - put this in config?
|
38
|
-
File.open(File.join(build_path, 'Info.plist'), 'w+') do |f|
|
39
|
-
f.write <<-EOF
|
40
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
41
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
42
|
-
<plist version="1.0">
|
43
|
-
<dict>
|
44
|
-
<key>CFBundleDevelopmentRegion</key>
|
45
|
-
<string>English</string>
|
46
|
-
<key>CFBundleExecutable</key>
|
47
|
-
<string>#{APP_NAME}</string>
|
48
|
-
<key>CFBundleIconFile</key>
|
49
|
-
<string>titanium.icns</string>
|
50
|
-
<key>CFBundleIdentifier</key>
|
51
|
-
<string>com.titaniumapp.testapp</string>
|
52
|
-
<key>CFBundleInfoDictionaryVersion</key>
|
53
|
-
<string>6.0</string>
|
54
|
-
<key>CFBundleName</key>
|
55
|
-
<string>#{APP_NAME}</string>
|
56
|
-
<key>CFBundlePackageType</key>
|
57
|
-
<string>APPL</string>
|
58
|
-
<key>CFBundleSignature</key>
|
59
|
-
<string>WRUN</string>
|
60
|
-
<key>CFBundleVersion</key>
|
61
|
-
<string>0.4</string>
|
62
|
-
<key>NSMainNibFile</key>
|
63
|
-
<string>MainMenu</string>
|
64
|
-
<key>NSPrincipalClass</key>
|
65
|
-
<string>NSApplication</string>
|
66
|
-
</dict>
|
67
|
-
</plist>
|
68
|
-
EOF
|
69
|
-
end
|
93
|
+
FileUtils.cp(tiapp, app_path)
|
94
|
+
FileUtils.cp(manifest, app_path)
|
70
95
|
|
71
|
-
|
72
|
-
|
96
|
+
dirs = Dir[File.join(APP_ROOT, '**')]
|
97
|
+
dirs.delete(build_path)
|
98
|
+
dirs.delete(File.join(APP_ROOT, 'log'))
|
99
|
+
dirs.delete(File.join(APP_ROOT, 'tmp'))
|
100
|
+
dirs.delete(File.join(APP_ROOT, 'db'))
|
101
|
+
dirs.delete_if {|i| i =~ /\.svn|\.DS_Store/ }
|
73
102
|
|
74
|
-
|
75
|
-
FileUtils.
|
76
|
-
FileUtils.
|
77
|
-
|
78
|
-
|
103
|
+
FileUtils.cd(app_path) do
|
104
|
+
FileUtils.makedirs('Resources')
|
105
|
+
FileUtils.cp_r(dirs, 'Resources')
|
106
|
+
schema_path = File.join(APP_ROOT, 'db', 'schema.rb')
|
107
|
+
if File.exists?(schema_path)
|
108
|
+
FileUtils.cp(
|
109
|
+
schema_path,
|
110
|
+
File.join('Resources', 'db')
|
111
|
+
)
|
79
112
|
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
desc "Use the Titanium SDK to build the app"
|
117
|
+
task :build do
|
118
|
+
build_path = File.join(APP_ROOT, 'build')
|
119
|
+
app_path = File.join(build_path, 'app')
|
120
|
+
|
121
|
+
# Todo - cross OS
|
122
|
+
ti_path = ENV['TIPATH'] || '/Library/Application Support/Titanium'
|
123
|
+
ti_lib_path = Dir[File.join(ti_path, "sdk", "*", "*")][0]
|
80
124
|
|
81
|
-
|
82
|
-
|
125
|
+
# Space in path
|
126
|
+
ti_path.gsub!(' ', '\ ')
|
127
|
+
ti_lib_path.gsub!(' ', '\ ')
|
83
128
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
129
|
+
command = []
|
130
|
+
command << File.join(ti_lib_path, "tibuild.py")
|
131
|
+
command << "-d #{build_path}"
|
132
|
+
command << "-s #{ti_path}"
|
133
|
+
command << "-r"
|
134
|
+
command << "-a #{ti_lib_path}"
|
135
|
+
command << app_path
|
136
|
+
|
137
|
+
exec(command.join(' '))
|
89
138
|
end
|
90
139
|
end
|
File without changes
|
data/lib/bowline.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Bowline
|
2
|
-
VERSION = '0.1.
|
2
|
+
VERSION = '0.1.8'
|
3
3
|
|
4
4
|
# The raw JavaScript window object
|
5
5
|
def self.js
|
@@ -31,6 +31,7 @@ require 'bowline/ext/array'
|
|
31
31
|
require 'bowline/ext/class'
|
32
32
|
require 'bowline/ext/string'
|
33
33
|
|
34
|
+
require 'bowline/helpers'
|
34
35
|
require 'bowline/gem_dependency'
|
35
36
|
require 'bowline/initializer'
|
36
37
|
|
data/templates/config/boot.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Don't change this file!
|
2
2
|
# Configure your app in config/environment.rb and config/environments/*.rb
|
3
3
|
|
4
|
-
APP_ROOT = File.join(File.dirname(__FILE__), "..") unless defined?(APP_ROOT)
|
4
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "..")) unless defined?(APP_ROOT)
|
5
5
|
|
6
6
|
bowline_path = File.join(APP_ROOT, *%w[vendor bowline lib bowline.rb])
|
7
7
|
|
@@ -2,8 +2,12 @@
|
|
2
2
|
require File.join(File.dirname(__FILE__), 'boot')
|
3
3
|
|
4
4
|
Bowline::Initializer.run do |config|
|
5
|
-
config.name
|
6
|
-
|
5
|
+
config.name = <%= full_name.inspect %>
|
6
|
+
config.id = "com.<%= full_name.underscore %>"
|
7
|
+
config.version = "0.1.0"
|
8
|
+
config.publisher = "Example"
|
9
|
+
config.url = "http://example.com"
|
10
|
+
|
7
11
|
# config.gem "net-mdns", :lib => 'net/dns/mdns'
|
8
12
|
# config.gem "rack"
|
9
13
|
# config.gem "rubyzip", :lib => 'zip/zip'
|
data/templates/gitignore
CHANGED
Binary file
|
data/templates/public/index.html
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
<script src="javascripts/jquery.js" type="text/javascript" charset="utf-8"></script>
|
12
12
|
<script src="javascripts/jquery.chain.js" type="text/javascript" charset="utf-8"></script>
|
13
13
|
<script src="javascripts/jquery.bowline.js" type="text/javascript" charset="utf-8"></script>
|
14
|
-
<script src="../script/init" type="text/ruby"
|
14
|
+
<script src="../script/init" type="text/ruby"></script>
|
15
15
|
<script src="javascripts/application.js" type="text/javascript" charset="utf-8"></script>
|
16
16
|
<link rel="stylesheet" href="stylesheets/application.css" type="text/css" charset="utf-8">
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
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
|
+
version: 0.1.8
|
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-07-
|
12
|
+
date: 2009-07-09 00:00:00 -07:00
|
13
13
|
default_executable: bowline-gen
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -44,7 +44,6 @@ files:
|
|
44
44
|
- .gitignore
|
45
45
|
- History.txt
|
46
46
|
- MIT-LICENSE
|
47
|
-
- Manifest.txt
|
48
47
|
- README.txt
|
49
48
|
- Rakefile
|
50
49
|
- VERSION
|
@@ -75,6 +74,7 @@ files:
|
|
75
74
|
- lib/bowline/generators/binder.rb
|
76
75
|
- lib/bowline/generators/migration.rb
|
77
76
|
- lib/bowline/generators/model.rb
|
77
|
+
- lib/bowline/helpers.rb
|
78
78
|
- lib/bowline/initializer.rb
|
79
79
|
- lib/bowline/jquery.rb
|
80
80
|
- lib/bowline/observer.rb
|
@@ -82,7 +82,7 @@ files:
|
|
82
82
|
- lib/bowline/tasks/bowline.rb
|
83
83
|
- lib/bowline/tasks/database.rake
|
84
84
|
- lib/bowline/tasks/log.rake
|
85
|
-
- lib/bowline/tasks/
|
85
|
+
- lib/bowline/tasks/misc.rake
|
86
86
|
- templates/Rakefile
|
87
87
|
- templates/binder.rb
|
88
88
|
- templates/config/application.yml
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- templates/gitignore
|
95
95
|
- templates/migration.rb
|
96
96
|
- templates/model.rb
|
97
|
+
- templates/public/icon.png
|
97
98
|
- templates/public/index.html
|
98
99
|
- templates/public/javascripts/application.js
|
99
100
|
- templates/public/stylesheets/application.css
|
data/Manifest.txt
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
.gitignore
|
2
|
-
History.txt
|
3
|
-
MIT-LICENSE
|
4
|
-
Manifest.txt
|
5
|
-
README.txt
|
6
|
-
Rakefile
|
7
|
-
assets/jquery.bowline.js
|
8
|
-
assets/jquery.chain.js
|
9
|
-
assets/jquery.js
|
10
|
-
bin/bowline-gen
|
11
|
-
bowline.gemspec
|
12
|
-
examples/account.rb
|
13
|
-
examples/example.js
|
14
|
-
examples/twitter.html
|
15
|
-
examples/tweets.rb
|
16
|
-
examples/users.rb
|
17
|
-
lib/bowline.rb
|
18
|
-
lib/bowline/binders.rb
|
19
|
-
lib/bowline/binders/collection.rb
|
20
|
-
lib/bowline/binders/singleton.rb
|
21
|
-
lib/bowline/commands/console.rb
|
22
|
-
lib/bowline/commands/generate.rb
|
23
|
-
lib/bowline/commands/run.rb
|
24
|
-
lib/bowline/ext/array.rb
|
25
|
-
lib/bowline/ext/class.rb
|
26
|
-
lib/bowline/ext/object.rb
|
27
|
-
lib/bowline/ext/string.rb
|
28
|
-
lib/bowline/gem_dependency.rb
|
29
|
-
lib/bowline/generators.rb
|
30
|
-
lib/bowline/generators/application.rb
|
31
|
-
lib/bowline/generators/binder.rb
|
32
|
-
lib/bowline/generators/migration.rb
|
33
|
-
lib/bowline/generators/model.rb
|
34
|
-
lib/bowline/initializer.rb
|
35
|
-
lib/bowline/jquery.rb
|
36
|
-
lib/bowline/observer.rb
|
37
|
-
lib/bowline/tasks/app.rake
|
38
|
-
lib/bowline/tasks/bowline.rb
|
39
|
-
lib/bowline/tasks/database.rake
|
40
|
-
lib/bowline/tasks/log.rake
|
41
|
-
lib/bowline/tasks/misk.rake
|
42
|
-
templates/Rakefile
|
43
|
-
templates/binder.rb
|
44
|
-
templates/config/application.yml
|
45
|
-
templates/config/boot.rb
|
46
|
-
templates/config/database.yml
|
47
|
-
templates/config/environment.rb
|
48
|
-
templates/config/manifest
|
49
|
-
templates/config/tiapp.xml
|
50
|
-
templates/gitignore
|
51
|
-
templates/migration.rb
|
52
|
-
templates/model.rb
|
53
|
-
templates/public/index.html
|
54
|
-
templates/public/javascripts/application.js
|
55
|
-
templates/public/stylesheets/application.css
|
56
|
-
templates/script/console
|
57
|
-
templates/script/init
|
58
|
-
templates/script/run
|