redpotion 1.4.0 → 1.5.0

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: d02a5ebf83ee813131955bcb138df65d3c0d46df
4
- data.tar.gz: 14409d48ae7de7f9a20cdd14205f0e3acc84f5bc
3
+ metadata.gz: c612a7c529685b2e3d9788f59c71f6326ed2e9c5
4
+ data.tar.gz: 0868dfb194fad46b871c527a278ea85e356e39af
5
5
  SHA512:
6
- metadata.gz: bdd6442f259a64cdc1a948dab9039d31378b0a264aaf532c663eddd9545ae869ba9ee8e95393bdf4263dad7244ef5fe05fa02e1ddf97b245cfae224237a1e487
7
- data.tar.gz: 3e8249d43d27b7af83dab08bcd0941f4f5aacb925d12fa73f54eb5cb5522146dc2a34e3b6d804103585686d7378a37fe36faa4015e27a6c43fae130a677f8ac8
6
+ metadata.gz: db1174afce9b8419e240349f1dc88a43b06d6dcdb69ae2b2a95062825a4a0888061b30d38eb9a61054810ad25625e50e9be9a2b32fe3bcdabe4578fd42b472d5
7
+ data.tar.gz: 2384817d833b77a6950aaf56ad8c60039bf6cbb99bbe623d97f2a26ef1da4020a4f3bf273464f449642bc0174e9603f5b7af73a7e8e70275f2e471288e56de7f
data/README.md CHANGED
@@ -30,38 +30,4 @@ ProMotion for screens and RMQ for styles, animations, traversing, events, etc.
30
30
 
