Permalink
Browse files

temporary backup

  • Loading branch information...
jedi4ever committed Sep 17, 2011
1 parent bde5cc0 commit 7db5231ace64cdcc4e4a60ab152fd39110b183c9
Showing with 1,920 additions and 771 deletions.
  1. +3 −2 Gemfile.lock
  2. +22 −0 bin/veewee-kvm
  3. +34 −0 bin/veewee-kvm-old
  4. +21 −24 bin/{veewee → veewee-vagrant}
  5. +34 −0 bin/veewee-vmfusion
  6. +19 −2 lib/veewee.rb
  7. +6 −6 lib/veewee/builder/core/box.rb
  8. +53 −11 lib/veewee/builder/core/builder.rb
  9. +56 −0 lib/veewee/builder/core/definition.rb
  10. +52 −52 lib/veewee/builder/core/helper/iso.rb
  11. +1 −3 lib/veewee/builder/core/helper/transaction.rb
  12. +118 −0 lib/veewee/builder/core/helper/vnc.rb
  13. +3 −3 lib/veewee/builder/kvm/assemble.rb
  14. +13 −11 lib/veewee/builder/kvm/box.rb
  15. +52 −47 lib/veewee/builder/kvm/build.rb
  16. +12 −0 lib/veewee/builder/kvm/definition.rb
  17. +6 −6 lib/veewee/builder/kvm/destroy.rb
  18. +3 −1 lib/veewee/builder/kvm/helper/buildinfo.rb
  19. +6 −8 lib/veewee/builder/kvm/helper/console_type.rb
  20. +2 −2 lib/veewee/builder/kvm/helper/disk.rb
  21. +12 −6 lib/veewee/builder/kvm/helper/network.rb
  22. +41 −31 lib/veewee/builder/kvm/helper/tunnel.rb
  23. +19 −13 lib/veewee/builder/kvm/helper/vm.rb
  24. +2 −1 lib/veewee/builder/virtualbox/box.rb
  25. +56 −34 lib/veewee/builder/virtualbox/build.rb
  26. +3 −3 lib/veewee/builder/virtualbox/builder.rb
  27. +9 −9 lib/veewee/builder/virtualbox/helper/disk.rb
  28. +7 −2 lib/veewee/builder/virtualbox/helper/network.rb
  29. +1 −1 lib/veewee/builder/virtualbox/helper/path.rb
  30. +12 −12 lib/veewee/builder/virtualbox/helper/vm.rb
  31. +3 −3 lib/veewee/builder/vmfusion/assemble.rb
  32. +5 −5 lib/veewee/builder/vmfusion/box.rb
  33. +3 −3 lib/veewee/builder/vmfusion/build.rb
  34. +12 −0 lib/veewee/builder/vmfusion/definition.rb
  35. +8 −116 lib/veewee/builder/vmfusion/helper/console_type.rb
  36. +10 −7 lib/veewee/builder/vmfusion/helper/vm.rb
  37. +55 −0 lib/veewee/cli.rb
  38. +11 −0 lib/veewee/command.rb
  39. +106 −0 lib/veewee/command/base.rb
  40. +107 −0 lib/veewee/command/group_base.rb
  41. +13 −0 lib/veewee/command/helpers.rb
  42. +17 −0 lib/veewee/command/init.rb
  43. +14 −0 lib/veewee/command/named_base.rb
  44. +14 −0 lib/veewee/command/version.rb
  45. +140 −0 lib/veewee/config.rb
  46. +53 −0 lib/veewee/config/builder.rb
  47. +82 −0 lib/veewee/config/collection.rb
  48. +19 −0 lib/veewee/config/component.rb
  49. +66 −0 lib/veewee/config/definition.rb
  50. +40 −0 lib/veewee/config/veewee.rb
  51. +0 −82 lib/veewee/definition.rb
  52. +234 −0 lib/veewee/environment-ol.rb
  53. +112 −195 lib/veewee/environment.rb
  54. +0 −36 lib/veewee/logger.rb
  55. +0 −12 lib/veewee/logsnippet.txt
  56. +0 −16 lib/veewee/session.rb
  57. +30 −0 lib/veewee/templates/locales/en.yml
  58. +81 −0 lib/veewee/ui.rb
  59. +1 −1 lib/veewee/version.rb
  60. +5 −5 test/environment_test.rb
  61. +1 −0 veewee.gemspec
