maccman-bowline 0.1.10 → 0.3.0
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/README.txt +1 -2
- data/Rakefile +5 -0
- data/assets/jquery.bowline.js +14 -6
- data/assets/jquery.js +2122 -1295
- data/bin/bowline-gen +1 -1
- data/bowline.gemspec +3 -3
- data/lib/bowline.rb +3 -1
- data/lib/bowline/binders.rb +10 -8
- data/lib/bowline/binders/collection.rb +10 -7
- data/lib/bowline/binders/singleton.rb +9 -6
- data/lib/bowline/commands/run.rb +4 -11
- data/lib/bowline/ext/array.rb +1 -1
- data/lib/bowline/generators.rb +1 -0
- data/lib/bowline/generators/helper.rb +11 -4
- data/lib/bowline/helpers.rb +4 -1
- data/lib/bowline/initializer.rb +11 -4
- data/lib/bowline/tasks/app.rake +5 -2
- data/lib/bowline/version.rb +11 -0
- data/templates/helper.rb +2 -0
- data/templates/public/index.html +0 -1
- metadata +3 -3
- data/Manifest.txt +0 -58
- data/VERSION +0 -1
data/bin/bowline-gen
CHANGED
data/bowline.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{bowline}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.3.0"
|
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"]
|
@@ -18,10 +18,8 @@ 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
|
-
"VERSION",
|
25
23
|
"assets/jquery.bowline.js",
|
26
24
|
"assets/jquery.chain.js",
|
27
25
|
"assets/jquery.js",
|
@@ -59,6 +57,7 @@ Gem::Specification.new do |s|
|
|
59
57
|
"lib/bowline/tasks/database.rake",
|
60
58
|
"lib/bowline/tasks/log.rake",
|
61
59
|
"lib/bowline/tasks/misc.rake",
|
60
|
+
"lib/bowline/version.rb",
|
62
61
|
"templates/Rakefile",
|
63
62
|
"templates/binder.rb",
|
64
63
|
"templates/config/application.yml",
|
@@ -68,6 +67,7 @@ Gem::Specification.new do |s|
|
|
68
67
|
"templates/config/manifest",
|
69
68
|
"templates/config/tiapp.xml",
|
70
69
|
"templates/gitignore",
|
70
|
+
"templates/helper.rb",
|
71
71
|
"templates/migration.rb",
|
72
72
|
"templates/model.rb",
|
73
73
|
"templates/public/icon.png",
|
data/lib/bowline.rb
CHANGED
@@ -15,7 +15,7 @@ module Bowline
|
|
15
15
|
|
16
16
|
# Change which page we're on
|
17
17
|
def self.show_view(name)
|
18
|
-
js.
|
18
|
+
js.location = "app://public/#{name}.html"
|
19
19
|
end
|
20
20
|
|
21
21
|
class Base
|
@@ -24,6 +24,8 @@ end
|
|
24
24
|
|
25
25
|
$LOAD_PATH << File.dirname(__FILE__)
|
26
26
|
|
27
|
+
require 'bowline/version'
|
28
|
+
|
27
29
|
require 'bowline/ext/object'
|
28
30
|
require 'bowline/ext/array'
|
29
31
|
require 'bowline/ext/class'
|
data/lib/bowline/binders.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
module Bowline
|
2
2
|
module Binders
|
3
|
-
class Base
|
4
|
-
cattr_accessor :params
|
5
|
-
|
3
|
+
class Base
|
6
4
|
class << self
|
7
5
|
# See Bowline::js
|
8
6
|
def js
|
@@ -16,7 +14,7 @@ module Bowline
|
|
16
14
|
|
17
15
|
# See the Observer class
|
18
16
|
def observer
|
19
|
-
|
17
|
+
@observer ||= Observer.new
|
20
18
|
end
|
21
19
|
|
22
20
|
# See Bowline::logger
|
@@ -28,6 +26,10 @@ module Bowline
|
|
28
26
|
def show_view(*args)
|
29
27
|
Bowline::show_view(*args)
|
30
28
|
end
|
29
|
+
|
30
|
+
def params
|
31
|
+
@params
|
32
|
+
end
|
31
33
|
|
32
34
|
def params=(p)
|
33
35
|
case p
|
@@ -36,18 +38,18 @@ module Bowline
|
|
36
38
|
# serialized form) - we need to make it into
|
37
39
|
# a nestled hash. Stolen from Ramaze
|
38
40
|
m = proc {|_,o,n|o.merge(n,&m)}
|
39
|
-
|
41
|
+
@params = params.inject({}) do |hash, (key, value)|
|
40
42
|
parts = key.split(/[\]\[]+/)
|
41
43
|
hash.merge(parts.reverse.inject(value) { |x, i| {i => x} }, &m)
|
42
44
|
end
|
43
45
|
else
|
44
|
-
|
46
|
+
@params = p
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
48
50
|
def setup(d)
|
49
|
-
|
50
|
-
|
51
|
+
@elements ||= []
|
52
|
+
@elements << d
|
51
53
|
self.item_sync!
|
52
54
|
end
|
53
55
|
|
@@ -1,23 +1,26 @@
|
|
1
1
|
module Bowline
|
2
2
|
module Binders
|
3
3
|
class Collection < Base
|
4
|
-
cattr_accessor :items
|
5
4
|
class << self
|
6
5
|
def items=(args)
|
7
|
-
|
6
|
+
@items = args
|
8
7
|
self.item_sync!
|
9
|
-
|
8
|
+
@items
|
9
|
+
end
|
10
|
+
|
11
|
+
def items
|
12
|
+
@items ||= []
|
10
13
|
end
|
11
14
|
|
12
15
|
def item_sync!
|
13
|
-
return unless
|
14
|
-
|
15
|
-
i.updateCollection(
|
16
|
+
return unless @items && @elements
|
17
|
+
@elements.each {|i|
|
18
|
+
i.updateCollection(@items.to_js)
|
16
19
|
}
|
17
20
|
end
|
18
21
|
|
19
22
|
def find(id)
|
20
|
-
|
23
|
+
@items.find {|item|
|
21
24
|
item.id == id
|
22
25
|
}
|
23
26
|
end
|
@@ -1,23 +1,26 @@
|
|
1
1
|
module Bowline
|
2
2
|
module Binders
|
3
3
|
class Singleton < Base
|
4
|
-
cattr_accessor :item
|
5
4
|
class << self
|
5
|
+
def item
|
6
|
+
@item
|
7
|
+
end
|
8
|
+
|
6
9
|
def item=(arg)
|
7
|
-
|
10
|
+
@item = arg
|
8
11
|
self.item_sync!
|
9
12
|
end
|
10
13
|
|
11
14
|
def item_sync!
|
12
|
-
return unless
|
15
|
+
return unless @item && @elements
|
13
16
|
# Call the chain.js function 'item' on elements
|
14
|
-
|
15
|
-
i.updateSingleton(
|
17
|
+
@elements.each {|i|
|
18
|
+
i.updateSingleton(@item.to_js)
|
16
19
|
}
|
17
20
|
end
|
18
21
|
|
19
22
|
def find(*a)
|
20
|
-
|
23
|
+
@item
|
21
24
|
end
|
22
25
|
end
|
23
26
|
end
|
data/lib/bowline/commands/run.rb
CHANGED
@@ -1,11 +1,4 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
require 'rake'
|
6
|
-
require 'bowline/tasks/bowline'
|
7
|
-
Rake::Task['app:bundle'].invoke
|
8
|
-
end
|
9
|
-
|
10
|
-
# Debug view
|
11
|
-
`open #{File.join(exec_path, 'Contents', 'MacOS', APP_NAME)}`
|
1
|
+
require 'rake'
|
2
|
+
require 'bowline/tasks/bowline'
|
3
|
+
ENV['TIRUN'] = 'true'
|
4
|
+
Rake::Task['app'].invoke
|
data/lib/bowline/ext/array.rb
CHANGED
data/lib/bowline/generators.rb
CHANGED
@@ -8,12 +8,19 @@ module Bowline::Generators
|
|
8
8
|
[]
|
9
9
|
end
|
10
10
|
|
11
|
-
|
11
|
+
def module_name
|
12
|
+
"#{self.name.camel_case}Helper"
|
13
|
+
end
|
12
14
|
|
15
|
+
def file_name
|
16
|
+
"#{name}_helper"
|
17
|
+
end
|
18
|
+
|
19
|
+
first_argument :name, :required => true, :desc => "helper name"
|
13
20
|
|
14
|
-
template :
|
15
|
-
template.source = "
|
16
|
-
template.destination = "app/
|
21
|
+
template :helper do |template|
|
22
|
+
template.source = "helper.rb"
|
23
|
+
template.destination = "app/helpers/#{file_name}.rb"
|
17
24
|
end
|
18
25
|
end
|
19
26
|
|
data/lib/bowline/helpers.rb
CHANGED
data/lib/bowline/initializer.rb
CHANGED
@@ -208,8 +208,8 @@ module Bowline
|
|
208
208
|
def load_application_helpers
|
209
209
|
helpers = configuration.helpers
|
210
210
|
helpers = helpers.map(&:constantize)
|
211
|
-
helpers.each {|h| Helpers.module_eval {
|
212
|
-
|
211
|
+
helpers.each {|h| Helpers.module_eval { extend h } }
|
212
|
+
Helpers.init
|
213
213
|
end
|
214
214
|
|
215
215
|
def load_application_classes
|
@@ -252,6 +252,10 @@ module Bowline
|
|
252
252
|
})
|
253
253
|
end
|
254
254
|
|
255
|
+
def initialize_js
|
256
|
+
Bowline.js.bowline_loaded
|
257
|
+
end
|
258
|
+
|
255
259
|
def process
|
256
260
|
Bowline.configuration = configuration
|
257
261
|
|
@@ -288,6 +292,8 @@ module Bowline
|
|
288
292
|
load_application_classes
|
289
293
|
load_application_helpers
|
290
294
|
|
295
|
+
initialize_js
|
296
|
+
|
291
297
|
Bowline.initialized = true
|
292
298
|
end
|
293
299
|
|
@@ -475,7 +481,7 @@ module Bowline
|
|
475
481
|
end
|
476
482
|
|
477
483
|
def helpers
|
478
|
-
Dir[helper_glob].map {|f| File.basename(f) }
|
484
|
+
Dir[helper_glob].map {|f| File.basename(f, '.rb').classify }
|
479
485
|
end
|
480
486
|
|
481
487
|
# Adds a block which will be executed after bowline has been fully initialized.
|
@@ -514,6 +520,7 @@ module Bowline
|
|
514
520
|
app/binders
|
515
521
|
app/models
|
516
522
|
app/remote
|
523
|
+
app/helpers
|
517
524
|
lib
|
518
525
|
vendor
|
519
526
|
).map { |dir| "#{root_path}/#{dir}" }.select { |dir| File.directory?(dir) }
|
@@ -528,9 +535,9 @@ module Bowline
|
|
528
535
|
|
529
536
|
def default_eager_load_paths
|
530
537
|
%w(
|
538
|
+
app/binders
|
531
539
|
app/models
|
532
540
|
app/remote
|
533
|
-
app/binders
|
534
541
|
app/helpers
|
535
542
|
).map { |dir| "#{root_path}/#{dir}" }.select { |dir| File.directory?(dir) }
|
536
543
|
end
|
data/lib/bowline/tasks/app.rake
CHANGED
@@ -130,10 +130,13 @@ tiprocess:0.4.4
|
|
130
130
|
command << File.join(ti_lib_path, "tibuild.py")
|
131
131
|
command << "-d #{build_path}"
|
132
132
|
command << "-s #{ti_path}"
|
133
|
-
command << "-r"
|
133
|
+
command << "-r" if ENV['TIRUN']
|
134
134
|
command << "-a #{ti_lib_path}"
|
135
135
|
command << app_path
|
136
136
|
|
137
137
|
exec(command.join(' '))
|
138
138
|
end
|
139
|
-
end
|
139
|
+
end
|
140
|
+
|
141
|
+
desc "Bundle and build app"
|
142
|
+
task :app => ["app:bundle", "app:build"]
|
data/templates/helper.rb
ADDED
data/templates/public/index.html
CHANGED
@@ -11,7 +11,6 @@
|
|
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"></script>
|
15
14
|
<script src="javascripts/application.js" type="text/javascript" charset="utf-8"></script>
|
16
15
|
<link rel="stylesheet" href="stylesheets/application.css" type="text/css" charset="utf-8">
|
17
16
|
<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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex MacCaw
|
@@ -44,10 +44,8 @@ files:
|
|
44
44
|
- .gitignore
|
45
45
|
- History.txt
|
46
46
|
- MIT-LICENSE
|
47
|
-
- Manifest.txt
|
48
47
|
- README.txt
|
49
48
|
- Rakefile
|
50
|
-
- VERSION
|
51
49
|
- assets/jquery.bowline.js
|
52
50
|
- assets/jquery.chain.js
|
53
51
|
- assets/jquery.js
|
@@ -85,6 +83,7 @@ files:
|
|
85
83
|
- lib/bowline/tasks/database.rake
|
86
84
|
- lib/bowline/tasks/log.rake
|
87
85
|
- lib/bowline/tasks/misc.rake
|
86
|
+
- lib/bowline/version.rb
|
88
87
|
- templates/Rakefile
|
89
88
|
- templates/binder.rb
|
90
89
|
- templates/config/application.yml
|
@@ -94,6 +93,7 @@ files:
|
|
94
93
|
- templates/config/manifest
|
95
94
|
- templates/config/tiapp.xml
|
96
95
|
- templates/gitignore
|
96
|
+
- templates/helper.rb
|
97
97
|
- templates/migration.rb
|
98
98
|
- templates/model.rb
|
99
99
|
- templates/public/icon.png
|
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
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.1.10
|