From d77aa74c2ecd7943aae6dd39659197c5db8d4f3c Mon Sep 17 00:00:00 2001 From: Laurent Sansonetti Date: Fri, 27 Jan 2012 15:41:08 +0100 Subject: [PATCH] change the way we build the app in spec_mode --- lib/motion/project.rb | 1 - lib/motion/project/builder.rb | 6 ++++-- lib/motion/project/config.rb | 10 +++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/motion/project.rb b/lib/motion/project.rb index fd6c4d05..f7edda50 100644 --- a/lib/motion/project.rb +++ b/lib/motion/project.rb @@ -75,7 +75,6 @@ end desc "Run specs" task :spec do - App.config.name += '_spec' App.config.spec_mode = true Rake::Task["simulator"].invoke end diff --git a/lib/motion/project/builder.rb b/lib/motion/project/builder.rb index eba13f15..5ded09b1 100644 --- a/lib/motion/project/builder.rb +++ b/lib/motion/project/builder.rb @@ -176,6 +176,7 @@ EOS + (id)launcher { + [UIApplication sharedApplication]; SpecLauncher *launcher = [[self alloc] init]; [[NSNotificationCenter defaultCenter] addObserver:launcher selector:@selector(appLaunched:) name:UIApplicationDidBecomeActiveNotification object:nil]; return launcher; @@ -183,7 +184,7 @@ EOS - (void)appLaunched:(id)notification { - // Give a bit of time to the simulator to attach... + // Give a bit of time for the simulator to attach... [self performSelector:@selector(runSpecs) withObject:nil afterDelay:0.1]; } @@ -213,10 +214,10 @@ main(int argc, char **argv) try { void *self = rb_vm_top_self(); EOS + main_txt << "[SpecLauncher launcher];\n" if config.spec_mode app_objs.each do |_, init_func| main_txt << "#{init_func}(self, 0);\n" end - main_txt << "[SpecLauncher launcher];\n" if config.spec_mode main_txt << < File.mtime(main_exec) \ or objs.any? { |path, _| File.mtime(path) > File.mtime(main_exec) } \ + or File.mtime(main_o) > File.mtime(main_exec) \ or File.mtime(File.join(datadir, platform, 'libmacruby-static.a')) > File.mtime(main_exec) App.info 'Link', main_exec objs_list = objs.map { |path, _| path }.unshift(main_o).map { |x| "\"#{x}\"" }.join(' ') diff --git a/lib/motion/project/config.rb b/lib/motion/project/config.rb index cf6e03c1..76f95168 100644 --- a/lib/motion/project/config.rb +++ b/lib/motion/project/config.rb @@ -238,16 +238,20 @@ module Motion; module Project platform + sdk_version + '.sdk') end + def bundle_name + @name + (spec_mode ? '_spec' : '') + end + def app_bundle(platform) - File.join(versionized_build_dir, platform, @name + '.app') + File.join(versionized_build_dir, platform, bundle_name + '.app') end def app_bundle_dsym(platform) - File.join(versionized_build_dir, platform, @name + '.dSYM') + File.join(versionized_build_dir, platform, bundle_name + '.dSYM') end def archive - File.join(versionized_build_dir, @name + '.ipa') + File.join(versionized_build_dir, bundle_name + '.ipa') end def identifier