Removed PM::FormotionScreen which also removed dependencies on Formotion, BubbleWrap

This commit is contained in:
Jamon Holmgren
2013-12-04 23:39:11 -08:00
21 changed files with 53 additions and 159 deletions

View File

@@ -1,4 +1,5 @@
source 'https://rubygems.org'
gem 'motion-require'
# Specify your gem's dependencies in ProMotion.gemspec
gemspec

View File

@@ -3,29 +3,26 @@ PATH
specs:
ProMotion (1.1.0)
methadone
motion-require (>= 0.0.6)
GEM
remote: https://rubygems.org/
specs:
bubble-wrap (1.4.0)
formotion (1.6)
bubble-wrap (~> 1.4.0)
motion-require (~> 0.0.3)
methadone (1.3.1)
bundler
motion-redgreen (0.1.0)
motion-require (0.0.7)
motion-stump (0.3.0)
rake (10.1.0)
webstub (0.6.1)
webstub (1.0.1)
PLATFORMS
ruby
DEPENDENCIES
ProMotion!
formotion
motion-redgreen
motion-require
motion-stump
rake
webstub

View File

@@ -21,10 +21,10 @@ Gem::Specification.new do |gem|
gem.require_paths = ["lib"]
gem.version = ProMotion::VERSION
gem.add_dependency "motion-require", ">= 0.0.6"
gem.add_development_dependency("webstub")
gem.add_development_dependency("motion-stump")
gem.add_development_dependency("motion-redgreen")
gem.add_development_dependency("formotion")
gem.add_development_dependency("rake")
gem.add_dependency("methadone")
end

View File

@@ -18,7 +18,7 @@ Motion::Project::App.setup do |app|
app.deployment_target = "6.0"
app.device_family = [:ipad] # so we can test split screen capability
app.detect_dependencies = true
app.detect_dependencies = false
end
def all_files

View File

@@ -1,13 +1,3 @@
unless defined?(Motion::Project::Config)
raise "This file must be required within a RubyMotion project Rakefile."
end
require 'motion-require'
require "ProMotion/version"
Motion::Project::App.setup do |app|
app.detect_dependencies = true
original_files = app.files
delegate = File.join(File.dirname(__FILE__), 'ProMotion/delegate/delegate.rb')
promotion_files = FileList[File.join(File.dirname(__FILE__), 'ProMotion/**/*.rb')].exclude(delegate).to_a
app.files = (promotion_files << delegate) + original_files
end
Motion::Require.all(Dir.glob(File.expand_path('../ProMotion/**/*.rb', __FILE__)))

View File

@@ -1,3 +1,5 @@
motion_require '../table/cell/table_view_cell_module'
module ProMotion
class TableViewCell < UITableViewCell
include TableViewCellModule

View File

@@ -1,3 +1,5 @@
motion_require '../extensions/conversions'
module ProMotion
module Tabs
include Conversions

View File

@@ -1,3 +1,6 @@
motion_require 'delegate_module'
motion_require 'delegate_parent'
module ProMotion
class Delegate < DelegateParent
include ProMotion::DelegateModule

View File

@@ -1,3 +1,7 @@
motion_require '../containers/tabs'
motion_require '../containers/split_screen'
motion_require 'delegate_notifications'
module ProMotion
module DelegateModule
include ProMotion::Tabs

View File

@@ -1,3 +1,7 @@
motion_require '../cocoatouch/view_controller'
motion_require '../screen/screen_module'
motion_require 'map_screen_module'
module ProMotion
class MapScreen < ViewController
include ProMotion::ScreenModule

View File

@@ -1,3 +1,6 @@
motion_require '../cocoatouch/view_controller'
motion_require 'screen_module'
module ProMotion
class Screen < ViewController
# You can inherit a screen from any UIViewController if you include the ScreenModule

View File

@@ -1,3 +1,8 @@
motion_require 'screen_navigation'
motion_require '../view/styling'
motion_require '../containers/tabs'
motion_require '../containers/split_screen'
module ProMotion
module ScreenModule
include ProMotion::ScreenNavigation

View File

@@ -1,3 +1,5 @@
motion_require '../../view/styling'
module ProMotion
module TableViewCellModule
include Styling

View File

