Sha256: c7f7bb78239192be217247b22201c93fc9c147e2221d0caa9b429bb825978411

Contents?: true

Size: 2 KB

Versions: 17

Compression:

Stored size: 2 KB

Contents

#!/usr/bin/env ruby

require 'smartcloud'

command = ARGV.shift

if command == '--version'
	puts "Smartcloud #{Smartcloud.version}"
	return
end

if Smartcloud::Machine.smartcloud_local?
	if command == 'start'
		machine = Smartcloud::Machine.new
		machine.start
	elsif command == 'stop'
		machine = Smartcloud::Machine.new
		machine.stop
	elsif command == 'ssh'
		machine = Smartcloud::Machine.new
		machine.ssh
	elsif command == 'sync'
		machine = Smartcloud::Machine.new
		machine.sync
	elsif command == 'grid'
		machine = Smartcloud::Machine.new
		machine.grid ARGV
	elsif command == 'app'
		machine = Smartcloud::Machine.new
		machine.app ARGV
	elsif command == 'ps'
		ssh = Smartcloud::SSH.new
		ssh.run "smartcloud ps #{ARGV.join(' ')}"
	elsif command == 'logs'
		ssh = Smartcloud::SSH.new
		ssh.run "smartcloud logs #{ARGV.join(' ')}"
	elsif command == 'credentials:edit'
		credentials = Smartcloud::Credentials.new
		credentials.edit
	else
		puts "Specify a valid local command to execute."
	end
elsif Smartcloud::Machine.smartcloud_server?
	if command == 'run'
		machine = Smartcloud::Machine.new
		machine.run ARGV
	elsif command == 'buildpacker'
		buildpacker = Smartcloud::Buildpacker.new
		action = ARGV.shift
		if action == "install"
			buildpacker.install
		elsif action == "uninstall"
			buildpacker.uninstall
		end
	elsif command == 'prereceiver'
		prereceiver = Smartcloud::Grids::Prereceiver.new
		action = ARGV.shift
		if action == "install"
			prereceiver.install
		elsif action == "uninstall"
			prereceiver.uninstall
		end
	elsif command == 'ps'
		exec "docker ps #{ARGV.join(' ')}"
	elsif command == 'logs'
		exec "docker logs #{ARGV.join(' ')}"
	elsif command == 'shell'
		exec '/bin/sh -c sh'
	else
		puts "Specify a valid server command to execute."
	end
else
	if command == 'new'
		raise "Please specify a machine name" if ARGV.empty?
		machine = Smartcloud::Machine.new
		machine.create ARGV
	else
		puts "Specify a valid smartcloud command to execute. Are you in the correct directory to run this command?"
	end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
smartcloud-0.6.0 bin/smartcloud
smartcloud-0.5.3 bin/smartcloud
smartcloud-0.5.2 bin/smartcloud
smartcloud-0.5.1 bin/smartcloud
smartcloud-0.5.0 bin/smartcloud
smartcloud-0.4.4 bin/smartcloud
smartcloud-0.4.3 bin/smartcloud
smartcloud-0.4.2 bin/smartcloud
smartcloud-0.4.1 bin/smartcloud
smartcloud-0.3.2 bin/smartcloud
smartcloud-0.3.1 bin/smartcloud
smartcloud-0.3.0 bin/smartcloud
smartcloud-0.2.4 bin/smartcloud
smartcloud-0.2.3 bin/smartcloud
smartcloud-0.2.2 bin/smartcloud
smartcloud-0.2.1 bin/smartcloud
smartcloud-0.2.0 bin/smartcloud