redpotion 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 62ecec116f423ede1149e470e67d497265969f96
4
- data.tar.gz: c5c046f6ce6064129f0e34e4e1971090d87e49dc
3
+ metadata.gz: 208290336f9c7cd48c520b633a17e84169610172
4
+ data.tar.gz: ab75b29edd058734b2dd544041fc52a4485b2e2f
5
5
  SHA512:
6
- metadata.gz: 6e5e64bfd2696d11d25ad48c876916f64918c039a87d07a58103fb56124361e22df4330e360acca119388004a68d0883dff1f8cf2584fb4bc8f230451f70d09e
7
- data.tar.gz: 7ea38189c9df9e7f22a3c7f689dbf0d09c862a8b8952d27fbde741045f929eb7c2e104445b3c046cab82b34aae7be37af6e48a664cc0ccbf0e85aed07e1cc0ee
6
+ metadata.gz: 33cfb65c5133437c0eaaa919a746cf124317eef2f58aff3a1e0e79e5990fdf250e49c064c35e7a138262d9e609b096778edac3f87c91a736910b91e4919c0d4c
7
+ data.tar.gz: b3df2b62436a3361f029d6b1c81e0c9d4955dd0e89ccec835e79bed5684ae55860f55a0349509d61b1fec4a94ffeab376a4afa9b54929e52039b9d7d4275d6b8
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ![image](http://ir_wp.s3.amazonaws.com/wp-content/uploads/sites/11/2014/11/logo_02.png)
1
+ ![image](http://ir_wp.s3.amazonaws.com/wp-content/uploads/sites/11/2015/01/RedPotion_logo_1000w_padding.png)
2
2
 
3
3
  # RedPotion
4
4
 
@@ -8,7 +8,7 @@ RedPotion combines [RMQ](http://rubymotionquery.com/), [ProMotion](https://githu
8
8
 
9
9
  =========
10
10
 
11
- The **makers of RMQ** at [InfiniteRed](http://infinitered.com/) and the **creators of ProMotion** at [ClearSight Studio](https://clearsightstudio.com/) have teamed up to create the ultimate RubyMotion library.
11
+ The **makers of RMQ** at [InfiniteRed](http://infinitered.com/) and the **creators of ProMotion** at [ClearSight](https://clearsightstudio.com/) as well as [David Larrabee](https://twitter.com/Squidpunch) have teamed up to create the ultimate RubyMotion library.
12
12
 
13
13
  [![image](https://ir_wp.s3.amazonaws.com/wp-content/uploads/sites/11/2013/08/InfiniteRed_logo_100h.png)](http://infinitered.com/)               [![image](https://clearsightstudio.com/assets/images/clearsight-logos/color-logo@2x-458a9655.png)](https://clearsightstudio.com/)
14
14
 
@@ -18,7 +18,7 @@ ProMotion for screens and RMQ for styles, animations, traversing, events, etc.
18
18
 
19
19
  You can use both RMQ Plugins and ProMotion Add-ons
20
20
 
21
- ![image](https://camo.githubusercontent.com/523372b371be1de2fb2cec421be423e2b89bcfd0/687474703a2f2f69725f77702e73332e616d617a6f6e6177732e636f6d2f77702d636f6e74656e742f75706c6f6164732f73697465732f31392f323031342f30392f726d715f706c7567696e2e706e67)
21
+ ![image](https://camo.githubusercontent.com/523372b371be1de2fb2cec421be423e2b89bcfd0/687474703a2f2f69725f77702e73332e616d617a6f6e6177732e636f6d2f77702d636f6e74656e742f75706c6f6164732f73697465732f31392f323031342f30392f726d715f706c7567696e2e706e67)
22
22
 
23
23
  ![image](http://ir_wp.s3.amazonaws.com/wp-content/uploads/sites/11/2014/11/ProMotion-addon-logo.png)
24
24
 
data/bin/potion CHANGED
@@ -18,6 +18,7 @@ class PotionCommandLine
18
18
  > potion create model foo
19
19
  > potion create screen foo
20
20
  > potion create table_screen foo
21
+ > potion create metal_table_screen foo
21
22
  > potion create view bar
22
23
  > potion create shared some_class_used_app_wide
23
24
  > potion create lib some_class_used_by_multiple_apps
@@ -44,6 +45,7 @@ class PotionCommandLine
44
45
  VALID_CREATE_TYPES = [
45
46
  :screen, :table_screen,
46
47
  :model, :controller,
48
+ :metal_table_screen,
47
49
  :view,
48
50
  :shared,
49
51
  :lib,
@@ -53,17 +55,20 @@ class PotionCommandLine
53
55
 
54
56
 
55
57
  def create(template_or_app_name, *options)
58
+ options.compact!
56
59
  # Dry Run option - TODO - change this to --dry_run to streamline
57
60
  if options.first == 'dry_run'
58
61
  @dry_run = true
59
62
  options.slice!(0)
60
63
  end
61
64
 
62
- unless options.first.include?('--')
63
- name = options.slice!(0)
64
- unless VALID_CREATE_TYPES.include?(template_or_app_name.to_sym)
65
- puts "potion - Invalid command, do something like this: potion create controller my_controller\n"
66
- return
65
+ if options.count > 0
66
+ unless options.first.include?('--')
67
+ name = options.slice!(0)
68
+ unless VALID_CREATE_TYPES.include?(template_or_app_name.to_sym)
69
+ puts "potion - Invalid command, do something like this: potion create controller my_controller\n"
70
+ return
71
+ end
67
72
  end
68
73
  end
69
74
 
@@ -140,19 +145,17 @@ class PotionCommandLine
140
145
  end
141
146
 
142
147
  def insert_from_template(template_name, name)
143
- unless %w{screen table_screen view}.include? template_name
144
- puts `rmq create #{template_name} #{name}`
145
- return
148
+ # TODO refactor this, it's less than wonderful
149
+ if %w{metal_table_screen view}.include? template_name
150
+ # Do nothing
151
+ elsif template_name =~ /.*screen/
152
+ @screen_base = template_name.split('_').collect(&:capitalize).join
153
+ template_name = 'screen'
146
154
  else
147
- if template_name =~ /.*screen/
148
- @screen_base = template_name.split('_').collect(&:capitalize).join
149
- template_name = 'screen'
150
- end
155
+ puts `potion create #{template_name} #{name}`
156
+ return
151
157
  end
152
158
 
153
- #if [:lib, :collection_view_controller, :shared, :controller].include?(template_name)
154
- #end
155
-
156
159
  puts "\n Creating #{template_name}: #{name}\n\n"
157
160
 
158
161
  return unless (@template_path = template_path(template_name))
@@ -1,3 +1,3 @@
1
1
  module RedPotion
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
@@ -0,0 +1,73 @@
1
+ class <%= @name_camel_case %>Screen < UITableViewController
2
+ include ProMotion::ScreenModule
3
+
4
+ title "Your title here"
5
+ stylesheet <%= @name_camel_case %>ScreenStylesheet
6
+
7
+ <%= @name.upcase %>_CELL_ID = "<%= @name_camel_case %>Cell"
8
+
9
+ # Needed to be a ProMotion screen. Many controllers have different inits, so you need
10
+ # to provide the correct one here
11
+ def self.new(args = {})
12
+ s = self.alloc.initWithStyle(UITableViewStylePlain)
13
+ s.screen_init(args) if s.respond_to?(:screen_init)
14
+ s
15
+ end
16
+
17
+ def on_load
18
+ load_data
19
+
20
+ table = view
21
+ table.delegate = self
22
+ table.dataSource = self
23
+ end
24
+
25
+ def load_data
26
+ @data = 0.upto(rand(100)).map do |i| # Test data
27
+ {
28
+ name: %w(Lorem ipsum dolor sit amet consectetur adipisicing elit sed).sample,
29
+ num: rand(100),
30
+ }
31
+ end
32
+ end
33
+
34
+ # Standard table stuff
35
+ def tableView(table_view, numberOfRowsInSection: section)
36
+ @data.length
37
+ end
38
+
39
+ def tableView(table_view, heightForRowAtIndexPath: index_path)
40
+ stylesheet.cell_height
41
+ end
42
+
43
+ def tableView(table_view, cellForRowAtIndexPath: index_path)
44
+ data_row = @data[index_path.row]
45
+
46
+ cell = table_view.dequeueReusableCellWithIdentifier(<%= @name.upcase %>_CELL_ID) || begin
47
+ rmq.create(<%= @name_camel_case %>Cell, :cell, reuse_identifier: <%= @name.upcase %>_CELL_ID).get
48
+
49
+ # If you want to change the style of the cell, you can do something like this:
50
+ #rmq.create(<%= @name_camel_case %>Cell, :cell, reuse_identifier: <%= @name.upcase %>_CELL_ID, cell_style: UITableViewCellStyleSubtitle).get
51
+ end
52
+
53
+ cell.update(data_row)
54
+ cell
55
+ end
56
+
57
+ # Remove the following if you're only using portrait
58
+
59
+ # You don't have to reapply styles to all UIViews, if you want to optimize, another way to do it
60
+ # is tag the views you need to restyle in your stylesheet, then only reapply the tagged views, like so:
61
+ # def logo(st)
62
+ # st.frame = {t: 10, w: 200, h: 96}
63
+ # st.centered = :horizontal
64
+ # st.image = image.resource('logo')
65
+ # st.tag(:reapply_style)
66
+ # end
67
+ #
68
+ # Then in will_animate_rotate
69
+ # find(:reapply_style).reapply_styles#
70
+ def will_animate_rotate(orientation, duration)
71
+ reapply_styles
72
+ end
73
+ end
@@ -0,0 +1,25 @@
1
+ class <%= @name_camel_case %>ScreenStylesheet < ApplicationStylesheet
2
+
3
+ def setup
4
+ # Add stylesheet specific setup stuff here.
5
+ # Add application specific setup stuff in application_stylesheet.rb
6
+ end
7
+
8
+ def root_view(st)
9
+ st.background_color = color.gray
10
+ end
11
+
12
+ def cell(st)
13
+ # Style overall cell here
14
+ st.background_color = color.random
15
+ end
16
+
17
+ def cell_height
18
+ 80
19
+ end
20
+
21
+ def cell_name(st)
22
+ st.frame = {left: 5, top: 5, from_right: 10, from_bottom: 5}
23
+ st.color = color.black
24
+ end
25
+ end
@@ -0,0 +1,11 @@
1
+ class <%= @name_camel_case %>Cell < UITableViewCell
2
+ def on_load
3
+ find(self.contentView).tap do |q|
4
+ @name = q.append!(UILabel, :cell_name)
5
+ end
6
+ end
7
+
8
+ def update(data)
9
+ @name.text = "#{data[:name]} is #{data[:num]}"
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ describe '<%= @name_camel_case %>Screen' do
2
+
3
+ before do
4
+ end
5
+
6
+ after do
7
+ end
8
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redpotion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - InfiniteRed
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-23 00:00:00.000000000 Z
12
+ date: 2015-01-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby_motion_query
@@ -102,6 +102,10 @@ files:
102
102
  - lib/project/ruby_motion_query/traverse.rb
103
103
  - lib/project/version.rb
104
104
  - lib/redpotion.rb
105
+ - templates/metal_table_screen/app/screens/name_screen.rb
106
+ - templates/metal_table_screen/app/stylesheets/name_screen_stylesheet.rb
107
+ - templates/metal_table_screen/app/views/name_cell.rb
108
+ - templates/metal_table_screen/spec/screens/name_screen_spec.rb
105
109
  - templates/screen/app/screens/name_screen.rb
106
110
  - templates/screen/app/stylesheets/name_screen_stylesheet.rb
107
111
  - templates/screen/spec/screens/name_screen_spec.rb
@@ -128,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
132
  version: '0'
129
133
  requirements: []
130
134
  rubyforge_project:
131
- rubygems_version: 2.4.4
135
+ rubygems_version: 2.4.5
132
136
  signing_key:
133
137
  specification_version: 4
134
138
  summary: RedPotion combines RMQ, ProMotion, CDQ, AFMotion, and more for the perfect