@@ -1,3 +1,8 @@
motion_require '../cocoatouch/table_view_controller'
motion_require '../screen/screen_module'
motion_require 'table'
motion_require 'grouped_table'
module ProMotion
class GroupedTableScreen < TableViewController
include ProMotion::ScreenModule

View File

@@ -1,3 +1,8 @@
motion_require '../view/styling'
motion_require 'extensions/searchable'
motion_require 'extensions/refreshable'
motion_require 'extensions/indexable'
module ProMotion
module Table

View File

@@ -1,3 +1,7 @@
motion_require '../cocoatouch/table_view_controller'
motion_require '../screen/screen_module'
motion_require 'table'
module ProMotion
class TableScreen < TableViewController
include ProMotion::ScreenModule

View File

@@ -1,87 +0,0 @@
module ProMotion
if defined?(Formotion) && defined?(Formotion::FormController)
class FormotionScreen < Formotion::FormController
include ProMotion::ScreenModule
def self.new(args = {})
s = self.alloc.initWithStyle(UITableViewStyleGrouped)
s.on_create(args) if s.respond_to?(:on_create)
if s.respond_to?(:table_data)
s.form = s.table_data
elsif args[:form]
s.form = args[:form]
else
PM.logger.error "PM::FormotionScreen requires a `table_data` method or form: to be passed into `new`."
end
t = s.title # Formotion kills the title when you request tableView.
s.tableView.allowsSelectionDuringEditing = true
s.title = t
s.form.on_submit { |form| s.on_submit(form) if s.respond_to?(:on_submit) }
s
end
# emulate the ProMotion table update for formotion
def update_table_data
self.form = table_data
self.form.controller = self
self.tableView.reloadData
end
def screen_setup
self.title = self.class.send(:get_title)
end
def loadView
super
self.send(:on_load) if self.respond_to?(:on_load)
end
def viewDidLoad
super
self.view_did_load if self.respond_to?(:view_did_load)
end
def viewWillAppear(animated)
super
self.view_will_appear(animated) if self.respond_to?("view_will_appear:")
end
def viewDidAppear(animated)
super
self.view_did_appear(animated) if self.respond_to?("view_did_appear:")
end
def viewWillDisappear(animated)
self.view_will_disappear(animated) if self.respond_to?("view_will_disappear:")
super
end
def viewDidDisappear(animated)
if self.respond_to?("view_did_disappear:")
self.view_did_disappear(animated)
end
super
end
def shouldAutorotateToInterfaceOrientation(orientation)
self.should_rotate(orientation)
end
def shouldAutorotate
self.should_autorotate
end
def willRotateToInterfaceOrientation(orientation, duration:duration)
self.will_rotate(orientation, duration)
end
def didRotateFromInterfaceOrientation(orientation)
self.on_rotate
end
end
end
end

View File

@@ -1,3 +1,5 @@
motion_require '../extensions/conversions'
module ProMotion
module Styling
include Conversions

View File

@@ -1,3 +1,7 @@
motion_require '../cocoatouch/view_controller'
motion_require '../screen/screen_module'
motion_require 'web_screen_module'
module ProMotion
class WebScreen < ViewController
include ProMotion::ScreenModule

View File

@@ -1,30 +0,0 @@
class TestFormotionScreen < PM::FormotionScreen
attr_accessor :submitted_form
title "Formotion Test"
def table_data
@data ||= {
sections: [{
title: "Currency",
key: :currency,
select_one: true,
rows: [{
title: "EUR",
key: :eur,
value: true,
type: :check
}, {
title: "USD",
key: :usd,
type: :check
}]
}]
}
end
def on_submit(form)
self.submitted_form = form
end
end

View File

@@ -1,22 +0,0 @@
describe "PM::FormotionScreen" do
before do
@screen = TestFormotionScreen.new
end
it "should store title" do
TestFormotionScreen.get_title.should == 'Formotion Test'
@screen.class.get_title.should == "Formotion Test"
end
it "should set default title on new instances" do
@screen.title.should == "Formotion Test"
end
it "should fire the on_submit method when form is submitted" do
@screen.form.submit
@screen.submitted_form.should.not.be.nil
@screen.submitted_form.render.should.be.kind_of(Hash)
end
end