Commits

doob committed d4309df

Windows and Ruby 1.9 compability

  • Participants
  • Parent commits 1759c39

Comments (0)

Files changed (31)

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.
 
 return unless __FILE__ == $0
 
-#path = File.join(File.dirname($0), "..")
-path = File.join(File.dirname(File.readlink($0)), "..")
+path = File.join(File.dirname($0), "..")
+#path = File.join(File.dirname(File.readlink($0)), "..")
 
 $: << File.expand_path(path)
 

dake/build/build.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/build/install.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/build/link.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 doob.

dake/build/target.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/build/task.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/config/config.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 doob.

dake/config/options.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/config/settings.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 doob.

dake/core/core_additions.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 doob.
 end
 
 class << Singleton
+	alias __old_init__ __init__
+	
 	def __init__ (klass)
-		klass.instance_eval { @__instance__ = nil }	
-	
-		class << klass
-			define_method(:instance, FirstInstanceCall)
-			
-			def method_missing (method, *args, &block)
-				instance.send(method, *args, &block)
-			end
+		__old_init__ klass
+		
+		def klass.method_missing (method, *args, &block)
+			instance.send(method, *args, &block)
 		end
 
 		klass

dake/core/import.rb

-class Object	
+# encoding: utf-8
+
+class Object
 	def import (mod, auto_load = false)
 		modules = mod.split(/\./)
 		file_to_require = ""

dake/dake/application.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.
 	$WINDOWS = RUBY_PLATFORM =~ /windows/ ? true : false
 	$POSIX = $DARWIN || $FREEBSD || $HAIKU || $LINUX || $SOLARIS
 	
+	class MissingDakefileException < Exception
+	end
+	
 	class Application
 		include TargetManager
 		include TaskManager
 			@args = ARGV
 			@topLevel = Set[]
 			@task = :run_top_level
+			@dakefile_loaded = false
 		end
 		
 		def run
-			handle_exceptions do
+			debug_handle_exceptions do
 				parse_options
-				load_dakefile
+				load_dakefile if dakefile?				
 				invoke_task
 			end
 		end
 		
 		def load_dakefile
 			infer_dakefile
-			Enviorment::load_dakefile(@options.dakefile)		
+			Enviorment::load_dakefile(@options.dakefile)
+			@dakefile_loaded = true		
 		end
 		
 		def working_directory
 			raise "No dakefile found." if @options.dakefile.nil?
 		end
 		
+		def dakefile?
+			infer_dakefile
+			File.exists? @options.dakefile
+		end		
+		
 		def invoke_task
+			raise MissingDakefileException, "No dakefile found and no other target specified."
+			
 			self.send(@task)
 		end
 		
 		end		
 		
 		def handle_exceptions
+			begin
+				yield
+			rescue Exception => e
+				die e
+			end
+		end
+		
+		def debug_handle_exceptions
 			yield
-			# begin
-			# 	yield
-			# rescue Exception => e
-			# 	die e
-			# end
-		end
+		end		
 		
 		def handle_command (command)
 			case command

dake/dake/dake.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/dependency/dependency_generator.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 doob.

dake/dependency/dependency_parser.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/managers/flag_manager.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/managers/post_manager.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/managers/pre_manager.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/managers/target_manager.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/managers/task_manager.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/managers/util_manager.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/managers/version_manager.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 doob.
 				add_version(:Win64) if version_set?(:X86_64)
 			end
 			
-			add_version(:Posix) if $DARWIN || $FREEBSD || $HAIKU || $LINUX || $SOLARIS
+			add_version(:Posix) if $POSIX
 			
 			Config.versions.each do |version|
 				add_version(version.to_sym)

dake/script/enviorment.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/script/flag.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/script/post.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/script/pre.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/script/script.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/script/util.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/script/version.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/util/enforce.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 Jacob Carlborg.

dake/util/util.rb

 #!/usr/bin/env ruby
+# encoding: utf-8
 
 ##
 # Copyright:: Copyright (c) 2010 doob.