bin/cloud_test.rb in lorj-0.2.0 vs bin/cloud_test.rb in lorj-1.0.0
- old
+ new
@@ -1,81 +1,29 @@
#!/usr/bin/env ruby
-#require 'byebug'
+# require 'byebug'
-$APP_PATH = File.dirname(__FILE__)
-$LIB_PATH = File.expand_path(File.join(File.dirname($APP_PATH),'lib'))
+app_path = File.dirname(__FILE__)
+lib_path = File.expand_path(File.join(File.dirname(app_path), 'lib'))
-$LOAD_PATH << $LIB_PATH
+load_path << lib_path
-$LOAD_PATH << File.join($LIB_PATH, 'lib-forj', 'lib')
+require 'lorj.rb'
-require 'appinit.rb'
-
-# Initialize forj paths
-AppInit::forj_initialize()
-
-# Initialize global Log object
-$FORJ_LOGGER=LorjLog.new()
-
-require 'lib-forj.rb'
-
-Logging.set_level(Logger::DEBUG)
-
# Load global Config
-oConfig = ForjConfig.new()
+oconfig = ForjConfig.new
-aProcesses = []
+processes = []
# Defines how to manage Maestro and forges
# create a maestro box. Identify a forge instance, delete it,...
-aProcesses << File.join($LIB_PATH, 'forj', 'ForjCore.rb')
+processes << File.join(lib_path, 'forj', 'ForjCore.rb')
# Defines how cli will control FORJ features
# boot/down/ssh/...
-aProcesses << File.join($LIB_PATH, 'forj', 'ForjCli.rb')
+processes << File.join(lib_path, 'forj', 'ForjCli.rb')
-$LIB_FORJ_DEBUG = 3 # verbose
+ocloud = ForjCloud.new(oconfig, 'hpcloud', processes)
-infra_dir = File.expand_path(oConfig.get(:infra_repo))
-
-# Ask information if needed.
-if not Dir.exist?(File.expand_path(infra_dir))
- Logging.warning(<<-END
-Your infra workspace directory is missing.
-
-Forj uses an infra workspace directory to store any kind of data that are private to you.
-We provides ways to send those data securily to your new Forge instance, as metadata.
-In production case, we suggest you to keep it safe in your SCM preferred database.
-
-If you already have an existing infra workspace, use 'forj set infra_repo=<PathToYourRepo>' to set it and restart.
-
-Otherwise, we will build a new one with some predefined data, you can review and update later.
- END
- )
- sAsk = "Do you want to create a new one from Maestro (yes/no)?" % [infra_dir]
- bBuildInfra=agree(sAsk)
- if not bBuildInfra
- puts 'Process aborted on your demand.'
- exit 0
- end
-end
-
-oCloud = ForjCloud.new(oConfig, 'hpcloud', aProcesses)
-
-#oConfig.set(:instance_name, "test")
-#oCloud.Create(:metadata)
-#oCloud.Create(:infra_repository)
-#oCloud.Create(:userdata)
-
-
-#oCloud.Setup(:server, 'hpcloud')
-#oCloud.Setup(:forge, 'hpcloud')
-
-#oCloud.Create(:forge)
-
-oConfig.set(:box_name, '183')
-oConfig.set(:box, 'maestro')
-#oConfig.Create(:server)
-oCloud.Create(:ssh)
-
-#oCloud.Query(:server, 'maestro')
+oconfig.set(:box_name, '183')
+oconfig.set(:box, 'maestro')
+ocloud.Create(:ssh)