Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Sven Fuchs authored February 25, 2012
6  README.md
Source Rendered
@@ -29,7 +29,7 @@ Worker boxes are built per "environment" (i.e. worker type, e.g. "staging", "rub
29 29
 
30 30
 E.g. for rebuilding the staging base box use:
31 31
 
32  
-    $ thor travis:box:build -d staging
  32
+    $ thor travis:box:build staging
33 33
 
34 34
 You can also use the `thor` tasks to build a new base box which the worker boxes are provisioned on top of.
35 35
 
@@ -89,8 +89,8 @@ To upload a provisioned box you can use:
89 89
 
90 90
 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:
91 91
 
92  
-    thor travis:box:upload -d standard
93  
-    thor travis:box:upload -d ruby
  92
+    thor travis:box:upload standard
  93
+    thor travis:box:upload ruby
94 94
 
95 95
 If you need access to files.travis-ci.org, pass your SSH key to [@michaelklishin](https://github.com/michaelklishin)
96 96
 
37  lib/travis/boxes/cli/vagrant.rb
@@ -10,13 +10,13 @@ class Vagrant < Thor
10 10
 
11 11
         include Cli
12 12
 
13  
-        desc 'build', 'Build a base box (only the development box by default)'
14  
-        method_option :definition,  :aliases => '-d', :default => 'development', :desc => 'Box definition used for configuration (e.g staging)'
15  
-        method_option :base,        :aliases => '-b', :desc => 'Base box for this box (e.g. natty32.box)'
16  
-        method_option :upload,      :aliases => '-u', :desc => 'Upload the box'
17  
-        method_option :reset,       :aliases => '-r', :type => :boolean, :default => false, :desc => 'Force reset on virtualbox settings and boxes'
  13
+        desc 'build [BOX]', 'Build a base box (defaults to development)'
  14
+        method_option :base,   :aliases => '-b', :desc => 'Base box for this box (e.g. natty32.box)'
  15
+        method_option :upload, :aliases => '-u', :desc => 'Upload the box'
  16
+        method_option :reset,  :aliases => '-r', :type => :boolean, :default => false, :desc => 'Force reset on virtualbox settings and boxes'
18 17
 
19  
-        def build
  18
+        def build(box = 'development')
  19
+          self.box = box
20 20
           vbox.reset if options['reset']
21 21
 
22 22
           download
@@ -24,35 +24,33 @@ def build
24 24
           exit unless up
25 25
 
26 26
           package_box
27  
-          upload if upload?
  27
+          upload(box) if upload?
28 28
         end
29 29
 
30  
-        desc 'upload', 'Upload a base box'
31  
-        method_option :definition,  :aliases => '-d', :default => 'staging', :desc => 'Box definition to upload (e.g staging)'
  30
+        desc 'upload', 'Upload a base box (defaults to development)'
32 31
 
33  
-        def upload
  32
+        def upload(box = 'development')
  33
+          self.box = box
34 34
           cached_timestamp = timestamp
35 35
 
36  
-          original    = "boxes/travis-#{definition}.box"
37  
-          destination = "provisioned/#{definition}/#{cached_timestamp}.box"
  36
+          original    = "boxes/travis-#{box}.box"
  37
+          destination = "provisioned/#{box}/#{cached_timestamp}.box"
38 38
 
39 39
           remote = ::Travis::Boxes::Remote.new
40 40
           remote.upload(original, destination)
41  
-          remote.symlink(destination, "provisioned/travis-#{definition}.box")
  41
+          remote.symlink(destination, "provisioned/travis-#{box}.box")
42 42
         end
43 43
 
44 44
         protected
45 45
 
  46
+          attr_accessor :box
  47
+
46 48
           def vbox
47 49
             @vbox ||= Vbox.new('', options)
48 50
           end
49 51
 
50 52
           def config
51  
-            @config ||= ::Travis::Boxes::Config.new[definition]
52  
-          end
53  
-
54  
-          def definition
55  
-            options['definition']
  53
+            @config ||= ::Travis::Boxes::Config.new[box]
56 54
           end
57 55
 
58 56
           def upload?
@@ -100,7 +98,7 @@ def uuid
100 98
           end
101 99
 
102 100
           def base_box_name
103  
-            "travis-#{definition}"
  101
+            "travis-#{box}"
104 102
           end
105 103
 
106 104
           def base_name_and_path
@@ -110,7 +108,6 @@ def base_name_and_path
110 108
           def timestamp
111 109
             Time.now.strftime('%Y-%m-%d-%H%M')
112 110
           end
113  
-
114 111
       end
115 112
     end
116 113
   end

0 notes on commit 70c55c3

Please sign in to comment.
Something went wrong with that request. Please try again.