From 6046dd7f49ba174f309baaa428eaac80ce0290b6 Mon Sep 17 00:00:00 2001 From: Allen Wang Date: Wed, 27 Nov 2013 15:52:58 -0500 Subject: [PATCH] use motion-require --- Gemfile | 1 + Gemfile.lock | 6 ++++-- ProMotion.gemspec | 1 + Rakefile | 2 +- lib/ProMotion.rb | 14 ++------------ lib/ProMotion/cocoatouch/table_view_cell.rb | 2 ++ lib/ProMotion/containers/tabs.rb | 2 ++ lib/ProMotion/delegate/delegate.rb | 3 +++ lib/ProMotion/delegate/delegate_module.rb | 4 ++++ lib/ProMotion/map/map_screen.rb | 4 ++++ lib/ProMotion/screen/screen.rb | 3 +++ lib/ProMotion/screen/screen_module.rb | 5 +++++ lib/ProMotion/table/cell/table_view_cell_module.rb | 2 ++ lib/ProMotion/table/grouped_table_screen.rb | 5 +++++ lib/ProMotion/table/table.rb | 5 +++++ lib/ProMotion/table/table_screen.rb | 4 ++++ lib/ProMotion/thirdparty/formotion_screen.rb | 2 ++ lib/ProMotion/view/styling.rb | 2 ++ lib/ProMotion/web/web_screen.rb | 4 ++++ 19 files changed, 56 insertions(+), 15 deletions(-) diff --git a/Gemfile b/Gemfile index c70dc6f..79d9ccd 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,5 @@ source 'https://rubygems.org' +gem 'motion-require' # Specify your gem's dependencies in ProMotion.gemspec gemspec diff --git a/Gemfile.lock b/Gemfile.lock index dc26289..56a95c4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,8 +1,9 @@ PATH remote: . specs: - ProMotion (1.0.4) + ProMotion (1.1.0.rc1) methadone + motion-require (>= 0.0.6) GEM remote: https://rubygems.org/ @@ -11,7 +12,7 @@ GEM formotion (1.6) bubble-wrap (~> 1.4.0) motion-require (~> 0.0.3) - methadone (1.3.0) + methadone (1.3.1) bundler motion-redgreen (0.1.0) motion-require (0.0.7) @@ -26,6 +27,7 @@ DEPENDENCIES ProMotion! formotion motion-redgreen + motion-require motion-stump rake webstub diff --git a/ProMotion.gemspec b/ProMotion.gemspec index 85e9ed4..09cefac 100644 --- a/ProMotion.gemspec +++ b/ProMotion.gemspec @@ -21,6 +21,7 @@ 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") diff --git a/Rakefile b/Rakefile index 0f592c7..8dc18d0 100644 --- a/Rakefile +++ b/Rakefile @@ -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 diff --git a/lib/ProMotion.rb b/lib/ProMotion.rb index 6d8ce9b..5d2b0d8 100644 --- a/lib/ProMotion.rb +++ b/lib/ProMotion.rb @@ -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__))) \ No newline at end of file diff --git a/lib/ProMotion/cocoatouch/table_view_cell.rb b/lib/ProMotion/cocoatouch/table_view_cell.rb index e2d65a9..9a3347a 100644 --- a/lib/ProMotion/cocoatouch/table_view_cell.rb +++ b/lib/ProMotion/cocoatouch/table_view_cell.rb @@ -1,3 +1,5 @@ +motion_require '../table/cell/table_view_cell_module' + module ProMotion class TableViewCell < UITableViewCell include TableViewCellModule diff --git a/lib/ProMotion/containers/tabs.rb b/lib/ProMotion/containers/tabs.rb index 4ee12ed..4624f2c 100644 --- a/lib/ProMotion/containers/tabs.rb +++ b/lib/ProMotion/containers/tabs.rb @@ -1,3 +1,5 @@ +motion_require '../extensions/conversions' + module ProMotion module Tabs include Conversions diff --git a/lib/ProMotion/delegate/delegate.rb b/lib/ProMotion/delegate/delegate.rb index 3fd47f3..73b157e 100644 --- a/lib/ProMotion/delegate/delegate.rb +++ b/lib/ProMotion/delegate/delegate.rb @@ -1,3 +1,6 @@ +motion_require 'delegate_module' +motion_require 'delegate_parent' + module ProMotion class Delegate < DelegateParent include ProMotion::DelegateModule diff --git a/lib/ProMotion/delegate/delegate_module.rb b/lib/ProMotion/delegate/delegate_module.rb index 79ffd85..10004f0 100644 --- a/lib/ProMotion/delegate/delegate_module.rb +++ b/lib/ProMotion/delegate/delegate_module.rb @@ -1,3 +1,7 @@ +motion_require '../containers/tabs' +motion_require '../containers/split_screen' +motion_require 'delegate_notifications' + module ProMotion module DelegateModule include ProMotion::Tabs diff --git a/lib/ProMotion/map/map_screen.rb b/lib/ProMotion/map/map_screen.rb index e015c94..5e6dfd4 100644 --- a/lib/ProMotion/map/map_screen.rb +++ b/lib/ProMotion/map/map_screen.rb @@ -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 diff --git a/lib/ProMotion/screen/screen.rb b/lib/ProMotion/screen/screen.rb index 2c8e425..0496f1f 100644 --- a/lib/ProMotion/screen/screen.rb +++ b/lib/ProMotion/screen/screen.rb @@ -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 diff --git a/lib/ProMotion/screen/screen_module.rb b/lib/ProMotion/screen/screen_module.rb index f02544c..0814789 100644 --- a/lib/ProMotion/screen/screen_module.rb +++ b/lib/ProMotion/screen/screen_module.rb @@ -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 diff --git a/lib/ProMotion/table/cell/table_view_cell_module.rb b/lib/ProMotion/table/cell/table_view_cell_module.rb index f5b6415..6cb0cc8 100644 --- a/lib/ProMotion/table/cell/table_view_cell_module.rb +++ b/lib/ProMotion/table/cell/table_view_cell_module.rb @@ -1,3 +1,5 @@ +motion_require '../../view/styling' + module ProMotion module TableViewCellModule include Styling diff --git a/lib/ProMotion/table/grouped_table_screen.rb b/lib/ProMotion/table/grouped_table_screen.rb index 0fa2dff..2bcd97e 100644 --- a/lib/ProMotion/table/grouped_table_screen.rb +++ b/lib/ProMotion/table/grouped_table_screen.rb @@ -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 diff --git a/lib/ProMotion/table/table.rb b/lib/ProMotion/table/table.rb index 2654cdd..315b16c 100644 --- a/lib/ProMotion/table/table.rb +++ b/lib/ProMotion/table/table.rb @@ -1,3 +1,8 @@ +motion_require '../view/styling' +motion_require 'extensions/searchable' +motion_require 'extensions/refreshable' +motion_require 'extensions/indexable' + module ProMotion module Table diff --git a/lib/ProMotion/table/table_screen.rb b/lib/ProMotion/table/table_screen.rb index 441a768..862470b 100644 --- a/lib/ProMotion/table/table_screen.rb +++ b/lib/ProMotion/table/table_screen.rb @@ -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 diff --git a/lib/ProMotion/thirdparty/formotion_screen.rb b/lib/ProMotion/thirdparty/formotion_screen.rb index ee68719..b6fd347 100644 --- a/lib/ProMotion/thirdparty/formotion_screen.rb +++ b/lib/ProMotion/thirdparty/formotion_screen.rb @@ -1,3 +1,5 @@ +motion_require '../screen/screen_module' + module ProMotion if defined?(Formotion) && defined?(Formotion::FormController) class FormotionScreen < Formotion::FormController diff --git a/lib/ProMotion/view/styling.rb b/lib/ProMotion/view/styling.rb index 96d58a7..b1933a3 100644 --- a/lib/ProMotion/view/styling.rb +++ b/lib/ProMotion/view/styling.rb @@ -1,3 +1,5 @@ +motion_require '../extensions/conversions' + module ProMotion module Styling include Conversions diff --git a/lib/ProMotion/web/web_screen.rb b/lib/ProMotion/web/web_screen.rb index e26523f..8f19518 100644 --- a/lib/ProMotion/web/web_screen.rb +++ b/lib/ProMotion/web/web_screen.rb @@ -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