You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by dj...@apache.org on 2009/06/23 02:03:20 UTC
svn commit: r787468 - /buildr/trunk/lib/buildr/shell.rb
Author: djspiewak
Date: Tue Jun 23 00:03:20 2009
New Revision: 787468
URL: http://svn.apache.org/viewvc?rev=787468&view=rev
Log:
Added shell configuration (shell.using ...)
Modified:
buildr/trunk/lib/buildr/shell.rb
Modified: buildr/trunk/lib/buildr/shell.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/shell.rb?rev=787468&r1=787467&r2=787468&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/shell.rb (original)
+++ buildr/trunk/lib/buildr/shell.rb Tue Jun 23 00:03:20 2009
@@ -20,6 +20,30 @@
end
module Shell
+ class Base
+ attr_reader :project
+
+ class << self
+ def lang
+ :none
+ end
+
+ def to_sym
+ @symbol ||= name.split('::').last.downcase.to_sym
+ end
+ end
+
+ def initialize(project)
+ @project = project
+ end
+
+ def launch
+ fail 'Not implemented'
+ end
+ end
+ end
+
+ module ShellExtension
include Extension
first_time do
@@ -47,8 +71,7 @@
end
after_define do |project|
- lang = project.compile.language
- default_shell = ShellProviders.providers[lang]
+ default_shell = project.shell.using
if default_shell
dep = "shell:#{default_shell.to_sym}"
@@ -57,35 +80,38 @@
project.task :shell => dep
else
project.task :shell do
- fail "No shell provider defined for language '#{lang}'"
+ fail "No shell provider defined for language '#{project.compile.language}'"
end
end
end
- class Base
- attr_reader :project
-
- class << self
- def lang
- :none
- end
-
- def to_sym
- @symbol ||= name.split('::').last.downcase.to_sym
- end
- end
-
+ class ShellConfig
def initialize(project)
@project = project
end
- def launch
- fail 'Not implemented'
+ def using(*args)
+ if args.size > 0
+ @using ||= args.first
+ else
+ @using ||= find_shell_task
+ end
+ end
+
+ private
+ def find_shell_task
+ lang = @project.compile.language
+ ShellProviders.providers[lang]
end
end
+
+ # TODO temporary hack
+ def shell
+ @shell ||= ShellConfig.new self
+ end
end
class Project
- include Shell
+ include ShellExtension
end
end