View
@@ -1,20 +1,21 @@
PATH
remote: .
specs:
- veewee (0.2.0)
+ veewee (0.3.0)
ansi (~> 1.3.0)
cucumber (~> 1.0.2)
highline (~> 1.6.1)
net-ssh (~> 2.1.0)
popen4 (~> 0.1.2)
progressbar
rspec (~> 2.5.0)
+ ruby-vnc (~> 1.0.0)
thor (~> 0.14.6)
PATH
remote: /Users/patrick/imac/fog
specs:
- fog (0.10.0)
+ fog (0.11.0)
builder
excon (~> 0.6.5)
formatador (~> 0.2.0)
View
@@ -0,0 +1,22 @@
+#!/usr/bin/env ruby
+require 'veewee'
+
+env = Veewee::Environment.new
+
+begin
+ # Begin logging
+ # env.logger.info("veewee")
+
+ # Disable color if the proper argument was passed
+ shell = ARGV.include?("--no-color") ? Thor::Shell::Basic.new : Thor::Base.shell.new
+
+ # Attach the UI
+ env.ui = ::Veewee::UI::Shell.new(env, shell)
+ env.load!
+
+ # Start the CLI
+ ::Veewee::CLI.start(ARGV,:env => env)
+
+rescue Veewee::Error => e
+ puts "#{e}"
+end
View
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby
+
+require 'rubygems'
+require 'thor'
+require 'libvirt'
+require 'fog'
+
+require 'veewee'
+
+class VeeweeCLI < Thor
+
+ desc "build [NAME]", "build the box defined"
+ method_options :force => :boolean
+ def build(box_name)
+
+
+ logger=ANSI::Logger.new(STDOUT)
+ logger.level=Object.const_get('ANSI').const_get('Logger').const_get('DEBUG')
+ logger.formatter do |severity, timestamp, progname, msg|
+ # "#{progname}@#{timestamp} - #{severity}::#{msg}"
+ "#{msg}\n"
+ end
+ logger.ansicolor=false
+
+
+ puts "Building box #{box_name}"
+ box=Veewee::Environment.new(options,logger).get_builder(:kvm,options).get_box(box_name,box_name,options)
+ box.build(options)
+
+ end
+
+end
+
+VeeweeCLI.start
@@ -7,52 +7,49 @@ require 'virtualbox'
require 'veewee'
-
-class VeeweeCLI < Thor
-
- desc "define [NAME] [TEMPLATE]", "initializes a box from a template"
+class VeeweeCLI < Thor
+
+ desc "define [NAME] [TEMPLATE]", "initializes a box from a template"
method_options :force => :boolean
def define(box_name=nil, template=nil)
-
- if (box_name.nil?)
+
+ if (box_name.nil?)
puts "please provide a box_name"
exit
end
-
+
puts "Init a new box #{box_name}, starting from template #{template}"
- Veewee::Environment.define(box_name,template)
-
+ Veewee::Environment.define(box_name,template)
+
end
- desc "templates", "list the template available"
- def templates
+ desc "templates", "list the template available"
+ def templates
Veewee::Environment.list_templates
end
-
- desc "build [NAME]", "build the box defined"
+
+ desc "build [NAME]", "build the box defined"
method_options :force => :boolean
def build(box_name)
puts "Building box #{box_name}"
vs=Veewee::Environment.new(options)
vd=vs.get_definition(box_name)
- vs.build(box_name,vd)
+ vs.build(box_name,vd)
end
- desc "export [NAME]", "export the box"
- method_options :force => :boolean
+ desc "export [NAME]", "export the box"
+ method_options :force => :boolean
def export(box_name)
- if (!box_name.nil?)
- Veewee::Environment.export_box(box_name)
- end
+ if (!box_name.nil?)
+ Veewee::Environment.export_box(box_name)
+ end
end
-
-end
-
+end
version=VirtualBox.version
if (version.match(/^4./))
- VeeweeCLI.start
+ VeeweeCLI.start
else
- puts "veewee only supports VirtualBox 4.x"
+ puts "veewee only supports VirtualBox 4.x"
end
View
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby
+
+require 'rubygems'
+require 'thor'
+require 'fog'
+require 'fission'
+
+require 'veewee'
+
+class VeeweeCLI < Thor
+
+ desc "build [NAME]", "build the box defined"
+ method_options :force => :boolean
+ def build(box_name)
+
+
+ logger=ANSI::Logger.new(STDOUT)
+ logger.level=Object.const_get('ANSI').const_get('Logger').const_get('DEBUG')
+ logger.formatter do |severity, timestamp, progname, msg|
+ # "#{progname}@#{timestamp} - #{severity}::#{msg}"
+ "#{msg}\n"
+ end
+ logger.ansicolor=false
+
+
+ puts "Building box #{box_name}"
+ box=Veewee::Environment.new(options,logger).get_builder(:vmfusion,options).get_box(box_name,box_name,options)
+ box.build(options)
+
+ end
+
+end
+
+VeeweeCLI.start
View
@@ -1,4 +1,21 @@
+require 'json'
+require 'i18n'
+
+module Veewee
+ # The source root is the path to the root directory of
+ # the Mccloud gem.
+ def self.source_root
+ @source_root ||= Pathname.new(File.expand_path('../../', __FILE__))
+ end
+end
+
+# # Default I18n to load the en locale
+I18n.load_path << File.expand_path("templates/locales/en.yml", Veewee.source_root)
+
+# Load the things which must be loaded before anything else
+require 'veewee/cli'
+require 'veewee/ui'
+require 'veewee/command'
require 'veewee/error'
-require 'veewee/logger'
require 'veewee/environment'
-require 'veewee/session'
+require 'veewee/version'
@@ -26,7 +26,7 @@ def handle_postinstall
@definition.postinstall_files.each do |postinstall_file|
# Filenames of postinstall_files are relative to their definition
- filename=File.join(@environment.definition_dir,@box_name,postinstall_file)
+ filename=File.join(@environment.definition_dir,@box_name,postinstall_file)
Veewee::Util::Ssh.when_ssh_login_works(ip_address,ssh_options) do
begin
@@ -40,7 +40,7 @@ def handle_postinstall
newcommand.gsub!(/%u/,"#{@definition.ssh_user}")
newcommand.gsub!(/%f/,"#{postinstall_file}")
Veewee::Util::Ssh.execute(ip_address,"#{newcommand}",ssh_options)
- end
+ end
end
end
@@ -52,7 +52,7 @@ def handle_kickstart
if kickstartfiles.nil? || kickstartfiles.length == 0
puts "Skipping webserver as no kickstartfile was specified"
end
-
+
puts "Starting a webserver on port #{@definition.kickstart_port}"
#:kickstart_port => "7122", :kickstart_ip => self.local_ip, :kickstart_timeout => 1000,:kickstart_file => "preseed.cfg",
if kickstartfiles.is_a?(String)
@@ -63,14 +63,14 @@ def handle_kickstart
kickstartfiles.each do |kickfile|
Veewee::Util::Web.wait_for_request(kickfile,{
:port => @definition.kickstart_port,
- :host => @definition.kickstart_ip,
+ :host => @definition.kickstart_ip,
:timeout => @definition.kickstart_timeout,
:web_dir => File.join(@environment.definition_dir,@box_name)
- })
+ })
end
end
end #End Class
end # End Module
end # End Module
-end # End Module
+end # End Module
@@ -7,22 +7,45 @@ module Builder
module Core
class Builder
- attr_accessor :environment
+ attr_accessor :env
attr_accessor :options
+
attr_accessor :type
+ attr_accessor :name
+
+ attr_accessor :boxes
+
+ def initialize(name,options,env)
+
+ @name=name
+ @options=options
+ @env=env
- # This is a generic class that will be implemeted by each boxbuilder
- # It passes the options builder_options and links the environment to its
- def initialize(builder_options,environment)
- @environment=environment
- @options=builder_options
- type=self.class.to_s
- # Strip out the module path Veewee::Builder::Virtualbox::Builder
- type['Veewee::Builder::']=''
- type['::Builder']=''
- @type=type
+ @type=self.class.to_s.split("::")[-2]
+
+ @boxes=Hash.new
+
end
+ def get_component(type,env)
+ real_component=nil
+ begin
+ # Now that we know the actual provider, we can check if the provider has this type of component
+ require_path='mccloud/provider/'+@type.to_s.downcase+"/"+type
+ require require_path
+ # Now we can create the real component
+
+ env.logger.debug("provide #{@type} about to create component of type #{type}")
+
+ real_component=Object.const_get("Veewee").const_get("Builder").const_get(@type.to_s.capitalize).const_get(type.to_s.capitalize).new(env)
+
+ rescue Error => e
+ puts "Error getting component - #{e}"
+ end
+ return real_component
+ end
+
+
# This function asks a builder to initialize a box,with a name and definition
def get_box(box_name,definition_name=nil,box_options={})
if definition_name.nil?
@@ -32,6 +55,25 @@ def get_box(box_name,definition_name=nil,box_options={})
box=box_class.new(@environment,box_name,definition_name,box_options)
return box
end
+
+ def check_gem_availability(gems)
+
+ gems.each do |gemname|
+ availability_gem=false
+ begin
+ availability_gem=true unless Gem::Specification::find_by_name("#{gemname}").nil?
+ rescue Gem::LoadError
+ availability_gem=false
+ rescue
+ availability_gem=Gem.available?("#{gemname}")
+ end
+ unless availability_gem
+ abort "The #{gemname} gem is not installed and is required by the #{@name.to_sym} provider"
+ exit
+ end
+ end
+ end
+
end #End Class
Oops, something went wrong.

0 comments on commit 7db5231

Please sign in to comment.