Skip to content
This repository has been archived by the owner on Nov 29, 2017. It is now read-only.

Commit

Permalink
Wired in cyoi to choose a provider/credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
drnic committed May 14, 2013
1 parent b3c78bb commit 490bfca
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
1 change: 1 addition & 0 deletions Guardfile
@@ -1,6 +1,7 @@
guard 'rspec', spec_paths: ["spec/unit"] do
watch(%r{^spec/unit/(.+_spec)\.rb$})
watch(%r{^lib/bosh/cli/commands/(.+)\.rb$}) { |m| "spec/unit/cli" }
watch(%r{^lib/bosh-bootstrap/cli/commands/(.+)\.rb$}) { |m| "spec/unit/commands/#{m[1]}_spec.rb" }
watch(%r{^lib/bosh-bootstrap/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec/unit" }
end
Expand Down
9 changes: 8 additions & 1 deletion lib/bosh-bootstrap/cli/commands/deploy.rb
@@ -1,16 +1,23 @@
module Bosh; module Bootstrap; module Cli; module Commands; end; end; end; end

require "cyoi/cli/provider"
require "bosh-bootstrap/cli/helpers"

# * select_provider
# * select_or_provision_public_networking # public_ip or ip/network/gateway
# * select_public_image_or_download_stemcell # download if stemcell
# * create_microbosh_manifest
# * microbosh_deploy
class Bosh::Bootstrap::Cli::Commands::Deploy
include Bosh::Bootstrap::Cli::Helpers::Settings

def initialize

end

def perform

cyoi_provider = Cyoi::Cli::Provider.new([settings_dir])
cyoi_provider.execute!
reload_settings!
end
end
12 changes: 11 additions & 1 deletion lib/bosh-bootstrap/cli/helpers/settings.rb
Expand Up @@ -10,7 +10,12 @@ module Bosh::Bootstrap::Cli::Helpers::Settings
# Defaults to ~/.bosh_inception; and can be overridden with either:
# * $SETTINGS - to a folder (supported method)
def settings_dir
@settings_dir ||= ENV['SETTINGS'] || raise("please assign @settings_dir or $SETTINGS first")
@settings_dir ||= File.expand_path(ENV["SETTINGS"] || "~/.microbosh")
end

def settings_dir=(settings_dir)
@settings_dir = File.expand_path(settings_dir)
reload_settings!
end

def settings_ssh_dir
Expand Down Expand Up @@ -46,6 +51,11 @@ def save_settings!
settings.create_accessors!
end

def reload_settings!
@settings = nil
settings
end

def migrate_old_settings
end
end
11 changes: 9 additions & 2 deletions spec/unit/commands/deploy_spec.rb
Expand Up @@ -2,7 +2,9 @@

require "bosh-bootstrap/cli/commands/deploy"
describe Bosh::Bootstrap::Cli::Commands::Deploy do
include FileUtils
include Bosh::Bootstrap::Cli::Helpers::Settings

let(:settings_dir) { File.expand_path("~/.microbosh") }

before do
FileUtils.mkdir_p(@stemcells_dir = File.join(Dir.mktmpdir, "stemcells"))
Expand All @@ -20,7 +22,12 @@
# * create_microbosh_manifest
# * microbosh_deploy
describe "aws" do
it "deploy creates provisions IP address micro_bosh.yml, discovers/downloads stemcell/AMI, runs 'bosh micro deploy'"
it "deploy creates provisions IP address micro_bosh.yml, discovers/downloads stemcell/AMI, runs 'bosh micro deploy'" do
cyoi_provider = double(Cyoi::Cli::Provider)
cyoi_provider.stub(:execute!)
Cyoi::Cli::Provider.stub(:new).with([settings_dir]).and_return(cyoi_provider)
cmd.perform
end
it "delete does nothing if not targetting a deployment"
it "delete runs 'bosh micro delete' & releases IP address; updates settings"
end
Expand Down

0 comments on commit 490bfca

Please sign in to comment.