Permalink
Browse files

Let Typhon::Compiler always recompile files when running bin/typhon d…

…irectly.

Once typhon has been installed as a gem it will compile files only when needed.
For development, we most likely will be usin bin/typhon directly.
  • Loading branch information...
1 parent c513415 commit ed42db8582b9b0acf8b7e654adfbb5e30a4a3026 @vic committed Dec 24, 2010
Showing with 10 additions and 2 deletions.
  1. +1 −1 Rakefile
  2. +4 −0 bin/typhon
  3. +5 −1 lib/typhon/compiler/compiler.rb
View
@@ -30,7 +30,7 @@ spec = Gem::Specification.new do |s|
s.has_rdoc = true
s.extra_rdoc_files = %w[ README.md ]
s.executables = ["typhon"]
- s.files = FileList[ '{bin,lib,spec}/**/*.{yaml,txt,rb}', 'Rakefile', *s.extra_rdoc_files ]
+ s.files = FileList[ '{bin,lib,spec}/**/*.{yaml,txt,rb,py}', 'Rakefile', *s.extra_rdoc_files ]
s.homepage = %q{http://github.com/vic/typhon}
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.5}
View
@@ -6,5 +6,9 @@ require 'typhon/code_loader'
require 'typhon/environment'
require 'typhon/main'
+# When running this script directly (ie, not using a gem installed typhon)
+# Set the compiler to always recompile python files. (devel-mode)
+Typhon::Compiler.always_recompile = $0 == __FILE__
+
Typhon::Main.new.main ARGV
@@ -10,9 +10,13 @@ def self.compiled_filename(filename)
end
end
+ def self.always_recompile=(flag)
+ @always_recompile = flag
+ end
+
def self.compile_if_needed(file, output = nil, print = Print.new)
compiled = output || compiled_filename(file)
- needed = true || !File.exists?(compiled) ||
+ needed = @always_recompile || !File.exists?(compiled) ||
File.stat(compiled).mtime < File.stat(file).mtime
if needed
compile_file(file, compiled, print)

0 comments on commit ed42db8

Please sign in to comment.