~awstools-dev/ubuntu/maverick/ec2-ami-tools/maverick

« back to all changes in this revision

Viewing changes to lib/ec2/amitools/bundleimageparameters.rb

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2008-10-14 08:35:25 UTC
  • Revision ID: james.westby@ubuntu.com-20081014083525-c0n69wr7r7aqfb8w
Tags: 1.3-26357-0ubuntu2
* New upstream version.
* Update the debian copyright file.
* Added quilt patch system to make it easier to maintain. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2008 Amazon.com, Inc. or its affiliates.  All Rights
 
2
# Reserved.  Licensed under the Amazon Software License (the
 
3
# "License").  You may not use this file except in compliance with the
 
4
# License. A copy of the License is located at
 
5
# http://aws.amazon.com/asl or in the "license" file accompanying this
 
6
# file.  This file is distributed on an "AS IS" BASIS, WITHOUT
 
7
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
 
8
# the License for the specific language governing permissions and
 
9
# limitations under the License.
 
10
 
 
11
require 'ec2/amitools/bundlemachineparameters'
 
12
 
 
13
# The Bundle Image command line parameters.
 
14
class BundleImageParameters < BundleMachineParameters
 
15
 
 
16
  IMAGE_PATH_DESCRIPTION = "The path to the file system image to bundle."
 
17
  PREFIX_DESCRIPTION = "The filename prefix for bundled AMI files. Defaults to image name."
 
18
 
 
19
  attr_reader :image_path
 
20
  attr_reader :prefix
 
21
                
 
22
  def initialize( argv, name )
 
23
    add_mandatory_parameters_proc = lambda do
 
24
      on( '-i', '--image PATH', String, IMAGE_PATH_DESCRIPTION ) do |p|
 
25
        unless p and File::exist?( p )
 
26
          raise "the specified image file #{p} does not exist"
 
27
        end
 
28
        @image_path = p
 
29
      end
 
30
    end
 
31
    
 
32
    add_optional_parameters_proc = lambda do
 
33
      on( '-p', '--prefix PREFIX', String, PREFIX_DESCRIPTION ) do |p|
 
34
        @prefix = p
 
35
      end
 
36
    end
 
37
    
 
38
    super(argv, name, add_mandatory_parameters_proc, add_optional_parameters_proc)
 
39
  end
 
40
end