ruby_motion_query 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MTAyZjRlZmI2ZGMzZTViZDRhZGQwM2FmZTQzNzc2YjJhOGQxOTZkMg==
4
+ MGJjYWZmMzUyNWEzY2ExZTI5OWUxNjQ0NzVhODg1N2ZkZGM5YjFkMw==
5
5
  data.tar.gz: !binary |-
6
- NjIyZTYyZWUzZjFiMzk2NDI4ZjNmMGU2ZTBlZjdiMjM3YWE5MzEwZQ==
6
+ MTZlMzYxZDAyNjdjMmM4NmU5ODA5NTAyOWU3MmRkODg4MDRmYjI0Yg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NTIxYmRkNzcyMWNkYzEzNGIwZDMxYzYxMjZlYWUzYjFkODBjNDE0YWNmN2Uw
10
- ZGZjMTM1YTdkM2M4MTMwYWE2NjJkMjljNTVmMDM4OTc5N2ZjODE5MTU3NWFj
11
- MzFkZjgxNmRjNmRlODg1YTFmYjY1YzQxYWE2NGNlZjNmNGNkZjg=
9
+ ZTg3Yjk2NGI2N2IxYTA5YmE2NDgyYzRmNzk1NjEyNWIwNWEwOWU1NWQ5NGY4
10
+ ZTQ4MTIzMjZhZmRjNmE5NmUwMWJkZTZkYmUxYmYyMTJlMTE3MTBmMjZjZDRh
11
+ M2FmODhiYzAwNjlhN2QyOGI0ZjM0MDg5MDUwOTlmNDI1ZjY2MWU=
12
12
  data.tar.gz: !binary |-