31
31
  **Read the [RedPotion Documentation](http://docs.redpotion.org) here**
32
32
 
33
- <br />
34
- <br />
35
-
36
- ----------
37
-
38
- <br />
39
-
40
- ## Quick start
41
-
42
- ```
43
- gem install redpotion
44
-
45
- potion create my_app
46
- bundle
47
- rake pod:install
48
- rake
49
- ```
50
-
51
- ## Installation
52
-
53
- - `gem install redpotion`
54
-
55
- If you use rbenv
56
-
57
- - `rbenv rehash`
58
-
59
- add it to your `Gemfile`:
60
-
61
- - `gem 'redpotion'`
62
-
63
- <br />
64
-
65
- ## Read the documentation at [docs.redpotion.org](http://docs.redpotion.org)
66
-
67
- <br />
33
+ **Read the [RedPotion Quick Start Documentation](http://docs.redpotion.org/en/latest/quick_start/) here**
data/bin/potion CHANGED
@@ -78,6 +78,10 @@ class PotionCommandLine
78
78
  end
79
79
  end
80
80
 
81
+ def include_skip_option?(options)
82
+ (options.first && options.first.include?('--'))
83
+ end
84
+
81
85
  def create(template_or_app_name, *options)
82
86
  # Dry Run option - TODO - change this to --dry_run to streamline
83
87
  if options.first == 'dry_run'
@@ -85,7 +89,7 @@ class PotionCommandLine
85
89
  options.slice!(0)
86
90
  end
87
91
 
88
- if options.first && options.first.include?('--')
92
+ if options.compact.empty? || include_skip_option?(options)
89
93
  new(template_or_app_name, *options)
90
94
  else
91
95
  generate(template_or_app_name, *options)
@@ -263,7 +267,7 @@ end
263
267
 
264
268
  # Process input, execute actions
265
269
  unless ARGV.length > 0
266
- puts "potion - Invalid command, do something like this: potion create my_new_app\n"
270
+ puts "potion - Invalid command, do something like this: potion new my_new_app\n"
267
271
  puts PotionCommandLine::HELP_TEXT
268
272
  exit
269
273
  end
@@ -1,5 +1,5 @@
1
1
  if RUBYMOTION_ENV == "development"
2
- module Kernel
2
+ class TopLevel
3
3
  def live(interval = 1.0, debug=false)
4
4
  rmq_live_stylesheets interval, debug
5
5
  end
@@ -7,5 +7,13 @@ if RUBYMOTION_ENV == "development"
7
7
  def enable_live_stylesheets(interval)
8
8
  enable_rmq_live_stylesheets interval
9
9
  end
10
+
11
+ def open(screen, args={})
12
+ find.screen.open(screen, args)
13
+ end
14
+
15
+ def close(args={})
16
+ find.screen.close(args)
17
+ end
10
18
  end
11
19
  end
@@ -18,4 +18,8 @@ class Object
18
18
  def find!(*args)
19
19
  rmq(*args).get
20
20
  end
21
+
22
+ def screen
23
+ rmq.screen
24
+ end
21
25
  end
@@ -16,7 +16,9 @@ class UIImageView
16
16
  options:SDWebImageRefreshCached,
17
17
  progress:nil,
18
18
  completed: -> image, error, cacheType, finished {
19
- self.image = image unless image.nil?
19
+ Dispatch::Queue.main.async do
20
+ self.image = image
21
+ end unless image.nil?
20
22
  })
21
23
  else
22
24
  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"
@@ -19,32 +19,32 @@ class UIView
19
19
  on_styled
20
20
  end
21
21
 
22
- def append(view_or_constant, style=nil, opts = {})
23
- rmq(self).append(view_or_constant, style, opts)
22
+ def append(view_or_constant, style=nil, opts = {}, &block)
23
+ rmq(self).append(view_or_constant, style, opts, &block)
24
24
  end
25
- def append!(view_or_constant, style=nil, opts = {})
26
- rmq(self).append!(view_or_constant, style, opts)
25
+ def append!(view_or_constant, style=nil, opts = {}, &block)
26
+ rmq(self).append!(view_or_constant, style, opts, &block)
27
27
  end
28
28
 
29
- def prepend(view_or_constant, style=nil, opts = {})
30
- rmq(self).prepend(view_or_constant, style, opts)
29
+ def prepend(view_or_constant, style=nil, opts = {}, &block)
30
+ rmq(self).prepend(view_or_constant, style, opts, &block)
31
31
  end
32
- def prepend!(view_or_constant, style=nil, opts = {})
33
- rmq(self).prepend!(view_or_constant, style, opts)
32
+ def prepend!(view_or_constant, style=nil, opts = {}, &block)
33
+ rmq(self).prepend!(view_or_constant, style, opts, &block)
34
34
  end
35
35
 
36
- def create(view_or_constant, style=nil, opts = {})
37
- rmq(self).create(view_or_constant, style, opts)
36
+ def create(view_or_constant, style=nil, opts = {}, &block)
37
+ rmq(self).create(view_or_constant, style, opts, &block)
38
38
  end
39
- def create!(view_or_constant, style=nil, opts = {})
40
- rmq(self).create!(view_or_constant, style, opts)
39
+ def create!(view_or_constant, style=nil, opts = {}, &block)
40
+ rmq(self).create!(view_or_constant, style, opts, &block)
41
41
  end
42
42
 
43
- def build(view, style = nil, opts = {})
44
- rmq(self).build(view, style, opts)
43
+ def build(view, style = nil, opts = {}, &block)
44
+ rmq(self).build(view, style, opts, &block)
45
45
  end
46
- def build!(view, style = nil, opts = {})
47
- rmq(self).build!(view, style, opts)
46
+ def build!(view, style = nil, opts = {}, &block)
47
+ rmq(self).build!(view, style, opts, &block)
48
48
  end
49
49
 
50
50
  def on(event, args = {}, &block)
@@ -0,0 +1,13 @@
1
+ module ProMotion
2
+ class CollectionScreen
3
+
4
+ def set_stylesheet
5
+ super.tap do
6
+ if self.class.rmq_style_sheet_class
7
+ self.collection_view.rmq.apply_style(:collection_view) if self.rmq.stylesheet.respond_to?(:collection_view)
8
+ end
9
+ end
10
+ end
11
+
12
+ end
13
+ end
@@ -58,7 +58,7 @@ module ProMotion
58
58
  data_with_scope = data_model.send(data_scope)
59
59
  end
60
60
 
61
- if data_with_scope.sort_descriptors.empty?
61
+ if data_with_scope.sort_descriptors.blank?
62
62
  # Try to be smart about how we sort things if a sort descriptor doesn't exist
63
63
  attributes = data_model.send(:attribute_names)
64
64
  sort_attribute = nil
@@ -67,7 +67,10 @@ module ProMotion
67
67
  end
68
68
 
69
69
  if sort_attribute
70
- mp "The `#{data_model}` model scope `#{data_scope}` needs a sort descriptor. Add sort_by(:property) to your scope. Currently sorting by :#{sort_attribute}.", force_color: :yellow
70
+
71
+ unless data_scope == :all
72
+ mp "The `#{data_model}` model scope `#{data_scope}` needs a sort descriptor. Add sort_by(:property) to your scope. Currently sorting by :#{sort_attribute}.", force_color: :yellow
73
+ end
71
74
  data_model.send(data_scope).sort_by(sort_attribute)
72
75
  else
73
76
  # This is where the application says goodbye and dies in a fiery crash.
@@ -2,21 +2,15 @@ module ProMotion
2
2
  module Table
3
3
  module Searchable
4
4
 
5
- # Replace this method so that we can gather the predicate fields for DataTableScreen searchable
6
- alias_method :old_set_searchable_param_defaults, :set_searchable_param_defaults
7
- def set_searchable_param_defaults(params)
8
- all_params = old_set_searchable_param_defaults(params)
9
-
10
- if self.is_a?(ProMotion::DataTableScreen)
11
- if params[:search_bar][:fields].nil?
12
- raise "ERROR: You must specify fields:[:example] for your searchable DataTableScreen. It should be an array of fields you want searched in CDQ."
13
- else
14
- @data_table_predicate_fields = all_params[:search_bar][:fields]
15
- end
5
+ def make_data_table_searchable(params={})
6
+ if params[:search_bar][:fields].nil?
7
+ raise "ERROR: You must specify fields:[:example] for your searchable DataTableScreen. It should be an array of fields you want searched in CDQ."
8
+ else
9
+ @data_table_predicate_fields = params[:search_bar][:fields]
16
10
  end
11
+ params[:delegate] = search_delegate
17
12
 
18
- all_params[:delegate] = search_delegate
19
- all_params
13
+ make_searchable(params)
20
14
  end
21
15
 
22
16
  def search_fetch_controller
@@ -24,6 +18,8 @@ module ProMotion
24
18
  end
25
19
 
26
20
  def new_frc_with_search(search_string)
21
+ return if @data_table_predicate_fields.blank?
22
+
27
23
  # Create the predicate from the predetermined fetch scope.
28
24
  where = @data_table_predicate_fields.map{|f| "#{f} CONTAINS[cd] \"#{search_string}\"" }.join(" OR ")
29
25
  search_scope = fetch_scope.where(where)
@@ -5,4 +5,22 @@ module ProMotion
5
5
  self.rmq.build(cell)
6
6
  end
7
7
  end
8
+
9
+ # This is duplicated from ProMotion in order to be call
10
+ # make_data_table_searchable instead of make_searchable
11
+ module Table
12
+ def set_up_searchable
13
+ if self.class.respond_to?(:get_searchable) && self.class.get_searchable
14
+ if self.is_a?(ProMotion::DataTableScreen)
15
+ self.make_data_table_searchable(content_controller: self, search_bar: self.class.get_searchable_params)
16
+ else
17
+ self.make_searchable(content_controller: self, search_bar: self.class.get_searchable_params)
18
+ end
19
+ if self.class.get_searchable_params[:hide_initially]
20
+ self.tableView.contentOffset = CGPointMake(0, self.searchDisplayController.searchBar.frame.size.height)
21
+ end
22
+ end
23
+ end
24
+ end
25
+
8
26
  end
@@ -8,6 +8,16 @@ module RubyMotionQuery
8
8
  def data(*args) # Do not alias this
9
9
  CDQ.cdq(*args)
10
10
  end
11
+
12
+ def reset_image_cache!
13
+ if !!defined?(SDWebImageManager)
14
+ image_cache = SDImageCache.sharedImageCache
15
+ image_cache.clearMemory
16
+ image_cache.clearDisk
17
+ else
18
+ 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
+ end
20
+ end
11
21
  end
12
22
  end
13
23
  end
@@ -1,3 +1,3 @@
1
1
  module RedPotion
2
- VERSION = "1.4.0"
2
+ VERSION = "1.5.0"
3
3
  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: 1.4.0
4
+ version: 1.5.0
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-07-14 00:00:00.000000000 Z
12
+ date: 2015-11-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby_motion_query
@@ -17,28 +17,28 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 1.6.1
20
+ version: 1.7.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 1.6.1
27
+ version: 1.7.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: ProMotion
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 2.4.2
34
+ version: 2.5.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: 2.4.2
41
+ version: 2.5.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: motion_print
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -129,6 +129,7 @@ files:
129
129
  - lib/project/ext/ui_table_view_cell.rb
130
130
  - lib/project/ext/ui_view.rb
131
131
  - lib/project/ext/ui_view_controller.rb
132
+ - lib/project/pro_motion/collection_screen.rb
132
133
  - lib/project/pro_motion/data_table.rb
133
134
  - lib/project/pro_motion/data_table_screen.rb
134
135
  - lib/project/pro_motion/data_table_search_delegate.rb
@@ -180,10 +181,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
181
  version: '0'
181
182
  requirements: []
182
183
  rubyforge_project:
183
- rubygems_version: 2.4.6
184
+ rubygems_version: 2.4.5.1
184
185
  signing_key:
185
186
  specification_version: 4
186
187
  summary: RedPotion combines RMQ, ProMotion, CDQ, AFMotion, and more for the perfect
187
188
  mix to develop in RubyMotion fast
188
189
  test_files: []
189
- has_rdoc: