From 4a726646c1a57ddec3298a2b666c1b8e2c20143f Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 12 Mar 2012 11:17:32 -0700 Subject: [PATCH 01/12] Rename rake tasks to match their behavior --- Atom.xcodeproj/project.pbxproj | 2 +- Rakefile | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Atom.xcodeproj/project.pbxproj b/Atom.xcodeproj/project.pbxproj index ff0b27072..cc867a4a1 100644 --- a/Atom.xcodeproj/project.pbxproj +++ b/Atom.xcodeproj/project.pbxproj @@ -726,7 +726,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "rake build"; + shellScript = "rake compile-coffeescripts"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ diff --git a/Rakefile b/Rakefile index 74cd0fa4c..719ca1db9 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ ENV['PATH'] = "#{ENV['PATH']}:/usr/local/bin/" -desc "Build the shit." -task :build do +desc "Compile CoffeeScripts" +task :"compile-coffeescripts" do project_dir = ENV['PROJECT_DIR'] || '.' built_dir = ENV['BUILT_PRODUCTS_DIR'] || '.' contents_dir = ENV['CONTENTS_FOLDER_PATH'].to_s @@ -23,12 +23,6 @@ task :build do sh "coffee -c #{dest}/src #{dest}/vendor #{dest}/spec" end -desc "Install the app in /Applications" -task :install do - rm_rf "/Applications/Atomicity.app" - cp_r "Cocoa/build/Debug/Atomicity.app /Applications" -end - desc "Change webkit frameworks to use @rpath as install name" task :"webkit-fix" do for framework in FileList["frameworks/*.framework"] From d8227ac36dd99d750e3dfa15676ab7942d701aad Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 12 Mar 2012 11:51:15 -0700 Subject: [PATCH 02/12] Add atom-build to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 3e9f73c1f..61f013ad3 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ profile *.moved-aside .DS_Store tags +atom-build From cbfa165e5f7a5c9dcaa9d34bc5e679c065d37929 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 12 Mar 2012 14:19:19 -0700 Subject: [PATCH 03/12] resources is Resources --- Atom.xcodeproj/project.pbxproj | 14 +++++++------- Atom/{resources => Resources}/aliasCursor.png | Bin Atom/{resources => Resources}/cellCursor.png | Bin Atom/{resources => Resources}/chrome.pak | Bin .../contextMenuCursor.png | Bin Atom/{resources => Resources}/copyCursor.png | Bin Atom/{resources => Resources}/deleteButton.png | Bin Atom/{resources => Resources}/deleteButton.tiff | Bin Atom/{resources => Resources}/deleteButton@2x.png | Bin .../deleteButtonPressed.png | Bin .../deleteButtonPressed.tiff | Bin .../deleteButtonPressed@2x.png | Bin .../{resources => Resources}/eastResizeCursor.png | Bin .../eastWestResizeCursor.png | Bin Atom/{resources => Resources}/en.lproj/locale.pak | Bin Atom/{resources => Resources}/helpCursor.png | Bin Atom/{resources => Resources}/inputSpeech.png | Bin Atom/{resources => Resources}/inputSpeech.tiff | Bin Atom/{resources => Resources}/linkCursor.png | Bin Atom/{resources => Resources}/missingImage.png | Bin Atom/{resources => Resources}/missingImage.tiff | Bin Atom/{resources => Resources}/missingImage@2x.png | Bin Atom/{resources => Resources}/moveCursor.png | Bin Atom/{resources => Resources}/noDropCursor.png | Bin Atom/{resources => Resources}/noneCursor.png | Bin .../northEastResizeCursor.png | Bin .../northEastSouthWestResizeCursor.png | Bin .../northResizeCursor.png | Bin .../northSouthResizeCursor.png | Bin .../northWestResizeCursor.png | Bin .../northWestSouthEastResizeCursor.png | Bin Atom/{resources => Resources}/nullPlugin.png | Bin Atom/{resources => Resources}/nullPlugin@2x.png | Bin Atom/{resources => Resources}/panIcon.png | Bin Atom/{resources => Resources}/progressCursor.png | Bin .../southEastResizeCursor.png | Bin .../southResizeCursor.png | Bin .../southWestResizeCursor.png | Bin .../textAreaResizeCorner.png | Bin .../textAreaResizeCorner.tiff | Bin .../textAreaResizeCorner@2x.png | Bin Atom/{resources => Resources}/urlIcon.png | Bin .../verticalTextCursor.png | Bin Atom/{resources => Resources}/waitCursor.png | Bin .../{resources => Resources}/westResizeCursor.png | Bin Atom/{resources => Resources}/zoomInCursor.png | Bin Atom/{resources => Resources}/zoomOutCursor.png | Bin 47 files changed, 7 insertions(+), 7 deletions(-) rename Atom/{resources => Resources}/aliasCursor.png (100%) rename Atom/{resources => Resources}/cellCursor.png (100%) rename Atom/{resources => Resources}/chrome.pak (100%) rename Atom/{resources => Resources}/contextMenuCursor.png (100%) rename Atom/{resources => Resources}/copyCursor.png (100%) rename Atom/{resources => Resources}/deleteButton.png (100%) rename Atom/{resources => Resources}/deleteButton.tiff (100%) rename Atom/{resources => Resources}/deleteButton@2x.png (100%) rename Atom/{resources => Resources}/deleteButtonPressed.png (100%) rename Atom/{resources => Resources}/deleteButtonPressed.tiff (100%) rename Atom/{resources => Resources}/deleteButtonPressed@2x.png (100%) rename Atom/{resources => Resources}/eastResizeCursor.png (100%) rename Atom/{resources => Resources}/eastWestResizeCursor.png (100%) rename Atom/{resources => Resources}/en.lproj/locale.pak (100%) rename Atom/{resources => Resources}/helpCursor.png (100%) rename Atom/{resources => Resources}/inputSpeech.png (100%) rename Atom/{resources => Resources}/inputSpeech.tiff (100%) rename Atom/{resources => Resources}/linkCursor.png (100%) rename Atom/{resources => Resources}/missingImage.png (100%) rename Atom/{resources => Resources}/missingImage.tiff (100%) rename Atom/{resources => Resources}/missingImage@2x.png (100%) rename Atom/{resources => Resources}/moveCursor.png (100%) rename Atom/{resources => Resources}/noDropCursor.png (100%) rename Atom/{resources => Resources}/noneCursor.png (100%) rename Atom/{resources => Resources}/northEastResizeCursor.png (100%) rename Atom/{resources => Resources}/northEastSouthWestResizeCursor.png (100%) rename Atom/{resources => Resources}/northResizeCursor.png (100%) rename Atom/{resources => Resources}/northSouthResizeCursor.png (100%) rename Atom/{resources => Resources}/northWestResizeCursor.png (100%) rename Atom/{resources => Resources}/northWestSouthEastResizeCursor.png (100%) rename Atom/{resources => Resources}/nullPlugin.png (100%) rename Atom/{resources => Resources}/nullPlugin@2x.png (100%) rename Atom/{resources => Resources}/panIcon.png (100%) rename Atom/{resources => Resources}/progressCursor.png (100%) rename Atom/{resources => Resources}/southEastResizeCursor.png (100%) rename Atom/{resources => Resources}/southResizeCursor.png (100%) rename Atom/{resources => Resources}/southWestResizeCursor.png (100%) rename Atom/{resources => Resources}/textAreaResizeCorner.png (100%) rename Atom/{resources => Resources}/textAreaResizeCorner.tiff (100%) rename Atom/{resources => Resources}/textAreaResizeCorner@2x.png (100%) rename Atom/{resources => Resources}/urlIcon.png (100%) rename Atom/{resources => Resources}/verticalTextCursor.png (100%) rename Atom/{resources => Resources}/waitCursor.png (100%) rename Atom/{resources => Resources}/westResizeCursor.png (100%) rename Atom/{resources => Resources}/zoomInCursor.png (100%) rename Atom/{resources => Resources}/zoomOutCursor.png (100%) diff --git a/Atom.xcodeproj/project.pbxproj b/Atom.xcodeproj/project.pbxproj index cc867a4a1..10116ee3d 100644 --- a/Atom.xcodeproj/project.pbxproj +++ b/Atom.xcodeproj/project.pbxproj @@ -76,8 +76,8 @@ 0487D15B14FEE6D60045E5E3 /* cef_zip_archive.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0487D12314FEE6D60045E5E3 /* cef_zip_archive.cc */; }; 0487D15C14FEE6D60045E5E3 /* libcef_dll_wrapper.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0487D12414FEE6D60045E5E3 /* libcef_dll_wrapper.cc */; }; 0487D15D14FEE6D60045E5E3 /* libcef_dll_wrapper2.cc in Sources */ = {isa = PBXBuildFile; fileRef = 0487D12514FEE6D60045E5E3 /* libcef_dll_wrapper2.cc */; }; - 0487D15F14FEE7880045E5E3 /* resources in Resources */ = {isa = PBXBuildFile; fileRef = 0487D15E14FEE7880045E5E3 /* resources */; }; - 0487D16014FEE78E0045E5E3 /* resources in Copy Chrome Resources */ = {isa = PBXBuildFile; fileRef = 0487D15E14FEE7880045E5E3 /* resources */; }; + 0487D15F14FEE7880045E5E3 /* Resources in Resources */ = {isa = PBXBuildFile; fileRef = 0487D15E14FEE7880045E5E3 /* Resources */; }; + 0487D16014FEE78E0045E5E3 /* Resources in Copy Chrome Resources */ = {isa = PBXBuildFile; fileRef = 0487D15E14FEE7880045E5E3 /* Resources */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -105,11 +105,11 @@ }; 0487CD9C14FEE17D0045E5E3 /* Copy Chrome Resources */ = { isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; + buildActionMask = 12; dstPath = "$(CONTENTS_FOLDER_PATH)"; dstSubfolderSpec = 16; files = ( - 0487D16014FEE78E0045E5E3 /* resources in Copy Chrome Resources */, + 0487D16014FEE78E0045E5E3 /* Resources in Copy Chrome Resources */, ); name = "Copy Chrome Resources"; runOnlyForDeploymentPostprocessing = 0; @@ -285,7 +285,7 @@ 0487D12314FEE6D60045E5E3 /* cef_zip_archive.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cef_zip_archive.cc; sourceTree = ""; }; 0487D12414FEE6D60045E5E3 /* libcef_dll_wrapper.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = libcef_dll_wrapper.cc; sourceTree = ""; }; 0487D12514FEE6D60045E5E3 /* libcef_dll_wrapper2.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = libcef_dll_wrapper2.cc; sourceTree = ""; }; - 0487D15E14FEE7880045E5E3 /* resources */ = {isa = PBXFileReference; lastKnownFileType = folder; path = resources; sourceTree = ""; }; + 0487D15E14FEE7880045E5E3 /* Resources */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Resources; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -371,7 +371,7 @@ 0487C91D14FED5360045E5E3 /* Supporting Files */ = { isa = PBXGroup; children = ( - 0487D15E14FEE7880045E5E3 /* resources */, + 0487D15E14FEE7880045E5E3 /* Resources */, 0487C93314FED5FB0045E5E3 /* Atom.icns */, 0487C93414FED5FB0045E5E3 /* ClientWindow.xib */, 0487C93514FED5FB0045E5E3 /* Info.plist */, @@ -675,7 +675,7 @@ 0487C93714FED5FB0045E5E3 /* Atom.icns in Resources */, 0487C93814FED5FB0045E5E3 /* ClientWindow.xib in Resources */, 0487C93A14FED5FB0045E5E3 /* MainMenu.xib in Resources */, - 0487D15F14FEE7880045E5E3 /* resources in Resources */, + 0487D15F14FEE7880045E5E3 /* Resources in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Atom/resources/aliasCursor.png b/Atom/Resources/aliasCursor.png similarity index 100% rename from Atom/resources/aliasCursor.png rename to Atom/Resources/aliasCursor.png diff --git a/Atom/resources/cellCursor.png b/Atom/Resources/cellCursor.png similarity index 100% rename from Atom/resources/cellCursor.png rename to Atom/Resources/cellCursor.png diff --git a/Atom/resources/chrome.pak b/Atom/Resources/chrome.pak similarity index 100% rename from Atom/resources/chrome.pak rename to Atom/Resources/chrome.pak diff --git a/Atom/resources/contextMenuCursor.png b/Atom/Resources/contextMenuCursor.png similarity index 100% rename from Atom/resources/contextMenuCursor.png rename to Atom/Resources/contextMenuCursor.png diff --git a/Atom/resources/copyCursor.png b/Atom/Resources/copyCursor.png similarity index 100% rename from Atom/resources/copyCursor.png rename to Atom/Resources/copyCursor.png diff --git a/Atom/resources/deleteButton.png b/Atom/Resources/deleteButton.png similarity index 100% rename from Atom/resources/deleteButton.png rename to Atom/Resources/deleteButton.png diff --git a/Atom/resources/deleteButton.tiff b/Atom/Resources/deleteButton.tiff similarity index 100% rename from Atom/resources/deleteButton.tiff rename to Atom/Resources/deleteButton.tiff diff --git a/Atom/resources/deleteButton@2x.png b/Atom/Resources/deleteButton@2x.png similarity index 100% rename from Atom/resources/deleteButton@2x.png rename to Atom/Resources/deleteButton@2x.png diff --git a/Atom/resources/deleteButtonPressed.png b/Atom/Resources/deleteButtonPressed.png similarity index 100% rename from Atom/resources/deleteButtonPressed.png rename to Atom/Resources/deleteButtonPressed.png diff --git a/Atom/resources/deleteButtonPressed.tiff b/Atom/Resources/deleteButtonPressed.tiff similarity index 100% rename from Atom/resources/deleteButtonPressed.tiff rename to Atom/Resources/deleteButtonPressed.tiff diff --git a/Atom/resources/deleteButtonPressed@2x.png b/Atom/Resources/deleteButtonPressed@2x.png similarity index 100% rename from Atom/resources/deleteButtonPressed@2x.png rename to Atom/Resources/deleteButtonPressed@2x.png diff --git a/Atom/resources/eastResizeCursor.png b/Atom/Resources/eastResizeCursor.png similarity index 100% rename from Atom/resources/eastResizeCursor.png rename to Atom/Resources/eastResizeCursor.png diff --git a/Atom/resources/eastWestResizeCursor.png b/Atom/Resources/eastWestResizeCursor.png similarity index 100% rename from Atom/resources/eastWestResizeCursor.png rename to Atom/Resources/eastWestResizeCursor.png diff --git a/Atom/resources/en.lproj/locale.pak b/Atom/Resources/en.lproj/locale.pak similarity index 100% rename from Atom/resources/en.lproj/locale.pak rename to Atom/Resources/en.lproj/locale.pak diff --git a/Atom/resources/helpCursor.png b/Atom/Resources/helpCursor.png similarity index 100% rename from Atom/resources/helpCursor.png rename to Atom/Resources/helpCursor.png diff --git a/Atom/resources/inputSpeech.png b/Atom/Resources/inputSpeech.png similarity index 100% rename from Atom/resources/inputSpeech.png rename to Atom/Resources/inputSpeech.png diff --git a/Atom/resources/inputSpeech.tiff b/Atom/Resources/inputSpeech.tiff similarity index 100% rename from Atom/resources/inputSpeech.tiff rename to Atom/Resources/inputSpeech.tiff diff --git a/Atom/resources/linkCursor.png b/Atom/Resources/linkCursor.png similarity index 100% rename from Atom/resources/linkCursor.png rename to Atom/Resources/linkCursor.png diff --git a/Atom/resources/missingImage.png b/Atom/Resources/missingImage.png similarity index 100% rename from Atom/resources/missingImage.png rename to Atom/Resources/missingImage.png diff --git a/Atom/resources/missingImage.tiff b/Atom/Resources/missingImage.tiff similarity index 100% rename from Atom/resources/missingImage.tiff rename to Atom/Resources/missingImage.tiff diff --git a/Atom/resources/missingImage@2x.png b/Atom/Resources/missingImage@2x.png similarity index 100% rename from Atom/resources/missingImage@2x.png rename to Atom/Resources/missingImage@2x.png diff --git a/Atom/resources/moveCursor.png b/Atom/Resources/moveCursor.png similarity index 100% rename from Atom/resources/moveCursor.png rename to Atom/Resources/moveCursor.png diff --git a/Atom/resources/noDropCursor.png b/Atom/Resources/noDropCursor.png similarity index 100% rename from Atom/resources/noDropCursor.png rename to Atom/Resources/noDropCursor.png diff --git a/Atom/resources/noneCursor.png b/Atom/Resources/noneCursor.png similarity index 100% rename from Atom/resources/noneCursor.png rename to Atom/Resources/noneCursor.png diff --git a/Atom/resources/northEastResizeCursor.png b/Atom/Resources/northEastResizeCursor.png similarity index 100% rename from Atom/resources/northEastResizeCursor.png rename to Atom/Resources/northEastResizeCursor.png diff --git a/Atom/resources/northEastSouthWestResizeCursor.png b/Atom/Resources/northEastSouthWestResizeCursor.png similarity index 100% rename from Atom/resources/northEastSouthWestResizeCursor.png rename to Atom/Resources/northEastSouthWestResizeCursor.png diff --git a/Atom/resources/northResizeCursor.png b/Atom/Resources/northResizeCursor.png similarity index 100% rename from Atom/resources/northResizeCursor.png rename to Atom/Resources/northResizeCursor.png diff --git a/Atom/resources/northSouthResizeCursor.png b/Atom/Resources/northSouthResizeCursor.png similarity index 100% rename from Atom/resources/northSouthResizeCursor.png rename to Atom/Resources/northSouthResizeCursor.png diff --git a/Atom/resources/northWestResizeCursor.png b/Atom/Resources/northWestResizeCursor.png similarity index 100% rename from Atom/resources/northWestResizeCursor.png rename to Atom/Resources/northWestResizeCursor.png diff --git a/Atom/resources/northWestSouthEastResizeCursor.png b/Atom/Resources/northWestSouthEastResizeCursor.png similarity index 100% rename from Atom/resources/northWestSouthEastResizeCursor.png rename to Atom/Resources/northWestSouthEastResizeCursor.png diff --git a/Atom/resources/nullPlugin.png b/Atom/Resources/nullPlugin.png similarity index 100% rename from Atom/resources/nullPlugin.png rename to Atom/Resources/nullPlugin.png diff --git a/Atom/resources/nullPlugin@2x.png b/Atom/Resources/nullPlugin@2x.png similarity index 100% rename from Atom/resources/nullPlugin@2x.png rename to Atom/Resources/nullPlugin@2x.png diff --git a/Atom/resources/panIcon.png b/Atom/Resources/panIcon.png similarity index 100% rename from Atom/resources/panIcon.png rename to Atom/Resources/panIcon.png diff --git a/Atom/resources/progressCursor.png b/Atom/Resources/progressCursor.png similarity index 100% rename from Atom/resources/progressCursor.png rename to Atom/Resources/progressCursor.png diff --git a/Atom/resources/southEastResizeCursor.png b/Atom/Resources/southEastResizeCursor.png similarity index 100% rename from Atom/resources/southEastResizeCursor.png rename to Atom/Resources/southEastResizeCursor.png diff --git a/Atom/resources/southResizeCursor.png b/Atom/Resources/southResizeCursor.png similarity index 100% rename from Atom/resources/southResizeCursor.png rename to Atom/Resources/southResizeCursor.png diff --git a/Atom/resources/southWestResizeCursor.png b/Atom/Resources/southWestResizeCursor.png similarity index 100% rename from Atom/resources/southWestResizeCursor.png rename to Atom/Resources/southWestResizeCursor.png diff --git a/Atom/resources/textAreaResizeCorner.png b/Atom/Resources/textAreaResizeCorner.png similarity index 100% rename from Atom/resources/textAreaResizeCorner.png rename to Atom/Resources/textAreaResizeCorner.png diff --git a/Atom/resources/textAreaResizeCorner.tiff b/Atom/Resources/textAreaResizeCorner.tiff similarity index 100% rename from Atom/resources/textAreaResizeCorner.tiff rename to Atom/Resources/textAreaResizeCorner.tiff diff --git a/Atom/resources/textAreaResizeCorner@2x.png b/Atom/Resources/textAreaResizeCorner@2x.png similarity index 100% rename from Atom/resources/textAreaResizeCorner@2x.png rename to Atom/Resources/textAreaResizeCorner@2x.png diff --git a/Atom/resources/urlIcon.png b/Atom/Resources/urlIcon.png similarity index 100% rename from Atom/resources/urlIcon.png rename to Atom/Resources/urlIcon.png diff --git a/Atom/resources/verticalTextCursor.png b/Atom/Resources/verticalTextCursor.png similarity index 100% rename from Atom/resources/verticalTextCursor.png rename to Atom/Resources/verticalTextCursor.png diff --git a/Atom/resources/waitCursor.png b/Atom/Resources/waitCursor.png similarity index 100% rename from Atom/resources/waitCursor.png rename to Atom/Resources/waitCursor.png diff --git a/Atom/resources/westResizeCursor.png b/Atom/Resources/westResizeCursor.png similarity index 100% rename from Atom/resources/westResizeCursor.png rename to Atom/Resources/westResizeCursor.png diff --git a/Atom/resources/zoomInCursor.png b/Atom/Resources/zoomInCursor.png similarity index 100% rename from Atom/resources/zoomInCursor.png rename to Atom/Resources/zoomInCursor.png diff --git a/Atom/resources/zoomOutCursor.png b/Atom/Resources/zoomOutCursor.png similarity index 100% rename from Atom/resources/zoomOutCursor.png rename to Atom/Resources/zoomOutCursor.png From 338d4e7ad5eb6e146c4872fd98572d1d55b82889 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 12 Mar 2012 14:23:33 -0700 Subject: [PATCH 04/12] Add ability to build and run atom via rake --- Rakefile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Rakefile b/Rakefile index 719ca1db9..1cc7a3a9c 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,36 @@ +import "benchmark/benchmark.rake" + +$ATOM_ENV = [] + ENV['PATH'] = "#{ENV['PATH']}:/usr/local/bin/" +BUILD_DIR = 'atom-build' + +desc "Build Atom via `xcodebuild`" +task :build do + output = `xcodebuild SYMROOT=#{BUILD_DIR}` + if $?.exitstatus != 0 + $stderr.puts "Error #{$?.exitstatus}:\n#{output}" + end +end + +desc "Run Atom" +task :run => :build do + applications = FileList["#{BUILD_DIR}/**/*.app"] + if applications.size == 0 + $stderr.puts "No Atom application found in directory `#{BUILD_DIR}`" + elsif applications.size > 1 + $stderr.puts "Multiple Atom applications found \n\t" + applications.join("\n\t") + else + app_path = "#{applications.first}/Contents/MacOS/Atom" + if File.exists?(app_path) + puts "#{$ATOM_ENV.join(' ')} #{applications.first}/Contents/MacOS/Atom" + output = `#{applications.first}/Contents/MacOS/Atom --benchmark` + puts output + else + $stderr.puts "Executable `#{app_path}` not found." + end + end +end desc "Compile CoffeeScripts" task :"compile-coffeescripts" do From 98bc29cdce1ea12cb21833e53da49e701d301333 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 12 Mar 2012 14:24:06 -0700 Subject: [PATCH 05/12] Benchmarks are run when atom is run with --benchmark argument --- Atom/src/Atom.mm | 7 +++++++ Atom/src/BrowserDelegate.h | 1 + Atom/src/client_handler.mm | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/Atom/src/Atom.mm b/Atom/src/Atom.mm index 8d95a62c2..d3b849e3d 100755 --- a/Atom/src/Atom.mm +++ b/Atom/src/Atom.mm @@ -113,6 +113,13 @@ context->Exit(); } +- (void)loadEnd { + if ([[[NSProcessInfo processInfo] arguments] containsObject:@"--benchmark"]) { + NSLog(@"Running Benchmarks"); + [self runBenchmarks:self]; + } +} + @end // Returns the application settings based on command line arguments. diff --git a/Atom/src/BrowserDelegate.h b/Atom/src/BrowserDelegate.h index 6d94f27be..b81f812f4 100644 --- a/Atom/src/BrowserDelegate.h +++ b/Atom/src/BrowserDelegate.h @@ -6,6 +6,7 @@ @optional - (void)afterCreated; - (void)loadStart; +- (void)loadEnd; - (bool)keyEventOfType:(cef_handler_keyevent_type_t)type code:(int)code modifiers:(int)modifiers isSystemKey:(bool)isSystemKey isAfterJavaScript:(bool)isAfterJavaScript; @end diff --git a/Atom/src/client_handler.mm b/Atom/src/client_handler.mm index 215ffdbc3..82a118e96 100755 --- a/Atom/src/client_handler.mm +++ b/Atom/src/client_handler.mm @@ -82,6 +82,12 @@ void ClientHandler::OnLoadEnd(CefRefPtr browser, int httpStatusCode) { REQUIRE_UI_THREAD(); + + + if ([m_delegate respondsToSelector:@selector(loadEnd)]) { + [m_delegate loadEnd]; + } + } bool ClientHandler::OnLoadError(CefRefPtr browser, From f0c2746f54a9a4f0fa99a33b2aa466a0e1bfd485 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 12 Mar 2012 14:25:17 -0700 Subject: [PATCH 06/12] Add ability to run benchmarks from rake --- Rakefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Rakefile b/Rakefile index 1cc7a3a9c..eee0766c6 100644 --- a/Rakefile +++ b/Rakefile @@ -32,6 +32,12 @@ task :run => :build do end end +desc "Run the benchmarks" +task :benchmark do + $ATOM_ENV.push "RUN_BENCHMARKS=1" + Rake::Task["run"].invoke +end + desc "Compile CoffeeScripts" task :"compile-coffeescripts" do project_dir = ENV['PROJECT_DIR'] || '.' From 9d3b13a850018e92e2a21931efa47192679245d5 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 12 Mar 2012 14:28:45 -0700 Subject: [PATCH 07/12] These comments are line noise --- Atom/src/Atom.mm | 2 -- Atom/src/AtomController.mm | 1 - 2 files changed, 3 deletions(-) diff --git a/Atom/src/Atom.mm b/Atom/src/Atom.mm index d3b849e3d..3f3c4ca4a 100755 --- a/Atom/src/Atom.mm +++ b/Atom/src/Atom.mm @@ -14,11 +14,9 @@ + (NSApplication *)sharedApplication { if (!NSApp) { - // Populate the settings based on command line arguments. CefSettings settings; AppGetSettings(settings); - // Initialize CEF. CefRefPtr app; CefInitialize(settings, app); } diff --git a/Atom/src/AtomController.mm b/Atom/src/AtomController.mm index 62477510b..16d53d2ab 100644 --- a/Atom/src/AtomController.mm +++ b/Atom/src/AtomController.mm @@ -120,7 +120,6 @@ _atomContext = NULL; _clientHandler = NULL; - // Clean ourselves up after clearing the stack of anything that might have the window on it. [self autorelease]; return YES; From b1ba8b051e219b00a5c942258266a6dc452eb899 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 12 Mar 2012 14:35:34 -0700 Subject: [PATCH 08/12] Fix broken import --- Rakefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Rakefile b/Rakefile index eee0766c6..aa641d65b 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,3 @@ -import "benchmark/benchmark.rake" - $ATOM_ENV = [] ENV['PATH'] = "#{ENV['PATH']}:/usr/local/bin/" From 4be4f83dce316c0e3c488c6d4ab949e845bccd78 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 12 Mar 2012 16:39:02 -0700 Subject: [PATCH 09/12] Class method `load` initializes Cef --- Atom/src/Atom.mm | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Atom/src/Atom.mm b/Atom/src/Atom.mm index 3f3c4ca4a..eab77bee5 100755 --- a/Atom/src/Atom.mm +++ b/Atom/src/Atom.mm @@ -12,16 +12,12 @@ // Provide the CefAppProtocol implementation required by CEF. @implementation Atom -+ (NSApplication *)sharedApplication { - if (!NSApp) { - CefSettings settings; - AppGetSettings(settings); - - CefRefPtr app; - CefInitialize(settings, app); - } ++ (void)load { + CefSettings settings; + AppGetSettings(settings); - return [super sharedApplication]; + CefRefPtr app; + CefInitialize(settings, app); } - (void)dealloc { @@ -62,7 +58,7 @@ NSURL *resourceDirURL = [[NSBundle mainBundle] resourceURL]; NSString *indexURLString = [[resourceDirURL URLByAppendingPathComponent:@"index.html"] absoluteString]; CefBrowser::CreateBrowser(window_info, _clientHandler.get(), [indexURLString UTF8String], settings); - } +} - (void)open:(NSString *)path { [[AtomController alloc] initWithPath:path atomContext:[self atomContext]]; @@ -113,7 +109,12 @@ - (void)loadEnd { if ([[[NSProcessInfo processInfo] arguments] containsObject:@"--benchmark"]) { - NSLog(@"Running Benchmarks"); + CefRefPtr context = _clientHandler->GetBrowser()->GetMainFrame()->GetV8Context(); + context->Enter(); + CefRefPtr atom = context->GetGlobal()->GetValue("atom"); + atom->SetValue("exitOnCompletion", CefV8Value::CreateBool(YES), V8_PROPERTY_ATTRIBUTE_NONE); + context->Exit(); + [self runBenchmarks:self]; } } From b39201891f0fb1aef1a493ade31de23bc9824377 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 12 Mar 2012 16:39:20 -0700 Subject: [PATCH 10/12] Add native exit method --- Atom/src/native_handler.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Atom/src/native_handler.mm b/Atom/src/native_handler.mm index 8bc51d0f5..fd87050ed 100644 --- a/Atom/src/native_handler.mm +++ b/Atom/src/native_handler.mm @@ -10,7 +10,7 @@ NSString *stringFromCefV8Value(const CefRefPtr& value) { NativeHandler::NativeHandler() : CefV8Handler() { m_object = CefV8Value::CreateObject(NULL); - const char *functionNames[] = {"exists", "read", "write", "absolute", "list", "isFile", "isDirectory", "remove", "asyncList", "open", "openDialog", "quit", "writeToPasteboard", "readFromPasteboard", "showDevTools", "newWindow", "saveDialog"}; + const char *functionNames[] = {"exists", "read", "write", "absolute", "list", "isFile", "isDirectory", "remove", "asyncList", "open", "openDialog", "quit", "writeToPasteboard", "readFromPasteboard", "showDevTools", "newWindow", "saveDialog", "exit"}; NSUInteger arrayLength = sizeof(functionNames) / sizeof(const char *); for (NSUInteger i = 0; i < arrayLength; i++) { const char *functionName = functionNames[i]; @@ -253,6 +253,10 @@ bool NativeHandler::Execute(const CefString& name, CefV8Context::GetCurrentContext()->GetBrowser()->ShowDevTools(); return true; } + else if (name == "exit") { + [NSApp terminate:NSApp]; + return true; + } return false; }; \ No newline at end of file From 11da15ac991afc2d7cf2fcbda40e2b870b5fc827 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 12 Mar 2012 16:40:27 -0700 Subject: [PATCH 11/12] Exit app if exitAppWhenFinished is set --- benchmark/benchmark-bootstrap.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/benchmark/benchmark-bootstrap.coffee b/benchmark/benchmark-bootstrap.coffee index 84a0a4fcb..e42cbecb9 100644 --- a/benchmark/benchmark-bootstrap.coffee +++ b/benchmark/benchmark-bootstrap.coffee @@ -14,6 +14,12 @@ $('body').append $$ -> @div id: 'jasmine_runner' @div id: 'jasmine-content' +if atom.exitOnCompletion? + originalFinishCallback = jasmine.Runner.prototype.finishCallback + jasmine.Runner.prototype.finishCallback = -> + originalFinishCallback.call(this) + $native.exit() + jasmineEnv = jasmine.getEnv() trivialReporter = new jasmine.TrivialReporter(document, 'jasmine_runner') From e7de17aed743d058fa89552426d0f0d58ca8a310 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 12 Mar 2012 17:05:30 -0700 Subject: [PATCH 12/12] Console output is less noisy --- Atom/src/client_handler.h | 5 +++++ Atom/src/client_handler.mm | 14 +++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Atom/src/client_handler.h b/Atom/src/client_handler.h index c03ec83ee..7a366082a 100755 --- a/Atom/src/client_handler.h +++ b/Atom/src/client_handler.h @@ -82,6 +82,11 @@ public: virtual void OnFocusedNodeChanged(CefRefPtr browser, CefRefPtr frame, CefRefPtr node) OVERRIDE; + + virtual bool OnConsoleMessage(CefRefPtr browser, + const CefString& message, + const CefString& source, + int line) OVERRIDE; // CefKeyboardHandler methods. virtual bool OnKeyEvent(CefRefPtr browser, diff --git a/Atom/src/client_handler.mm b/Atom/src/client_handler.mm index 82a118e96..f469ae1bb 100755 --- a/Atom/src/client_handler.mm +++ b/Atom/src/client_handler.mm @@ -4,10 +4,10 @@ #import "AtomController.h" #import +#import #import #import #import - #import #ifndef NDEBUG @@ -203,3 +203,15 @@ void ClientHandler::OnTitleChange(CefRefPtr browser, NSString* str = [NSString stringWithUTF8String:titleStr.c_str()]; [window setTitle:str]; } + +bool ClientHandler::OnConsoleMessage(CefRefPtr browser, + const CefString& message, + const CefString& source, + int line) +{ + REQUIRE_UI_THREAD(); + + std::cout << std::string(message) << "\n"; + + return true; +}