From 8fc7100e0de2582f9732b9ddb69e2549f1231ffb Mon Sep 17 00:00:00 2001 From: Felipe Date: Wed, 29 Jan 2014 17:24:14 -0200 Subject: [PATCH 01/20] updated gemspec --- motion_model.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/motion_model.gemspec b/motion_model.gemspec index 28c244f..124c7db 100644 --- a/motion_model.gemspec +++ b/motion_model.gemspec @@ -12,7 +12,7 @@ Gem::Specification.new do |gem| gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.name = "motion_model" gem.require_paths = ["lib"] - gem.add_dependency 'bubble-wrap', '1.3.0' + gem.add_dependency 'bubble-wrap', '>= 1.3.0' gem.add_dependency 'motion-support', '>= 0.2.2' gem.version = MotionModel::VERSION end From 5b643dec685ef276e6763d30982d19255767536a Mon Sep 17 00:00:00 2001 From: Felipe Date: Wed, 29 Jan 2014 17:33:16 -0200 Subject: [PATCH 02/20] removed pospec for FMDB --- FMDB.podspec | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 FMDB.podspec diff --git a/FMDB.podspec b/FMDB.podspec deleted file mode 100644 index 9cfe71c..0000000 --- a/FMDB.podspec +++ /dev/null @@ -1,12 +0,0 @@ -Pod::Spec.new do |s| - s.name = 'FMDB' - s.version = '2.0' - s.summary = 'A Cocoa / Objective-C wrapper around SQLite.' - s.homepage = 'https://github.com/ccgus/fmdb' - s.license = 'MIT' - s.author = { 'August Mueller' => 'gus@flyingmeat.com' } - s.source = { :git => 'https://github.com/aceofspades/fmdb.git' } - - s.source_files = FileList['src/FM*.{h,m}'].exclude(/fmdb\.m/) - s.library = 'sqlite3' -end From b0092bbddaf5b1848e8aa45a48efbf916c805885 Mon Sep 17 00:00:00 2001 From: Felipe Date: Thu, 30 Jan 2014 08:38:47 -0200 Subject: [PATCH 03/20] update require paths --- lib/motion_model.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/motion_model.rb b/lib/motion_model.rb index 6c0389d..83adbd2 100644 --- a/lib/motion_model.rb +++ b/lib/motion_model.rb @@ -1,6 +1,6 @@ require 'motion-require' require 'motion-support' -%w(*.rb model/*.rb adapters/*.rb).each do |path| +%w(*.rb model/*.rb adapters/*.rb adapters/sql/*.rb).each do |path| Motion::Require.all(Dir.glob(File.expand_path("../../motion/#{path}", __FILE__))) end From 58fcebef18adfc46e0ffdcb27e1c52bb6c33818d Mon Sep 17 00:00:00 2001 From: Felipe Date: Thu, 30 Jan 2014 10:03:02 -0200 Subject: [PATCH 04/20] fixed dependency issue on sql_adapters --- lib/motion_model.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/motion_model.rb b/lib/motion_model.rb index 83adbd2..2530c51 100644 --- a/lib/motion_model.rb +++ b/lib/motion_model.rb @@ -1,6 +1,3 @@ -require 'motion-require' -require 'motion-support' - -%w(*.rb model/*.rb adapters/*.rb adapters/sql/*.rb).each do |path| +%w(*.rb model/*.rb adapters/*.rb adapters/sql/sql_db_adapter.rb adapters/sql/sqlite3_adapter.rb adapters/sql/*.rb).each do |path| Motion::Require.all(Dir.glob(File.expand_path("../../motion/#{path}", __FILE__))) end From a9ef57e8e0c04f308e8a129adf855fa0b10a3140 Mon Sep 17 00:00:00 2001 From: Felipe Date: Thu, 30 Jan 2014 10:34:30 -0200 Subject: [PATCH 05/20] changed resultDictionary to resultDict to support the oficial FMDB pod --- motion/adapters/sql/fmdb_adapter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/motion/adapters/sql/fmdb_adapter.rb b/motion/adapters/sql/fmdb_adapter.rb index bb7bfd2..e944c08 100644 --- a/motion/adapters/sql/fmdb_adapter.rb +++ b/motion/adapters/sql/fmdb_adapter.rb @@ -44,7 +44,7 @@ def execute_sql(sql) if rset result = [] while rset.next do - result << rset.resultDictionary + result << rset.resultDict end end else From f395e2a6d87d0272558bbd559b4cb77b4b6930ec Mon Sep 17 00:00:00 2001 From: Felipe Date: Thu, 30 Jan 2014 10:39:00 -0200 Subject: [PATCH 06/20] conditional logging of queries only for development enviroment --- motion/adapters/sql/sql_db_adapter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/motion/adapters/sql/sql_db_adapter.rb b/motion/adapters/sql/sql_db_adapter.rb index 932573d..1dd68f5 100644 --- a/motion/adapters/sql/sql_db_adapter.rb +++ b/motion/adapters/sql/sql_db_adapter.rb @@ -19,7 +19,7 @@ def log(sql, result) def execute result = @db_adapter.execute_sql(self) - log(@sql, result) + log(@sql, result) if RUBYMOTION_ENV == 'development' result end end From 7e9b0777ca994b373fb62f9017b7095aac20753c Mon Sep 17 00:00:00 2001 From: Felipe Date: Thu, 30 Jan 2014 11:05:03 -0200 Subject: [PATCH 07/20] fixing set_auto_date_field to populate column only if field is blank? --- motion/model/model.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/motion/model/model.rb b/motion/model/model.rb index 6442418..4f180c5 100644 --- a/motion/model/model.rb +++ b/motion/model/model.rb @@ -533,9 +533,12 @@ def save_without_transaction(options = {}) end # Set created_at and updated_at fields + def set_auto_date_field(field_name) method = "#{field_name}=" - self.send(method, Time.now) if self.respond_to?(method) + if self.respond_to?(method) + self.send(method, Time.now) if self.send(field_name).blank? + end end def hooks(name) From 050c45c1f0bf0aad9c5d19567ba186f4d8962298 Mon Sep 17 00:00:00 2001 From: Felipe Date: Thu, 30 Jan 2014 11:08:17 -0200 Subject: [PATCH 08/20] fixed boolean column with default value=false behaviour on model.rb#initialize_data_columns method --- motion/model/model.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/motion/model/model.rb b/motion/model/model.rb index 4f180c5..97bd65e 100644 --- a/motion/model/model.rb +++ b/motion/model/model.rb @@ -820,7 +820,8 @@ def unload_relation(col) end def initialize_data_columns(column, value) #nodoc - self.attributes = {column => value || self.class.default(column)} + _value = value.nil? ? self.class.default(column) : value + self.attributes = {column => _value} end def column_as(col) #nodoc From da0cd6eb8506ce8c84592b0ff73f919509d105e5 Mon Sep 17 00:00:00 2001 From: Felipe Date: Thu, 30 Jan 2014 11:20:32 -0200 Subject: [PATCH 09/20] added reload method on sql_model_adapter InstanceMethods to reload a record instance --- motion/adapters/sql/sql_model_adapter.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/motion/adapters/sql/sql_model_adapter.rb b/motion/adapters/sql/sql_model_adapter.rb index 49d9d67..8800b01 100644 --- a/motion/adapters/sql/sql_model_adapter.rb +++ b/motion/adapters/sql/sql_model_adapter.rb @@ -322,6 +322,15 @@ def get_loaded_attr(col) _col.type == :belongs_to? ? get_attr(name) : relation(_col).loaded end + def reload + _new_record = self.class.find(self.id) + if _new_record.present? + self.attributes = self.class.find(self.id).attributes + else + nil + end + end + private def before_initialize(options) From 97581acf55fd93d1b73dac74c9047efcf3ea4e0d Mon Sep 17 00:00:00 2001 From: Felipe Date: Sat, 8 Feb 2014 20:20:43 -0200 Subject: [PATCH 10/20] added TrueClass and FalseClass support on queries --- motion/adapters/sql/sql_condition.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/motion/adapters/sql/sql_condition.rb b/motion/adapters/sql/sql_condition.rb index 07c1dce..fed9ba5 100644 --- a/motion/adapters/sql/sql_condition.rb +++ b/motion/adapters/sql/sql_condition.rb @@ -49,6 +49,8 @@ def to_sql_str values = @value.map { |v| v.is_a?(Numeric) ? v : %Q["#{v}"] } elsif @value.is_a?(Range) values = [@value.min, @value.max] + elsif @value.is_a?(TrueClass) || @value.is_a?(FalseClass) + value = @value.to_i else value = %Q["#{@value}"] end From 213317df6d82d380ff43020218f1faa878aaa33e Mon Sep 17 00:00:00 2001 From: Felipe Date: Sun, 9 Feb 2014 12:15:52 -0200 Subject: [PATCH 11/20] added delete_all + update_all support --- motion/adapters/sql/sql_db_adapter.rb | 9 +++++++++ motion/adapters/sql/sql_scope.rb | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/motion/adapters/sql/sql_db_adapter.rb b/motion/adapters/sql/sql_db_adapter.rb index 1dd68f5..53bb06b 100644 --- a/motion/adapters/sql/sql_db_adapter.rb +++ b/motion/adapters/sql/sql_db_adapter.rb @@ -154,6 +154,15 @@ def to_delete_sql(scope) SQL end + def to_update_all_sql(scope, attrs) + typed_attrs = _quoted_db_typed_attributes(attrs) + column_values_str = typed_attrs.map { |k, v| %Q["#{k.to_s}" = #{v}] }.join(', ') + + <<-SQL.strip << ';' + UPDATE "#{scope.table_name}" SET #{column_values_str} #{scope.options_str} + SQL + end + private def _quoted_db_typed_attributes(attrs) diff --git a/motion/adapters/sql/sql_scope.rb b/motion/adapters/sql/sql_scope.rb index 6e04cae..d7aed44 100644 --- a/motion/adapters/sql/sql_scope.rb +++ b/motion/adapters/sql/sql_scope.rb @@ -235,6 +235,20 @@ def delete @model_class.do_delete(self) end + def delete_all_sql + @db_adapter.to_delete_sql(default_scope) + end + + def delete_all + _delete_all_sql = @db_adapter.to_delete_sql(self) + @db_adapter.build_sql_context(:delete, _delete_all_sql).execute + end + + def update_all(_attributes) + _update_all_sql = @db_adapter.to_update_all_sql(self, _attributes) + @db_adapter.build_sql_context(:update, _update_all_sql).execute + end + def to_sql @db_adapter.send("to_#{type.to_s}_sql", self) end From 19e5132b5693c81eaf389b5612760c8e26b7eb1f Mon Sep 17 00:00:00 2001 From: Felipe Date: Wed, 19 Feb 2014 19:39:16 -0300 Subject: [PATCH 12/20] trying to fix failing tests-- --- Gemfile | 16 +++----- Gemfile.lock | 95 ++++++++++++++++++--------------------------- Rakefile | 18 ++++++--- lib/motion_model.rb | 2 +- 4 files changed, 57 insertions(+), 74 deletions(-) diff --git a/Gemfile b/Gemfile index 6f01543..39a90b8 100644 --- a/Gemfile +++ b/Gemfile @@ -1,12 +1,8 @@ -source "https://rubygems.org" +source 'https://rubygems.org' -gem "rake" -gem "bubble-wrap" -gem "motion-stump", '~>0.2' +gem 'rake' +gem 'motion-support' +gem 'motion-cocoapods' +gem 'bubble-wrap' +gem 'motion-stump' -gem "motion-support", ">= 0.2.2" - -gem 'cocoapods', '~>0.19.1' -gem 'motion-cocoapods', '~>1.3.0' - -gemspec diff --git a/Gemfile.lock b/Gemfile.lock index e84a9b6..c4b528f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,75 +1,56 @@ -PATH - remote: . - specs: - motion_model (0.4.6) - bubble-wrap (= 1.3.0) - motion-support (>= 0.2.2) - GEM remote: https://rubygems.org/ specs: - activesupport (3.2.13) - i18n (= 0.6.1) + activesupport (3.2.16) + i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) - addressable (2.3.4) - bubble-wrap (1.3.0) - claide (0.2.0) - cocoapods (0.19.1) - activesupport (~> 3.2.13) - claide (~> 0.2.0) - cocoapods-core (= 0.19.1) - cocoapods-downloader (~> 0.1.0) + bubble-wrap (1.4.0) + claide (0.4.0) + cocoapods (0.29.0) + activesupport (>= 3.2.15, < 4) + claide (~> 0.4.0) + cocoapods-core (= 0.29.0) + cocoapods-downloader (~> 0.3.0) + cocoapods-try-release-fix (~> 0.1.1) colored (~> 1.2) escape (~> 0.0.4) - faraday (~> 0.8.1) - json (~> 1.7.3) - octokit (~> 1.7) - open4 (~> 1.3.0) - rake (~> 10.0.0) - xcodeproj (~> 0.5.5) - cocoapods-core (0.19.1) - activesupport (~> 3.2.13) - rake (~> 10.0.0) - cocoapods-downloader (0.1.0) + json_pure (~> 1.8) + nap (~> 0.5) + open4 (~> 1.3) + xcodeproj (~> 0.14.1) + cocoapods-core (0.29.0) + activesupport (>= 3.2.15, < 4) + fuzzy_match (~> 2.0.4) + json_pure (~> 1.8) + nap (~> 0.5) + cocoapods-downloader (0.3.0) + cocoapods-try-release-fix (0.1.1) colored (1.2) escape (0.0.4) - faraday (0.8.7) - multipart-post (~> 1.1) - faraday_middleware (0.9.0) - faraday (>= 0.7.4, < 0.9) - hashie (2.0.5) - i18n (0.6.1) - json (1.7.7) - motion-cocoapods (1.3.1) - cocoapods (>= 0.17.0) - motion-require (0.0.6) - motion-stump (0.2.1) - motion-support (0.2.2) + fuzzy_match (2.0.4) + i18n (0.6.9) + json_pure (1.8.1) + motion-cocoapods (1.4.0) + cocoapods (>= 0.26.2) + motion-require (0.1.0) + motion-stump (0.3.1) + motion-support (0.2.6) motion-require (>= 0.0.6) - multi_json (1.7.3) - multipart-post (1.2.0) - netrc (0.7.7) - octokit (1.24.0) - addressable (~> 2.2) - faraday (~> 0.8) - faraday_middleware (~> 0.9) - hashie (~> 2.0) - multi_json (~> 1.3) - netrc (~> 0.7.7) + multi_json (1.8.4) + nap (0.6.0) open4 (1.3.0) - rake (10.0.4) - xcodeproj (0.5.5) - activesupport (~> 3.2.13) + rake (10.1.1) + xcodeproj (0.14.1) + activesupport (~> 3.0) colored (~> 1.2) + rake PLATFORMS ruby DEPENDENCIES bubble-wrap - cocoapods (~> 0.19.1) - motion-cocoapods (~> 1.3.0) - motion-stump (~> 0.2) - motion-support (>= 0.2.2) - motion_model! + motion-cocoapods + motion-stump + motion-support rake diff --git a/Rakefile b/Rakefile index df46d30..93e350d 100644 --- a/Rakefile +++ b/Rakefile @@ -1,19 +1,25 @@ # -*- coding: utf-8 -*- -require "bundler/gem_tasks" $:.unshift("/Library/RubyMotion/lib") require 'motion/project/template/ios' -require 'bundler' -Bundler.require(:default) + +begin + require 'bundler' + Bundler.require +rescue LoadError +end require 'motion-cocoapods' +$: << File.expand_path('/lib', __FILE__) + require 'motion_model' -require 'motion_model/array' -require 'motion_model/sql' -require 'motion_model/fmdb' Motion::Project::App.setup do |app| # Use `rake config' to see complete project settings. app.name = 'MotionModel' app.delegate_class = 'FakeDelegate' + + app.pods do + pod 'FMDB', '2.0' + end end diff --git a/lib/motion_model.rb b/lib/motion_model.rb index 2530c51..64afda2 100644 --- a/lib/motion_model.rb +++ b/lib/motion_model.rb @@ -1,3 +1,3 @@ -%w(*.rb model/*.rb adapters/*.rb adapters/sql/sql_db_adapter.rb adapters/sql/sqlite3_adapter.rb adapters/sql/*.rb).each do |path| +%w(*.rb model/*.rb adapters/*.rb adapters/array/*.rb adapters/sql/sql_db_adapter.rb adapters/sql/sqlite3_adapter.rb adapters/sql/*.rb).each do |path| Motion::Require.all(Dir.glob(File.expand_path("../../motion/#{path}", __FILE__))) end From e18213610a47b640dec8c3cb3870f2f75ecca7f7 Mon Sep 17 00:00:00 2001 From: Felipe Date: Wed, 19 Feb 2014 19:40:37 -0300 Subject: [PATCH 13/20] removed logging --- motion/adapters/sql/sql_db_adapter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/motion/adapters/sql/sql_db_adapter.rb b/motion/adapters/sql/sql_db_adapter.rb index 53bb06b..45dcbfe 100644 --- a/motion/adapters/sql/sql_db_adapter.rb +++ b/motion/adapters/sql/sql_db_adapter.rb @@ -19,7 +19,7 @@ def log(sql, result) def execute result = @db_adapter.execute_sql(self) - log(@sql, result) if RUBYMOTION_ENV == 'development' + #log(@sql, result) if RUBYMOTION_ENV == 'development' result end end From 3eeb216a9bb61d33acb6d1c1bc721c71117945e2 Mon Sep 17 00:00:00 2001 From: Felipe Date: Mon, 24 Feb 2014 16:33:35 -0300 Subject: [PATCH 14/20] added offset scope option --- motion/adapters/sql/sql_scope.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/motion/adapters/sql/sql_scope.rb b/motion/adapters/sql/sql_scope.rb index d7aed44..ec7c37e 100644 --- a/motion/adapters/sql/sql_scope.rb +++ b/motion/adapters/sql/sql_scope.rb @@ -17,6 +17,7 @@ def initialize(model_class, db_adapter, type = :select) @orders = nil @group = nil @limit = nil + @offset = nil end def method_missing(id, *args) @@ -34,6 +35,7 @@ def deep_clone _orders = @orders.try(:dup) _group = @group.try(:dup) _limit = @limit + _offset = @offset _conditions = @conditions.try(:dup) _type = @type self.class.new(@model_class, @db_adapter).instance_eval do @@ -43,6 +45,7 @@ def deep_clone @orders = _orders @group = _group @limit = _limit + @offset = _offset @conditions = _conditions @type = _type self @@ -190,6 +193,14 @@ def limit(limit) end end + def offset(offset) + return self if null_scope? + deep_clone.instance_eval do + @offset = offset + self + end + end + def all deep_clone end @@ -300,8 +311,12 @@ def limit_str @limit ? %Q[LIMIT #{@limit}] : nil end + def offset_str + @offset ? %Q[OFFSET #{@offset}] : nil + end + def options_str - arr = [SQLCondition.to_sql_str(@conditions), group_str, order_str, limit_str].compact + arr = [SQLCondition.to_sql_str(@conditions), group_str, order_str, limit_str, offset_str].compact arr.empty? ? nil : arr.join(' ') end From 7dd370af2495c1da5d5dda549e624d5600a8e22d Mon Sep 17 00:00:00 2001 From: Felipe Date: Mon, 24 Feb 2014 16:47:35 -0300 Subject: [PATCH 15/20] removed conditional loggin --- motion/adapters/sql/sql_db_adapter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/motion/adapters/sql/sql_db_adapter.rb b/motion/adapters/sql/sql_db_adapter.rb index 45dcbfe..abfbd9a 100644 --- a/motion/adapters/sql/sql_db_adapter.rb +++ b/motion/adapters/sql/sql_db_adapter.rb @@ -19,7 +19,7 @@ def log(sql, result) def execute result = @db_adapter.execute_sql(self) - #log(@sql, result) if RUBYMOTION_ENV == 'development' + log(@sql, result) result end end From ea6a9697fc890eb18bb4af24939148187589cce2 Mon Sep 17 00:00:00 2001 From: Luis Felipe Colle da Luz Date: Mon, 4 Aug 2014 14:22:56 +0100 Subject: [PATCH 16/20] rtyng to fix dependencies issue --- lib/motion_model.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/motion_model.rb b/lib/motion_model.rb index 64afda2..c546321 100644 --- a/lib/motion_model.rb +++ b/lib/motion_model.rb @@ -1,3 +1,12 @@ -%w(*.rb model/*.rb adapters/*.rb adapters/array/*.rb adapters/sql/sql_db_adapter.rb adapters/sql/sqlite3_adapter.rb adapters/sql/*.rb).each do |path| +# Motion::Require.all(Dir.glob(File.expand_path("../../motion/#{path}", __FILE__))) +# %w[*.rb model/*.rb adapters/*.rb adapters/array/*.rb adapters/sql/sql_db_adapter.rb adapters/sql/sqlite3_adapter.rb adapters/sql/*.rb].each do |path| +# Motion::Require.all(Dir.glob(File.expand_path("../../motion/#{path}", __FILE__))) +# end + + +require 'motion-require' +require 'motion-support' + +%w(*.rb model/*.rb adapters/*.rb).each do |path| Motion::Require.all(Dir.glob(File.expand_path("../../motion/#{path}", __FILE__))) -end +end \ No newline at end of file From 1d497b9b966720f86685e41f4a66a8171ae06b91 Mon Sep 17 00:00:00 2001 From: Luis Felipe Colle da Luz Date: Mon, 4 Aug 2014 14:26:21 +0100 Subject: [PATCH 17/20] rtyng to fix dependencies issue --- lib/motion_model.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/motion_model.rb b/lib/motion_model.rb index c546321..e005f17 100644 --- a/lib/motion_model.rb +++ b/lib/motion_model.rb @@ -4,9 +4,8 @@ # end -require 'motion-require' -require 'motion-support' - -%w(*.rb model/*.rb adapters/*.rb).each do |path| - Motion::Require.all(Dir.glob(File.expand_path("../../motion/#{path}", __FILE__))) +Motion::Project::App.setup do |app| + Dir.glob(File.join(File.expand_path('../../motion/**/*.rb', __FILE__))).each do |file| + app.files.unshift(file) + end end \ No newline at end of file From 230c5d9e2887ed9f6f2298f3abed809ad8b23be2 Mon Sep 17 00:00:00 2001 From: Luis Felipe Colle da Luz Date: Mon, 4 Aug 2014 14:30:15 +0100 Subject: [PATCH 18/20] rtyng to fix dependencies issue --- Rakefile | 16 +++++++++------- lib/motion_model.rb | 9 +++++---- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Rakefile b/Rakefile index 93e350d..af378d3 100644 --- a/Rakefile +++ b/Rakefile @@ -1,15 +1,16 @@ # -*- coding: utf-8 -*- +require "bundler/gem_tasks" $:.unshift("/Library/RubyMotion/lib") require 'motion/project/template/ios' - -begin - require 'bundler' - Bundler.require -rescue LoadError -end +require 'bundler' +Bundler.require(:default) require 'motion-cocoapods' +require 'motion_model' +require 'motion_model/array' +require 'motion_model/sql' + $: << File.expand_path('/lib', __FILE__) require 'motion_model' @@ -18,8 +19,9 @@ Motion::Project::App.setup do |app| # Use `rake config' to see complete project settings. app.name = 'MotionModel' app.delegate_class = 'FakeDelegate' + app.detect_dependencies = false app.pods do - pod 'FMDB', '2.0' + pod 'FMDB', '2.1' end end diff --git a/lib/motion_model.rb b/lib/motion_model.rb index e005f17..c546321 100644 --- a/lib/motion_model.rb +++ b/lib/motion_model.rb @@ -4,8 +4,9 @@ # end -Motion::Project::App.setup do |app| - Dir.glob(File.join(File.expand_path('../../motion/**/*.rb', __FILE__))).each do |file| - app.files.unshift(file) - end +require 'motion-require' +require 'motion-support' + +%w(*.rb model/*.rb adapters/*.rb).each do |path| + Motion::Require.all(Dir.glob(File.expand_path("../../motion/#{path}", __FILE__))) end \ No newline at end of file From a719c9a167bc39b7c392c257a3379daaa59b835e Mon Sep 17 00:00:00 2001 From: Luis Felipe Colle da Luz Date: Mon, 4 Aug 2014 14:33:35 +0100 Subject: [PATCH 19/20] rtyng to fix dependencies issue --- Rakefile | 16 +++++++--------- lib/motion_model.rb | 12 ++---------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/Rakefile b/Rakefile index af378d3..93e350d 100644 --- a/Rakefile +++ b/Rakefile @@ -1,15 +1,14 @@ # -*- coding: utf-8 -*- -require "bundler/gem_tasks" $:.unshift("/Library/RubyMotion/lib") require 'motion/project/template/ios' -require 'bundler' -Bundler.require(:default) -require 'motion-cocoapods' +begin + require 'bundler' + Bundler.require +rescue LoadError +end -require 'motion_model' -require 'motion_model/array' -require 'motion_model/sql' +require 'motion-cocoapods' $: << File.expand_path('/lib', __FILE__) @@ -19,9 +18,8 @@ Motion::Project::App.setup do |app| # Use `rake config' to see complete project settings. app.name = 'MotionModel' app.delegate_class = 'FakeDelegate' - app.detect_dependencies = false app.pods do - pod 'FMDB', '2.1' + pod 'FMDB', '2.0' end end diff --git a/lib/motion_model.rb b/lib/motion_model.rb index c546321..0627572 100644 --- a/lib/motion_model.rb +++ b/lib/motion_model.rb @@ -1,12 +1,4 @@ -# Motion::Require.all(Dir.glob(File.expand_path("../../motion/#{path}", __FILE__))) -# %w[*.rb model/*.rb adapters/*.rb adapters/array/*.rb adapters/sql/sql_db_adapter.rb adapters/sql/sqlite3_adapter.rb adapters/sql/*.rb].each do |path| -# Motion::Require.all(Dir.glob(File.expand_path("../../motion/#{path}", __FILE__))) -# end - - -require 'motion-require' -require 'motion-support' - -%w(*.rb model/*.rb adapters/*.rb).each do |path| +Motion::Require.all(Dir.glob(File.expand_path("../../motion/#{path}", __FILE__))) +%w[*.rb model/*.rb adapters/*.rb adapters/array/*.rb adapters/sql/sql_db_adapter.rb adapters/sql/sqlite3_adapter.rb adapters/sql/*.rb].each do |path| Motion::Require.all(Dir.glob(File.expand_path("../../motion/#{path}", __FILE__))) end \ No newline at end of file From 4c10aaabae349d95e4d932fdceecf70914985b08 Mon Sep 17 00:00:00 2001 From: Luis Felipe Colle da Luz Date: Mon, 4 Aug 2014 14:51:58 +0100 Subject: [PATCH 20/20] rtyng to fix dependencies issue --- lib/motion_model.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/motion_model.rb b/lib/motion_model.rb index 0627572..c20726e 100644 --- a/lib/motion_model.rb +++ b/lib/motion_model.rb @@ -1,4 +1,3 @@ -Motion::Require.all(Dir.glob(File.expand_path("../../motion/#{path}", __FILE__))) %w[*.rb model/*.rb adapters/*.rb adapters/array/*.rb adapters/sql/sql_db_adapter.rb adapters/sql/sqlite3_adapter.rb adapters/sql/*.rb].each do |path| Motion::Require.all(Dir.glob(File.expand_path("../../motion/#{path}", __FILE__))) end \ No newline at end of file