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/bin/bowline-gen CHANGED
@@ -3,4 +3,4 @@
3
3
  require File.join(File.dirname(__FILE__), *%w[.. lib bowline])
4
4
  require 'bowline/generators'
5
5
 
6
- Bowline::Generators.run_cli(Dir.pwd, 'bowline', Bowline::VERSION, ARGV)
6
+ Bowline::Generators.run_cli(Dir.pwd, 'bowline', Bowline::Version::STRING, ARGV)
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.1.10"
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.window.location = "app://public/#{name}.html"
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'
@@ -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
- @@observer ||= Observer.new
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
- @@params = params.inject({}) do |hash, (key, value)|
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
- @@params = p
46
+ @params = p
45
47
  end
46
48
  end
47
49
 
48
50
  def setup(d)
49
- @@elements ||= []
50
- @@elements << d
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
- @@items = args
6
+ @items = args
8
7
  self.item_sync!
9
- @@items
8
+ @items
9
+ end
10
+
11
+ def items
12
+ @items ||= []
10
13
  end
11
14
 
12
15
  def item_sync!
13
- return unless @@items && @@elements
14
- @@elements.each {|i|
15
- i.updateCollection(@@items.to_js)
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
- @@items.find {|item|
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
- @@item = arg
10
+ @item = arg
8
11
  self.item_sync!
9
12
  end
10
13
 
11
14
  def item_sync!
12
- return unless @@item && @@elements
15
+ return unless @item && @elements
13
16
  # Call the chain.js function 'item' on elements
14
- @@elements.each {|i|
15
- i.updateSingleton(@@item.to_js)
17
+ @elements.each {|i|
18
+ i.updateSingleton(@item.to_js)
16
19
  }
17
20
  end
18
21
 
19
22
  def find(*a)
20
- @@item
23
+ @item
21
24
  end
22
25
  end
23
26
  end
@@ -1,11 +1,4 @@
1
- require "config/environment"
2
- exec_path = File.join(APP_ROOT, 'build', 'osx', "#{APP_NAME}.app")
3
-
4
- unless File.exist?(exec_path)
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
@@ -1,5 +1,5 @@
1
1
  class Array
2
2
  def to_js(opts = {})
3
- collect {|i| i.to_js(opts) }
3
+ map {|i| i.to_js(opts) }
4
4
  end
5
5
  end
@@ -56,4 +56,5 @@ end
56
56
  require "bowline/generators/application"
57
57
  require "bowline/generators/binder"
58
58
  require "bowline/generators/model"
59
+ require "bowline/generators/helper"
59
60
  require "bowline/generators/migration"
@@ -8,12 +8,19 @@ module Bowline::Generators
8
8
  []
9
9
  end
10
10
 
11
- first_argument :name, :required => true, :desc => "helper name"
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 :model do |template|
15
- template.source = "model.rb"
16
- template.destination = "app/models/#{file_name}.rb"
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
 
@@ -1,4 +1,7 @@
1
1
  module Bowline
2
- module Helpers
2
+ module Helpers
3
+ def self.init
4
+ Bowline.js.send("bowline_helper=", method(:send))
5
+ end
3
6
  end
4
7
  end
@@ -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 { include h } }
212
- Bowline.js.helper = Helpers
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
@@ -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"]
@@ -0,0 +1,11 @@
1
+ module Bowline
2
+ module Version #:nodoc:
3
+ MAJOR = 0
4
+ MINOR = 3
5
+ TINY = 0
6
+
7
+ STRING = [MAJOR, MINOR, TINY].join('.')
8
+
9
+ CODENAME = "If you can meet with Triumph and Disaster".freeze
10
+ end
11
+ end
@@ -0,0 +1,2 @@
1
+ module <%= module_name %>
2
+ end
@@ -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.1.10
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