redpotion 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/bin/potion +4 -0
- data/lib/project/ext/kernel.rb +2 -0
- data/lib/project/ext/object.rb +2 -0
- data/lib/project/ext/pm_delegate.rb +6 -0
- data/lib/project/ext/ui_collection_view_cell.rb +2 -0
- data/lib/project/ext/ui_color.rb +3 -1
- data/lib/project/ext/ui_image_view.rb +37 -9
- data/lib/project/ext/ui_table_view_cell.rb +2 -0
- data/lib/project/ext/ui_view.rb +2 -0
- data/lib/project/ext/ui_view_controller.rb +2 -0
- data/lib/project/pro_motion/data_table.rb +1 -0
- data/lib/project/pro_motion/data_table_screen.rb +1 -0
- data/lib/project/pro_motion/data_table_searchable.rb +1 -0
- data/lib/project/pro_motion/screen.rb +2 -0
- data/lib/project/pro_motion/support.rb +2 -0
- data/lib/project/pro_motion/table.rb +1 -0
- data/lib/project/ruby_motion_query/app.rb +9 -1
- data/lib/project/ruby_motion_query/stylers/ui_image_view.rb +1 -0
- data/lib/project/ruby_motion_query/traverse.rb +2 -0
- data/lib/project/version.rb +1 -1
- data/templates/collection_view_screen/app/screens/name_screen.rb +2 -0
- data/templates/collection_view_screen/app/stylesheets/name_cell_stylesheet.rb +1 -0
- data/templates/collection_view_screen/app/views/name_cell.rb +2 -0
- data/templates/metal_table_screen/app/screens/name_screen.rb +2 -0
- data/templates/metal_table_screen/app/stylesheets/name_screen_stylesheet.rb +1 -0
- data/templates/metal_table_screen/app/views/name_cell.rb +2 -0
- data/templates/metal_table_screen/spec/screens/name_screen_spec.rb +1 -0
- data/templates/screen/app/screens/name_screen.rb +2 -0
- data/templates/screen/app/stylesheets/name_screen_stylesheet.rb +2 -0
- data/templates/screen/spec/screens/name_screen_spec.rb +1 -0
- data/templates/table_screen_cell/app/views/name.rb +1 -2
- metadata +5 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04e83a3c050909fd7827bc277ca1f71f1316e849
|
4
|
+
data.tar.gz: d1413854f702ecbf9d36d66a1d64f6bf5561650b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da82e2a3404ad63a8e77b89f71d7353c5331132f66710af74ee918b2ab285b9a8280af968e1d545943fd5bfe288319a5eb1f0fed0b3083a2017c1943beb1a0a8
|
7
|
+
data.tar.gz: 4d9cb28f587bdb43c719710f4d6aa5128f9807888c29a4d2e8d16c62e7ab6ad631793514ca73840c717a8984dee8cd1e4a6727c71815d9e9ffe4c8e32b71e572
|
data/README.md
CHANGED
@@ -10,12 +10,12 @@
|
|
10
10
|
|
11
11
|
We believe iPhone development should be clean, scalable, and fast with a language that developers not only enjoy, but actively choose. With the advent of Ruby for iPhone development the RubyMotion community has combined and tested the most active and powerful gems into a single package called **RedPotion**
|
12
12
|
|
13
|
-
RedPotion combines [RMQ](http://rubymotionquery.com/), [ProMotion](https://github.com/
|
13
|
+
RedPotion combines [RMQ](http://rubymotionquery.com/), [ProMotion](https://github.com/infinitered/ProMotion), [CDQ](https://github.com/infinitered/cdq), [AFMotion](https://github.com/clayallsopp/afmotion), [MotionPrint](https://github.com/OTGApps/motion_print) and [MORE!](#full-listing-of-gems-and-pods-for-redpotion). It also adds new features to better integrate RMQ with ProMotion. The goal is simply to choose standard libraries and promote best practices, allowing you to develop iOS apps in record time.
|
14
14
|
|
15
15
|
|
16
|
-
The **makers of RMQ** at [InfiniteRed](http://
|
16
|
+
The **makers of RMQ and ProMotion** at [InfiniteRed](http://infinite.red) (web and mobile developers based in Portland, OR and San Francisco, CA) have teamed up with [David Larrabee](https://twitter.com/Squidpunch) to create the ultimate RubyMotion library.
|
17
17
|
|
18
|
-
[![image](
|
18
|
+
[![image](http://infinite.red/images/ir-logo.svg)](http://infinite.red)
|
19
19
|
|
20
20
|
ProMotion for screens and RMQ for styles, animations, traversing, events, etc.
|
21
21
|
|
data/bin/potion
CHANGED
@@ -6,6 +6,7 @@ require 'open-uri'
|
|
6
6
|
require_relative "../lib/project/version"
|
7
7
|
|
8
8
|
class PotionCommandLine
|
9
|
+
|
9
10
|
HELP_TEXT = %{ potion version #{RedPotion::VERSION}
|
10
11
|
|
11
12
|
Some things you can do with the potion command:
|
@@ -43,6 +44,7 @@ class PotionCommandLine
|
|
43
44
|
> rmq docs "background image" }
|
44
45
|
|
45
46
|
class << self
|
47
|
+
|
46
48
|
SKIP_FLAGS = [ "--skip-cdq", "--skip-afmotion" ]
|
47
49
|
|
48
50
|
VALID_CREATE_TYPES = [
|
@@ -262,7 +264,9 @@ class PotionCommandLine
|
|
262
264
|
data = IO.readlines("Gemfile.lock")
|
263
265
|
data.any?{|l| l.match(/\s.cdq\s\(/) }
|
264
266
|
end
|
267
|
+
|
265
268
|
end
|
269
|
+
|
266
270
|
end
|
267
271
|
|
268
272
|
# Process input, execute actions
|
data/lib/project/ext/kernel.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
if RUBYMOTION_ENV == "development"
|
2
2
|
class TopLevel
|
3
|
+
|
3
4
|
def live(interval = 1.0, debug=false)
|
4
5
|
rmq_live_stylesheets interval, debug
|
5
6
|
end
|
@@ -15,5 +16,6 @@ if RUBYMOTION_ENV == "development"
|
|
15
16
|
def close(args={})
|
16
17
|
find.screen.close(args)
|
17
18
|
end
|
19
|
+
|
18
20
|
end
|
19
21
|
end
|
data/lib/project/ext/object.rb
CHANGED
@@ -5,22 +5,28 @@ end
|
|
5
5
|
# Defines which ProMotion classes handle delegates
|
6
6
|
module ProMotion
|
7
7
|
class ViewController < UIViewController
|
8
|
+
|
8
9
|
def class_handles_delegates?
|
9
10
|
true
|
10
11
|
end
|
12
|
+
|
11
13
|
end
|
12
14
|
|
13
15
|
class TableViewController < UITableViewController
|
16
|
+
|
14
17
|
def class_handles_delegates?
|
15
18
|
true
|
16
19
|
end
|
20
|
+
|
17
21
|
end
|
18
22
|
|
19
23
|
# Include the entire class declaration chain for people that may not have
|
20
24
|
# the ProMotion-form gem installed.
|
21
25
|
class FormViewController < FXFormViewController
|
26
|
+
|
22
27
|
def class_handles_delegates?
|
23
28
|
true
|
24
29
|
end
|
30
|
+
|
25
31
|
end
|
26
32
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
class UICollectionViewCell
|
2
|
+
|
2
3
|
# You can use either rmq_build or on_load, not both. If you have both, on_load will be ignored,
|
3
4
|
# you can however call it from rmq_build. They are the same, on_load follows the ProMotion style
|
4
5
|
# and is recommended.
|
@@ -14,4 +15,5 @@ class UICollectionViewCell
|
|
14
15
|
super
|
15
16
|
@reused = true
|
16
17
|
end
|
18
|
+
|
17
19
|
end
|
data/lib/project/ext/ui_color.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
class UIColor
|
2
|
+
|
2
3
|
def with(options)
|
3
4
|
type = CGSize.type[/(f|d)/]
|
4
5
|
r, g, b, a = Pointer.new(type), Pointer.new(type), Pointer.new(type), Pointer.new(type)
|
5
6
|
self.getRed(r, green: g, blue: b, alpha: a)
|
6
|
-
|
7
|
+
|
7
8
|
r = options[:r] || options[:red] || r.value
|
8
9
|
g = options[:g] || options[:green] || g.value
|
9
10
|
b = options[:b] || options[:blue] || b.value
|
@@ -11,4 +12,5 @@ class UIColor
|
|
11
12
|
|
12
13
|
UIColor.colorWithRed(r, green: g, blue: b, alpha: a)
|
13
14
|
end
|
15
|
+
|
14
16
|
end
|
@@ -1,27 +1,55 @@
|
|
1
1
|
class UIImageView
|
2
2
|
|
3
|
-
def remote_image=(
|
4
|
-
|
5
|
-
|
3
|
+
def remote_image=(args)
|
4
|
+
url = args.respond_to?(:fetch) ? args.fetch(:url) : args
|
5
|
+
callback = args.respond_to?(:fetch) ? args.fetch(:on_load, -> {}) : -> {}
|
6
|
+
load_remote_image(url, callback)
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
6
10
|
|
11
|
+
def load_remote_image(url, callback = nil)
|
12
|
+
if defined?(SDWebImageManager)
|
13
|
+
@remote_image_operations ||= {}
|
7
14
|
# Cancel the previous remote operation if it exists
|
8
15
|
operation = @remote_image_operations[("%p" % self)]
|
9
16
|
if operation && operation.respond_to?(:cancel)
|
10
17
|
operation.cancel
|
11
18
|
@remote_image_operations[("%p" % self)] = nil
|
12
19
|
end
|
20
|
+
url = NSURL.URLWithString(url) unless url.is_a?(NSURL)
|
21
|
+
@remote_image_operations[("%p" % self)] = load_remote_image_using_sdwebimage(url, callback)
|
22
|
+
else
|
23
|
+
puts "\n[RedPotion ERROR] tried to set remote_image without SDWebImage CocoaPod. Please add this to your Rakefile: \n\napp.pods do\n pod \"SDWebImage\"\nend\n"
|
24
|
+
end
|
25
|
+
end
|
13
26
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
27
|
+
def load_remote_image_using_sdwebimage(url, callback = nil)
|
28
|
+
manager = SDWebImageManager.sharedManager
|
29
|
+
if manager.respond_to?('downloadWithURL:options:progress:completed')
|
30
|
+
# Support for SDWebImage v3.x
|
31
|
+
manager.downloadWithURL(url,
|
32
|
+
options: SDWebImageRefreshCached,
|
33
|
+
progress: nil,
|
18
34
|
completed: -> image, error, cacheType, finished {
|
19
35
|
Dispatch::Queue.main.async do
|
20
36
|
self.image = image
|
37
|
+
callback.call if callback
|
21
38
|
end unless image.nil?
|
22
|
-
|
39
|
+
}
|
40
|
+
)
|
23
41
|
else
|
24
|
-
|
42
|
+
# Support for SDWebImage v4.x
|
43
|
+
manager.loadImageWithURL(url,
|
44
|
+
options: SDWebImageRefreshCached,
|
45
|
+
progress: nil,
|
46
|
+
completed: -> image, imageData, error, cacheType, finished, imageURL {
|
47
|
+
Dispatch::Queue.main.async do
|
48
|
+
self.image = image
|
49
|
+
callback.call if callback
|
50
|
+
end unless image.nil?
|
51
|
+
}
|
52
|
+
)
|
25
53
|
end
|
26
54
|
end
|
27
55
|
|
@@ -1,8 +1,10 @@
|
|
1
1
|
class UITableViewCell
|
2
|
+
|
2
3
|
# You can use either rmq_build or on_load, not both. If you have both, on_load will be ignored,
|
3
4
|
# you can however call it from rmq_build. They are the same, on_load follows the ProMotion style
|
4
5
|
# and is recommended.
|
5
6
|
def rmq_build
|
6
7
|
self.on_load
|
7
8
|
end
|
9
|
+
|
8
10
|
end
|
data/lib/project/ext/ui_view.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
class UIView
|
2
|
+
|
2
3
|
# You can use either rmq_build or on_load, not both. If you have both, on_load will be ignored,
|
3
4
|
# you can however call it from rmq_build. They are the same, on_load follows the ProMotion style
|
4
5
|
# and is recommended.
|
@@ -86,4 +87,5 @@ class UIView
|
|
86
87
|
def stylesheet=(value)
|
87
88
|
rmq.stylesheet = value
|
88
89
|
end
|
90
|
+
|
89
91
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
class UIViewController
|
2
|
+
|
2
3
|
def append(view_or_constant, style=nil, opts = {})
|
3
4
|
self.rmq.append(view_or_constant, style, opts)
|
4
5
|
end
|
@@ -164,4 +165,5 @@ class UIViewController
|
|
164
165
|
def pm_handles_delegates?
|
165
166
|
self.respond_to?(:class_handles_delegates?) && self.class_handles_delegates?
|
166
167
|
end
|
168
|
+
|
167
169
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module RubyMotionQuery
|
2
2
|
class App
|
3
3
|
class << self
|
4
|
+
|
4
5
|
def current_screen(root_view_controller = nil)
|
5
6
|
current_view_controller root_view_controller
|
6
7
|
end
|
@@ -13,11 +14,18 @@ module RubyMotionQuery
|
|
13
14
|
if !!defined?(SDWebImageManager)
|
14
15
|
image_cache = SDImageCache.sharedImageCache
|
15
16
|
image_cache.clearMemory
|
16
|
-
image_cache.clearDisk
|
17
|
+
if image_cache.respond_to?(:clearDisk)
|
18
|
+
# Support for SDWebImage v3.x
|
19
|
+
image_cache.clearDisk
|
20
|
+
else
|
21
|
+
# Support for SDWebImage v4.x
|
22
|
+
image_cache.deleteOldFilesWithCompletion(nil)
|
23
|
+
end
|
17
24
|
else
|
18
25
|
puts "\n[RedPotion ERROR] tried to reset image cache without SDWebImage cocoapod. Please add this to your Rakefile: \n\napp.pods do\n pod \"SDWebImage\"\nend\n"
|
19
26
|
end
|
20
27
|
end
|
28
|
+
|
21
29
|
end
|
22
30
|
end
|
23
31
|
end
|
data/lib/project/version.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
class <%= @name_camel_case %>Screen < UICollectionViewController
|
2
|
+
|
2
3
|
include ProMotion::ScreenModule
|
3
4
|
|
4
5
|
title "Your title here"
|
@@ -50,4 +51,5 @@ class <%= @name_camel_case %>Screen < UICollectionViewController
|
|
50
51
|
def will_animate_rotate(orientation, duration)
|
51
52
|
reapply_styles
|
52
53
|
end
|
54
|
+
|
53
55
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
class <%= @name_camel_case %>Cell < UICollectionViewCell
|
2
|
+
|
2
3
|
def on_load
|
3
4
|
find(self).apply_style :<%= @name %>_cell
|
4
5
|
|
@@ -6,4 +7,5 @@ class <%= @name_camel_case %>Cell < UICollectionViewCell
|
|
6
7
|
# Add your subviews, init stuff here
|
7
8
|
# @foo = q.append!(UILabel, :foo)
|
8
9
|
end
|
10
|
+
|
9
11
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
class <%= @name_camel_case %>Screen < UITableViewController
|
2
|
+
|
2
3
|
include ProMotion::ScreenModule
|
3
4
|
|
4
5
|
title "Your title here"
|
@@ -70,4 +71,5 @@ class <%= @name_camel_case %>Screen < UITableViewController
|
|
70
71
|
def will_animate_rotate(orientation, duration)
|
71
72
|
reapply_styles
|
72
73
|
end
|
74
|
+
|
73
75
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
class <%= @name_camel_case %>Cell < UITableViewCell
|
2
|
+
|
2
3
|
def on_load
|
3
4
|
find(self.contentView).tap do |q|
|
4
5
|
@name = q.append!(UILabel, :cell_name)
|
@@ -8,4 +9,5 @@ class <%= @name_camel_case %>Cell < UITableViewCell
|
|
8
9
|
def update(data)
|
9
10
|
@name.text = "#{data[:name]} is #{data[:num]}"
|
10
11
|
end
|
12
|
+
|
11
13
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
class <%= @name_camel_case %>Screen < PM::<%= @screen_base %>
|
2
|
+
|
2
3
|
title "Your title here"
|
3
4
|
stylesheet <%= @name_camel_case %>ScreenStylesheet
|
4
5
|
|
@@ -26,4 +27,5 @@ class <%= @name_camel_case %>Screen < PM::<%= @screen_base %>
|
|
26
27
|
def will_animate_rotate(orientation, duration)
|
27
28
|
reapply_styles
|
28
29
|
end
|
30
|
+
|
29
31
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
class <%= @name_camel_case %>ScreenStylesheet < ApplicationStylesheet
|
2
|
+
|
2
3
|
# Add your view stylesheets here. You can then override styles if needed,
|
3
4
|
# example: include FooStylesheet
|
4
5
|
|
@@ -10,4 +11,5 @@ class <%= @name_camel_case %>ScreenStylesheet < ApplicationStylesheet
|
|
10
11
|
def root_view(st)
|
11
12
|
st.background_color = color.white
|
12
13
|
end
|
14
|
+
|
13
15
|
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redpotion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
- ClearSight Studio
|
7
|
+
- Infinite Red
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2017-06-13 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: ruby_motion_query
|
@@ -111,8 +110,7 @@ dependencies:
|
|
111
110
|
version: '0'
|
112
111
|
description: RedPotion - The best combination of RubyMotion tools and libraries
|
113
112
|
email:
|
114
|
-
- hello@
|
115
|
-
- hello@clearsightstudio.com
|
113
|
+
- hello@infinite.red
|
116
114
|
executables:
|
117
115
|
- potion
|
118
116
|
extensions: []
|
@@ -181,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
179
|
version: '0'
|
182
180
|
requirements: []
|
183
181
|
rubyforge_project:
|
184
|
-
rubygems_version: 2.
|
182
|
+
rubygems_version: 2.5.2
|
185
183
|
signing_key:
|
186
184
|
specification_version: 4
|
187
185
|
summary: RedPotion combines RMQ, ProMotion, CDQ, AFMotion, and more for the perfect
|