13
- ODU3NTAyODJmYzhkNDdjZmM2ZmFkZGQ0MmVmYTNjNTRkODNlZWI4NTQ2NjVi
14
- MDI3NzdmOTFmN2I0OGQ1OWI4YzBiODNkZjlkZTI1MzgwNjFmMGY3NzkwMDNk
15
- Yjc4NDg2OWQ4MDdjNmE3ZmQ0NWQ3ZjkzYjZiMzE4ZDZiMzEzOGI=
13
+ OTA1ZDlmNTljYzY3ZTdhZDBkOWViMzA5YTgzNzc3YWVjYjc5NzNkOTZhMTU2
14
+ MTIxMzE0YWVjNjY2MTNhMmQ1OTc3NDdmNDVhMDVhOWNjMWRkZThlZTIyZDY1
15
+ YjM3MzIwZTIwNTZhN2ZkNjZjZWE0NDYyNTY3MGI2YThkZThiOWQ=
data/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Gem Version](https://badge.fury.io/rb/ruby_motion_query.png)](http://badge.fury.io/rb/ruby_motion_query)
8
8
  [![Crusher.io optimized](http://www.crusher.io/repo/infinitered/rmq/badge)](http://www.crusher.io/repo/infinitered/rmq)
9
9
 
10
- A fast, muggle, nonpolluting, zero-dependency, jQuery-like library for [RubyMotion](http://rubymotion.com).
10
+ A fast, non-polluting, chaining, front-end library. It’s jQuery for [RubyMotion](http://rubymotion.com), plus stylesheets and templates
11
11
 
12
12
  **The [RMQ website][1] is a great place to start.**
13
13
 
@@ -199,6 +199,7 @@ Here are the commands available to you:
199
199
  > rmq create lib some_class_used_by_multiple_apps
200
200
 
201
201
  > rmq create collection_view_controller foos
202
+ > rmq create table_view_controller bars
202
203
 
203
204
  # To test the create command without actually creating any files, do:
204
205
  > rmq create view my_view dry_run
data/bin/rmq CHANGED
@@ -22,12 +22,20 @@ class RmqCommandLine
22
22
  > rmq create lib some_class_used_by_multiple_apps
23
23
 
24
24
  > rmq create collection_view_controller foos
25
+ > rmq create table_view_controller bars
25
26
 
26
27
  > rmq -h, --help
27
28
  > rmq -v, --version }
28
29
 
29
30
  class << self
30
- VALID_CREATE_TYPES = [:model, :controller, :view, :shared, :lib, :collection_view_controller]
31
+ VALID_CREATE_TYPES = [
32
+ :model, :controller,
33
+ :view,
34
+ :shared,
35
+ :lib,
36
+ :collection_view_controller,
37
+ :table_view_controller
38
+ ]
31
39
 
32
40
  def create(template_or_app_name, name, options)
33
41
  @dry_run = true if options == 'dry_run'
@@ -1,5 +1,5 @@
1
1
  module RubyMotionQuery
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
 
4
4
  class RMQ
5
5
  def version
@@ -0,0 +1,56 @@
1
+ class <%= @name_camel_case %>Controller < UITableViewController
2
+
3
+ <%= @name.upcase %>_CELL_ID = "<%= @name_camel_case %>Cell"
4
+
5
+ def viewDidLoad
6
+ super
7
+
8
+ load_data
9
+
10
+ rmq.stylesheet = <%= @name_camel_case %>ControllerStylesheet
11
+
12
+ view.tap do |table|
13
+ table.delegate = self
14
+ table.dataSource = self
15
+ rmq(table).apply_style :table
16
+ end
17
+ end
18
+
19
+ def load_data
20
+ @data = 0.upto(rand(100)).map do |i| # Test data
21
+ {
22
+ name: %w(Lorem ipsum dolor sit amet consectetur adipisicing elit sed).sample,
23
+ num: rand(100),
24
+ }
25
+ end
26
+ end
27
+
28
+ def tableView(table_view, numberOfRowsInSection: section)
29
+ @data.length
30
+ end
31
+
32
+ def tableView(table_view, heightForRowAtIndexPath: index_path)
33
+ rmq.stylesheet.<%= @name %>_cell_height
34
+ end
35
+
36
+ def tableView(table_view, cellForRowAtIndexPath: index_path)
37
+ data_row = @data[index_path.row]
38
+
39
+ cell = table_view.dequeueReusableCellWithIdentifier(<%= @name.upcase %>_CELL_ID) || begin
40
+ rmq.create(<%= @name_camel_case %>Cell).get
41
+ end
42
+
43
+ cell.update(data_row)
44
+ cell
45
+ end
46
+
47
+ # Remove if you are only supporting portrait
48
+ def supportedInterfaceOrientations
49
+ UIInterfaceOrientationMaskAll
50
+ end
51
+
52
+ # Remove if you are only supporting portrait
53
+ def willAnimateRotationToInterfaceOrientation(orientation, duration: duration)
54
+ rmq.all.reapply_styles
55
+ end
56
+ end
@@ -0,0 +1,14 @@
1
+ module <%= @name_camel_case %>CellStylesheet
2
+ def <%= @name %>_cell_height
3
+ 80
4
+ end
5
+
6
+ def <%= @name %>_cell(st)
7
+ # Style overall cell here
8
+ st.background_color = color.random
9
+ end
10
+
11
+ def cell_label(st)
12
+ st.color = color.black
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ class <%= @name_camel_case %>ControllerStylesheet < ApplicationStylesheet
2
+
3
+ include <%= @name_camel_case %>CellStylesheet
4
+
5
+ def setup
6
+ # Add stylesheet specific setup stuff here.
7
+ # Add application specific setup stuff in application_stylesheet.rb
8
+ end
9
+
10
+ def table(st)
11
+ st.background_color = color.gray
12
+ end
13
+ end
@@ -0,0 +1,22 @@
1
+ class <%= @name_camel_case %>Cell < UITableViewCell
2
+
3
+ def rmq_build
4
+ rmq(self).apply_style :<%= @name %>_cell
5
+
6
+ rmq(self.contentView).tap do |q|
7
+ # Add your subviews, init stuff here
8
+ # @foo = q.append(UILabel, :foo).get
9
+ #
10
+ # Or use the built-in table cell controls, if you don't use
11
+ # these, they won't exist at runtime
12
+ # q.build(self.imageView, :cell_image)
13
+ @name = q.build(self.textLabel, :cell_label).get
14
+ end
15
+ end
16
+
17
+ def update(data)
18
+ # Update data here
19
+ @name.text = data[:name]
20
+ end
21
+
22
+ end
@@ -0,0 +1,9 @@
1
+ describe '<%= @name_camel_case %>Controller' do
2
+
3
+ before do
4
+ end
5
+
6
+ after do
7
+ end
8
+
9
+ end
@@ -0,0 +1,9 @@
1
+ describe '<%= @name_camel_case %>Cell' do
2
+
3
+ before do
4
+ end
5
+
6
+ after do
7
+ end
8
+
9
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_motion_query
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Werth
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-08 00:00:00.000000000 Z
12
+ date: 2014-02-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bacon
@@ -108,6 +108,12 @@ files:
108
108
  - templates/model/spec/models/name.rb
109
109
  - templates/shared/app/shared/name.rb
110
110
  - templates/shared/spec/shared/name.rb
111
+ - templates/table_view_controller/app/controllers/name_controller.rb
112
+ - templates/table_view_controller/app/stylesheets/name_cell_stylesheet.rb
113
+ - templates/table_view_controller/app/stylesheets/name_controller_stylesheet.rb
114
+ - templates/table_view_controller/app/views/name_cell.rb
115
+ - templates/table_view_controller/spec/controllers/name_controller.rb
116
+ - templates/table_view_controller/spec/views/name_cell.rb
111
117
  - templates/view/app/stylesheets/name_stylesheet.rb
112
118
  - templates/view/app/views/name.rb
113
119
  - templates/view/spec/views/name.rb