redpotion 0.7.0 → 0.7.1
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.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/bin/potion +18 -15
- data/lib/project/version.rb +1 -1
- data/templates/metal_table_screen/app/screens/name_screen.rb +73 -0
- data/templates/metal_table_screen/app/stylesheets/name_screen_stylesheet.rb +25 -0
- data/templates/metal_table_screen/app/views/name_cell.rb +11 -0
- data/templates/metal_table_screen/spec/screens/name_screen_spec.rb +8 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 208290336f9c7cd48c520b633a17e84169610172
|
4
|
+
data.tar.gz: ab75b29edd058734b2dd544041fc52a4485b2e2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33cfb65c5133437c0eaaa919a746cf124317eef2f58aff3a1e0e79e5990fdf250e49c064c35e7a138262d9e609b096778edac3f87c91a736910b91e4919c0d4c
|
7
|
+
data.tar.gz: b3df2b62436a3361f029d6b1c81e0c9d4955dd0e89ccec835e79bed5684ae55860f55a0349509d61b1fec4a94ffeab376a4afa9b54929e52039b9d7d4275d6b8
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-

|
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
|
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
|
[](http://infinitered.com/) [](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
|
-

|
21
|
+

|
22
22
|
|
23
23
|

|
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
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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
|
-
|
144
|
-
|
145
|
-
|
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
|
-
|
148
|
-
|
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))
|
data/lib/project/version.rb
CHANGED
@@ -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
|
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.
|
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-
|
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.
|
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
|