Class: SmartCloud::Buildpacker

Inherits:
Base
  • Object
show all
Defined in:
lib/smart_cloud/buildpacker.rb

Instance Method Summary collapse

Methods included from Logger

configure_logger_for, included, #logger, logger_for

Constructor Details

#initializeBuildpacker

Returns a new instance of Buildpacker.



5
6
# File 'lib/smart_cloud/buildpacker.rb', line 5

def initialize
end

Instance Method Details

#installObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/smart_cloud/buildpacker.rb', line 8

def install
	self.uninstall
	unless system("docker image inspect smartcloud/buildpacks/rails", [:out, :err] => File::NULL)
		print "-----> Creating image smartcloud/buildpacks/rails ... "
		if system("docker image build -t smartcloud/buildpacks/rails \
			--build-arg USER_UID=`id -u` \
			--build-arg USER_NAME=`id -un` \
			#{SmartCloud.config.root_path}/lib/smartcloud/engine/buildpacks/rails", out: File::NULL)
			puts "done"
		end
	end
end

#packObject



30
31
32
33
34
35
# File 'lib/smart_cloud/buildpacker.rb', line 30

def pack
	if File.exist? "bin/rails"
		rails = SmartCloud::Apps::Rails.new
		rails.pack
	end
end

#uninstallObject



21
22
23
24
25
26
27
28
# File 'lib/smart_cloud/buildpacker.rb', line 21

def uninstall
	if system("docker image inspect smartcloud/buildpacks/rails", [:out, :err] => File::NULL)
		print "-----> Removing image smartcloud/buildpacks/rails ... "
		if system("docker image rm smartcloud/buildpacks/rails", out: File::NULL)
			puts "done"
		end
	end
end