Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove use of &/to_proc syntactic sugar since it causes RubyMotion to leak #161

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Formotion.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ Gem::Specification.new do |s|
s.license = 'MIT'

s.add_dependency "bubble-wrap", ">= 1.4.0"
s.add_dependency "motion-require", ">= 0.1.0"
s.add_development_dependency 'rake'
end
9 changes: 5 additions & 4 deletions lib/formotion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
require 'bubble-wrap/font'
require 'bubble-wrap/camera'

require 'motion-require'

Motion::Require.all(Dir.glob(File.expand_path('../formotion/**/*.rb', __FILE__)))

Motion::Project::App.setup do |app|
app.frameworks<<'CoreLocation' unless app.frameworks.include?('CoreLocation')
app.frameworks<<'MapKit' unless app.frameworks.include?('MapKit')

app.resources_dirs << File.join(File.dirname(__FILE__), '../resources')

Dir.glob(File.join(File.dirname(__FILE__), 'formotion/**/*.rb')).each do |file|
app.files.unshift(file)
end

end
2 changes: 1 addition & 1 deletion lib/formotion/base.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'row_type/base'


module Formotion
class Base
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/controller/form_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require '../patch/ui_text_field'


#################
#
Expand Down
4 changes: 2 additions & 2 deletions lib/formotion/form/form.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require "../base"


module Formotion
class Form < Formotion::Base
Expand Down Expand Up @@ -206,7 +206,7 @@ def render

def sub_render
kv = {}
rows = sections.map(&:rows).flatten
rows = sections.map { |x| x.rows }.flatten
subform_rows = rows.select{ |row| row.subform != nil }
subform_rows.each do |subform_row|
kv[subform_row.key] = subform_row.subform.to_form.render
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/form/form_delegate.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require "../base"


module Formotion
class Form < Formotion::Base
Expand Down
4 changes: 2 additions & 2 deletions lib/formotion/row/row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require "../base"


module Formotion
class Row < Formotion::Base
Expand Down Expand Up @@ -236,7 +236,7 @@ def button?
end

def subform?
self.type.to_s == "subform"
!!(self.type.to_s =~ /^\w*subform$/)
end

def templated?
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/activity_view_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'object_row'


module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/back_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'button'


module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/button.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'base'


module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/check_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'base'


module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/currency_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'number_row'


module Formotion
module RowType
Expand Down
4 changes: 2 additions & 2 deletions lib/formotion/row_type/date_row.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
motion_require 'string_row'
motion_require 'multi_choice_row'



module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/edit_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'button'


module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/email_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'string_row'


module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/image_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'base'


module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/map_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'base'


module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/number_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'string_row'


module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/object_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'string_row'


module Formotion
module RowType
Expand Down
4 changes: 2 additions & 2 deletions lib/formotion/row_type/options_row.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
motion_require 'base'
motion_require 'items_mapper'



module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/paged_image_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'base'


# ideas taken from:
# http://www.raywenderlich.com/10518/how-to-use-uiscrollview-to-scroll-and-zoom-content
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/phone_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'string_row'


module Formotion
module RowType
Expand Down
4 changes: 2 additions & 2 deletions lib/formotion/row_type/picker_row.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# currently supports only one component
motion_require 'string_row'
motion_require 'multi_choice_row'



module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/slider_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'base'


module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/static_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'string_row'


module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/string_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'base'


module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/subform_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'base'


module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/submit_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'button'


module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/switch_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'base'


module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/tags_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'base'


# ideas and images taken from:
# https://github.com/davbeck/TURecipientBar
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/template_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'base'


# Define template row:
# {
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/text_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'base'


module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/web_link_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'object_row'


module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/row_type/web_view_row.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require 'base'


module Formotion
module RowType
Expand Down
2 changes: 1 addition & 1 deletion lib/formotion/section/section.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
motion_require "../base"


module Formotion
class Section < Formotion::Base
Expand Down