Permalink
Browse files

Need to pass shared buildpacks location to VM

  • Loading branch information...
1 parent 14a84cc commit bbccea4b6812ac74574547d8a3d92463933cc575 Nick Sieger committed Mar 28, 2012
Showing with 13 additions and 3 deletions.
  1. +9 −2 lib/mason/buildpacks.rb
  2. +4 −1 lib/mason/cli.rb
View
@@ -28,8 +28,15 @@ def self.uninstall(name)
end
def self.root(expand=true)
- dir = "~/.mason/buildpacks"
- expand ? File.expand_path(dir) : dir
+ @root ||= begin
+ dir = "~/.mason/buildpacks"
+ expand ? File.expand_path(dir) : dir
+ end
+ end
+
+ def self.root=(new_root)
+ @buildpacks = nil # rediscover buildpacks
+ @root = new_root
end
def self.buildpacks
View
@@ -25,6 +25,8 @@ def version
method_option :quiet, :type => :boolean, :aliases => "-q", :desc => "quiet packaging output"
method_option :stack, :type => :string, :aliases => "-s", :desc => "use a stack for building"
method_option :type, :type => :string, :aliases => "-t", :desc => "output type (dir, img, tgz)"
+ method_option :buildpack_root, :type => :string, :aliases => "-r",
+ :desc => "Use a location for installed buildpacks different than #{Mason::Buildpacks.root}"
def build(app)
app = File.expand_path(app)
@@ -61,7 +63,7 @@ def build(app)
FileUtils.cp_r app, compile_dir
FileUtils.cp_r File.expand_path("../../../", __FILE__), mason_dir
- mason_args = %{ /share/app -q -o /share/output -t #{type} }
+ mason_args = %{ /share/app -q -o /share/output -t #{type} -r /share/buildpacks }
mason_args += %{ -b "#{options[:buildpack]}" } if options[:buildpack]
Mason::Stacks.run(stack, <<-COMMAND)
@@ -77,6 +79,7 @@ def build(app)
puts " = location: #{output}"
else
print "* detecting buildpack... "
+ Mason::Buildpacks.root = options[:buildpack_root] if options[:buildpack_root]
buildpack, ret = Mason::Buildpacks.detect(app)
raise "no valid buildpack detected" unless buildpack

0 comments on commit bbccea4

Please sign in to comment.