Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

change thor travis:box:build so that former --definition option now i…

…s a thor argument (i.e. call with e.g. $ thor travis:box:build ruby)
  • Loading branch information...
commit 70c55c3e11c2ca87c88025caef816387b450815a 1 parent 9b0bf58
@svenfuchs svenfuchs authored
Showing with 20 additions and 23 deletions.
  1. +3 −3 README.md
  2. +17 −20 lib/travis/boxes/cli/vagrant.rb
View
6 README.md
@@ -29,7 +29,7 @@ Worker boxes are built per "environment" (i.e. worker type, e.g. "staging", "rub
E.g. for rebuilding the staging base box use:
- $ thor travis:box:build -d staging
+ $ thor travis:box:build staging
You can also use the `thor` tasks to build a new base box which the worker boxes are provisioned on top of.
@@ -89,8 +89,8 @@ To upload a provisioned box you can use:
This will upload the travis-staging.box by default, renaming it to staging/[yyyy-mm-dd-hhmm].box during the upload process. If you want to upload a different provisioned box you can use the -d option, for example:
- thor travis:box:upload -d standard
- thor travis:box:upload -d ruby
+ thor travis:box:upload standard
+ thor travis:box:upload ruby
If you need access to files.travis-ci.org, pass your SSH key to [@michaelklishin](https://github.com/michaelklishin)
View
37 lib/travis/boxes/cli/vagrant.rb
@@ -10,13 +10,13 @@ class Vagrant < Thor
include Cli
- desc 'build', 'Build a base box (only the development box by default)'
- method_option :definition, :aliases => '-d', :default => 'development', :desc => 'Box definition used for configuration (e.g staging)'
- method_option :base, :aliases => '-b', :desc => 'Base box for this box (e.g. natty32.box)'
- method_option :upload, :aliases => '-u', :desc => 'Upload the box'
- method_option :reset, :aliases => '-r', :type => :boolean, :default => false, :desc => 'Force reset on virtualbox settings and boxes'
+ desc 'build [BOX]', 'Build a base box (defaults to development)'
+ method_option :base, :aliases => '-b', :desc => 'Base box for this box (e.g. natty32.box)'
+ method_option :upload, :aliases => '-u', :desc => 'Upload the box'
+ method_option :reset, :aliases => '-r', :type => :boolean, :default => false, :desc => 'Force reset on virtualbox settings and boxes'
- def build
+ def build(box = 'development')
+ self.box = box
vbox.reset if options['reset']
download
@@ -24,35 +24,33 @@ def build
exit unless up
package_box
- upload if upload?
+ upload(box) if upload?
end
- desc 'upload', 'Upload a base box'
- method_option :definition, :aliases => '-d', :default => 'staging', :desc => 'Box definition to upload (e.g staging)'
+ desc 'upload', 'Upload a base box (defaults to development)'
- def upload
+ def upload(box = 'development')
+ self.box = box
cached_timestamp = timestamp
- original = "boxes/travis-#{definition}.box"
- destination = "provisioned/#{definition}/#{cached_timestamp}.box"
+ original = "boxes/travis-#{box}.box"
+ destination = "provisioned/#{box}/#{cached_timestamp}.box"
remote = ::Travis::Boxes::Remote.new
remote.upload(original, destination)
- remote.symlink(destination, "provisioned/travis-#{definition}.box")
+ remote.symlink(destination, "provisioned/travis-#{box}.box")
end
protected
+ attr_accessor :box
+
def vbox
@vbox ||= Vbox.new('', options)
end
def config
- @config ||= ::Travis::Boxes::Config.new[definition]
- end
-
- def definition
- options['definition']
+ @config ||= ::Travis::Boxes::Config.new[box]
end
def upload?
@@ -100,7 +98,7 @@ def uuid
end
def base_box_name
- "travis-#{definition}"
+ "travis-#{box}"
end
def base_name_and_path
@@ -110,7 +108,6 @@ def base_name_and_path
def timestamp
Time.now.strftime('%Y-%m-%d-%H%M')
end
-
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.