Sha256: 4e82ddca1e7557f7484b2b3550b0f2e82f0eadbbe81b9e50cb5788955ae49487

Contents?: true

Size: 587 Bytes

Versions: 12

Compression:

Stored size: 587 Bytes

Contents

module VagrantPlugins
  module OVirtProvider
    module Action

      class SetNameOfDomain
        @@MAX_NAME_LENGTH = 64
        def initialize(app, env)
          @app = app
        end

        def call(env)
          dir_name = env[:root_path].basename.to_s.dup.gsub(/[^-a-z0-9_]/i, "")
          timestamp = "_#{Time.now.to_f}"
          max_dir_name_length = dir_name.length-[(dir_name + timestamp).length-(@@MAX_NAME_LENGTH-1), 0].max
          env[:domain_name] = dir_name[0..max_dir_name_length] << timestamp

          @app.call(env)
        end
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
vagrant-ovirt4-2.2.0 lib/vagrant-ovirt4/action/set_name_of_domain.rb
vagrant-ovirt4-2.1.3 lib/vagrant-ovirt4/action/set_name_of_domain.rb
vagrant-ovirt4-2.1.0 lib/vagrant-ovirt4/action/set_name_of_domain.rb
vagrant-ovirt4-2.0.0 lib/vagrant-ovirt4/action/set_name_of_domain.rb
vagrant-ovirt4-1.2.3 lib/vagrant-ovirt4/action/set_name_of_domain.rb
vagrant-ovirt4-1.2.2 lib/vagrant-ovirt4/action/set_name_of_domain.rb
vagrant-ovirt4-1.2.1 lib/vagrant-ovirt4/action/set_name_of_domain.rb
vagrant-ovirt4-1.2.0 lib/vagrant-ovirt4/action/set_name_of_domain.rb
vagrant-ovirt4-1.1.0 lib/vagrant-ovirt4/action/set_name_of_domain.rb
vagrant-ovirt4-1.0.2 lib/vagrant-ovirt4/action/set_name_of_domain.rb
vagrant-ovirt4-1.0.1 lib/vagrant-ovirt4/action/set_name_of_domain.rb
vagrant-ovirt4-1.0.0 lib/vagrant-ovirt4/action/set_name_of_domain.rb