diff --git a/.rubocop.yml b/.rubocop.yml index 0787348..846347a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,6 +12,7 @@ Metrics/ClassLength: Enabled: true Exclude: - lib/vagrant-zones/driver* + - lib/vagrant-zones/action/package* Naming/MethodName: EnforcedStyle: snake_case diff --git a/lib/vagrant-zones/action/package.rb b/lib/vagrant-zones/action/package.rb index 5c4b609..0a366d9 100644 --- a/lib/vagrant-zones/action/package.rb +++ b/lib/vagrant-zones/action/package.rb @@ -36,10 +36,12 @@ def call(env) kernel = @machine.provider_config.kernel vcc = @machine.provider_config.vagrant_cloud_creator boxshortname = @machine.provider_config.boxshortname + vagrant_cloud_creator = @machine.provider_config.vagrant_cloud_creator files = {} raise "#{boxname}: Already exists" if File.exist?(boxname) ## Create Snapshot + Dir.mkdir("#{Dir.pwd}/_tmp_package") datasetpath = "#{@machine.provider_config.boot['array']}/#{@machine.provider_config.boot['dataset']}/#{name}" t = Time.new datetime = %(#{t.year}-#{t.month}-#{t.day}-#{t.hour}:#{t.min}:#{t.sec}) @@ -63,7 +65,7 @@ def call(env) end files.each do |from, dest| - include_directory = Pathname.new("#{Dir.pwd}/_tmp_package") + include_directory = Pathname.new("#{Dir.pwd}/_tmp_package/") to = include_directory.join(dest) FileUtils.mkdir_p(to.parent) if File.directory?(from) @@ -86,6 +88,13 @@ def call(env) files[env['package.vagrantfile']] = '_Vagrantfile' if env['package.vagrantfile'] + info_content_hash = { + 'boxname' => "#{boxshortname}", + 'Author' => "#{vagrant_cloud_creator}", + 'Vagrant-Zones' => "This box was built with Vagrant-Zones: https://github.com/STARTcloud/vagrant-zones" + } + File.write("#{Dir.pwd}/_tmp_package/info.json", info_content_hash.to_json) + metadata_content_hash = { 'provider' => 'zone', 'architecture' => 'amd64',